mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-27 09:39:22 +00:00
Compare commits
362
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebd289335a | ||
|
|
d2f7902af0 | ||
|
|
1005bed722 | ||
|
|
d6c92cdc34 | ||
|
|
61e1b9a49d | ||
|
|
c98dd165b0 | ||
|
|
ff1c277ef8 | ||
|
|
c8f7614b98 | ||
|
|
246a434f61 | ||
|
|
5c066a81c2 | ||
|
|
78f961efe9 | ||
|
|
09bc0a577d | ||
|
|
b700a427d2 | ||
|
|
4480b95dcd | ||
|
|
e77c81f6f8 | ||
|
|
971dbee521 | ||
|
|
6f2e82be3a | ||
|
|
9eec9699b9 | ||
|
|
5ae5c54c7e | ||
|
|
7b04fe6c9e | ||
|
|
e67566ce0a | ||
|
|
f93ddcfd1c | ||
|
|
1bba40f578 | ||
|
|
f65e14dc3a | ||
|
|
14a94bba6f | ||
|
|
8109c5d4e2 | ||
|
|
a92b5cb8d8 | ||
|
|
4a23e2fe29 | ||
|
|
a3ba74104e | ||
|
|
e1c22419ac | ||
|
|
189090cee9 | ||
|
|
1a5b7b404f | ||
|
|
9cf12b20af | ||
|
|
63a45330cb | ||
|
|
4a0aaad022 | ||
|
|
095bb1bfa5 | ||
|
|
3937bd962b | ||
|
|
ddb3efc906 | ||
|
|
4e42521d8c | ||
|
|
054efe541f | ||
|
|
a0e1befb57 | ||
|
|
c36c73f681 | ||
|
|
6f4a19f59f | ||
|
|
0d8f04cd83 | ||
|
|
4906052019 | ||
|
|
c6a823e267 | ||
|
|
b7f9aedfac | ||
|
|
7dd0a30361 | ||
|
|
ca120e31f2 | ||
|
|
48eb35cd78 | ||
|
|
7f20dbbcd2 | ||
|
|
55e706c918 | ||
|
|
4e7d433dfb | ||
|
|
7d44ff7de6 | ||
|
|
a8c3e5e3c7 | ||
|
|
4402db3ecc | ||
|
|
7960d3e182 | ||
|
|
8a07b55a04 | ||
|
|
d53f4900d7 | ||
|
|
d3def58c52 | ||
|
|
96fa2d9d02 | ||
|
|
2d6a38fbf7 | ||
|
|
bb2b275b7d | ||
|
|
45bf8b3a75 | ||
|
|
60870be86c | ||
|
|
39ff43c579 | ||
|
|
1bbb796799 | ||
|
|
74e632fea8 | ||
|
|
efb8de492a | ||
|
|
a1f00cc557 | ||
|
|
421db3da06 | ||
|
|
b7526e7806 | ||
|
|
b40ce65180 | ||
|
|
1e8e2e78a5 | ||
|
|
4d5b72cdb4 | ||
|
|
35c2851cc1 | ||
|
|
ea7c1a7d90 | ||
|
|
96adefdb12 | ||
|
|
5e3cb8a747 | ||
|
|
3bf4088b8b | ||
|
|
256ee7ac6a | ||
|
|
f8b4c3b6b3 | ||
|
|
4bf703206d | ||
|
|
a284320e1e | ||
|
|
2df8f43d3e | ||
|
|
6f1bc8bc0f | ||
|
|
04f39f6df8 | ||
|
|
35d4761ce2 | ||
|
|
33d02a42d6 | ||
|
|
7bbb60cfbd | ||
|
|
da93d6753b | ||
|
|
59c943ecf6 | ||
|
|
4336b5d85e | ||
|
|
44ce3a93b6 | ||
|
|
7d400406a7 | ||
|
|
77dae919b6 | ||
|
|
0ab8e025c1 | ||
|
|
b80c2d6d4b | ||
|
|
6aa6077bcc | ||
|
|
66c00cb159 | ||
|
|
3a129dba59 | ||
|
|
8df6eff6da | ||
|
|
889ebe922b | ||
|
|
d4d55b29e0 | ||
|
|
55e2c84fe3 | ||
|
|
15a463d742 | ||
|
|
cd46aa6cef | ||
|
|
9ef81064a3 | ||
|
|
11a7793221 | ||
|
|
080603f0b0 | ||
|
|
4f84ae0ec8 | ||
|
|
ab4366fd49 | ||
|
|
e6a6182d95 | ||
|
|
1a454efe89 | ||
|
|
deaa7052c5 | ||
|
|
7b5d51d837 | ||
|
|
593865b907 | ||
|
|
31c0cd4362 | ||
|
|
c2fdb33116 | ||
|
|
9e18dfe277 | ||
|
|
59ba9d147f | ||
|
|
23012db921 | ||
|
|
6fcec43954 | ||
|
|
a9f25a0819 | ||
|
|
c7995256e4 | ||
|
|
e1aa5b6620 | ||
|
|
da5ed5cf6b | ||
|
|
5757a93e01 | ||
|
|
deca601915 | ||
|
|
a5986276ec | ||
|
|
da45f43ce3 | ||
|
|
0de172a0c0 | ||
|
|
20aea9492f | ||
|
|
1326b9ae2a | ||
|
|
1fe26ab4a0 | ||
|
|
83e9c273e5 | ||
|
|
ec525c18e1 | ||
|
|
93fcc7ad73 | ||
|
|
1d912bd3c9 | ||
|
|
57ffe93485 | ||
|
|
5da5517288 | ||
|
|
2312f06c30 | ||
|
|
2416415c53 | ||
|
|
e6050a683c | ||
|
|
da7703286a | ||
|
|
f02e6b5675 | ||
|
|
035a26c16a | ||
|
|
bc8a6137b2 | ||
|
|
6fe506b04b | ||
|
|
81a2e438dc | ||
|
|
9b45c0733e | ||
|
|
11b2a9b70b | ||
|
|
d743d22de6 | ||
|
|
11da14b548 | ||
|
|
2bdd07195c | ||
|
|
5e77d9cfc1 | ||
|
|
7d5116251d | ||
|
|
81023dbdbd | ||
|
|
b2e9294fb9 | ||
|
|
16a22c3851 | ||
|
|
c9cd02c965 | ||
|
|
8149861554 | ||
|
|
ea57de18f8 | ||
|
|
d0d1e3dacb | ||
|
|
3809f0163b | ||
|
|
46d8a2033b | ||
|
|
c773faf05e | ||
|
|
513eeb61dd | ||
|
|
bc379c1aa1 | ||
|
|
286551b4eb | ||
|
|
16057d6bbb | ||
|
|
f649a6a8fd | ||
|
|
ef28ee8bc1 | ||
|
|
300f48c532 | ||
|
|
2d357558fb | ||
|
|
0c62a5b28e | ||
|
|
b0720b4988 | ||
|
|
d5bab2c0e1 | ||
|
|
3ea0ccb319 | ||
|
|
08772054e9 | ||
|
|
1dcb27157d | ||
|
|
61c22fdf36 | ||
|
|
431e57a797 | ||
|
|
b521bb816d | ||
|
|
7d06b24eac | ||
|
|
3bbeade41d | ||
|
|
ba82db7a0d | ||
|
|
801564c804 | ||
|
|
ac8cac1dac | ||
|
|
4b85f1228a | ||
|
|
c35fcdc0b7 | ||
|
|
15decd26cc | ||
|
|
9c6482b8d6 | ||
|
|
41f26e0ebc | ||
|
|
2def66169e | ||
|
|
9e34a34e44 | ||
|
|
5ccaf90415 | ||
|
|
44a387e0ea | ||
|
|
a388e25576 | ||
|
|
a1ef7718c9 | ||
|
|
65ddb30016 | ||
|
|
31747dd521 | ||
|
|
6a74c4dfff | ||
|
|
394c3e0ac2 | ||
|
|
60d31116c2 | ||
|
|
8445b0115f | ||
|
|
8506a64149 | ||
|
|
66acd9d64c | ||
|
|
348d05359c | ||
|
|
0d2d30bb39 | ||
|
|
631187be8c | ||
|
|
e756ec8284 | ||
|
|
87d62d7d29 | ||
|
|
5460cfeba8 | ||
|
|
8997730612 | ||
|
|
3617c59bab | ||
|
|
881c6a1049 | ||
|
|
2024ade285 | ||
|
|
674ad4f6bc | ||
|
|
5b99970eb7 | ||
|
|
80cfd940cc | ||
|
|
3c2304d55f | ||
|
|
5645cc7995 | ||
|
|
33690255c5 | ||
|
|
c61471fc8b | ||
|
|
54da019fdb | ||
|
|
28668d808e | ||
|
|
9612ebc00e | ||
|
|
1a46a3a4b3 | ||
|
|
2df1255117 | ||
|
|
3c98038174 | ||
|
|
800f63d38f | ||
|
|
5620eb5332 | ||
|
|
9f8acdaa5d | ||
|
|
2dc1eb6cbf | ||
|
|
b9563c9451 | ||
|
|
d6d8e9a93e | ||
|
|
d06de6c871 | ||
|
|
6af7d49b92 | ||
|
|
bcfa6d72e3 | ||
|
|
dd7f792c85 | ||
|
|
d061fda7e9 | ||
|
|
4db2250000 | ||
|
|
c6b755df45 | ||
|
|
e2a6810069 | ||
|
|
c4f11a2a99 | ||
|
|
e0a7bffa1e | ||
|
|
38b864eaa1 | ||
|
|
12359faff0 | ||
|
|
9fdc64a927 | ||
|
|
665c575b2a | ||
|
|
47dcf7b176 | ||
|
|
d59849b2e7 | ||
|
|
7a3f4a18d1 | ||
|
|
7f084087b2 | ||
|
|
d5524ca87b | ||
|
|
390cd7ca90 | ||
|
|
60375a88fe | ||
|
|
dd07e0c4cf | ||
|
|
9d3ae8ecbb | ||
|
|
d1307d873a | ||
|
|
c12936c5d1 | ||
|
|
cdc17f60dc | ||
|
|
b35ec29927 | ||
|
|
05f3a0d754 | ||
|
|
c966a489cf | ||
|
|
bb0c57ecd2 | ||
|
|
24f4e57c46 | ||
|
|
ac319fbc90 | ||
|
|
4bfe934cd1 | ||
|
|
40a5bfde36 | ||
|
|
a67c755ef1 | ||
|
|
87a04a2df6 | ||
|
|
c03995d297 | ||
|
|
ec0ebb3fc2 | ||
|
|
6ab537e324 | ||
|
|
e6c368d468 | ||
|
|
4f1cfd22d3 | ||
|
|
6d5a4ceefe | ||
|
|
f06c2172c0 | ||
|
|
7cb24eb5ff | ||
|
|
f30c692c1f | ||
|
|
8b66bb5d8d | ||
|
|
5d17fd0fec | ||
|
|
ac35a0f792 | ||
|
|
3ee0869734 | ||
|
|
70bb6c855e | ||
|
|
c7f34744c6 | ||
|
|
3f63b4d89f | ||
|
|
dac6ce73be | ||
|
|
5701750c2c | ||
|
|
9e236169e9 | ||
|
|
339eacce1b | ||
|
|
810f991b9e | ||
|
|
386571a24b | ||
|
|
3fe63754d2 | ||
|
|
76681e714e | ||
|
|
46522fb7bd | ||
|
|
e7d09ac4f7 | ||
|
|
67508925d0 | ||
|
|
0c62124eb5 | ||
|
|
9b5d4eed31 | ||
|
|
79054c1d1e | ||
|
|
44d47bbe6f | ||
|
|
323de05ba2 | ||
|
|
5a01722ebc | ||
|
|
1106c3f072 | ||
|
|
bed78ef4e6 | ||
|
|
0ee5cdfe9f | ||
|
|
a1dcc2cb98 | ||
|
|
ee7fb780c8 | ||
|
|
5ade4a4248 | ||
|
|
6cd660435e | ||
|
|
090d7c81cf | ||
|
|
48145ea358 | ||
|
|
dd614590c9 | ||
|
|
a86865891a | ||
|
|
fb9f12a02d | ||
|
|
e25f8e1f37 | ||
|
|
4685200fa9 | ||
|
|
1397f0b520 | ||
|
|
8b3e6eb6b6 | ||
|
|
a0c9d5c6d9 | ||
|
|
5cf9459c08 | ||
|
|
e7b66a28de | ||
|
|
203f53fbbe | ||
|
|
02663ee9d9 | ||
|
|
f169f65e75 | ||
|
|
2855a0fcce | ||
|
|
bf0f3a8c3e | ||
|
|
cb72aa1809 | ||
|
|
896f913571 | ||
|
|
89295a0628 | ||
|
|
eb03ede014 | ||
|
|
8fbe5c7df7 | ||
|
|
e54b8f536b | ||
|
|
fa9b3dcae2 | ||
|
|
9a021c5580 | ||
|
|
80e8b13ac4 | ||
|
|
b61599aca4 | ||
|
|
a602dc5425 | ||
|
|
93c120754a | ||
|
|
1ca4b75ec2 | ||
|
|
329550c4a9 | ||
|
|
00bfa988fc | ||
|
|
81afc5cce6 | ||
|
|
cb3c4a4722 | ||
|
|
954f7bf5ec | ||
|
|
526d3d25e2 | ||
|
|
74124c344c | ||
|
|
5177391ebe | ||
|
|
64db14b0cb | ||
|
|
effe203677 | ||
|
|
82591fa6e7 | ||
|
|
11d81fc6d1 | ||
|
|
30fd7198fe | ||
|
|
8d179dae4e | ||
|
|
e11cb7268e | ||
|
|
3bc9c8cfc8 | ||
|
|
c430e00b80 | ||
|
|
cf8d6bbd9e | ||
|
|
8b46b0ea36 |
No files matched your search
+10
-6
@@ -12,7 +12,9 @@ ascii.bitmaps
|
|||||||
ascii.h
|
ascii.h
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
build_env.mk
|
build_env.mk
|
||||||
.bzrignore
|
build-grub-gen-asciih
|
||||||
|
build-grub-gen-widthspec
|
||||||
|
build-grub-mkfont
|
||||||
cdboot_test
|
cdboot_test
|
||||||
cmp_test
|
cmp_test
|
||||||
config.cache
|
config.cache
|
||||||
@@ -49,6 +51,7 @@ grub_cmd_set_date
|
|||||||
grub_cmd_sleep
|
grub_cmd_sleep
|
||||||
grub-editenv
|
grub-editenv
|
||||||
grub-emu
|
grub-emu
|
||||||
|
grub-emu-lite
|
||||||
grub_emu_init.c
|
grub_emu_init.c
|
||||||
grub_emu_init.h
|
grub_emu_init.h
|
||||||
grub-fstest
|
grub-fstest
|
||||||
@@ -59,7 +62,7 @@ grub-install
|
|||||||
grub-kbdcomp
|
grub-kbdcomp
|
||||||
grub-macho2img
|
grub-macho2img
|
||||||
grub-menulst2cfg
|
grub-menulst2cfg
|
||||||
grub-mk*
|
/grub-mk*
|
||||||
grub-mount
|
grub-mount
|
||||||
grub-ofpathname
|
grub-ofpathname
|
||||||
grub-pe2elf
|
grub-pe2elf
|
||||||
@@ -127,6 +130,7 @@ mod-*.c
|
|||||||
missing
|
missing
|
||||||
netboot_test
|
netboot_test
|
||||||
*.o
|
*.o
|
||||||
|
*.a
|
||||||
ohci_test
|
ohci_test
|
||||||
partmap_test
|
partmap_test
|
||||||
pata_test
|
pata_test
|
||||||
@@ -161,10 +165,10 @@ depcomp
|
|||||||
mdate-sh
|
mdate-sh
|
||||||
texinfo.tex
|
texinfo.tex
|
||||||
grub-core/lib/libgcrypt-grub
|
grub-core/lib/libgcrypt-grub
|
||||||
**/.deps
|
.deps
|
||||||
**/.deps-util
|
.deps-util
|
||||||
**/.deps-core
|
.deps-core
|
||||||
**/.dirstamp
|
.dirstamp
|
||||||
Makefile.util.am
|
Makefile.util.am
|
||||||
contrib
|
contrib
|
||||||
grub-core/bootinfo.txt
|
grub-core/bootinfo.txt
|
||||||
|
|||||||
@@ -12,6 +12,23 @@ you don't have any of them, please obtain and install them before
|
|||||||
configuring the GRUB.
|
configuring the GRUB.
|
||||||
|
|
||||||
* GCC 4.1.3 or later
|
* GCC 4.1.3 or later
|
||||||
|
Note: older versions may work but support is limited
|
||||||
|
Note: clang 3.2 or later works for i386 and x86_64 targets but results in
|
||||||
|
much bigger binaries.
|
||||||
|
earlier versions not tested
|
||||||
|
Note: clang 3.2 or later works for arm
|
||||||
|
earlier versions not tested
|
||||||
|
Note: clang 3.3 or later works for arm64
|
||||||
|
earlier versions have no arm64 support
|
||||||
|
Note: clang 3.3 or later works for mips(el)
|
||||||
|
earlier versions fail to generate .reginfo and hence gprel relocations
|
||||||
|
fail.
|
||||||
|
Note: clang 3.4 or later works for powerpc
|
||||||
|
earlier versions suffer from vacopy bug (#15286)
|
||||||
|
Note: clang has no support for generating 64-bit sparc code and hence you
|
||||||
|
can't compile GRUB for sparc64 with clang
|
||||||
|
Note: clang has no support for ia64 and hence you can't compile GRUB
|
||||||
|
for ia64 with clang
|
||||||
* GNU Make
|
* GNU Make
|
||||||
* GNU Bison 2.3 or later
|
* GNU Bison 2.3 or later
|
||||||
* GNU gettext 0.17 or later
|
* GNU gettext 0.17 or later
|
||||||
|
|||||||
+37
@@ -68,12 +68,20 @@ starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/s
|
|||||||
|
|
||||||
build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
|
build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
|
||||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
|
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
|
||||||
|
CLEANFILES += build-grub-mkfont
|
||||||
|
|
||||||
|
garbage-gen: util/garbage-gen.c
|
||||||
|
$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $^
|
||||||
|
CLEANFILES += garbage-gen
|
||||||
|
EXTRA_DIST += util/garbage-gen.c
|
||||||
|
|
||||||
build-grub-gen-asciih: util/grub-gen-asciih.c
|
build-grub-gen-asciih: util/grub-gen-asciih.c
|
||||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
|
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
|
||||||
|
CLEANFILES += build-grub-gen-asciih
|
||||||
|
|
||||||
build-grub-gen-widthspec: util/grub-gen-widthspec.c
|
build-grub-gen-widthspec: util/grub-gen-widthspec.c
|
||||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
|
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
|
||||||
|
CLEANFILES += build-grub-gen-widthspec
|
||||||
|
|
||||||
if COND_STARFIELD
|
if COND_STARFIELD
|
||||||
starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
|
starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
|
||||||
@@ -389,4 +397,33 @@ BOOTCHECK_TIMEOUT=180
|
|||||||
|
|
||||||
bootcheck: $(BOOTCHECKS)
|
bootcheck: $(BOOTCHECKS)
|
||||||
|
|
||||||
|
if COND_i386_coreboot
|
||||||
|
default_payload.elf: grub-mkstandalone grub-mkimage
|
||||||
|
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
|
||||||
|
endif
|
||||||
|
|
||||||
|
windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows
|
||||||
|
windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
|
||||||
|
test -d $(windowsdir) && rm -rf $(windowsdir) || true
|
||||||
|
test -d $(windowsdir) || mkdir $(windowsdir)
|
||||||
|
$(MAKE) -C po $(AM_MAKEFLAGS) windowsdir
|
||||||
|
$(MAKE) -C grub-core $(AM_MAKEFLAGS) windowsdir
|
||||||
|
test -d $(windowsdir)/themes || mkdir $(windowsdir)/themes
|
||||||
|
test -d $(windowsdir)/themes/starfield || mkdir $(windowsdir)/themes/starfield
|
||||||
|
for x in $(PROGRAMS); do \
|
||||||
|
if [ x$(STRIP) != x ]; then $(STRIP) $$x -o $(windowsdir)/$$x; \
|
||||||
|
else cp -fp $$x $(windowsdir)/$$x; fi; \
|
||||||
|
done
|
||||||
|
for x in $(pkgdata_DATA); do \
|
||||||
|
cp -fp $$x $(windowsdir)/$$x; \
|
||||||
|
done
|
||||||
|
for x in $(starfield_DATA); do \
|
||||||
|
cp -fp $$x $(windowsdir)/themes/starfield/$$(basename $$x); \
|
||||||
|
done
|
||||||
|
|
||||||
|
windowszip=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows.zip
|
||||||
|
windowszip: windowsdir
|
||||||
|
test -f $(windowszip) && rm $(windowszip) || true
|
||||||
|
zip -r $(windowszip) $(windowsdir)
|
||||||
|
|
||||||
EXTRA_DIST += linguas.sh
|
EXTRA_DIST += linguas.sh
|
||||||
+263
-16
@@ -15,6 +15,7 @@ library = {
|
|||||||
common = grub-core/osdep/getroot.c;
|
common = grub-core/osdep/getroot.c;
|
||||||
common = grub-core/osdep/devmapper/getroot.c;
|
common = grub-core/osdep/devmapper/getroot.c;
|
||||||
common = grub-core/osdep/relpath.c;
|
common = grub-core/osdep/relpath.c;
|
||||||
|
extra_dist = grub-core/kern/disk_common.c;
|
||||||
extra_dist = grub-core/osdep/unix/relpath.c;
|
extra_dist = grub-core/osdep/unix/relpath.c;
|
||||||
extra_dist = grub-core/osdep/aros/relpath.c;
|
extra_dist = grub-core/osdep/aros/relpath.c;
|
||||||
extra_dist = grub-core/osdep/windows/relpath.c;
|
extra_dist = grub-core/osdep/windows/relpath.c;
|
||||||
@@ -155,6 +156,8 @@ library = {
|
|||||||
common = grub-core/io/gzio.c;
|
common = grub-core/io/gzio.c;
|
||||||
common = grub-core/io/lzopio.c;
|
common = grub-core/io/lzopio.c;
|
||||||
common = grub-core/kern/ia64/dl_helper.c;
|
common = grub-core/kern/ia64/dl_helper.c;
|
||||||
|
common = grub-core/kern/arm/dl_helper.c;
|
||||||
|
common = grub-core/kern/arm64/dl_helper.c;
|
||||||
common = grub-core/lib/minilzo/minilzo.c;
|
common = grub-core/lib/minilzo/minilzo.c;
|
||||||
common = grub-core/lib/xzembed/xz_dec_bcj.c;
|
common = grub-core/lib/xzembed/xz_dec_bcj.c;
|
||||||
common = grub-core/lib/xzembed/xz_dec_lzma2.c;
|
common = grub-core/lib/xzembed/xz_dec_lzma2.c;
|
||||||
@@ -170,8 +173,11 @@ program = {
|
|||||||
common = util/resolve.c;
|
common = util/resolve.c;
|
||||||
common = grub-core/kern/emu/argp_common.c;
|
common = grub-core/kern/emu/argp_common.c;
|
||||||
common = grub-core/osdep/init.c;
|
common = grub-core/osdep/init.c;
|
||||||
|
common = grub-core/osdep/config.c;
|
||||||
common = grub-core/kern/arm/dl_helper.c;
|
extra_dist = grub-core/osdep/aros/config.c;
|
||||||
|
extra_dist = grub-core/osdep/windows/config.c;
|
||||||
|
extra_dist = grub-core/osdep/unix/config.c;
|
||||||
|
common = util/config.c;
|
||||||
|
|
||||||
extra_dist = util/grub-mkimagexx.c;
|
extra_dist = util/grub-mkimagexx.c;
|
||||||
|
|
||||||
@@ -249,7 +255,7 @@ program = {
|
|||||||
name = grub-macho2img;
|
name = grub-macho2img;
|
||||||
mansection = 1;
|
mansection = 1;
|
||||||
common = util/grub-macho2img.c;
|
common = util/grub-macho2img.c;
|
||||||
condition = COND_APPLE_CC;
|
condition = COND_APPLE_LINKER;
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
@@ -309,6 +315,7 @@ program = {
|
|||||||
installdir = sbin;
|
installdir = sbin;
|
||||||
mansection = 8;
|
mansection = 8;
|
||||||
common = util/grub-probe.c;
|
common = util/grub-probe.c;
|
||||||
|
common = util/probe.c;
|
||||||
common = grub-core/osdep/ofpath.c;
|
common = grub-core/osdep/ofpath.c;
|
||||||
common = grub-core/kern/emu/argp_common.c;
|
common = grub-core/kern/emu/argp_common.c;
|
||||||
common = grub-core/osdep/init.c;
|
common = grub-core/osdep/init.c;
|
||||||
@@ -478,38 +485,157 @@ script = {
|
|||||||
installdir = grubconf;
|
installdir = grubconf;
|
||||||
};
|
};
|
||||||
|
|
||||||
script = {
|
program = {
|
||||||
mansection = 1;
|
mansection = 1;
|
||||||
name = grub-mkrescue;
|
name = grub-mkrescue;
|
||||||
common = util/grub-install_header;
|
|
||||||
common = util/grub-mkrescue.in;
|
common = util/grub-mkrescue.c;
|
||||||
enable = noemu;
|
common = util/render-label.c;
|
||||||
|
common = util/glue-efi.c;
|
||||||
|
common = util/mkimage.c;
|
||||||
|
common = util/grub-install-common.c;
|
||||||
|
common = util/setup_bios.c;
|
||||||
|
common = util/setup_sparc.c;
|
||||||
|
common = grub-core/lib/reed_solomon.c;
|
||||||
|
common = grub-core/osdep/random.c;
|
||||||
|
common = grub-core/osdep/ofpath.c;
|
||||||
|
common = grub-core/osdep/platform.c;
|
||||||
|
common = grub-core/osdep/platform_unix.c;
|
||||||
|
common = grub-core/osdep/compress.c;
|
||||||
|
extra_dist = grub-core/osdep/unix/compress.c;
|
||||||
|
extra_dist = grub-core/osdep/basic/compress.c;
|
||||||
|
common = util/editenv.c;
|
||||||
|
common = grub-core/osdep/blocklist.c;
|
||||||
|
common = grub-core/osdep/config.c;
|
||||||
|
common = util/config.c;
|
||||||
|
|
||||||
|
common = grub-core/kern/emu/hostfs.c;
|
||||||
|
common = grub-core/disk/host.c;
|
||||||
|
|
||||||
|
common = util/resolve.c;
|
||||||
|
|
||||||
|
common = grub-core/kern/emu/argp_common.c;
|
||||||
|
common = grub-core/osdep/init.c;
|
||||||
|
|
||||||
|
ldadd = '$(LIBLZMA)';
|
||||||
|
ldadd = libgrubmods.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
|
|
||||||
|
condition = COND_HAVE_EXEC;
|
||||||
};
|
};
|
||||||
|
|
||||||
script = {
|
program = {
|
||||||
mansection = 1;
|
mansection = 1;
|
||||||
name = grub-mkstandalone;
|
name = grub-mkstandalone;
|
||||||
common = util/grub-install_header;
|
common = util/grub-mkstandalone.c;
|
||||||
common = util/grub-mkstandalone.in;
|
|
||||||
|
common = util/render-label.c;
|
||||||
|
common = util/glue-efi.c;
|
||||||
|
common = util/mkimage.c;
|
||||||
|
common = util/grub-install-common.c;
|
||||||
|
common = util/setup_bios.c;
|
||||||
|
common = util/setup_sparc.c;
|
||||||
|
common = grub-core/lib/reed_solomon.c;
|
||||||
|
common = grub-core/osdep/random.c;
|
||||||
|
common = grub-core/osdep/ofpath.c;
|
||||||
|
common = grub-core/osdep/platform.c;
|
||||||
|
common = grub-core/osdep/platform_unix.c;
|
||||||
|
extra_dist = grub-core/osdep/linux/platform.c;
|
||||||
|
extra_dist = grub-core/osdep/basic/platform.c;
|
||||||
|
extra_dist = grub-core/osdep/basic/no_platform.c;
|
||||||
|
extra_dist = grub-core/osdep/unix/platform.c;
|
||||||
|
common = grub-core/osdep/compress.c;
|
||||||
|
common = util/editenv.c;
|
||||||
|
common = grub-core/osdep/blocklist.c;
|
||||||
|
common = grub-core/osdep/config.c;
|
||||||
|
common = util/config.c;
|
||||||
|
|
||||||
|
common = grub-core/kern/emu/hostfs.c;
|
||||||
|
common = grub-core/disk/host.c;
|
||||||
|
|
||||||
|
common = util/resolve.c;
|
||||||
|
|
||||||
|
common = grub-core/kern/emu/argp_common.c;
|
||||||
|
common = grub-core/osdep/init.c;
|
||||||
|
|
||||||
|
ldadd = '$(LIBLZMA)';
|
||||||
|
ldadd = libgrubmods.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
};
|
};
|
||||||
|
|
||||||
script = {
|
program = {
|
||||||
mansection = 8;
|
mansection = 8;
|
||||||
installdir = sbin;
|
installdir = sbin;
|
||||||
name = grub-install;
|
name = grub-install;
|
||||||
|
|
||||||
common = util/grub-install_header;
|
common = util/grub-install.c;
|
||||||
common = util/grub-install.in;
|
common = util/probe.c;
|
||||||
|
common = util/mkimage.c;
|
||||||
|
common = util/grub-install-common.c;
|
||||||
|
common = util/setup_bios.c;
|
||||||
|
common = util/setup_sparc.c;
|
||||||
|
common = grub-core/lib/reed_solomon.c;
|
||||||
|
common = grub-core/osdep/random.c;
|
||||||
|
common = grub-core/osdep/ofpath.c;
|
||||||
|
common = grub-core/osdep/platform.c;
|
||||||
|
common = grub-core/osdep/platform_unix.c;
|
||||||
|
common = grub-core/osdep/compress.c;
|
||||||
|
common = util/editenv.c;
|
||||||
|
common = grub-core/osdep/blocklist.c;
|
||||||
|
common = grub-core/osdep/config.c;
|
||||||
|
common = util/config.c;
|
||||||
|
|
||||||
|
common = util/resolve.c;
|
||||||
enable = noemu;
|
enable = noemu;
|
||||||
|
common = grub-core/kern/emu/argp_common.c;
|
||||||
|
common = grub-core/osdep/init.c;
|
||||||
|
|
||||||
|
ldadd = '$(LIBLZMA)';
|
||||||
|
ldadd = libgrubmods.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
};
|
};
|
||||||
|
|
||||||
script = {
|
program = {
|
||||||
mansection = 1;
|
mansection = 1;
|
||||||
installdir = bin;
|
installdir = bin;
|
||||||
name = grub-mknetdir;
|
name = grub-mknetdir;
|
||||||
|
|
||||||
common = util/grub-install_header;
|
common = util/grub-mknetdir.c;
|
||||||
common = util/grub-mknetdir.in;
|
|
||||||
|
common = util/mkimage.c;
|
||||||
|
common = util/grub-install-common.c;
|
||||||
|
common = util/setup_bios.c;
|
||||||
|
common = util/setup_sparc.c;
|
||||||
|
common = grub-core/lib/reed_solomon.c;
|
||||||
|
common = grub-core/osdep/random.c;
|
||||||
|
common = grub-core/osdep/ofpath.c;
|
||||||
|
common = grub-core/osdep/platform.c;
|
||||||
|
common = grub-core/osdep/platform_unix.c;
|
||||||
|
common = grub-core/osdep/compress.c;
|
||||||
|
common = util/editenv.c;
|
||||||
|
common = grub-core/osdep/blocklist.c;
|
||||||
|
common = grub-core/osdep/config.c;
|
||||||
|
common = util/config.c;
|
||||||
|
|
||||||
|
common = util/resolve.c;
|
||||||
|
common = grub-core/kern/emu/argp_common.c;
|
||||||
|
common = grub-core/osdep/init.c;
|
||||||
|
|
||||||
|
ldadd = '$(LIBLZMA)';
|
||||||
|
ldadd = libgrubmods.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
};
|
};
|
||||||
|
|
||||||
script = {
|
script = {
|
||||||
@@ -557,6 +683,127 @@ script = {
|
|||||||
installdir = noinst;
|
installdir = noinst;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
name = grub-fs-tester;
|
||||||
|
common = tests/util/grub-fs-tester.in;
|
||||||
|
installdir = noinst;
|
||||||
|
dependencies = garbage-gen;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = ext234_test;
|
||||||
|
common = tests/ext234_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = squashfs_test;
|
||||||
|
common = tests/squashfs_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = iso9660_test;
|
||||||
|
common = tests/iso9660_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = hfsplus_test;
|
||||||
|
common = tests/hfsplus_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = ntfs_test;
|
||||||
|
common = tests/ntfs_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = reiserfs_test;
|
||||||
|
common = tests/reiserfs_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = fat_test;
|
||||||
|
common = tests/fat_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = minixfs_test;
|
||||||
|
common = tests/minixfs_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = xfs_test;
|
||||||
|
common = tests/xfs_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = nilfs2_test;
|
||||||
|
common = tests/nilfs2_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = romfs_test;
|
||||||
|
common = tests/romfs_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = exfat_test;
|
||||||
|
common = tests/exfat_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = tar_test;
|
||||||
|
common = tests/tar_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = udf_test;
|
||||||
|
common = tests/udf_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = hfs_test;
|
||||||
|
common = tests/hfs_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = jfs_test;
|
||||||
|
common = tests/jfs_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = btrfs_test;
|
||||||
|
common = tests/btrfs_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = zfs_test;
|
||||||
|
common = tests/zfs_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = cpio_test;
|
||||||
|
common = tests/cpio_test.in;
|
||||||
|
};
|
||||||
|
|
||||||
script = {
|
script = {
|
||||||
testcase;
|
testcase;
|
||||||
name = example_scripted_test;
|
name = example_scripted_test;
|
||||||
|
|||||||
+30
-36
@@ -134,6 +134,29 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
|
|||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl Check nm
|
||||||
|
AC_DEFUN([grub_PROG_NM_WORKS],
|
||||||
|
[AC_MSG_CHECKING([whether nm works])
|
||||||
|
AC_CACHE_VAL(grub_cv_prog_nm_works,
|
||||||
|
[
|
||||||
|
nm_works_tmp_dir="$(mktemp -d "./confXXXXXX")"
|
||||||
|
AC_LANG_CONFTEST([AC_LANG_PROGRAM([[]], [[]])])
|
||||||
|
$TARGET_CC $TARGET_CFLAGS -c conftest.c -o "$nm_works_tmp_dir/ef"
|
||||||
|
if $TARGET_NM "$nm_works_tmp_dir/ef" > /dev/null; then
|
||||||
|
grub_cv_prog_nm_works=yes
|
||||||
|
else
|
||||||
|
grub_cv_prog_nm_minus_p=no
|
||||||
|
fi
|
||||||
|
rm "$nm_works_tmp_dir/ef"
|
||||||
|
rmdir "$nm_works_tmp_dir"
|
||||||
|
])
|
||||||
|
AC_MSG_RESULT([$grub_cv_prog_nm_works])
|
||||||
|
|
||||||
|
if test "x$grub_cv_prog_nm_works" != xyes; then
|
||||||
|
AC_MSG_ERROR([nm does not work])
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
dnl Supply -P to nm
|
dnl Supply -P to nm
|
||||||
AC_DEFUN([grub_PROG_NM_MINUS_P],
|
AC_DEFUN([grub_PROG_NM_MINUS_P],
|
||||||
[AC_MSG_CHECKING([whether nm accepts -P])
|
[AC_MSG_CHECKING([whether nm accepts -P])
|
||||||
@@ -141,13 +164,14 @@ AC_CACHE_VAL(grub_cv_prog_nm_minus_p,
|
|||||||
[
|
[
|
||||||
nm_minus_p_tmp_dir="$(mktemp -d "./confXXXXXX")"
|
nm_minus_p_tmp_dir="$(mktemp -d "./confXXXXXX")"
|
||||||
AC_LANG_CONFTEST([AC_LANG_PROGRAM([[]], [[]])])
|
AC_LANG_CONFTEST([AC_LANG_PROGRAM([[]], [[]])])
|
||||||
$TARGET_CC conftest.c -o "$nm_minus_p_tmp_dir/ef"
|
$TARGET_CC $TARGET_CFLAGS -c conftest.c -o "$nm_minus_p_tmp_dir/ef"
|
||||||
if $TARGET_NM -P "$nm_minus_p_tmp_dir/ef" 2>&1 > /dev/null; then
|
if $TARGET_NM -P "$nm_minus_p_tmp_dir/ef" 2>&1 > /dev/null; then
|
||||||
grub_cv_prog_nm_minus_p=yes
|
grub_cv_prog_nm_minus_p=yes
|
||||||
else
|
else
|
||||||
grub_cv_prog_nm_minus_p=no
|
grub_cv_prog_nm_minus_p=no
|
||||||
fi
|
fi
|
||||||
rm "$nm_minus_p_tmp_dir/ef"
|
rm "$nm_minus_p_tmp_dir/ef"
|
||||||
|
rmdir "$nm_minus_p_tmp_dir"
|
||||||
])
|
])
|
||||||
AC_MSG_RESULT([$grub_cv_prog_nm_minus_p])
|
AC_MSG_RESULT([$grub_cv_prog_nm_minus_p])
|
||||||
|
|
||||||
@@ -165,13 +189,14 @@ AC_CACHE_VAL(grub_cv_prog_nm_defined_only,
|
|||||||
[
|
[
|
||||||
nm_defined_only_tmp_dir="$(mktemp -d "./confXXXXXX")"
|
nm_defined_only_tmp_dir="$(mktemp -d "./confXXXXXX")"
|
||||||
AC_LANG_CONFTEST([AC_LANG_PROGRAM([[]], [[]])])
|
AC_LANG_CONFTEST([AC_LANG_PROGRAM([[]], [[]])])
|
||||||
$TARGET_CC conftest.c -o "$nm_defined_only_tmp_dir/ef"
|
$TARGET_CC $TARGET_CFLAGS -c conftest.c -o "$nm_defined_only_tmp_dir/ef"
|
||||||
if $TARGET_NM --defined-only "$nm_defined_only_tmp_dir/ef" 2>&1 > /dev/null; then
|
if $TARGET_NM --defined-only "$nm_defined_only_tmp_dir/ef" 2>&1 > /dev/null; then
|
||||||
grub_cv_prog_nm_defined_only=yes
|
grub_cv_prog_nm_defined_only=yes
|
||||||
else
|
else
|
||||||
grub_cv_prog_nm_defined_only=no
|
grub_cv_prog_nm_defined_only=no
|
||||||
fi
|
fi
|
||||||
rm "$nm_defined_only_tmp_dir/ef"
|
rm "$nm_defined_only_tmp_dir/ef"
|
||||||
|
rmdir "$nm_defined_only_tmp_dir"
|
||||||
])
|
])
|
||||||
AC_MSG_RESULT([$grub_cv_prog_nm_defined_only])
|
AC_MSG_RESULT([$grub_cv_prog_nm_defined_only])
|
||||||
|
|
||||||
@@ -212,7 +237,7 @@ else
|
|||||||
sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s
|
sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
||||||
grub_cv_i386_asm_addr32=yes
|
grub_cv_i386_asm_addr32=yes
|
||||||
else
|
else
|
||||||
grub_cv_i386_asm_addr32=no
|
grub_cv_i386_asm_addr32=no
|
||||||
@@ -222,37 +247,6 @@ rm -f conftest*])
|
|||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_i386_asm_addr32])])
|
AC_MSG_RESULT([$grub_cv_i386_asm_addr32])])
|
||||||
|
|
||||||
dnl check if our compiler is apple cc
|
|
||||||
dnl because it requires numerous workarounds
|
|
||||||
AC_DEFUN([grub_apple_cc],
|
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
|
||||||
AC_MSG_CHECKING([whether our compiler is apple cc])
|
|
||||||
AC_CACHE_VAL(grub_cv_apple_cc,
|
|
||||||
[if $CC -v 2>&1 | grep "Apple Inc." > /dev/null; then
|
|
||||||
grub_cv_apple_cc=yes
|
|
||||||
else
|
|
||||||
grub_cv_apple_cc=no
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_apple_cc])])
|
|
||||||
|
|
||||||
dnl check if our target compiler is apple cc
|
|
||||||
dnl because it requires numerous workarounds
|
|
||||||
AC_DEFUN([grub_apple_target_cc],
|
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
|
||||||
AC_MSG_CHECKING([whether our target compiler is apple cc])
|
|
||||||
AC_CACHE_VAL(grub_cv_apple_target_cc,
|
|
||||||
[if $CC -v 2>&1 | grep "Apple Inc." > /dev/null; then
|
|
||||||
grub_cv_apple_target_cc=yes
|
|
||||||
else
|
|
||||||
grub_cv_apple_target_cc=no
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_apple_target_cc])])
|
|
||||||
|
|
||||||
|
|
||||||
dnl Later versions of GAS requires that addr32 and data32 prefixes
|
dnl Later versions of GAS requires that addr32 and data32 prefixes
|
||||||
dnl appear in the same lines as the instructions they modify, while
|
dnl appear in the same lines as the instructions they modify, while
|
||||||
dnl earlier versions requires that they appear in separate lines.
|
dnl earlier versions requires that they appear in separate lines.
|
||||||
@@ -266,7 +260,7 @@ AC_CACHE_VAL(grub_cv_i386_asm_prefix_requirement,
|
|||||||
l1: addr32 movb %al, l1
|
l1: addr32 movb %al, l1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
||||||
grub_cv_i386_asm_prefix_requirement=yes
|
grub_cv_i386_asm_prefix_requirement=yes
|
||||||
else
|
else
|
||||||
grub_cv_i386_asm_prefix_requirement=no
|
grub_cv_i386_asm_prefix_requirement=no
|
||||||
@@ -391,7 +385,7 @@ AC_MSG_CHECKING([whether `$CC' accepts `-mstack-arg-probe'])
|
|||||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||||
void foo (void) { volatile char a[8]; a[3]; }
|
void foo (void) { volatile char a[8]; a[3]; }
|
||||||
]])])
|
]])])
|
||||||
[if eval "$ac_compile -S -mstack-arg-probe -o conftest.s" 2> /dev/null; then]
|
[if eval "$ac_compile -S -mstack-arg-probe -Werror -o conftest.s" 2> /dev/null; then]
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
||||||
rm -f conftest.s
|
rm -f conftest.s
|
||||||
|
|||||||
+11
-41
@@ -6,42 +6,28 @@ export LC_COLLATE := C
|
|||||||
unexport LC_ALL
|
unexport LC_ALL
|
||||||
|
|
||||||
# Platform specific options
|
# Platform specific options
|
||||||
if COND_i386_pc
|
|
||||||
CFLAGS_PLATFORM += -mrtd -mregparm=3 -freg-struct-return
|
|
||||||
endif
|
|
||||||
if COND_i386_qemu
|
|
||||||
CFLAGS_PLATFORM += -mrtd -mregparm=3 -freg-struct-return
|
|
||||||
endif
|
|
||||||
if COND_i386_coreboot
|
|
||||||
CFLAGS_PLATFORM += -mrtd -mregparm=3 -freg-struct-return
|
|
||||||
endif
|
|
||||||
if COND_i386_ieee1275
|
|
||||||
CFLAGS_PLATFORM += -mrtd -mregparm=3 -freg-struct-return
|
|
||||||
endif
|
|
||||||
if COND_mips_loongson
|
if COND_mips_loongson
|
||||||
CFLAGS_PLATFORM += -mexplicit-relocs
|
CFLAGS_PLATFORM += -mexplicit-relocs
|
||||||
CPPFLAGS_PLATFORM = -DUSE_ASCII_FALLBACK
|
CPPFLAGS_PLATFORM = -DUSE_ASCII_FALLBACK
|
||||||
endif
|
endif
|
||||||
if COND_mips
|
|
||||||
CFLAGS_PLATFORM += -mflush-func=grub_red_herring
|
|
||||||
CCASFLAGS_PLATFORM = -march=mips3
|
|
||||||
endif
|
|
||||||
if COND_sparc64_ieee1275
|
if COND_sparc64_ieee1275
|
||||||
CFLAGS_PLATFORM += -mno-app-regs
|
CFLAGS_PLATFORM += -mno-app-regs
|
||||||
LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
|
LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
|
||||||
endif
|
endif
|
||||||
if COND_arm
|
if COND_arm
|
||||||
CFLAGS_PLATFORM += -mthumb-interwork -mlong-calls
|
CFLAGS_PLATFORM += -mthumb-interwork -mlong-calls
|
||||||
|
CCASFLAGS_PLATFORM = -mthumb-interwork
|
||||||
LDFLAGS_PLATFORM = -Wl,--wrap=__clear_cache
|
LDFLAGS_PLATFORM = -Wl,--wrap=__clear_cache
|
||||||
endif
|
endif
|
||||||
|
if COND_arm64
|
||||||
|
CFLAGS_PLATFORM += -mcmodel=large
|
||||||
|
endif
|
||||||
|
|
||||||
|
#FIXME: discover and check XEN headers
|
||||||
|
CPPFLAGS_XEN = -I/usr/include
|
||||||
|
|
||||||
# Other options
|
# Other options
|
||||||
|
|
||||||
if ! COND_emu
|
|
||||||
CFLAGS_PLATFORM += -Dfloat=__grub_poison
|
|
||||||
CFLAGS_PLATFORM += -Ddouble=__grub_poison
|
|
||||||
endif
|
|
||||||
|
|
||||||
CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\"
|
CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\"
|
||||||
CPPFLAGS_DEFAULT += -I$(builddir)
|
CPPFLAGS_DEFAULT += -I$(builddir)
|
||||||
CPPFLAGS_DEFAULT += -I$(srcdir)
|
CPPFLAGS_DEFAULT += -I$(srcdir)
|
||||||
@@ -54,26 +40,10 @@ CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/
|
|||||||
CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1
|
CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1
|
||||||
BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT)
|
BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT)
|
||||||
|
|
||||||
LDADD_KERNEL =
|
LDADD_KERNEL = $(TARGET_LIBGCC)
|
||||||
|
|
||||||
if ! COND_i386_pc
|
|
||||||
if ! COND_i386_efi
|
|
||||||
if ! COND_i386_qemu
|
|
||||||
if ! COND_i386_coreboot
|
|
||||||
if ! COND_i386_multiboot
|
|
||||||
if ! COND_i386_ieee1275
|
|
||||||
if ! COND_x86_64_efi
|
|
||||||
LDADD_KERNEL += -lgcc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
|
CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
|
||||||
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -static-libgcc
|
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_LDFLAGS_STATIC_LIBGCC)
|
||||||
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
|
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
|
||||||
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
||||||
if COND_CYGWIN
|
if COND_CYGWIN
|
||||||
@@ -107,13 +77,13 @@ grubconfdir = $(sysconfdir)/grub.d
|
|||||||
platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
|
platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
|
||||||
starfielddir = $(pkgdatadir)/themes/starfield
|
starfielddir = $(pkgdatadir)/themes/starfield
|
||||||
|
|
||||||
CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-old-style-definition -Wno-unsafe-loop-optimizations
|
CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-old-style-definition
|
||||||
CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
|
CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
|
||||||
|
|
||||||
CFLAGS_POSIX = -fno-builtin
|
CFLAGS_POSIX = -fno-builtin
|
||||||
CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
|
CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
|
||||||
|
|
||||||
CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -Wno-redundant-decls $(CFLAGS_POSIX)
|
CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -Wno-redundant-decls -Wno-undef $(CFLAGS_POSIX)
|
||||||
CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap $(CPPFLAGS_POSIX) -D_GCRYPT_IN_LIBGCRYPT=1 -I$(top_srcdir)/include/grub/gcrypt
|
CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap $(CPPFLAGS_POSIX) -D_GCRYPT_IN_LIBGCRYPT=1 -I$(top_srcdir)/include/grub/gcrypt
|
||||||
|
|
||||||
CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
|
CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ EXTRA_DIST += util/import_gcry.py
|
|||||||
EXTRA_DIST += util/import_unicode.py
|
EXTRA_DIST += util/import_unicode.py
|
||||||
|
|
||||||
EXTRA_DIST += docs/man
|
EXTRA_DIST += docs/man
|
||||||
|
EXTRA_DIST += docs/autoiso.cfg
|
||||||
EXTRA_DIST += docs/grub.cfg
|
EXTRA_DIST += docs/grub.cfg
|
||||||
|
EXTRA_DIST += docs/osdetect.cfg
|
||||||
|
|
||||||
EXTRA_DIST += conf/i386-pc-cygwin-img-ld.sc
|
EXTRA_DIST += conf/i386-pc-cygwin-img-ld.sc
|
||||||
|
|
||||||
@@ -26,6 +28,11 @@ EXTRA_DIST += grub-core/gensymlist.sh
|
|||||||
EXTRA_DIST += grub-core/genemuinit.sh
|
EXTRA_DIST += grub-core/genemuinit.sh
|
||||||
EXTRA_DIST += grub-core/genemuinitheader.sh
|
EXTRA_DIST += grub-core/genemuinitheader.sh
|
||||||
|
|
||||||
|
EXTRA_DIST += grub-core/gnulib-fix-null-deref.diff
|
||||||
|
EXTRA_DIST += grub-core/gnulib-fix-width.diff
|
||||||
|
EXTRA_DIST += grub-core/gnulib-no-abort.diff
|
||||||
|
EXTRA_DIST += grub-core/gnulib-no-gets.diff
|
||||||
|
|
||||||
EXTRA_DIST += grub-core/lib/libgcrypt
|
EXTRA_DIST += grub-core/lib/libgcrypt
|
||||||
EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic
|
EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic
|
||||||
EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h')
|
EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h')
|
||||||
@@ -103,3 +110,4 @@ EXTRA_DIST += grub-core/osdep/windows/sleep.c
|
|||||||
EXTRA_DIST += tests/dfly-mbr-mbexample.mbr.img.gz
|
EXTRA_DIST += tests/dfly-mbr-mbexample.mbr.img.gz
|
||||||
EXTRA_DIST += tests/dfly-mbr-mbexample.dfly.img.gz
|
EXTRA_DIST += tests/dfly-mbr-mbexample.dfly.img.gz
|
||||||
|
|
||||||
|
EXTRA_DIST += coreboot.cfg
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
#define __powerpc__ 1
|
#define __powerpc__ 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define GCRYPT_NO_DEPRECATED 1
|
||||||
|
|
||||||
/* Define to 1 to enable disk cache statistics. */
|
/* Define to 1 to enable disk cache statistics. */
|
||||||
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
|
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
|
||||||
#define BOOT_TIME_STATS @BOOT_TIME_STATS@
|
#define BOOT_TIME_STATS @BOOT_TIME_STATS@
|
||||||
|
|||||||
+424
-283
@@ -41,9 +41,11 @@ AC_CONFIG_AUX_DIR([build-aux])
|
|||||||
|
|
||||||
# Checks for host and target systems.
|
# Checks for host and target systems.
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
save_program_prefix="${program_prefix}"
|
||||||
AC_CANONICAL_TARGET
|
AC_CANONICAL_TARGET
|
||||||
|
program_prefix="${save_program_prefix}"
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE()
|
AM_INIT_AUTOMAKE([1.10.1])
|
||||||
AC_PREREQ(2.60)
|
AC_PREREQ(2.60)
|
||||||
AC_CONFIG_SRCDIR([include/grub/dl.h])
|
AC_CONFIG_SRCDIR([include/grub/dl.h])
|
||||||
AC_CONFIG_HEADER([config-util.h])
|
AC_CONFIG_HEADER([config-util.h])
|
||||||
@@ -73,14 +75,10 @@ if test "x$TARGET_CFLAGS" = x; then
|
|||||||
TARGET_CFLAGS="$TARGET_CFLAGS -Os"
|
TARGET_CFLAGS="$TARGET_CFLAGS -Os"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BUILD_CPPFLAGS="$BUILD_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
|
|
||||||
|
|
||||||
# Default HOST_CPPFLAGS
|
# Default HOST_CPPFLAGS
|
||||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
|
HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
|
||||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
|
HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
|
||||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
|
HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
|
||||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\""
|
|
||||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
|
|
||||||
|
|
||||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
|
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
|
||||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
|
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
|
||||||
@@ -101,6 +99,9 @@ case "$target_cpu" in
|
|||||||
arm*)
|
arm*)
|
||||||
target_cpu=arm;
|
target_cpu=arm;
|
||||||
;;
|
;;
|
||||||
|
aarch64*)
|
||||||
|
target_cpu=arm64;
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Specify the platform (such as firmware).
|
# Specify the platform (such as firmware).
|
||||||
@@ -122,6 +123,7 @@ if test "x$with_platform" = x; then
|
|||||||
mips-*) platform=arc ;;
|
mips-*) platform=arc ;;
|
||||||
ia64-*) platform=efi ;;
|
ia64-*) platform=efi ;;
|
||||||
arm-*) platform=uboot ;;
|
arm-*) platform=uboot ;;
|
||||||
|
arm64-*) platform=efi ;;
|
||||||
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
@@ -131,6 +133,7 @@ fi
|
|||||||
case "$target_cpu"-"$platform" in
|
case "$target_cpu"-"$platform" in
|
||||||
x86_64-efi) ;;
|
x86_64-efi) ;;
|
||||||
x86_64-emu) ;;
|
x86_64-emu) ;;
|
||||||
|
x86_64-xen) ;;
|
||||||
x86_64-*) target_cpu=i386 ;;
|
x86_64-*) target_cpu=i386 ;;
|
||||||
powerpc64-ieee1275) target_cpu=powerpc ;;
|
powerpc64-ieee1275) target_cpu=powerpc ;;
|
||||||
esac
|
esac
|
||||||
@@ -139,6 +142,8 @@ esac
|
|||||||
case "$target_cpu"-"$platform" in
|
case "$target_cpu"-"$platform" in
|
||||||
i386-efi) ;;
|
i386-efi) ;;
|
||||||
x86_64-efi) ;;
|
x86_64-efi) ;;
|
||||||
|
i386-xen) ;;
|
||||||
|
x86_64-xen) ;;
|
||||||
i386-pc) ;;
|
i386-pc) ;;
|
||||||
i386-multiboot) ;;
|
i386-multiboot) ;;
|
||||||
i386-coreboot) ;;
|
i386-coreboot) ;;
|
||||||
@@ -159,14 +164,17 @@ case "$target_cpu"-"$platform" in
|
|||||||
mipsel-loongson) ;;
|
mipsel-loongson) ;;
|
||||||
arm-uboot) ;;
|
arm-uboot) ;;
|
||||||
arm-efi) ;;
|
arm-efi) ;;
|
||||||
|
arm64-efi) ;;
|
||||||
*-emu) ;;
|
*-emu) ;;
|
||||||
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$target_cpu" in
|
if test x$platform != xemu ; then
|
||||||
|
case "$target_cpu" in
|
||||||
i386 | powerpc) target_m32=1 ;;
|
i386 | powerpc) target_m32=1 ;;
|
||||||
x86_64 | sparc64) target_m64=1 ;;
|
x86_64 | sparc64) target_m64=1 ;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
case "$target_os" in
|
case "$target_os" in
|
||||||
windows* | mingw32*) target_os=cygwin ;;
|
windows* | mingw32*) target_os=cygwin ;;
|
||||||
@@ -185,10 +193,17 @@ case "$host_os" in
|
|||||||
cygwin | windows* | mingw32*) host_kernel=windows ;;
|
cygwin | windows* | mingw32*) host_kernel=windows ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
case "$host_os" in
|
||||||
|
cygwin | windows* | mingw32*) have_exec=n ;;
|
||||||
|
aros*) have_exec=n ;;
|
||||||
|
*) have_exec=y;;
|
||||||
|
esac
|
||||||
|
|
||||||
case "$platform" in
|
case "$platform" in
|
||||||
coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
|
coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
|
||||||
multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
|
multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
|
||||||
efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
|
efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
|
||||||
|
xen) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN=1" ;;
|
||||||
ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
|
ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
|
||||||
uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
|
uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
|
||||||
qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
|
qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
|
||||||
@@ -200,6 +215,7 @@ case "$platform" in
|
|||||||
esac
|
esac
|
||||||
case "$target_cpu" in
|
case "$target_cpu" in
|
||||||
arm) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM=1" ;;
|
arm) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM=1" ;;
|
||||||
|
arm64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM64=1" ;;
|
||||||
mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
||||||
sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
||||||
esac
|
esac
|
||||||
@@ -341,12 +357,6 @@ case "$host_os" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
grub_apple_cc
|
|
||||||
if test x$grub_cv_apple_cc = xyes ; then
|
|
||||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -fnested-functions"
|
|
||||||
HOST_LDFLAGS="$HOST_LDFLAGS -Wl,-allow_stack_execute"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x$USE_NLS = xno; then
|
if test x$USE_NLS = xno; then
|
||||||
HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
|
HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
|
||||||
fi
|
fi
|
||||||
@@ -385,7 +395,7 @@ AC_SUBST([LIBUTIL])
|
|||||||
|
|
||||||
AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
|
AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
|
||||||
SAVED_CFLAGS="$CFLAGS"
|
SAVED_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$HOST_CFLAGS -Wtrampolines"
|
CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror"
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
|
||||||
int va_arg_func (int fixed, va_list args);]], [[]])],
|
int va_arg_func (int fixed, va_list args);]], [[]])],
|
||||||
[grub_cv_host_cc_wtrampolines=yes],
|
[grub_cv_host_cc_wtrampolines=yes],
|
||||||
@@ -461,175 +471,39 @@ CPPFLAGS="$TARGET_CPPFLAGS"
|
|||||||
LDFLAGS="$TARGET_LDFLAGS"
|
LDFLAGS="$TARGET_LDFLAGS"
|
||||||
LIBS=""
|
LIBS=""
|
||||||
|
|
||||||
grub_PROG_NM_MINUS_P
|
|
||||||
grub_PROG_NM_DEFINED_ONLY
|
|
||||||
AC_SUBST(TARGET_NMFLAGS_MINUS_P)
|
|
||||||
AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
|
|
||||||
|
|
||||||
# debug flags.
|
# debug flags.
|
||||||
WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Wattributes -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
|
WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Wattributes -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
|
||||||
HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS"
|
HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
|
TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
|
||||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
|
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
|
||||||
|
|
||||||
# Force no alignment to save space on i386.
|
if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
|
||||||
if test "x$target_cpu" = xi386; then
|
TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
|
||||||
AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
|
|
||||||
CFLAGS="$CFLAGS -falign-loops=1"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
||||||
[grub_cv_cc_falign_loop=yes],
|
|
||||||
[grub_cv_cc_falign_loop=no])
|
|
||||||
])
|
|
||||||
|
|
||||||
if test "x$grub_cv_cc_falign_loop" = xyes; then
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
|
|
||||||
else
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
|
AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang]
|
||||||
# Some toolchains enable these features by default, but they need
|
[AC_COMPILE_IFELSE(
|
||||||
# registers that aren't set up properly in GRUB.
|
[AC_LANG_PROGRAM([], [[
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
|
#ifdef __clang__
|
||||||
|
#error "is clang"
|
||||||
|
#endif
|
||||||
|
]])],
|
||||||
|
[grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])])
|
||||||
|
|
||||||
|
# on x86 clang doesn't support .code16
|
||||||
|
# on arm clang doesn't support .arch directive
|
||||||
|
# on mips clang doesn't support privilegied instructions, doubleword store/load
|
||||||
|
# and crashes with hand-written assembly
|
||||||
|
if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
|
||||||
|
|| test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm \
|
||||||
|
|| test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ); then
|
||||||
|
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# By default, GCC 4.4 generates .eh_frame sections containing unwind
|
if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
|
||||||
# information in some cases where it previously did not. GRUB doesn't need
|
TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
|
||||||
# these and they just use up vital space. Restore the old compiler
|
|
||||||
# behaviour.
|
|
||||||
AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
|
|
||||||
SAVE_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
||||||
[grub_cv_cc_fno_dwarf2_cfi_asm=yes],
|
|
||||||
[grub_cv_cc_fno_dwarf2_cfi_asm=no])
|
|
||||||
CFLAGS="$SAVE_CFLAGS"
|
|
||||||
])
|
|
||||||
|
|
||||||
if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x"$target_os" = xcygwin; then
|
|
||||||
AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [
|
|
||||||
CFLAGS="$CFLAGS -fno-reorder-functions"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
||||||
[grub_cv_cc_no_reorder_functions=yes],
|
|
||||||
[grub_cv_cc_no_reorder_functions=no])
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# By default, GCC 4.6 generates .eh_frame sections containing unwind
|
|
||||||
# information in some cases where it previously did not. GRUB doesn't need
|
|
||||||
# these and they just use up vital space. Restore the old compiler
|
|
||||||
# behaviour.
|
|
||||||
AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
|
|
||||||
SAVE_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
||||||
[grub_cv_cc_fno_asynchronous_unwind_tables=yes],
|
|
||||||
[grub_cv_cc_fno_asynchronous_unwind_tables=no])
|
|
||||||
CFLAGS="$SAVE_CFLAGS"
|
|
||||||
])
|
|
||||||
|
|
||||||
if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
|
|
||||||
fi
|
|
||||||
|
|
||||||
grub_apple_target_cc
|
|
||||||
if test x$grub_cv_apple_target_cc = xyes ; then
|
|
||||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -fnested-functions"
|
|
||||||
|
|
||||||
CFLAGS="$CFLAGS -fnested-functions"
|
|
||||||
TARGET_APPLE_CC=1
|
|
||||||
AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
|
|
||||||
if test "x$TARGET_OBJCONV" = x ; then
|
|
||||||
AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
|
|
||||||
fi
|
|
||||||
if test "x$TARGET_OBJCONV" = x ; then
|
|
||||||
AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
|
|
||||||
fi
|
|
||||||
TARGET_IMG_LDSCRIPT=
|
|
||||||
TARGET_IMG_CFLAGS="-static"
|
|
||||||
TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
|
|
||||||
TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
|
|
||||||
TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
|
|
||||||
TARGET_LDFLAGS_OLDMAGIC=""
|
|
||||||
else
|
|
||||||
TARGET_APPLE_CC=0
|
|
||||||
TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
|
|
||||||
# Use linker script if present, otherwise use builtin -N script.
|
|
||||||
if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"; then
|
|
||||||
TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"
|
|
||||||
TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
|
|
||||||
TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"
|
|
||||||
TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
|
|
||||||
else
|
|
||||||
TARGET_IMG_LDSCRIPT=
|
|
||||||
TARGET_IMG_LDFLAGS='-Wl,-N'
|
|
||||||
TARGET_IMG_LDFLAGS_AC='-Wl,-N'
|
|
||||||
TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
|
|
||||||
fi
|
|
||||||
TARGET_IMG_CFLAGS=
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
|
|
||||||
|
|
||||||
# For platforms where ELF is not the default link format.
|
|
||||||
AC_MSG_CHECKING([for command to convert module to ELF format])
|
|
||||||
case "${target_os}" in
|
|
||||||
cygwin) TARGET_OBJ2ELF='./build-grub-pe2elf';
|
|
||||||
# FIXME: put proper test here
|
|
||||||
NEED_REGISTER_FRAME_INFO=1
|
|
||||||
;;
|
|
||||||
*) NEED_REGISTER_FRAME_INFO=0 ;;
|
|
||||||
esac
|
|
||||||
AC_MSG_RESULT([$TARGET_OBJ2ELF])
|
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([efiemu],
|
|
||||||
[AS_HELP_STRING([--enable-efiemu],
|
|
||||||
[build and install the efiemu runtimes (default=guessed)])])
|
|
||||||
if test x"$enable_efiemu" = xno ; then
|
|
||||||
efiemu_excuse="explicitly disabled"
|
|
||||||
fi
|
|
||||||
if test x"$target_os" = xcygwin ; then
|
|
||||||
efiemu_excuse="not available on cygwin"
|
|
||||||
fi
|
|
||||||
if test x"$target_cpu" != xi386 ; then
|
|
||||||
efiemu_excuse="only available on i386"
|
|
||||||
fi
|
|
||||||
if test x"$platform" = xefi ; then
|
|
||||||
efiemu_excuse="not available on efi"
|
|
||||||
fi
|
|
||||||
if test x"$efiemu_excuse" = x ; then
|
|
||||||
AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
|
|
||||||
SAVED_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
||||||
[grub_cv_cc_efiemu=yes],
|
|
||||||
[grub_cv_cc_efiemu=no])
|
|
||||||
CFLAGS="$SAVED_CFLAGS"
|
|
||||||
])
|
|
||||||
if test x$grub_cv_cc_efiemu = xno; then
|
|
||||||
efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
|
|
||||||
AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
|
|
||||||
fi
|
|
||||||
if test x"$efiemu_excuse" = x ; then
|
|
||||||
enable_efiemu=yes
|
|
||||||
else
|
|
||||||
enable_efiemu=no
|
|
||||||
fi
|
|
||||||
AC_SUBST([enable_efiemu])
|
|
||||||
|
|
||||||
if test "x$target_m32" = x1; then
|
if test "x$target_m32" = x1; then
|
||||||
# Force 32-bit mode.
|
# Force 32-bit mode.
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||||
@@ -648,55 +522,233 @@ if test "x$target_m64" = x1; then
|
|||||||
TARGET_MODULE_FORMAT="elf64"
|
TARGET_MODULE_FORMAT="elf64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$target_os" in
|
if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# on mips redirect cache flushing function to non-existant one.
|
||||||
|
if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then
|
||||||
|
AC_CACHE_CHECK([whether -mflush-func=grub_red_herring works], [grub_cv_cc_mflush_func], [
|
||||||
|
CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring -Werror"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_mflush_func=yes],
|
||||||
|
[grub_cv_cc_mflush_func=no])
|
||||||
|
])
|
||||||
|
|
||||||
|
if test "x$grub_cv_cc_mflush_func" = xyes; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Force no alignment to save space on i386.
|
||||||
|
if test "x$target_cpu" = xi386; then
|
||||||
|
AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
|
||||||
|
CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_falign_loop=yes],
|
||||||
|
[grub_cv_cc_falign_loop=no])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [
|
||||||
|
CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_malign_loop=yes],
|
||||||
|
[grub_cv_cc_malign_loop=no])
|
||||||
|
])
|
||||||
|
|
||||||
|
if test "x$grub_cv_cc_falign_loop" = xyes; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
|
||||||
|
elif test "x$grub_cv_cc_malign_loop" = xyes; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [
|
||||||
|
CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_freg_struct_return=yes],
|
||||||
|
[grub_cv_cc_freg_struct_return=no])
|
||||||
|
])
|
||||||
|
|
||||||
|
if test "x$grub_cv_cc_freg_struct_return" = xyes; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
|
||||||
|
# Some toolchains enable these features by default, but they need
|
||||||
|
# registers that aren't set up properly in GRUB.
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# By default, GCC 4.4 generates .eh_frame sections containing unwind
|
||||||
|
# information in some cases where it previously did not. GRUB doesn't need
|
||||||
|
# these and they just use up vital space. Restore the old compiler
|
||||||
|
# behaviour.
|
||||||
|
AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
|
||||||
|
CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_fno_dwarf2_cfi_asm=yes],
|
||||||
|
[grub_cv_cc_fno_dwarf2_cfi_asm=no])
|
||||||
|
])
|
||||||
|
|
||||||
|
if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$target_os" = xcygwin; then
|
||||||
|
AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [
|
||||||
|
CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_no_reorder_functions=yes],
|
||||||
|
[grub_cv_cc_no_reorder_functions=no])
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# By default, GCC 4.6 generates .eh_frame sections containing unwind
|
||||||
|
# information in some cases where it previously did not. GRUB doesn't need
|
||||||
|
# these and they just use up vital space. Restore the old compiler
|
||||||
|
# behaviour.
|
||||||
|
AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
|
||||||
|
CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_fno_asynchronous_unwind_tables=yes],
|
||||||
|
[grub_cv_cc_fno_asynchronous_unwind_tables=no])
|
||||||
|
])
|
||||||
|
|
||||||
|
if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For platforms where ELF is not the default link format.
|
||||||
|
case "${target_os}" in
|
||||||
cygwin)
|
cygwin)
|
||||||
|
# FIXME: put proper test here
|
||||||
|
NEED_REGISTER_FRAME_INFO=1
|
||||||
;;
|
;;
|
||||||
freebsd)
|
*) NEED_REGISTER_FRAME_INFO=0 ;;
|
||||||
if test x"$target_cpu" = xi386; then
|
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_fbsd"
|
|
||||||
fi
|
|
||||||
if test x"$target_cpu" = xx86_64; then
|
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_fbsd"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
openbsd*)
|
|
||||||
if test x"$target_cpu" = xi386; then
|
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_obsd"
|
|
||||||
fi
|
|
||||||
if test x"$target_cpu" = xx86_64; then
|
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_obsd"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
haiku*)
|
|
||||||
if test x"$target_cpu" = xi386; then
|
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_haiku"
|
|
||||||
fi
|
|
||||||
if test x"$target_cpu" = xx86_64; then
|
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_haiku"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if test x"$target_cpu" = xi386; then
|
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386"
|
|
||||||
fi
|
|
||||||
if test x"$target_cpu" = xx86_64; then
|
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([efiemu],
|
||||||
|
[AS_HELP_STRING([--enable-efiemu],
|
||||||
|
[build and install the efiemu runtimes (default=guessed)])])
|
||||||
|
if test x"$enable_efiemu" = xno ; then
|
||||||
|
efiemu_excuse="explicitly disabled"
|
||||||
|
fi
|
||||||
|
if test x"$target_os" = xcygwin ; then
|
||||||
|
efiemu_excuse="not available on cygwin"
|
||||||
|
fi
|
||||||
|
if test x"$target_cpu" != xi386 ; then
|
||||||
|
efiemu_excuse="only available on i386"
|
||||||
|
fi
|
||||||
|
if test x"$platform" = xefi ; then
|
||||||
|
efiemu_excuse="not available on efi"
|
||||||
|
fi
|
||||||
|
if test x"$efiemu_excuse" = x ; then
|
||||||
|
AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
|
||||||
|
CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_efiemu=yes],
|
||||||
|
[grub_cv_cc_efiemu=no])
|
||||||
|
])
|
||||||
|
if test x$grub_cv_cc_efiemu = xno; then
|
||||||
|
efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
|
||||||
|
AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
|
||||||
|
fi
|
||||||
|
if test x"$efiemu_excuse" = x ; then
|
||||||
|
enable_efiemu=yes
|
||||||
|
else
|
||||||
|
enable_efiemu=no
|
||||||
|
fi
|
||||||
|
AC_SUBST([enable_efiemu])
|
||||||
|
|
||||||
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
|
|
||||||
|
if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
|
||||||
|
AC_CACHE_CHECK([for linking format], [grub_cv_target_cc_link_format], [
|
||||||
|
grub_cv_target_cc_link_format=unknown
|
||||||
|
for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -m${target_cpu}pe -arch,${target_cpu}; do
|
||||||
|
if test x${target_cpu} != xi386 && test x$format = x${target_cpu}pe; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
|
LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib -static"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
asm (".globl start; start:");
|
||||||
|
asm (".globl _start; _start:");
|
||||||
|
asm (".globl __start; __start:");
|
||||||
|
void __main (void);
|
||||||
|
void __main (void) {}
|
||||||
|
]], [[]])], [flag=1], [])
|
||||||
|
if test x"$flag" = x1; then
|
||||||
|
grub_cv_target_cc_link_format="$format"
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
done])
|
||||||
|
if test x"$grub_cv_target_cc_link_format" = xunknown; then
|
||||||
|
AC_MSG_ERROR([no suitable link format found])
|
||||||
|
fi
|
||||||
|
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
|
||||||
|
if test x"$grub_cv_target_cc_link_format" = x-mi386pe; then
|
||||||
|
TARGET_OBJ2ELF='./build-grub-pe2elf';
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x$grub_cv_target_cc_link_format = x-arch,i386 || test x$grub_cv_target_cc_link_format = x-arch,x86_64; then
|
||||||
|
TARGET_APPLE_LINKER=1
|
||||||
|
AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
|
||||||
|
if test "x$TARGET_OBJCONV" = x ; then
|
||||||
|
AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
|
||||||
|
fi
|
||||||
|
if test "x$TARGET_OBJCONV" = x ; then
|
||||||
|
AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
|
||||||
|
fi
|
||||||
|
TARGET_IMG_LDSCRIPT=
|
||||||
|
TARGET_IMG_CFLAGS="-static"
|
||||||
|
TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
|
||||||
|
TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
|
||||||
|
TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
|
||||||
|
TARGET_LDFLAGS_OLDMAGIC=""
|
||||||
|
elif test x$grub_cv_target_cc_link_format = x-mi386pe && test x$platform = xpc; then
|
||||||
|
TARGET_APPLE_LINKER=0
|
||||||
|
TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
|
||||||
|
TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/i386-pc-cygwin-img-ld.sc"
|
||||||
|
TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
|
||||||
|
TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/i386-pc-cygwin-img-ld.sc"
|
||||||
|
TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
|
||||||
|
TARGET_IMG_CFLAGS=
|
||||||
|
else
|
||||||
|
TARGET_APPLE_LINKER=0
|
||||||
|
TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
|
||||||
|
TARGET_IMG_LDSCRIPT=
|
||||||
|
TARGET_IMG_LDFLAGS='-Wl,-N'
|
||||||
|
TARGET_IMG_LDFLAGS_AC='-Wl,-N'
|
||||||
|
TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
|
||||||
|
TARGET_IMG_CFLAGS=
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
|
||||||
|
|
||||||
|
|
||||||
|
LDFLAGS="$TARGET_LDFLAGS"
|
||||||
|
|
||||||
if test "$target_cpu" = x86_64; then
|
if test "$target_cpu" = x86_64; then
|
||||||
# Use large model to support 4G memory
|
# Use large model to support 4G memory
|
||||||
AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
|
AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
|
||||||
SAVED_CFLAGS=$CFLAGS
|
CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large"
|
||||||
CFLAGS="$CFLAGS -m64 -mcmodel=large"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
[grub_cv_cc_mcmodel=yes],
|
[grub_cv_cc_mcmodel=yes],
|
||||||
[grub_cv_cc_mcmodel=no])
|
[grub_cv_cc_mcmodel=no])
|
||||||
])
|
])
|
||||||
if test "x$grub_cv_cc_mcmodel" = xno; then
|
if test "x$grub_cv_cc_mcmodel" = xyes; then
|
||||||
AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
|
|
||||||
else
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
|
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -704,7 +756,7 @@ fi
|
|||||||
if test "$target_cpu"-"$platform" = x86_64-efi; then
|
if test "$target_cpu"-"$platform" = x86_64-efi; then
|
||||||
# EFI writes to stack below %rsp, we must not use the red zone
|
# EFI writes to stack below %rsp, we must not use the red zone
|
||||||
AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
|
AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
|
||||||
CFLAGS="$CFLAGS -m64 -mno-red-zone"
|
CFLAGS="$TARGET_CFLAGS -m64 -mno-red-zone"
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
[grub_cv_cc_no_red_zone=yes],
|
[grub_cv_cc_no_red_zone=yes],
|
||||||
[grub_cv_cc_no_red_zone=no])
|
[grub_cv_cc_no_red_zone=no])
|
||||||
@@ -720,6 +772,8 @@ fi
|
|||||||
# Compiler features.
|
# Compiler features.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
|
|
||||||
# Position independent executable.
|
# Position independent executable.
|
||||||
grub_CHECK_PIE
|
grub_CHECK_PIE
|
||||||
[# Need that, because some distributions ship compilers that include
|
[# Need that, because some distributions ship compilers that include
|
||||||
@@ -728,14 +782,25 @@ if [ x"$pie_possible" = xyes ]; then
|
|||||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
|
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
|
||||||
fi]
|
fi]
|
||||||
|
|
||||||
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
|
|
||||||
# Position independent executable.
|
# Position independent executable.
|
||||||
grub_CHECK_PIC
|
grub_CHECK_PIC
|
||||||
[# Need that, because some distributions ship compilers that include
|
[# On most platforms we don't want PIC as it only makes relocations harder
|
||||||
# `-fPIC' in the default specs.
|
# and code less efficient. On mips we want to have one got table per module
|
||||||
if [ x"$pic_possible" = xyes ]; then
|
# and reload $gp in every function.
|
||||||
|
# GCC implements it using symbol __gnu_local_gp in non-PIC as well.
|
||||||
|
# However with clang we need PIC for this reloading to happen.
|
||||||
|
# Since default varies across dictributions use either -fPIC or -fno-PIC
|
||||||
|
# explicitly.
|
||||||
|
if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel ) && test "x$grub_cv_cc_target_clang" = xyes ; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -fPIC"
|
||||||
|
elif [ x"$pic_possible" = xyes ]; then
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
|
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
|
||||||
fi]
|
fi]
|
||||||
|
|
||||||
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
|
|
||||||
# Smashing stack protector.
|
# Smashing stack protector.
|
||||||
grub_CHECK_STACK_PROTECTOR
|
grub_CHECK_STACK_PROTECTOR
|
||||||
# Need that, because some distributions ship compilers that include
|
# Need that, because some distributions ship compilers that include
|
||||||
@@ -743,6 +808,9 @@ grub_CHECK_STACK_PROTECTOR
|
|||||||
if test "x$ssp_possible" = xyes; then
|
if test "x$ssp_possible" = xyes; then
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
|
TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
|
|
||||||
grub_CHECK_STACK_ARG_PROBE
|
grub_CHECK_STACK_ARG_PROBE
|
||||||
# Cygwin's GCC uses alloca() to probe the stackframe on static
|
# Cygwin's GCC uses alloca() to probe the stackframe on static
|
||||||
# stack allocations above some threshold.
|
# stack allocations above some threshold.
|
||||||
@@ -750,6 +818,8 @@ if test x"$sap_possible" = xyes; then
|
|||||||
TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
|
TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
|
|
||||||
# -mno-unaligned-access
|
# -mno-unaligned-access
|
||||||
if test "$target_cpu" = arm; then
|
if test "$target_cpu" = arm; then
|
||||||
grub_CHECK_NO_UNALIGNED_ACCESS
|
grub_CHECK_NO_UNALIGNED_ACCESS
|
||||||
@@ -758,73 +828,36 @@ if test "$target_cpu" = arm; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE([werror],
|
|
||||||
[AS_HELP_STRING([--disable-werror],
|
|
||||||
[do not use -Werror when building GRUB])])
|
|
||||||
if test x"$enable_werror" != xno ; then
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
|
|
||||||
HOST_CFLAGS="$HOST_CFLAGS -Werror"
|
|
||||||
fi
|
|
||||||
|
|
||||||
TARGET_CPP="$TARGET_CC -E"
|
|
||||||
TARGET_CCAS=$TARGET_CC
|
|
||||||
|
|
||||||
GRUB_TARGET_CPU="${target_cpu}"
|
|
||||||
GRUB_PLATFORM="${platform}"
|
|
||||||
|
|
||||||
AC_SUBST(GRUB_TARGET_CPU)
|
|
||||||
AC_SUBST(GRUB_PLATFORM)
|
|
||||||
|
|
||||||
AC_SUBST(TARGET_OBJCONV)
|
|
||||||
AC_SUBST(TARGET_CPP)
|
|
||||||
AC_SUBST(TARGET_CCAS)
|
|
||||||
AC_SUBST(TARGET_OBJ2ELF)
|
|
||||||
AC_SUBST(TARGET_APPLE_CC)
|
|
||||||
AC_SUBST(TARGET_MODULE_FORMAT)
|
|
||||||
|
|
||||||
AC_SUBST(TARGET_CFLAGS)
|
|
||||||
AC_SUBST(TARGET_LDFLAGS)
|
|
||||||
AC_SUBST(TARGET_CPPFLAGS)
|
|
||||||
AC_SUBST(TARGET_CCASFLAGS)
|
|
||||||
|
|
||||||
AC_SUBST(TARGET_IMG_LDSCRIPT)
|
|
||||||
AC_SUBST(TARGET_IMG_LDFLAGS)
|
|
||||||
AC_SUBST(TARGET_IMG_CFLAGS)
|
|
||||||
AC_SUBST(TARGET_IMG_BASE_LDOPT)
|
|
||||||
|
|
||||||
AC_SUBST(HOST_CFLAGS)
|
|
||||||
AC_SUBST(HOST_LDFLAGS)
|
|
||||||
AC_SUBST(HOST_CPPFLAGS)
|
|
||||||
AC_SUBST(HOST_CCASFLAGS)
|
|
||||||
|
|
||||||
AC_SUBST(BUILD_LIBM)
|
|
||||||
|
|
||||||
# Set them to their new values for the tests below.
|
# Set them to their new values for the tests below.
|
||||||
CC="$TARGET_CC"
|
CC="$TARGET_CC"
|
||||||
if test "x$TARGET_APPLE_CC" = x1 ; then
|
if test "x$TARGET_APPLE_LINKER" = x1 ; then
|
||||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
|
CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error"
|
||||||
else
|
else
|
||||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
|
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
|
||||||
fi
|
fi
|
||||||
CPPFLAGS="$TARGET_CPPFLAGS"
|
CPPFLAGS="$TARGET_CPPFLAGS"
|
||||||
if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then
|
if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then
|
||||||
LIBS=
|
TARGET_LIBGCC=
|
||||||
else
|
else
|
||||||
LIBS=-lgcc
|
TARGET_LIBGCC=-lgcc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
LIBS="$TARGET_LIBGCC"
|
||||||
|
|
||||||
grub_ASM_USCORE
|
grub_ASM_USCORE
|
||||||
|
if test "x$TARGET_APPLE_LINKER" = x0 ; then
|
||||||
if test x$grub_cv_asm_uscore = xyes; then
|
if test x$grub_cv_asm_uscore = xyes; then
|
||||||
CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
|
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,_abort=_main"
|
||||||
else
|
else
|
||||||
CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
|
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,abort=main"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for libgcc symbols
|
# Check for libgcc symbols
|
||||||
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2)
|
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x)
|
||||||
|
|
||||||
if test "x$TARGET_APPLE_CC" = x1 ; then
|
if test "x$TARGET_APPLE_LINKER" = x1 ; then
|
||||||
CFLAGS="$TARGET_CFLAGS -nostdlib"
|
CFLAGS="$TARGET_CFLAGS -nostdlib -static"
|
||||||
else
|
else
|
||||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
|
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
|
||||||
fi
|
fi
|
||||||
@@ -832,15 +865,15 @@ LIBS=""
|
|||||||
|
|
||||||
# Defined in aclocal.m4.
|
# Defined in aclocal.m4.
|
||||||
grub_PROG_TARGET_CC
|
grub_PROG_TARGET_CC
|
||||||
if test "x$TARGET_APPLE_CC" != x1 ; then
|
if test "x$TARGET_APPLE_LINKER" != x1 ; then
|
||||||
grub_PROG_OBJCOPY_ABSOLUTE
|
grub_PROG_OBJCOPY_ABSOLUTE
|
||||||
fi
|
fi
|
||||||
grub_PROG_LD_BUILD_ID_NONE
|
grub_PROG_LD_BUILD_ID_NONE
|
||||||
if test "x$target_cpu" = xi386; then
|
if test "x$target_cpu" = xi386; then
|
||||||
if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
|
if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
|
||||||
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
|
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
|
||||||
# Check symbols provided by linker script.
|
# Check symbols provided by linker script.
|
||||||
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},8000 -Wl,--defsym,___main=0x8100"
|
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000 -Wl,--defsym,___main=0x8100"
|
||||||
fi
|
fi
|
||||||
grub_CHECK_BSS_START_SYMBOL
|
grub_CHECK_BSS_START_SYMBOL
|
||||||
grub_CHECK_END_SYMBOL
|
grub_CHECK_END_SYMBOL
|
||||||
@@ -850,6 +883,12 @@ if test "x$target_cpu" = xi386; then
|
|||||||
grub_I386_ASM_ADDR32
|
grub_I386_ASM_ADDR32
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
grub_PROG_NM_WORKS
|
||||||
|
grub_PROG_NM_MINUS_P
|
||||||
|
grub_PROG_NM_DEFINED_ONLY
|
||||||
|
AC_SUBST(TARGET_NMFLAGS_MINUS_P)
|
||||||
|
AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
|
||||||
|
|
||||||
if test "$platform" != emu; then
|
if test "$platform" != emu; then
|
||||||
AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
|
AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
|
||||||
SAVED_CPPFLAGS="$CPPFLAGS"
|
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||||
@@ -868,13 +907,11 @@ fi
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
|
AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
|
||||||
SAVED_CFLAGS="$CFLAGS"
|
CFLAGS="$TARGET_CFLAGS -Wtrampolines -Werror"
|
||||||
CFLAGS="$TARGET_CFLAGS -Wtrampolines"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
|
||||||
int va_arg_func (int fixed, va_list args);]], [[]])],
|
int va_arg_func (int fixed, va_list args);]], [[]])],
|
||||||
[grub_cv_cc_wtrampolines=yes],
|
[grub_cv_cc_wtrampolines=yes],
|
||||||
[grub_cv_cc_wtrampolines=no])
|
[grub_cv_cc_wtrampolines=no])
|
||||||
CFLAGS="$SAVED_CFLAGS"
|
|
||||||
])
|
])
|
||||||
|
|
||||||
if test x"$grub_cv_cc_wtrampolines" = xyes ; then
|
if test x"$grub_cv_cc_wtrampolines" = xyes ; then
|
||||||
@@ -1018,6 +1055,13 @@ fi
|
|||||||
AC_SUBST([enable_grub_emu_sdl])
|
AC_SUBST([enable_grub_emu_sdl])
|
||||||
AC_SUBST([enable_grub_emu_usb])
|
AC_SUBST([enable_grub_emu_usb])
|
||||||
AC_SUBST([enable_grub_emu_pci])
|
AC_SUBST([enable_grub_emu_pci])
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
# Ignore --enable-emu-* if platform is not emu
|
||||||
|
enable_grub_emu_sdl=no
|
||||||
|
enable_grub_emu_usb=no
|
||||||
|
enable_grub_emu_pci=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE([grub-mkfont],
|
AC_ARG_ENABLE([grub-mkfont],
|
||||||
@@ -1128,7 +1172,14 @@ DJVU_FONT_SOURCE=
|
|||||||
|
|
||||||
starfield_excuse=
|
starfield_excuse=
|
||||||
|
|
||||||
if test x"$enable_build_grub_mkfont" = xno ; then
|
AC_ARG_ENABLE([grub-themes],
|
||||||
|
[AS_HELP_STRING([--enable-grub-themes],
|
||||||
|
[build and install GRUB themes (default=guessed)])])
|
||||||
|
if test x"$enable_grub_themes" = xno ; then
|
||||||
|
starfield_excuse="explicitly disabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$starfield_excuse" = x && test x"$enable_build_grub_mkfont" = xno ; then
|
||||||
starfield_excuse="No build-time grub-mkfont"
|
starfield_excuse="No build-time grub-mkfont"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1147,6 +1198,10 @@ if test x"$starfield_excuse" = x; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then
|
||||||
|
AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SUBST([DJVU_FONT_SOURCE])
|
AC_SUBST([DJVU_FONT_SOURCE])
|
||||||
|
|
||||||
FONT_SOURCE=
|
FONT_SOURCE=
|
||||||
@@ -1249,10 +1304,32 @@ fi
|
|||||||
|
|
||||||
AC_SUBST([LIBGEOM])
|
AC_SUBST([LIBGEOM])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([liblzma],
|
||||||
|
[AS_HELP_STRING([--enable-liblzma],
|
||||||
|
[enable liblzma integration (default=guessed)])])
|
||||||
|
if test x"$enable_liblzma" = xno ; then
|
||||||
|
liblzma_excuse="explicitly disabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$liblzma_excuse" = x ; then
|
||||||
AC_CHECK_LIB([lzma], [lzma_code],
|
AC_CHECK_LIB([lzma], [lzma_code],
|
||||||
[LIBLZMA="-llzma"
|
[],[liblzma_excuse="need lzma library"])
|
||||||
AC_DEFINE([HAVE_LIBLZMA], [1],
|
fi
|
||||||
[Define to 1 if you have the LZMA library.])],)
|
if test x"$liblzma_excuse" = x ; then
|
||||||
|
AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then
|
||||||
|
AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied])
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test x"$liblzma_excuse" = x ; then
|
||||||
|
LIBLZMA="-llzma"
|
||||||
|
AC_DEFINE([USE_LIBLZMA], [1],
|
||||||
|
[Define to 1 if you have the LZMA library.])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SUBST([LIBLZMA])
|
AC_SUBST([LIBLZMA])
|
||||||
|
|
||||||
AC_ARG_ENABLE([libzfs],
|
AC_ARG_ENABLE([libzfs],
|
||||||
@@ -1301,8 +1378,6 @@ LIBS=""
|
|||||||
AC_SUBST([FONT_SOURCE])
|
AC_SUBST([FONT_SOURCE])
|
||||||
AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
|
AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
|
||||||
[AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
|
[AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
|
||||||
AS_IF([test x$TARGET_APPLE_CC = x1],
|
|
||||||
[AC_SUBST([USE_APPLE_CC_FIXES], yes)])
|
|
||||||
|
|
||||||
AC_SUBST(HAVE_ASM_USCORE)
|
AC_SUBST(HAVE_ASM_USCORE)
|
||||||
AC_SUBST(ADDR32)
|
AC_SUBST(ADDR32)
|
||||||
@@ -1313,11 +1388,61 @@ AC_SUBST(PACKAGE)
|
|||||||
AC_SUBST(VERSION)
|
AC_SUBST(VERSION)
|
||||||
AC_SUBST(NEED_REGISTER_FRAME_INFO)
|
AC_SUBST(NEED_REGISTER_FRAME_INFO)
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([werror],
|
||||||
|
[AS_HELP_STRING([--disable-werror],
|
||||||
|
[do not use -Werror when building GRUB])])
|
||||||
|
if test x"$enable_werror" != xno ; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
|
||||||
|
HOST_CFLAGS="$HOST_CFLAGS -Werror"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$grub_cv_cc_target_clang" = xno; then
|
||||||
|
TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc"
|
||||||
|
else
|
||||||
|
TARGET_LDFLAGS_STATIC_LIBGCC=
|
||||||
|
fi
|
||||||
|
|
||||||
|
TARGET_CPP="$TARGET_CC -E"
|
||||||
|
TARGET_CCAS=$TARGET_CC
|
||||||
|
|
||||||
|
GRUB_TARGET_CPU="${target_cpu}"
|
||||||
|
GRUB_PLATFORM="${platform}"
|
||||||
|
|
||||||
|
AC_SUBST(GRUB_TARGET_CPU)
|
||||||
|
AC_SUBST(GRUB_PLATFORM)
|
||||||
|
|
||||||
|
AC_SUBST(TARGET_OBJCONV)
|
||||||
|
AC_SUBST(TARGET_LIBGCC)
|
||||||
|
AC_SUBST(TARGET_LDFLAGS_STATIC_LIBGCC)
|
||||||
|
AC_SUBST(TARGET_CPP)
|
||||||
|
AC_SUBST(TARGET_CCAS)
|
||||||
|
AC_SUBST(TARGET_OBJ2ELF)
|
||||||
|
AC_SUBST(TARGET_MODULE_FORMAT)
|
||||||
|
|
||||||
|
AC_SUBST(TARGET_CFLAGS)
|
||||||
|
AC_SUBST(TARGET_LDFLAGS)
|
||||||
|
AC_SUBST(TARGET_CPPFLAGS)
|
||||||
|
AC_SUBST(TARGET_CCASFLAGS)
|
||||||
|
|
||||||
|
AC_SUBST(TARGET_IMG_LDSCRIPT)
|
||||||
|
AC_SUBST(TARGET_IMG_LDFLAGS)
|
||||||
|
AC_SUBST(TARGET_IMG_CFLAGS)
|
||||||
|
AC_SUBST(TARGET_IMG_BASE_LDOPT)
|
||||||
|
AC_SUBST(TARGET_APPLE_LINKER)
|
||||||
|
|
||||||
|
AC_SUBST(HOST_CFLAGS)
|
||||||
|
AC_SUBST(HOST_LDFLAGS)
|
||||||
|
AC_SUBST(HOST_CPPFLAGS)
|
||||||
|
AC_SUBST(HOST_CCASFLAGS)
|
||||||
|
|
||||||
|
AC_SUBST(BUILD_LIBM)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Automake conditionals
|
# Automake conditionals
|
||||||
#
|
#
|
||||||
|
|
||||||
AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
|
AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
|
||||||
|
AM_CONDITIONAL([COND_clang], [test x$grub_cv_cc_target_clang = xyes])
|
||||||
AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
|
AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
|
||||||
AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
|
AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
|
||||||
AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
|
AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
|
||||||
@@ -1326,6 +1451,8 @@ AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform =
|
|||||||
AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
|
AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
|
||||||
AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
|
AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
|
||||||
AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
|
AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
|
||||||
|
AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen])
|
||||||
|
AM_CONDITIONAL([COND_x86_64_xen], [test x$target_cpu = xx86_64 -a x$platform = xxen])
|
||||||
AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
|
AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
|
||||||
AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
|
AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
|
||||||
AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
|
AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
|
||||||
@@ -1337,6 +1464,8 @@ AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
|
|||||||
AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
|
AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
|
||||||
AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
|
AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
|
||||||
AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
|
AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
|
||||||
|
AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ])
|
||||||
|
AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi])
|
||||||
|
|
||||||
AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
|
AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
|
||||||
AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
|
AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
|
||||||
@@ -1351,11 +1480,9 @@ AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
|
|||||||
AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
|
AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
|
||||||
AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
|
AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
|
||||||
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
|
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
|
||||||
AM_CONDITIONAL([COND_BUILD_GRUB_MKFONT], [test x$enable_build_grub_mkfont = xyes])
|
|
||||||
AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
|
AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
|
||||||
AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
|
AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
|
||||||
AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
|
AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1])
|
||||||
AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
|
|
||||||
AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
|
AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
|
||||||
AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
|
AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
|
||||||
AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
|
AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
|
||||||
@@ -1365,6 +1492,20 @@ AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
|
|||||||
AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
|
AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
|
||||||
AM_CONDITIONAL([COND_CYGWIN], [test x$target_os = xcygwin])
|
AM_CONDITIONAL([COND_CYGWIN], [test x$target_os = xcygwin])
|
||||||
AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
|
AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
|
||||||
|
AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])
|
||||||
|
|
||||||
|
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||||
|
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
|
||||||
|
datarootdir="$(eval echo "$datarootdir")"
|
||||||
|
grub_libdir="$(eval echo "$libdir")"
|
||||||
|
grub_localedir="$(eval echo "$localedir")"
|
||||||
|
grub_datadir="$(eval echo "$datadir")"
|
||||||
|
grub_sysconfdir="$(eval echo "$sysconfdir")"
|
||||||
|
AC_DEFINE_UNQUOTED(LOCALEDIR, "$grub_localedir", [Locale dir])
|
||||||
|
AC_DEFINE_UNQUOTED(GRUB_LIBDIR, "$grub_libdir", [Library dir])
|
||||||
|
AC_DEFINE_UNQUOTED(GRUB_DATADIR, "$grub_datadir", [Data dir])
|
||||||
|
AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir])
|
||||||
|
|
||||||
|
|
||||||
# Output files.
|
# Output files.
|
||||||
cpudir="${target_cpu}"
|
cpudir="${target_cpu}"
|
||||||
@@ -1476,8 +1617,8 @@ else
|
|||||||
echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
|
echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
|
||||||
echo "Without unifont (no build-time grub-mkfont)"
|
echo "Without unifont (no build-time grub-mkfont)"
|
||||||
fi
|
fi
|
||||||
if test "x$LIBLZMA" = x ; then
|
if test x"$liblzma_excuse" != x ; then
|
||||||
echo "Without liblzma (no support for XZ-compressed mips images)"
|
echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excuse)"
|
||||||
else
|
else
|
||||||
echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
|
echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
if test -f (cbfsdisk)/etc/grub.cfg; then
|
||||||
|
source (cbfsdisk)/etc/grub.cfg
|
||||||
|
fi
|
||||||
@@ -0,0 +1,244 @@
|
|||||||
|
# Sample GRUB script to autodetect operating systems
|
||||||
|
#
|
||||||
|
# Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# GRUB is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# GRUB is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
function pathname { regexp -s 2:"$2" '^(\(.*\))?(/.*)$' "$1"; }
|
||||||
|
function devname { regexp -s "$2" '^(\(.*\)).*$' "$1"; }
|
||||||
|
|
||||||
|
function loopback_iso_entry {
|
||||||
|
realdev="$1"
|
||||||
|
isopath="$2"
|
||||||
|
loopdev="$3"
|
||||||
|
|
||||||
|
if test -f /boot/grub/loopback.cfg; then
|
||||||
|
cfgpath=/boot/grub/loopback.cfg
|
||||||
|
elif test -f /grub/loopback.cfg; then
|
||||||
|
cfgpath=/grub/loopback.cfg
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo loopback.cfg $isopath: yes
|
||||||
|
menuentry "Boot GRUB Loopback Config from ${realdev}${isopath}" "$realdev" "$isopath" "$cfgpath" {
|
||||||
|
set device="$2"
|
||||||
|
set iso_path="$3"
|
||||||
|
set cfg_path="$4"
|
||||||
|
|
||||||
|
export iso_path
|
||||||
|
loopback loopdev_cfg "${device}${iso_path}"
|
||||||
|
set root=(loopdev_cfg)
|
||||||
|
configfile $cfg_path
|
||||||
|
loopback -d loopdev_cfg
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function grml_iso_entry {
|
||||||
|
realdev="$1"
|
||||||
|
isopath="$2"
|
||||||
|
loopdev="$3"
|
||||||
|
|
||||||
|
result=1
|
||||||
|
for dir in /boot/grml /boot/grmlsmall /boot/grmlmedium; do
|
||||||
|
if ! test -f ${dir}/linux26 -a -f ${dir}/initrd.gz; then continue; fi
|
||||||
|
|
||||||
|
echo grml $isopath: yes
|
||||||
|
result=0
|
||||||
|
menuentry "GRML Linux from ${realdev}${isopath}" \
|
||||||
|
"$realdev" "$isopath" "$dir" {
|
||||||
|
set device="$2"
|
||||||
|
set isopath="$3"
|
||||||
|
set grmldir="$4"
|
||||||
|
|
||||||
|
loopback loopdev_grml "${device}${isopath}"
|
||||||
|
set root=(loopdev_grml)
|
||||||
|
linux $grmldir/linux26 findiso="$isopath" apm=power-off quiet \
|
||||||
|
boot=live nomce
|
||||||
|
initrd $grmldir/initrd.gz
|
||||||
|
loopback -d loopdev_grml
|
||||||
|
}
|
||||||
|
done
|
||||||
|
return $result
|
||||||
|
}
|
||||||
|
|
||||||
|
function pmagic_iso_entry {
|
||||||
|
realdev="$1"
|
||||||
|
isopath="$2"
|
||||||
|
loopdev="$3"
|
||||||
|
|
||||||
|
if ! test -f /pmagic/bzImage -a -f /pmagic/initramfs; then return 1; fi
|
||||||
|
|
||||||
|
echo pmagic $isopath: yes
|
||||||
|
menuentry "Parted Magic from ${realdev}${isopath}" "$realdev" "$isopath" {
|
||||||
|
set device="$2"
|
||||||
|
set isopath="$3"
|
||||||
|
|
||||||
|
loopback loopdev_pmagic "${device}${isopath}"
|
||||||
|
set root=(loopdev_pmagic)
|
||||||
|
linux /pmagic/bzImage iso_filename="$isopath" edd=off noapic \
|
||||||
|
load_ramdisk=1 prompt_ramdisk=0 rw sleep=10 loglevel=0 \
|
||||||
|
keymap=$langcode
|
||||||
|
initrd /pmagic/initramfs
|
||||||
|
loopback -d loopdev_pmagic
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function sidux_iso_entry {
|
||||||
|
realdev="$1"
|
||||||
|
isopath="$2"
|
||||||
|
loopdev="$3"
|
||||||
|
|
||||||
|
result=1
|
||||||
|
for kernel in /boot/vmlinuz-*-sidux-*; do
|
||||||
|
if ! test -f "$kernel"; then continue; fi
|
||||||
|
regexp -s 1:v1 -s 2:v2 '/boot/vmlinuz-(.*)-sidux-(.*)' "$kernel"
|
||||||
|
|
||||||
|
initrd="/boot/initrd.img-$v1-sidux-$v2"
|
||||||
|
if ! test -f "$initrd"; then continue; fi
|
||||||
|
|
||||||
|
result=0
|
||||||
|
echo sidux $isopath: yes
|
||||||
|
menuentry "Sidux vmlinux-$v1-sidux-$v2 from ${realdev}${isopath}" "$realdev" "$isopath" "$kernel" "$initrd" {
|
||||||
|
set device="$2"
|
||||||
|
set isopath="$3"
|
||||||
|
set kernel="$4"
|
||||||
|
set initrd="$5"
|
||||||
|
|
||||||
|
loopback loopdev_sidux "${device}${isopath}"
|
||||||
|
set root=(loopdev_sidux)
|
||||||
|
linux $kernel fromiso=$isopath boot=fll quiet
|
||||||
|
initrd $initrd
|
||||||
|
loopback -d loopdev_sidux
|
||||||
|
}
|
||||||
|
done
|
||||||
|
return $result
|
||||||
|
}
|
||||||
|
|
||||||
|
function slax_iso_entry {
|
||||||
|
realdev="$1"
|
||||||
|
isopath="$2"
|
||||||
|
loopdev="$3"
|
||||||
|
|
||||||
|
if ! test -f /boot/vmlinuz -a -f /boot/initrd.gz; then return 1; fi
|
||||||
|
|
||||||
|
echo slax $isopath: yes
|
||||||
|
menuentry "Slax Linux from ${realdev}${isopath}" "$realdev" "$isopath" {
|
||||||
|
set device="$2"
|
||||||
|
set isopath="$3"
|
||||||
|
|
||||||
|
loopback loopdev_slax "${device}${isopath}"
|
||||||
|
set root=(loopdev_slax)
|
||||||
|
linux /boot/vmlinuz from=$isopath ramdisk_size=6666 root=/dev/ram0 rw
|
||||||
|
initrd /boot/initrd.gz
|
||||||
|
loopback -d loopdev_slax
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function tinycore_iso_entry {
|
||||||
|
realpath="$1"
|
||||||
|
isopath="$2"
|
||||||
|
loopdev="$3"
|
||||||
|
|
||||||
|
if ! test -f /boot/bzImage -a -f /boot/tinycore.gz; then return 1; fi
|
||||||
|
|
||||||
|
echo tinycore $isopath: yes
|
||||||
|
menuentry "Tinycore Linux from ${realdev}${isopath}" "$realdev" "$isopath" {
|
||||||
|
set device="$2"
|
||||||
|
set isopath="$3"
|
||||||
|
|
||||||
|
loopback loopdev_tiny "${device}${isopath}"
|
||||||
|
set root=(loopdev_tiny)
|
||||||
|
linux /boot/bzImage
|
||||||
|
initrd /boot/tinycore.gz
|
||||||
|
loopback -d loopdev_tiny
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function casper_iso_entry {
|
||||||
|
realpath="$1"
|
||||||
|
isopath="$2"
|
||||||
|
loopdev="$3"
|
||||||
|
|
||||||
|
if ! test -f /casper/vmlinuz; then return 1; fi
|
||||||
|
initrd=
|
||||||
|
for f in /casper/initrd.*z; do
|
||||||
|
if ! test -f "$f"; then continue; fi
|
||||||
|
pathname "$f" initrd
|
||||||
|
done
|
||||||
|
if test -z "$initrd"; then return 1; fi
|
||||||
|
|
||||||
|
echo casper $isopath: yes
|
||||||
|
menuentry "Casper based Linux from ${realdev}${isopath}" "$realdev" "$isopath" "$initrd" {
|
||||||
|
set device="$2"
|
||||||
|
set isopath="$3"
|
||||||
|
set initrd="$4"
|
||||||
|
|
||||||
|
loopback loopdev_casper "${device}${isopath}"
|
||||||
|
set root=(loopdev_casper)
|
||||||
|
linux /casper/vmlinuz boot=casper iso-scan/filename="$isopath" quiet splash noprompt keyb="$langcode" \
|
||||||
|
debian-installer/language="$langcode" console-setup/layoutcode?="$langcode" --
|
||||||
|
initrd $initrd
|
||||||
|
loopback -d loopdev_casper
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function scan_isos {
|
||||||
|
isodirs="$1"
|
||||||
|
|
||||||
|
for dev in (*); do
|
||||||
|
for dir in $isodirs; do
|
||||||
|
for file in ${dev}${dir}/*.iso ${dev}${dir}/*.ISO; do
|
||||||
|
if ! test -f "$file"; then continue; fi
|
||||||
|
|
||||||
|
pathname $file isopath
|
||||||
|
if test -z "$dev" -o -z "$isopath"; then continue; fi
|
||||||
|
|
||||||
|
if ! loopback loopdev_scan "$file"; then continue; fi
|
||||||
|
saved_root=$root
|
||||||
|
set root=(loopdev_scan)
|
||||||
|
|
||||||
|
if loopback_iso_entry $dev $isopath (loopdev_scan); then true;
|
||||||
|
elif grml_iso_entry $dev $isopath (loopdev_scan); then true;
|
||||||
|
elif pmagic_iso_entry $dev $isopath (loopdev_scan); then true;
|
||||||
|
elif sidux_iso_entry $dev $isopath (loopdev_scan); then true;
|
||||||
|
elif slax_iso_entry $dev $isopath (loopdev_scan); then true;
|
||||||
|
elif tinycore_iso_entry $dev $isopath (loopdev_scan); then true;
|
||||||
|
elif casper_iso_entry $dev $isopath (loopdev_scan); then true;
|
||||||
|
else true; fi
|
||||||
|
|
||||||
|
set root=$saved_root
|
||||||
|
loopback -d loopdev_scan
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# XXX Remove later
|
||||||
|
insmod serial
|
||||||
|
serial
|
||||||
|
terminal_output --append serial
|
||||||
|
# terminal_input --append serial
|
||||||
|
|
||||||
|
langcode="$lang"
|
||||||
|
|
||||||
|
insmod regexp
|
||||||
|
scan_isos /iso /boot/iso
|
||||||
|
|
||||||
+156
-38
@@ -79,7 +79,7 @@ This edition documents version @value{VERSION}.
|
|||||||
* Contributing Changes::
|
* Contributing Changes::
|
||||||
* Porting::
|
* Porting::
|
||||||
* Error Handling::
|
* Error Handling::
|
||||||
* CIA::
|
* Stack and heap size::
|
||||||
* BIOS port memory map::
|
* BIOS port memory map::
|
||||||
* Video Subsystem::
|
* Video Subsystem::
|
||||||
* PFF2 Font File Format::
|
* PFF2 Font File Format::
|
||||||
@@ -92,24 +92,36 @@ This edition documents version @value{VERSION}.
|
|||||||
@node Getting the source code
|
@node Getting the source code
|
||||||
@chapter Getting the source code
|
@chapter Getting the source code
|
||||||
|
|
||||||
GRUB is maintained using the @uref{http://bazaar-vcs.org/, Bazaar revision
|
GRUB is maintained using the @uref{GIT revision
|
||||||
control system}. To fetch the primary development branch:
|
control system}. To fetch:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
bzr get http://bzr.savannah.gnu.org/r/grub/trunk/grub
|
git clone git://git.sv.gnu.org/grub.git
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
The GRUB developers maintain several other branches with work in progress.
|
Web access is available under
|
||||||
Of these, the most interesting is the experimental branch, which is a
|
|
||||||
staging area for new code which we expect to eventually merge into trunk but
|
|
||||||
which is not yet ready:
|
|
||||||
|
|
||||||
@example
|
@example
|
||||||
bzr get http://bzr.savannah.gnu.org/r/grub/branches/experimental
|
http://git.savannah.gnu.org/cgit/grub.git/
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
Once you have used @kbd{bzr get} to fetch an initial copy of a branch, you
|
The branches available are:
|
||||||
can use @kbd{bzr pull} to keep it up to date. If you have modified your
|
|
||||||
|
@table @samp
|
||||||
|
@item master
|
||||||
|
Main developpement branch.
|
||||||
|
@item grub-legacy
|
||||||
|
GRUB 0.97 codebase. Kept for reference and legal reasons
|
||||||
|
@item multiboot
|
||||||
|
Multiboot specfication
|
||||||
|
@item multiboot2
|
||||||
|
Multiboot2 specfication
|
||||||
|
@item developper branches
|
||||||
|
Prefixed with developper name. Every developper of a team manages his own branches.
|
||||||
|
Developper branches do not need changelog entries.
|
||||||
|
@end table
|
||||||
|
|
||||||
|
Once you have used @kbd{git clone} to fetch an initial copy of a branch, you
|
||||||
|
can use @kbd{git pull} to keep it up to date. If you have modified your
|
||||||
local version, you may need to resolve conflicts when pulling.
|
local version, you may need to resolve conflicts when pulling.
|
||||||
|
|
||||||
@node Coding style
|
@node Coding style
|
||||||
@@ -334,10 +346,10 @@ anymore.
|
|||||||
@itemize
|
@itemize
|
||||||
@item Always use latest GRUB 2 source code. So get that first.
|
@item Always use latest GRUB 2 source code. So get that first.
|
||||||
|
|
||||||
For developers it is recommended always to use the newest development version of GRUB 2. If development takes a long period of time, please remember to keep in sync with newest developments regularly so it is much easier to integrate your change in the future. GRUB 2 is being developed in a Bazaar (bzr) repository.
|
For developers it is recommended always to use the newest development version of GRUB 2. If development takes a long period of time, please remember to keep in sync with newest developments regularly so it is much easier to integrate your change in the future. GRUB 2 is being developed in a GIT repository.
|
||||||
|
|
||||||
Please check Savannah's GRUB project page for details how to get newest bzr:
|
Please check Savannah's GRUB project page for details how to get newest git:
|
||||||
@uref{http://savannah.gnu.org/bzr/?group=grub, GRUB 2 bzr Repository}
|
@uref{https://savannah.gnu.org/git/?group=grub, GRUB 2 git Repository}
|
||||||
|
|
||||||
@item Compile it and try it out.
|
@item Compile it and try it out.
|
||||||
|
|
||||||
@@ -895,33 +907,68 @@ if (grub_errno != GRUB_ERR_NONE)
|
|||||||
grub_error_pop ();
|
grub_error_pop ();
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@node CIA
|
@node Stack and heap size
|
||||||
@chapter CIA
|
@chapter Stack and heap size
|
||||||
@c By Robert Millan and Carles Pina
|
|
||||||
If you have commit access, please setup CIA in your Bazaar
|
|
||||||
config so those in IRC receive notification of your commits.
|
|
||||||
|
|
||||||
In @file{~/.bazaar/bazaar.conf}, add "cia_send_revno = true".
|
On emu stack and heap are just normal host OS stack and heap. Stack is typically
|
||||||
Optionally, you can also add "cia_user = myusername" if you'd
|
8 MiB although it's OS-dependent.
|
||||||
like CIA service to use a specific account (for statistical purpose).
|
|
||||||
|
|
||||||
In the @file{.bzr/branch/branch.conf} of your checkout branch,
|
On i386-pc, i386-coreboot, i386-qemu and i386-multiboot the stack is 60KiB.
|
||||||
"set nickname = /path_to_this_branch" and "cia_project = GNU GRUB".
|
All available space between 1MiB and 4GiB marks is part of heap.
|
||||||
|
|
||||||
Additionally, please set cia_send_revno in the [DEFAULT] section
|
On *-xen stack is 4MiB. If compiled for x86-64 with GCC 4.4 or later adressable
|
||||||
of your @file{~/.bazaar/bazaar.conf}. E.g.:
|
space is unlimited. When compiled for x86-64 with older GCC version adressable
|
||||||
|
space is limited to 2GiB. When compiling for i386 adressable space is limited
|
||||||
|
to 4GiB. All adressable pages except the ones for stack, GRUB binary, special
|
||||||
|
pages and page table are in the heap.
|
||||||
|
|
||||||
@example
|
On *-efi GRUB uses same stack as EFI. If compiled for x86-64 with GCC 4.4 or
|
||||||
[DEFAULT]
|
later adressable space is unlimited. When compiled for x86-64 with older GCC
|
||||||
cia_send_revno = true
|
version adressable space is limited to 2GiB. For all other platforms adressable
|
||||||
@end example
|
space is limited to 4GiB. GRUB allocates pages from EFI for its heap, at most
|
||||||
|
1.6 GiB.
|
||||||
|
|
||||||
Remember to install cia-clients (Debian/Ubuntu package) to be able to use CIA.
|
On i386-ieee1275 and powerpc-ieee1275 GRUB uses same stack as IEEE1275.
|
||||||
|
It allocates at most 32MiB for its heap.
|
||||||
|
|
||||||
|
On sparc64-ieee1275 stack is 256KiB and heap is 2MiB.
|
||||||
|
|
||||||
|
On mips(el)-qemu_mips and mipsel-loongson stack is 2MiB (everything below
|
||||||
|
GRUB image) and everything above GRUB image (from 2MiB + kernel size)
|
||||||
|
until 256MiB is part of heap.
|
||||||
|
|
||||||
|
On mips-arc stack is 2MiB (everything below GRUB image) and everything above
|
||||||
|
GRUB image(from 2MiB + kernel size) until 128MiB is part of heap.
|
||||||
|
|
||||||
|
On mipsel-arc stack is 2MiB (everything below GRUB image which is not part
|
||||||
|
of ARC) and everything above GRUB image (from 7MiB + kernel size)
|
||||||
|
until 256MiB is part of heap.
|
||||||
|
|
||||||
|
On arm-uboot stack is 256KiB and heap is 2MiB.
|
||||||
|
|
||||||
|
In short:
|
||||||
|
|
||||||
|
@multitable @columnfractions .15 .25 .5
|
||||||
|
@headitem Platform @tab Stack @tab Heap
|
||||||
|
@item emu @tab 8 MiB @tab ?
|
||||||
|
@item i386-pc @tab 60 KiB @tab < 4 GiB
|
||||||
|
@item i386-coreboot @tab 60 KiB @tab < 4 GiB
|
||||||
|
@item i386-multiboot @tab 60 KiB @tab < 4 GiB
|
||||||
|
@item i386-qemu @tab 60 KiB @tab < 4 GiB
|
||||||
|
@item *-efi @tab ? @tab < 1.6 GiB
|
||||||
|
@item i386-ieee1275 @tab ? @tab < 32 MiB
|
||||||
|
@item powerpc-ieee1275 @tab ? @tab < 32 MiB
|
||||||
|
@item sparc64-ieee1275 @tab 256KiB @tab 2 MiB
|
||||||
|
@item arm-uboot @tab 256KiB @tab 2 MiB
|
||||||
|
@item mips(el)-qemu_mips @tab 2MiB @tab 253 MiB
|
||||||
|
@item mipsel-loongson @tab 2MiB @tab 253 MiB
|
||||||
|
@item mips-arc @tab 2MiB @tab 125 MiB
|
||||||
|
@item mipsel-arc @tab 2MiB @tab 248 MiB
|
||||||
|
@item x86_64-xen (GCC >= 4.4) @tab 4MiB @tab unlimited
|
||||||
|
@item x86_64-xen (GCC < 4.4) @tab 4MiB @tab < 2GiB
|
||||||
|
@item i386-xen @tab 4MiB @tab < 4GiB
|
||||||
|
@end multitable
|
||||||
|
|
||||||
Keep in mind Bazaar sends notifications for all commits to branches that have
|
|
||||||
this setting, regardless of whether they're bound branches (checkouts) or not.
|
|
||||||
So if you make local commits in a non-bound branch and it bothers you that
|
|
||||||
others can read them, do not use this setting.
|
|
||||||
|
|
||||||
@node BIOS port memory map
|
@node BIOS port memory map
|
||||||
@chapter BIOS port memory map
|
@chapter BIOS port memory map
|
||||||
@@ -934,9 +981,8 @@ others can read them, do not use this setting.
|
|||||||
@item ? @tab 0x2000 - 1 @tab Real mode stack
|
@item ? @tab 0x2000 - 1 @tab Real mode stack
|
||||||
@item 0x7C00 @tab 0x7D00 - 1 @tab Boot sector
|
@item 0x7C00 @tab 0x7D00 - 1 @tab Boot sector
|
||||||
@item 0x8000 @tab ? @tab GRUB kernel
|
@item 0x8000 @tab ? @tab GRUB kernel
|
||||||
@item 0x68000 @tab 0x78000 - 1 @tab Disk buffer
|
@item 0x68000 @tab 0x71000 - 1 @tab Disk buffer
|
||||||
@item ? @tab 0x80000 - 1 @tab Protected mode stack
|
@item ? @tab 0x80000 - 1 @tab Protected mode stack
|
||||||
@item 0x80000 @tab ? @tab Heap
|
|
||||||
@item ? @tab 0xA0000 - 1 @tab Extended BIOS Data Area
|
@item ? @tab 0xA0000 - 1 @tab Extended BIOS Data Area
|
||||||
@item 0xA0000 @tab 0xC0000 - 1 @tab Video RAM
|
@item 0xA0000 @tab 0xC0000 - 1 @tab Video RAM
|
||||||
@item 0xC0000 @tab 0x100000 - 1 @tab BIOS
|
@item 0xC0000 @tab 0x100000 - 1 @tab BIOS
|
||||||
@@ -1113,6 +1159,47 @@ struct grub_video_palette_data
|
|||||||
Used to query indexed color palettes. If mode is RGB mode, colors will be copied from emulated palette data. In Indexed Color modes, palettes will be read from hardware. Color values will be converted to suit structure format. @code{start} will tell what hardware color index (or emulated color index) will be used as a source for first indice of @code{palette_data}, after that both hardware color index and @code{palette_data} index will be incremented until @code{count} number of colors have been read.
|
Used to query indexed color palettes. If mode is RGB mode, colors will be copied from emulated palette data. In Indexed Color modes, palettes will be read from hardware. Color values will be converted to suit structure format. @code{start} will tell what hardware color index (or emulated color index) will be used as a source for first indice of @code{palette_data}, after that both hardware color index and @code{palette_data} index will be incremented until @code{count} number of colors have been read.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
@subsection grub_video_set_area_status
|
||||||
|
@itemize
|
||||||
|
|
||||||
|
@item Prototype:
|
||||||
|
@example
|
||||||
|
grub_err_t
|
||||||
|
grub_video_set_area_status (grub_video_area_status_t area_status);
|
||||||
|
@end example
|
||||||
|
@example
|
||||||
|
enum grub_video_area_status_t
|
||||||
|
@{
|
||||||
|
GRUB_VIDEO_AREA_DISABLED,
|
||||||
|
GRUB_VIDEO_AREA_ENABLED
|
||||||
|
@};
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@item Description:
|
||||||
|
|
||||||
|
Used to set area drawing mode for redrawing the specified region. Draw commands
|
||||||
|
are performed in the intersection of the viewport and the region called area.
|
||||||
|
Coordinates remain related to the viewport. If draw commands try to draw over
|
||||||
|
the area, they are clipped.
|
||||||
|
Set status to DISABLED if you need to draw everything.
|
||||||
|
Set status to ENABLED and region to the desired rectangle to redraw everything
|
||||||
|
inside the region leaving everything else intact.
|
||||||
|
Should be used for redrawing of active elements.
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@subsection grub_video_get_area_status
|
||||||
|
@itemize
|
||||||
|
|
||||||
|
@item Prototype:
|
||||||
|
@example
|
||||||
|
grub_err_r
|
||||||
|
grub_video_get_area_status (grub_video_area_status_t *area_status);
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@item Description:
|
||||||
|
Used to query the area status.
|
||||||
|
@end itemize
|
||||||
|
|
||||||
@subsection grub_video_set_viewport
|
@subsection grub_video_set_viewport
|
||||||
@itemize
|
@itemize
|
||||||
@item Prototype:
|
@item Prototype:
|
||||||
@@ -1139,6 +1226,37 @@ grub_video_get_viewport (unsigned int *x, unsigned int *y, unsigned int *width,
|
|||||||
Used to query current viewport dimensions. Software developer can use this to choose best way to render contents of the viewport.
|
Used to query current viewport dimensions. Software developer can use this to choose best way to render contents of the viewport.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
@subsection grub_video_set_region
|
||||||
|
@itemize
|
||||||
|
@item Prototype:
|
||||||
|
|
||||||
|
@example
|
||||||
|
grub_err_t
|
||||||
|
grub_video_set_region (unsigned int x, unsigned int y, unsigned int width, unsigned int height);
|
||||||
|
@end example
|
||||||
|
@item Description:
|
||||||
|
|
||||||
|
Used to specify the region of the screen which should be redrawn. Use absolute
|
||||||
|
values. When the region is set and area status is ENABLE all draw commands will
|
||||||
|
be performed inside the interseption of region and viewport named area.
|
||||||
|
If draw commands try to draw over viewport, they are clipped. If developer
|
||||||
|
requests larger than possible region, width and height will be clamped to fit
|
||||||
|
screen. Should be used for redrawing of active elements.
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@subsection grub_video_get_region
|
||||||
|
@itemize
|
||||||
|
@item Prototype:
|
||||||
|
|
||||||
|
@example
|
||||||
|
grub_err_t
|
||||||
|
grub_video_get_region (unsigned int *x, unsigned int *y, unsigned int *width, unsigned int *height);
|
||||||
|
@end example
|
||||||
|
@item Description:
|
||||||
|
|
||||||
|
Used to query current region dimensions.
|
||||||
|
@end itemize
|
||||||
|
|
||||||
@subsection grub_video_map_color
|
@subsection grub_video_map_color
|
||||||
@itemize
|
@itemize
|
||||||
@item Prototype:
|
@item Prototype:
|
||||||
|
|||||||
+125
-24
@@ -701,6 +701,26 @@ you may run those commands directly to install GRUB, without using
|
|||||||
with the internals of GRUB. Installing a boot loader on a running OS may be
|
with the internals of GRUB. Installing a boot loader on a running OS may be
|
||||||
extremely dangerous.
|
extremely dangerous.
|
||||||
|
|
||||||
|
On EFI systems for fixed disk install you have to mount EFI System Partition.
|
||||||
|
If you mount it at @file{/boot/efi} then you don't need any special arguments:
|
||||||
|
|
||||||
|
@example
|
||||||
|
# @kbd{grub-install}
|
||||||
|
@end example
|
||||||
|
|
||||||
|
Otherwise you need to specify where your EFI System partition is mounted:
|
||||||
|
|
||||||
|
@example
|
||||||
|
# @kbd{grub-install --efi-directory=/mnt/efi}
|
||||||
|
@end example
|
||||||
|
|
||||||
|
For removable installs you have to use @option{--removable} and specify both
|
||||||
|
@option{--boot-directory} and @option{--efi-directory}:
|
||||||
|
|
||||||
|
@example
|
||||||
|
# @kbd{grub-install --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --removable}
|
||||||
|
@end example
|
||||||
|
|
||||||
@node Making a GRUB bootable CD-ROM
|
@node Making a GRUB bootable CD-ROM
|
||||||
@section Making a GRUB bootable CD-ROM
|
@section Making a GRUB bootable CD-ROM
|
||||||
|
|
||||||
@@ -1234,14 +1254,14 @@ Valid keys in @file{/etc/default/grub} are as follows:
|
|||||||
@item GRUB_DEFAULT
|
@item GRUB_DEFAULT
|
||||||
The default menu entry. This may be a number, in which case it identifies
|
The default menu entry. This may be a number, in which case it identifies
|
||||||
the Nth entry in the generated menu counted from zero, or the title of a
|
the Nth entry in the generated menu counted from zero, or the title of a
|
||||||
menu entry, or the special string @samp{saved}. Using the title may be
|
menu entry, or the special string @samp{saved}. Using the id may be
|
||||||
useful if you want to set a menu entry as the default even though there may
|
useful if you want to set a menu entry as the default even though there may
|
||||||
be a variable number of entries before it.
|
be a variable number of entries before it.
|
||||||
|
|
||||||
For example, if you have:
|
For example, if you have:
|
||||||
|
|
||||||
@verbatim
|
@verbatim
|
||||||
menuentry 'Example GNU/Linux distribution' --class gnu-linux {
|
menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
@end verbatim
|
@end verbatim
|
||||||
@@ -1249,12 +1269,17 @@ menuentry 'Example GNU/Linux distribution' --class gnu-linux {
|
|||||||
then you can make this the default using:
|
then you can make this the default using:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
GRUB_DEFAULT='Example GNU/Linux distribution'
|
GRUB_DEFAULT=example-gnu-linux
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
Previously it was documented the way to use entry title. While this still
|
||||||
|
works it's not recommended since titles often contain unstable device names
|
||||||
|
and may be translated
|
||||||
|
|
||||||
If you set this to @samp{saved}, then the default menu entry will be that
|
If you set this to @samp{saved}, then the default menu entry will be that
|
||||||
saved by @samp{GRUB_SAVEDEFAULT}, @command{grub-set-default}, or
|
saved by @samp{GRUB_SAVEDEFAULT} or @command{grub-set-default}. This relies on
|
||||||
@command{grub-reboot}.
|
the environment block, which may not be available in all situations
|
||||||
|
(@pxref{Environment block}).
|
||||||
|
|
||||||
The default is @samp{0}.
|
The default is @samp{0}.
|
||||||
|
|
||||||
@@ -1263,7 +1288,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save
|
|||||||
it as a new default entry for use by future runs of GRUB. This is only
|
it as a new default entry for use by future runs of GRUB. This is only
|
||||||
useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because
|
useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because
|
||||||
@samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with
|
@samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with
|
||||||
@command{grub-set-default} or @command{grub-reboot}. Unset by default.
|
@command{grub-set-default}. Unset by default.
|
||||||
This option relies on the environment block, which may not be available in
|
This option relies on the environment block, which may not be available in
|
||||||
all situations (@pxref{Environment block}).
|
all situations (@pxref{Environment block}).
|
||||||
|
|
||||||
@@ -1426,6 +1451,22 @@ Normally, @command{grub-mkconfig} will try to use the external
|
|||||||
systems installed on the same system and generate appropriate menu entries
|
systems installed on the same system and generate appropriate menu entries
|
||||||
for them. Set this option to @samp{true} to disable this.
|
for them. Set this option to @samp{true} to disable this.
|
||||||
|
|
||||||
|
@item GRUB_OS_PROBER_SKIP_LIST
|
||||||
|
List of space-separated FS UUIDs of filesystems to be ignored from os-prober
|
||||||
|
output. For efi chainloaders it's <UUID>@@<EFI FILE>
|
||||||
|
|
||||||
|
@item GRUB_DISABLE_SUBMENU
|
||||||
|
Normally, @command{grub-mkconfig} will generate top level menu entry for
|
||||||
|
the kernel with highest version number and put all other found kernels
|
||||||
|
or alternative menu entries for recovery mode in submenu. For entries returned
|
||||||
|
by @command{os-prober} first entry will be put on top level and all others
|
||||||
|
in submenu. If this option is set to @samp{y}, flat menu with all entries
|
||||||
|
on top level will be generated instead. Changing this option will require
|
||||||
|
changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback})
|
||||||
|
and @samp{default} (@pxref{default}) environment variables as well as saved
|
||||||
|
default entry using @command{grub-set-default} and value used with
|
||||||
|
@command{grub-reboot}.
|
||||||
|
|
||||||
@item GRUB_ENABLE_CRYPTODISK
|
@item GRUB_ENABLE_CRYPTODISK
|
||||||
If set to @samp{y}, @command{grub-mkconfig} and @command{grub-install} will
|
If set to @samp{y}, @command{grub-mkconfig} and @command{grub-install} will
|
||||||
check for encrypted disks and generate additional commands needed to access
|
check for encrypted disks and generate additional commands needed to access
|
||||||
@@ -2447,6 +2488,8 @@ button. @samp{GRUB_BUTTON_CMOS_ADDRESS} is vendor-specific and partially
|
|||||||
model-specific. Values known to the GRUB team are:
|
model-specific. Values known to the GRUB team are:
|
||||||
|
|
||||||
@table @key
|
@table @key
|
||||||
|
@item Dell XPS M1330M
|
||||||
|
121:3
|
||||||
@item Dell XPS M1530
|
@item Dell XPS M1530
|
||||||
85:3
|
85:3
|
||||||
@item Dell Latitude E4300
|
@item Dell Latitude E4300
|
||||||
@@ -2626,6 +2669,7 @@ Heavily limited platforms:
|
|||||||
Lightly limited platforms:
|
Lightly limited platforms:
|
||||||
|
|
||||||
@itemize
|
@itemize
|
||||||
|
@item *-xen: limited only by adress space and RAM size.
|
||||||
@item i386-qemu: kernel.img (.text + .data + .bss) is limited by 392704 bytes.
|
@item i386-qemu: kernel.img (.text + .data + .bss) is limited by 392704 bytes.
|
||||||
(core.img would be limited by ROM size but it's unlimited on qemu
|
(core.img would be limited by ROM size but it's unlimited on qemu
|
||||||
@item All EFI platforms: limited by contiguous RAM size and possibly firmware bugs
|
@item All EFI platforms: limited by contiguous RAM size and possibly firmware bugs
|
||||||
@@ -2681,9 +2725,9 @@ by a digit, like @samp{fd0}, or @samp{cd}.
|
|||||||
AHCI, PATA (ata), crypto, USB use the name of driver followed by a number.
|
AHCI, PATA (ata), crypto, USB use the name of driver followed by a number.
|
||||||
Memdisk and host are limited to one disk and so it's refered just by driver
|
Memdisk and host are limited to one disk and so it's refered just by driver
|
||||||
name.
|
name.
|
||||||
RAID (md), ofdisk (ieee1275 and nand), LVM (lvm), LDM and arcdisk (arc) use
|
RAID (md), ofdisk (ieee1275 and nand), LVM (lvm), LDM, virtio (vdsk)
|
||||||
intrinsic name of disk prefixed by driver name. Additionally just ``nand''
|
and arcdisk (arc) use intrinsic name of disk prefixed by driver name.
|
||||||
refers to the disk aliased as ``nand''.
|
Additionally just ``nand'' refers to the disk aliased as ``nand''.
|
||||||
Conflicts are solved by suffixing a number if necessarry.
|
Conflicts are solved by suffixing a number if necessarry.
|
||||||
Commas need to be escaped.
|
Commas need to be escaped.
|
||||||
Loopback uses whatever name specified to @command{loopback} command.
|
Loopback uses whatever name specified to @command{loopback} command.
|
||||||
@@ -2949,6 +2993,7 @@ These variables have special meaning to GRUB.
|
|||||||
* biosnum::
|
* biosnum::
|
||||||
* check_signatures::
|
* check_signatures::
|
||||||
* chosen::
|
* chosen::
|
||||||
|
* cmdpath::
|
||||||
* color_highlight::
|
* color_highlight::
|
||||||
* color_normal::
|
* color_normal::
|
||||||
* debug::
|
* debug::
|
||||||
@@ -3018,6 +3063,16 @@ the titles of each of the submenus starting from the top level followed by
|
|||||||
the title of the menu entry itself, separated by @samp{>}.
|
the title of the menu entry itself, separated by @samp{>}.
|
||||||
|
|
||||||
|
|
||||||
|
@node cmdpath
|
||||||
|
@subsection cmdpath
|
||||||
|
|
||||||
|
The location from which @file{core.img} was loaded as an absolute
|
||||||
|
directory name (@pxref{File name syntax}). This is set by GRUB at
|
||||||
|
startup based on information returned by platform firmware. Not every
|
||||||
|
platform provides this information and some may return only device
|
||||||
|
without path name.
|
||||||
|
|
||||||
|
|
||||||
@node color_highlight
|
@node color_highlight
|
||||||
@subsection color_highlight
|
@subsection color_highlight
|
||||||
|
|
||||||
@@ -3088,7 +3143,8 @@ to go beyond the current 16 colors.
|
|||||||
This variable may be set to enable debugging output from various components
|
This variable may be set to enable debugging output from various components
|
||||||
of GRUB. The value is a list of debug facility names separated by
|
of GRUB. The value is a list of debug facility names separated by
|
||||||
whitespace or @samp{,}, or @samp{all} to enable all available debugging
|
whitespace or @samp{,}, or @samp{all} to enable all available debugging
|
||||||
output.
|
output. The facility names are the first argument to grub_dprintf. Consult
|
||||||
|
source for more details.
|
||||||
|
|
||||||
|
|
||||||
@node default
|
@node default
|
||||||
@@ -3096,7 +3152,21 @@ output.
|
|||||||
|
|
||||||
If this variable is set, it identifies a menu entry that should be selected
|
If this variable is set, it identifies a menu entry that should be selected
|
||||||
by default, possibly after a timeout (@pxref{timeout}). The entry may be
|
by default, possibly after a timeout (@pxref{timeout}). The entry may be
|
||||||
identified by number or by title.
|
identified by number or by id.
|
||||||
|
|
||||||
|
For example, if you have:
|
||||||
|
|
||||||
|
@verbatim
|
||||||
|
menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
@end verbatim
|
||||||
|
|
||||||
|
then you can make this the default using:
|
||||||
|
|
||||||
|
@example
|
||||||
|
default=example-gnu-linux
|
||||||
|
@end example
|
||||||
|
|
||||||
If the entry is in a submenu, then it must be identified using the titles of
|
If the entry is in a submenu, then it must be identified using the titles of
|
||||||
each of the submenus starting from the top level followed by the number or
|
each of the submenus starting from the top level followed by the number or
|
||||||
@@ -3136,7 +3206,8 @@ If this variable is set, it sets the resolution used on the @samp{gfxterm}
|
|||||||
graphical terminal. Note that you can only use modes which your graphics
|
graphical terminal. Note that you can only use modes which your graphics
|
||||||
card supports via VESA BIOS Extensions (VBE), so for example native LCD
|
card supports via VESA BIOS Extensions (VBE), so for example native LCD
|
||||||
panel resolutions may not be available. The default is @samp{auto}, which
|
panel resolutions may not be available. The default is @samp{auto}, which
|
||||||
selects a platform-specific default that should look reasonable.
|
selects a platform-specific default that should look reasonable. Supported
|
||||||
|
modes can be listed by @samp{videoinfo} command in GRUB.
|
||||||
|
|
||||||
The resolution may be specified as a sequence of one or more modes,
|
The resolution may be specified as a sequence of one or more modes,
|
||||||
separated by commas (@samp{,}) or semicolons (@samp{;}); each will be tried
|
separated by commas (@samp{,}) or semicolons (@samp{;}); each will be tried
|
||||||
@@ -3680,6 +3751,8 @@ you forget a command, you can run the command @command{help}
|
|||||||
* lsfonts:: List loaded fonts
|
* lsfonts:: List loaded fonts
|
||||||
* lsmod:: Show loaded modules
|
* lsmod:: Show loaded modules
|
||||||
* md5sum:: Compute or check MD5 hash
|
* md5sum:: Compute or check MD5 hash
|
||||||
|
* module:: Load module for multiboot kernel
|
||||||
|
* multiboot:: Load multiboot compliant kernel
|
||||||
* nativedisk:: Switch to native disk drivers
|
* nativedisk:: Switch to native disk drivers
|
||||||
* normal:: Enter normal mode
|
* normal:: Enter normal mode
|
||||||
* normal_exit:: Exit from normal mode
|
* normal_exit:: Exit from normal mode
|
||||||
@@ -4369,7 +4442,6 @@ List loaded fonts.
|
|||||||
Show list of loaded modules.
|
Show list of loaded modules.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
@node md5sum
|
@node md5sum
|
||||||
@subsection md5sum
|
@subsection md5sum
|
||||||
|
|
||||||
@@ -4378,6 +4450,34 @@ Alias for @code{hashsum --hash md5 arg @dots{}}. See command @command{hashsum}
|
|||||||
(@pxref{hashsum}) for full description.
|
(@pxref{hashsum}) for full description.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@node module
|
||||||
|
@subsection module
|
||||||
|
|
||||||
|
@deffn Command module [--nounzip] file [arguments]
|
||||||
|
Load a module for multiboot kernel image. The rest of the
|
||||||
|
line is passed verbatim as the module command line.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
@node multiboot
|
||||||
|
@subsection multiboot
|
||||||
|
|
||||||
|
@deffn Command multiboot [--quirk-bad-kludge] [--quirk-modules-after-kernel] file @dots{}
|
||||||
|
Load a multiboot kernel image from @var{file}. The rest of the
|
||||||
|
line is passed verbatim as the @dfn{kernel command-line}. Any module must
|
||||||
|
be reloaded after using this command (@pxref{module}).
|
||||||
|
|
||||||
|
Some kernels have known problems. You need to specify --quirk-* for those.
|
||||||
|
--quirk-bad-kludge is a problem seen in several products that they include
|
||||||
|
loading kludge information with invalid data in ELF file. GRUB prior to 0.97
|
||||||
|
and some custom builds prefered ELF information while 0.97 and GRUB 2
|
||||||
|
use kludge. Use this option to ignore kludge.
|
||||||
|
Known affected systems: old Solaris, SkyOS.
|
||||||
|
|
||||||
|
--quirk-modules-after-kernel is needed for kernels which load at relatively
|
||||||
|
high address e.g. 16MiB mark and can't cope with modules stuffed between
|
||||||
|
1MiB mark and beginning of the kernel.
|
||||||
|
Known afftected systems: VMWare.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
@node nativedisk
|
@node nativedisk
|
||||||
@subsection nativedisk
|
@subsection nativedisk
|
||||||
@@ -5120,12 +5220,14 @@ is given, use default list of servers.
|
|||||||
|
|
||||||
|
|
||||||
@node Internationalisation
|
@node Internationalisation
|
||||||
@chapter Charset
|
@chapter Internationalisation
|
||||||
|
|
||||||
|
@section Charset
|
||||||
GRUB uses UTF-8 internally other than in rendering where some GRUB-specific
|
GRUB uses UTF-8 internally other than in rendering where some GRUB-specific
|
||||||
appropriate representation is used. All text files (including config) are
|
appropriate representation is used. All text files (including config) are
|
||||||
assumed to be encoded in UTF-8.
|
assumed to be encoded in UTF-8.
|
||||||
|
|
||||||
@chapter Filesystems
|
@section Filesystems
|
||||||
NTFS, JFS, UDF, HFS+, exFAT, long filenames in FAT, Joliet part of
|
NTFS, JFS, UDF, HFS+, exFAT, long filenames in FAT, Joliet part of
|
||||||
ISO9660 are treated as UTF-16 as per specification. AFS and BFS are read
|
ISO9660 are treated as UTF-16 as per specification. AFS and BFS are read
|
||||||
as UTF-8, again according to specification. BtrFS, cpio, tar, squash4, minix,
|
as UTF-8, again according to specification. BtrFS, cpio, tar, squash4, minix,
|
||||||
@@ -5159,7 +5261,7 @@ treated as distinct from u+combining diaresis. This however means that in
|
|||||||
order to access file on HFS+ its name must be specified in normalisation form D.
|
order to access file on HFS+ its name must be specified in normalisation form D.
|
||||||
On normalized ZFS subvolumes filenames out of normalisation are inaccessible.
|
On normalized ZFS subvolumes filenames out of normalisation are inaccessible.
|
||||||
|
|
||||||
@chapter Output terminal
|
@section Output terminal
|
||||||
Firmware output console ``console'' on ARC and IEEE1275 are limited to ASCII.
|
Firmware output console ``console'' on ARC and IEEE1275 are limited to ASCII.
|
||||||
|
|
||||||
BIOS firmware console and VGA text are limited to ASCII and some pseudographics.
|
BIOS firmware console and VGA text are limited to ASCII and some pseudographics.
|
||||||
@@ -5193,7 +5295,7 @@ called ``annotation characters'' If you can complete either of
|
|||||||
two lists or, better, propose a patch to improve rendering, please contact
|
two lists or, better, propose a patch to improve rendering, please contact
|
||||||
developer team.
|
developer team.
|
||||||
|
|
||||||
@chapter Input terminal
|
@section Input terminal
|
||||||
Firmware console on BIOS, IEEE1275 and ARC doesn't allow you to enter non-ASCII
|
Firmware console on BIOS, IEEE1275 and ARC doesn't allow you to enter non-ASCII
|
||||||
characters. EFI specification allows for such but author is unaware of any
|
characters. EFI specification allows for such but author is unaware of any
|
||||||
actual implementations. Serial input is currently limited for latin1 (unlikely
|
actual implementations. Serial input is currently limited for latin1 (unlikely
|
||||||
@@ -5203,15 +5305,15 @@ So no dead keys or advanced input method. Also there is no keymap change hotkey.
|
|||||||
In practice it makes difficult to enter any text using non-Latin alphabet.
|
In practice it makes difficult to enter any text using non-Latin alphabet.
|
||||||
Moreover all current input consumers are limited to ASCII.
|
Moreover all current input consumers are limited to ASCII.
|
||||||
|
|
||||||
@chapter Gettext
|
@section Gettext
|
||||||
GRUB supports being translated. For this you need to have language *.mo files in $prefix/locale, load gettext module and set ``lang'' variable.
|
GRUB supports being translated. For this you need to have language *.mo files in $prefix/locale, load gettext module and set ``lang'' variable.
|
||||||
|
|
||||||
@chapter Regexp
|
@section Regexp
|
||||||
Regexps work on unicode characters, however no attempt at checking cannonical
|
Regexps work on unicode characters, however no attempt at checking cannonical
|
||||||
equivalence has been made. Moreover the classes like [:alpha:] match only
|
equivalence has been made. Moreover the classes like [:alpha:] match only
|
||||||
ASCII subset.
|
ASCII subset.
|
||||||
|
|
||||||
@chapter Other
|
@section Other
|
||||||
Currently GRUB always uses YEAR-MONTH-DAY HOUR:MINUTE:SECOND [WEEKDAY] 24-hour
|
Currently GRUB always uses YEAR-MONTH-DAY HOUR:MINUTE:SECOND [WEEKDAY] 24-hour
|
||||||
datetime format but weekdays are translated.
|
datetime format but weekdays are translated.
|
||||||
GRUB always uses the decimal number format with [0-9] as digits and . as
|
GRUB always uses the decimal number format with [0-9] as digits and . as
|
||||||
@@ -5340,9 +5442,8 @@ may halt or otherwise impact the boot process.
|
|||||||
|
|
||||||
GRUB uses GPG-style detached signatures (meaning that a file
|
GRUB uses GPG-style detached signatures (meaning that a file
|
||||||
@file{foo.sig} will be produced when file @file{foo} is signed), and
|
@file{foo.sig} will be produced when file @file{foo} is signed), and
|
||||||
currently supports the DSA signing algorithm. Both 2048-bit and
|
currently supports the DSA and RSA signing algorithms. A signing key
|
||||||
3072-bit keys are supported. A signing key can be generated as
|
can be generated as follows:
|
||||||
follows:
|
|
||||||
|
|
||||||
@example
|
@example
|
||||||
gpg --gen-key
|
gpg --gen-key
|
||||||
@@ -5682,7 +5783,7 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel
|
|||||||
PowerPC, IA64 and Sparc64 ports support only Linux. MIPS port supports Linux
|
PowerPC, IA64 and Sparc64 ports support only Linux. MIPS port supports Linux
|
||||||
and multiboot2.
|
and multiboot2.
|
||||||
|
|
||||||
@chapter Boot tests
|
@section Boot tests
|
||||||
|
|
||||||
As you have seen in previous chapter the support matrix is pretty big and some of the configurations are only rarely used. To ensure the quality bootchecks are available for all x86 targets except EFI chainloader, Appleloader and XNU. All x86 platforms have bootcheck facility except ieee1275. Multiboot, multiboot2, BIOS chainloader, ntldr and freebsd-bootloader boot targets are tested only with a fake kernel images. Only Linux is tested among the payloads using Linux protocols.
|
As you have seen in previous chapter the support matrix is pretty big and some of the configurations are only rarely used. To ensure the quality bootchecks are available for all x86 targets except EFI chainloader, Appleloader and XNU. All x86 platforms have bootcheck facility except ieee1275. Multiboot, multiboot2, BIOS chainloader, ntldr and freebsd-bootloader boot targets are tested only with a fake kernel images. Only Linux is tested among the payloads using Linux protocols.
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,10 @@
|
|||||||
|
|
||||||
GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
|
GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
|
||||||
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
|
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
|
||||||
|
"i386_xen", "x86_64_xen",
|
||||||
"mips_loongson", "sparc64_ieee1275",
|
"mips_loongson", "sparc64_ieee1275",
|
||||||
"powerpc_ieee1275", "mips_arc", "ia64_efi",
|
"powerpc_ieee1275", "mips_arc", "ia64_efi",
|
||||||
"mips_qemu_mips", "arm_uboot", "arm_efi" ]
|
"mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi" ]
|
||||||
|
|
||||||
GROUPS = {}
|
GROUPS = {}
|
||||||
|
|
||||||
@@ -37,11 +38,13 @@ GROUPS["mips"] = [ "mips_loongson", "mips_qemu_mips", "mips_arc" ]
|
|||||||
GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
|
GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
|
||||||
GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
|
GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
|
||||||
GROUPS["arm"] = [ "arm_uboot", "arm_efi" ]
|
GROUPS["arm"] = [ "arm_uboot", "arm_efi" ]
|
||||||
|
GROUPS["arm64"] = [ "arm64_efi" ]
|
||||||
|
|
||||||
# Groups based on firmware
|
# Groups based on firmware
|
||||||
GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi" ]
|
GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi", "arm64_efi" ]
|
||||||
GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]
|
GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]
|
||||||
GROUPS["uboot"] = [ "arm_uboot" ]
|
GROUPS["uboot"] = [ "arm_uboot" ]
|
||||||
|
GROUPS["xen"] = [ "i386_xen", "x86_64_xen" ]
|
||||||
|
|
||||||
# emu is a special case so many core functionality isn't needed on this platform
|
# emu is a special case so many core functionality isn't needed on this platform
|
||||||
GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
|
GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
|
||||||
@@ -49,7 +52,7 @@ GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
|
|||||||
# Groups based on hardware features
|
# Groups based on hardware features
|
||||||
GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_loongson", "mips_qemu_mips",
|
GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_loongson", "mips_qemu_mips",
|
||||||
"sparc64_ieee1275", "powerpc_ieee1275"]
|
"sparc64_ieee1275", "powerpc_ieee1275"]
|
||||||
GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
|
GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi");
|
||||||
GROUPS["pci"] = GROUPS["x86"] + ["mips_loongson"]
|
GROUPS["pci"] = GROUPS["x86"] + ["mips_loongson"]
|
||||||
GROUPS["usb"] = GROUPS["pci"]
|
GROUPS["usb"] = GROUPS["pci"]
|
||||||
|
|
||||||
@@ -59,12 +62,12 @@ GROUPS["videomodules"] = GRUB_PLATFORMS[:];
|
|||||||
for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
|
for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
|
||||||
|
|
||||||
# Similar for terminfo
|
# Similar for terminfo
|
||||||
GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"] + GROUPS["uboot"];
|
GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["xen"] + GROUPS["ieee1275"] + GROUPS["uboot"];
|
||||||
GROUPS["terminfomodule"] = GRUB_PLATFORMS[:];
|
GROUPS["terminfomodule"] = GRUB_PLATFORMS[:];
|
||||||
for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
|
for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
|
||||||
|
|
||||||
# Flattened Device Trees (FDT)
|
# Flattened Device Trees (FDT)
|
||||||
GROUPS["fdt"] = [ "arm_uboot", "arm_efi" ]
|
GROUPS["fdt"] = [ "arm64_efi", "arm_uboot", "arm_efi" ]
|
||||||
|
|
||||||
# Miscelaneous groups schedulded to disappear in future
|
# Miscelaneous groups schedulded to disappear in future
|
||||||
GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
|
GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
|
||||||
@@ -307,13 +310,8 @@ def define_macro_for_platform_nodist_sources(p):
|
|||||||
return define_autogen_macro(
|
return define_autogen_macro(
|
||||||
"get_" + p + "_nodist_sources",
|
"get_" + p + "_nodist_sources",
|
||||||
platform_values(p, "_nodist"))
|
platform_values(p, "_nodist"))
|
||||||
def define_macro_for_platform_dependencies(p):
|
|
||||||
return define_autogen_macro(
|
|
||||||
"get_" + p + "_dependencies",
|
|
||||||
platform_values(p, "dependencies", "_dependencies"))
|
|
||||||
def platform_sources(p): return "[+ get_" + p + "_sources +]"
|
def platform_sources(p): return "[+ get_" + p + "_sources +]"
|
||||||
def platform_nodist_sources(p): return "[+ get_" + p + "_nodist_sources +]"
|
def platform_nodist_sources(p): return "[+ get_" + p + "_nodist_sources +]"
|
||||||
def platform_dependencies(p): return "[+ get_" + p + "_dependencies +]"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns Autogen code which defines the autogen macros that collect
|
# Returns Autogen code which defines the autogen macros that collect
|
||||||
@@ -428,14 +426,14 @@ def kernel(platform):
|
|||||||
r += gvar_add("CLEANFILES", "[+ name +].img")
|
r += gvar_add("CLEANFILES", "[+ name +].img")
|
||||||
r += rule("[+ name +].img", "[+ name +].exec$(EXEEXT)",
|
r += rule("[+ name +].img", "[+ name +].exec$(EXEEXT)",
|
||||||
if_platform_tagged(platform, "nostrip",
|
if_platform_tagged(platform, "nostrip",
|
||||||
"""if test x$(USE_APPLE_CC_FIXES) = xyes; then \
|
"""if test x$(TARGET_APPLE_LINKER) = x1; then \
|
||||||
$(TARGET_OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2022 -wd1106 -nu -nd $< $@; \
|
$(TARGET_OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2022 -wd1106 -nu -nd $< $@; \
|
||||||
elif test ! -z '$(TARGET_OBJ2ELF)'; then \
|
elif test ! -z '$(TARGET_OBJ2ELF)'; then \
|
||||||
cp $< $@.bin; $(TARGET_OBJ2ELF) $@.bin && cp $@.bin $@ || (rm -f $@.bin; exit 1); \
|
cp $< $@.bin; $(TARGET_OBJ2ELF) $@.bin && cp $@.bin $@ || (rm -f $@.bin; exit 1); \
|
||||||
else cp $< $@; fi""",
|
else cp $< $@; fi""",
|
||||||
"""if test x$(USE_APPLE_CC_FIXES) = xyes; then \
|
"""if test x$(TARGET_APPLE_LINKER) = x1; then \
|
||||||
$(TARGET_STRIP) $(""" + cname() + """) -o $@.bin $<; \
|
$(TARGET_STRIP) -S -x $(""" + cname() + """) -o $@.bin $<; \
|
||||||
$(TARGET_OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2022 -wd1106 -nu -nd $@.bin $@; \
|
$(TARGET_OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2022 -ed2016 -wd1106 -nu -nd $@.bin $@; \
|
||||||
else """ + "$(TARGET_STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<; \
|
else """ + "$(TARGET_STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<; \
|
||||||
fi"""))
|
fi"""))
|
||||||
return r
|
return r
|
||||||
@@ -460,7 +458,7 @@ def image(platform):
|
|||||||
r += gvar_add("platform_DATA", "[+ name +].img")
|
r += gvar_add("platform_DATA", "[+ name +].img")
|
||||||
r += gvar_add("CLEANFILES", "[+ name +].img")
|
r += gvar_add("CLEANFILES", "[+ name +].img")
|
||||||
r += rule("[+ name +].img", "[+ name +].image$(EXEEXT)", """
|
r += rule("[+ name +].img", "[+ name +].image$(EXEEXT)", """
|
||||||
if test x$(USE_APPLE_CC_FIXES) = xyes; then \
|
if test x$(TARGET_APPLE_LINKER) = x1; then \
|
||||||
$(MACHO2IMG) $< $@; \
|
$(MACHO2IMG) $< $@; \
|
||||||
else \
|
else \
|
||||||
$(TARGET_OBJCOPY) $(""" + cname() + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \
|
$(TARGET_OBJCOPY) $(""" + cname() + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \
|
||||||
@@ -544,8 +542,8 @@ def script(platform):
|
|||||||
r += "[+ IF mansection +]" + manpage("grub-mkconfig_lib") + "[+ ENDIF +]"
|
r += "[+ IF mansection +]" + manpage("grub-mkconfig_lib") + "[+ ENDIF +]"
|
||||||
r += "[+ ENDIF +]"
|
r += "[+ ENDIF +]"
|
||||||
|
|
||||||
r += rule("[+ name +]", "$(top_builddir)/config.status " + platform_sources(platform), """
|
r += rule("[+ name +]", "$(top_builddir)/config.status " + platform_sources(platform) + platform_dependencies(platform), """
|
||||||
(skip=1; for x in $^; do if [ $$skip = 1 ]; then skip=0; else cat "$$x"; fi; done) | $(top_builddir)/config.status --file=$@:-
|
(for x in """ + platform_sources(platform) + """; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:-
|
||||||
chmod a+x [+ name +]
|
chmod a+x [+ name +]
|
||||||
""")
|
""")
|
||||||
|
|
||||||
@@ -605,7 +603,6 @@ print ("[+ AutoGen5 template +]\n")
|
|||||||
for p in GRUB_PLATFORMS:
|
for p in GRUB_PLATFORMS:
|
||||||
print (define_macro_for_platform_sources(p))
|
print (define_macro_for_platform_sources(p))
|
||||||
print (define_macro_for_platform_nodist_sources(p))
|
print (define_macro_for_platform_nodist_sources(p))
|
||||||
# print define_macro_for_platform_dependencies(p)
|
|
||||||
|
|
||||||
print (define_macro_for_platform_startup(p))
|
print (define_macro_for_platform_startup(p))
|
||||||
print (define_macro_for_platform_cflags(p))
|
print (define_macro_for_platform_cflags(p))
|
||||||
|
|||||||
+45
-13
@@ -82,7 +82,9 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
|
|||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
|
||||||
|
if !COND_clang
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
|
||||||
|
endif
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
|
||||||
|
|
||||||
if COND_i386_pc
|
if COND_i386_pc
|
||||||
@@ -128,6 +130,24 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
|||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if COND_i386_xen
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
|
||||||
|
endif
|
||||||
|
|
||||||
|
if COND_x86_64_xen
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/x86_64/xen/hypercall.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
|
||||||
|
endif
|
||||||
|
|
||||||
if COND_x86_64_efi
|
if COND_x86_64_efi
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||||
@@ -214,6 +234,11 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
|||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if COND_arm64_efi
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||||
|
endif
|
||||||
|
|
||||||
if COND_emu
|
if COND_emu
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h
|
||||||
@@ -369,42 +394,49 @@ CLEANFILES += $(MOD_FILES)
|
|||||||
if COND_ENABLE_EFIEMU
|
if COND_ENABLE_EFIEMU
|
||||||
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
|
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
|
||||||
-rm -f $@; \
|
-rm -f $@; \
|
||||||
if test "x$(TARGET_APPLE_CC)" = x1; then \
|
if test "x$(TARGET_APPLE_LINKER)" = x1; then \
|
||||||
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF32 -DAPPLE_CC -m32 -Wall -Werror -nostdlib -O2 -c -o $@.bin $< || exit 1; \
|
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m32 -Wall -Werror -nostdlib -O2 -c -o $@.bin $< || exit 1; \
|
||||||
$(OBJCONV) -felf32 -nu -nd $@.bin $@ || exit 1; \
|
$(TARGET_OBJCONV) -felf32 -nu -nd $@.bin $@ || exit 1; \
|
||||||
rm -f $@.bin; \
|
rm -f $@.bin; \
|
||||||
else \
|
else \
|
||||||
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF32 -m32 -Wall -Werror -nostdlib -O2 -c -o $@ $< || exit 1; \
|
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m32 -Wall -Werror -nostdlib -O2 -c -o $@ $< || exit 1; \
|
||||||
if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
|
if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
efiemu64_c.o: efiemu/runtime/efiemu.c
|
efiemu64_c.o: efiemu/runtime/efiemu.c
|
||||||
if test "x$(TARGET_APPLE_CC)" = x1; then \
|
if test "x$(TARGET_APPLE_LINKER)" = x1; then \
|
||||||
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -DAPPLE_CC=1 -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \
|
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \
|
||||||
else \
|
else \
|
||||||
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
|
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
efiemu64_s.o: efiemu/runtime/efiemu.S
|
efiemu64_s.o: efiemu/runtime/efiemu.S
|
||||||
-rm -f $@
|
-rm -f $@
|
||||||
if test "x$(TARGET_APPLE_CC)" = x1; then \
|
if test "x$(TARGET_APPLE_LINKER)" = x1; then \
|
||||||
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -DAPPLE_CC=1 -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \
|
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \
|
||||||
else \
|
else \
|
||||||
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
|
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
|
efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
|
||||||
-rm -f $@; \
|
-rm -f $@; \
|
||||||
if test "x$(TARGET_APPLE_CC)" = x1; then \
|
if test "x$(TARGET_APPLE_LINKER)" = x1; then \
|
||||||
rm -f $@.bin; \
|
rm -f $@.bin; \
|
||||||
$(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \
|
$(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \
|
||||||
$(OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
|
$(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
|
||||||
rm -f $@.bin; \
|
rm -f $@.bin; \
|
||||||
else \
|
else \
|
||||||
$(TARGET_CC) -m64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \
|
$(TARGET_CC) -m64 -Wl,-melf_x86_64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \
|
||||||
if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
|
if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
platform_DATA += efiemu32.o efiemu64.o
|
platform_DATA += efiemu32.o efiemu64.o
|
||||||
CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
|
CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows
|
||||||
|
windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
|
||||||
|
test -d $(windowsdir)/$(target_cpu)-$(platform) || mkdir $(windowsdir)/$(target_cpu)-$(platform)
|
||||||
|
for x in $(platform_DATA); do \
|
||||||
|
cp -fp $$x $(windowsdir)/$(target_cpu)-$(platform)/$$x; \
|
||||||
|
done
|
||||||
+126
-10
@@ -59,9 +59,17 @@ kernel = {
|
|||||||
ia64_efi_ldflags = '-Wl,-r,-d';
|
ia64_efi_ldflags = '-Wl,-r,-d';
|
||||||
ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
||||||
|
|
||||||
|
x86_64_xen_ldflags = '-Wl,-Ttext=0';
|
||||||
|
x86_64_xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
|
i386_xen_ldflags = '-Wl,-Ttext=0';
|
||||||
|
i386_xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
|
|
||||||
arm_efi_ldflags = '-Wl,-r,-d';
|
arm_efi_ldflags = '-Wl,-r,-d';
|
||||||
arm_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
arm_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
||||||
|
|
||||||
|
arm64_efi_ldflags = '-Wl,-r,-d';
|
||||||
|
arm64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
|
||||||
|
|
||||||
i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
|
i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
|
||||||
i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x9000';
|
i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x9000';
|
||||||
|
|
||||||
@@ -90,6 +98,8 @@ kernel = {
|
|||||||
i386_pc_startup = kern/i386/pc/startup.S;
|
i386_pc_startup = kern/i386/pc/startup.S;
|
||||||
i386_efi_startup = kern/i386/efi/startup.S;
|
i386_efi_startup = kern/i386/efi/startup.S;
|
||||||
x86_64_efi_startup = kern/x86_64/efi/startup.S;
|
x86_64_efi_startup = kern/x86_64/efi/startup.S;
|
||||||
|
i386_xen_startup = kern/i386/xen/startup.S;
|
||||||
|
x86_64_xen_startup = kern/x86_64/xen/startup.S;
|
||||||
i386_qemu_startup = kern/i386/qemu/startup.S;
|
i386_qemu_startup = kern/i386/qemu/startup.S;
|
||||||
i386_ieee1275_startup = kern/i386/ieee1275/startup.S;
|
i386_ieee1275_startup = kern/i386/ieee1275/startup.S;
|
||||||
i386_coreboot_startup = kern/i386/coreboot/startup.S;
|
i386_coreboot_startup = kern/i386/coreboot/startup.S;
|
||||||
@@ -99,6 +109,7 @@ kernel = {
|
|||||||
powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S;
|
powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S;
|
||||||
arm_uboot_startup = kern/arm/uboot/startup.S;
|
arm_uboot_startup = kern/arm/uboot/startup.S;
|
||||||
arm_efi_startup = kern/arm/efi/startup.S;
|
arm_efi_startup = kern/arm/efi/startup.S;
|
||||||
|
arm64_efi_startup = kern/arm64/efi/startup.S;
|
||||||
|
|
||||||
common = kern/command.c;
|
common = kern/command.c;
|
||||||
common = kern/corecmd.c;
|
common = kern/corecmd.c;
|
||||||
@@ -146,6 +157,7 @@ kernel = {
|
|||||||
terminfoinkernel = lib/arg.c;
|
terminfoinkernel = lib/arg.c;
|
||||||
|
|
||||||
i386 = kern/i386/dl.c;
|
i386 = kern/i386/dl.c;
|
||||||
|
i386_xen = kern/i386/dl.c;
|
||||||
|
|
||||||
i386_coreboot = kern/i386/coreboot/init.c;
|
i386_coreboot = kern/i386/coreboot/init.c;
|
||||||
i386_multiboot = kern/i386/coreboot/init.c;
|
i386_multiboot = kern/i386/coreboot/init.c;
|
||||||
@@ -164,11 +176,20 @@ kernel = {
|
|||||||
i386_efi = kern/i386/efi/init.c;
|
i386_efi = kern/i386/efi/init.c;
|
||||||
i386_efi = bus/pci.c;
|
i386_efi = bus/pci.c;
|
||||||
|
|
||||||
x86_64_efi = kern/x86_64/dl.c;
|
x86_64 = kern/x86_64/dl.c;
|
||||||
|
x86_64_xen = kern/x86_64/dl.c;
|
||||||
x86_64_efi = kern/x86_64/efi/callwrap.S;
|
x86_64_efi = kern/x86_64/efi/callwrap.S;
|
||||||
x86_64_efi = kern/i386/efi/init.c;
|
x86_64_efi = kern/i386/efi/init.c;
|
||||||
x86_64_efi = bus/pci.c;
|
x86_64_efi = bus/pci.c;
|
||||||
|
|
||||||
|
xen = kern/i386/tsc.c;
|
||||||
|
x86_64_xen = kern/x86_64/xen/hypercall.S;
|
||||||
|
i386_xen = kern/i386/xen/hypercall.S;
|
||||||
|
xen = kern/xen/init.c;
|
||||||
|
xen = term/xen/console.c;
|
||||||
|
xen = disk/xen/xendisk.c;
|
||||||
|
xen = commands/boot.c;
|
||||||
|
|
||||||
ia64_efi = kern/ia64/efi/startup.S;
|
ia64_efi = kern/ia64/efi/startup.S;
|
||||||
ia64_efi = kern/ia64/efi/init.c;
|
ia64_efi = kern/ia64/efi/init.c;
|
||||||
ia64_efi = kern/ia64/dl.c;
|
ia64_efi = kern/ia64/dl.c;
|
||||||
@@ -177,6 +198,8 @@ kernel = {
|
|||||||
arm_efi = kern/arm/efi/init.c;
|
arm_efi = kern/arm/efi/init.c;
|
||||||
arm_efi = kern/arm/efi/misc.c;
|
arm_efi = kern/arm/efi/misc.c;
|
||||||
|
|
||||||
|
arm64_efi = kern/arm/efi/init.c;
|
||||||
|
|
||||||
i386_pc = kern/i386/pc/init.c;
|
i386_pc = kern/i386/pc/init.c;
|
||||||
i386_pc = kern/i386/pc/mmap.c;
|
i386_pc = kern/i386/pc/mmap.c;
|
||||||
i386_pc = term/i386/pc/console.c;
|
i386_pc = term/i386/pc/console.c;
|
||||||
@@ -237,6 +260,11 @@ kernel = {
|
|||||||
arm = kern/arm/cache.c;
|
arm = kern/arm/cache.c;
|
||||||
arm = kern/arm/misc.S;
|
arm = kern/arm/misc.S;
|
||||||
|
|
||||||
|
arm64 = kern/arm64/cache.c;
|
||||||
|
arm64 = kern/arm64/cache_flush.S;
|
||||||
|
arm64 = kern/arm64/dl.c;
|
||||||
|
arm64 = kern/arm64/dl_helper.c;
|
||||||
|
|
||||||
emu = disk/host.c;
|
emu = disk/host.c;
|
||||||
emu = kern/emu/cache_s.S;
|
emu = kern/emu/cache_s.S;
|
||||||
emu = kern/emu/hostdisk.c;
|
emu = kern/emu/hostdisk.c;
|
||||||
@@ -409,9 +437,9 @@ image = {
|
|||||||
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1';
|
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1';
|
||||||
|
|
||||||
objcopyflags = '-O binary';
|
objcopyflags = '-O binary';
|
||||||
mips_ldflags = '-static-libgcc -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
mips_ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
||||||
ldadd = '-lgcc';
|
ldadd = '$(TARGET_LIBGCC)';
|
||||||
cflags = '-Wno-unreachable-code -static-libgcc';
|
cflags = '-Wno-unreachable-code $(TARGET_LDFLAGS_STATIC_LIBGCC)';
|
||||||
enable = mips;
|
enable = mips;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -423,9 +451,9 @@ image = {
|
|||||||
cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1';
|
cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1';
|
||||||
|
|
||||||
objcopyflags = '-O binary';
|
objcopyflags = '-O binary';
|
||||||
mips_ldflags = '-static-libgcc -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
mips_ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
||||||
ldadd = '-lgcc';
|
ldadd = '$(TARGET_LIBGCC)';
|
||||||
cflags = '-static-libgcc';
|
cflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC)';
|
||||||
enable = mips;
|
enable = mips;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -443,7 +471,7 @@ image = {
|
|||||||
name = fwstart;
|
name = fwstart;
|
||||||
mips_loongson = boot/mips/loongson/fwstart.S;
|
mips_loongson = boot/mips/loongson/fwstart.S;
|
||||||
objcopyflags = '-O binary';
|
objcopyflags = '-O binary';
|
||||||
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
|
ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) $(TARGET_LIBGCC) -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
|
||||||
enable = mips_loongson;
|
enable = mips_loongson;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -451,13 +479,14 @@ image = {
|
|||||||
name = fwstart_fuloong2f;
|
name = fwstart_fuloong2f;
|
||||||
mips_loongson = boot/mips/loongson/fuloong2f.S;
|
mips_loongson = boot/mips/loongson/fuloong2f.S;
|
||||||
objcopyflags = '-O binary';
|
objcopyflags = '-O binary';
|
||||||
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
|
ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) $(TARGET_LIBGCC) -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
|
||||||
enable = mips_loongson;
|
enable = mips_loongson;
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
name = disk;
|
name = disk;
|
||||||
common = lib/disk.c;
|
common = lib/disk.c;
|
||||||
|
extra_dist = kern/disk_common.c;
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
@@ -496,6 +525,7 @@ module = {
|
|||||||
module = {
|
module = {
|
||||||
name = emuusb;
|
name = emuusb;
|
||||||
common = bus/usb/usb.c;
|
common = bus/usb/usb.c;
|
||||||
|
enable = emu;
|
||||||
condition = COND_GRUB_EMU_USB;
|
condition = COND_GRUB_EMU_USB;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -544,6 +574,7 @@ module = {
|
|||||||
module = {
|
module = {
|
||||||
name = pci;
|
name = pci;
|
||||||
common = bus/pci.c;
|
common = bus/pci.c;
|
||||||
|
i386_ieee1275 = bus/i386/ieee1275/pci.c;
|
||||||
|
|
||||||
enable = i386_pc;
|
enable = i386_pc;
|
||||||
enable = i386_ieee1275;
|
enable = i386_ieee1275;
|
||||||
@@ -565,6 +596,7 @@ module = {
|
|||||||
common = bus/emu/pci.c;
|
common = bus/emu/pci.c;
|
||||||
common = commands/lspci.c;
|
common = commands/lspci.c;
|
||||||
|
|
||||||
|
enable = emu;
|
||||||
condition = COND_GRUB_EMU_PCI;
|
condition = COND_GRUB_EMU_PCI;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -575,6 +607,19 @@ module = {
|
|||||||
enable = mips_arc;
|
enable = mips_arc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module = {
|
||||||
|
name = lsxen;
|
||||||
|
common = commands/xen/lsxen.c;
|
||||||
|
cppflags = '$(CPPFLAGS_XEN)';
|
||||||
|
|
||||||
|
enable = xen;
|
||||||
|
};
|
||||||
|
|
||||||
|
module = {
|
||||||
|
name = check_nt_hiberfil;
|
||||||
|
common = commands/i386/nthibr.c;
|
||||||
|
};
|
||||||
|
|
||||||
library = {
|
library = {
|
||||||
name = libgnulib.a;
|
name = libgnulib.a;
|
||||||
common = gnulib/regex.c;
|
common = gnulib/regex.c;
|
||||||
@@ -717,6 +762,7 @@ module = {
|
|||||||
enable = mips_arc;
|
enable = mips_arc;
|
||||||
enable = ia64_efi;
|
enable = ia64_efi;
|
||||||
enable = arm_efi;
|
enable = arm_efi;
|
||||||
|
enable = arm64_efi;
|
||||||
enable = arm_uboot;
|
enable = arm_uboot;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -737,8 +783,10 @@ module = {
|
|||||||
|
|
||||||
module = {
|
module = {
|
||||||
name = cpuid;
|
name = cpuid;
|
||||||
x86 = commands/i386/cpuid.c;
|
common = commands/i386/cpuid.c;
|
||||||
enable = x86;
|
enable = x86;
|
||||||
|
enable = i386_xen;
|
||||||
|
enable = x86_64_xen;
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
@@ -795,6 +843,8 @@ module = {
|
|||||||
i386_multiboot = lib/i386/halt.c;
|
i386_multiboot = lib/i386/halt.c;
|
||||||
i386_coreboot = lib/i386/halt.c;
|
i386_coreboot = lib/i386/halt.c;
|
||||||
i386_qemu = lib/i386/halt.c;
|
i386_qemu = lib/i386/halt.c;
|
||||||
|
xen = lib/xen/halt.c;
|
||||||
|
xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
efi = lib/efi/halt.c;
|
efi = lib/efi/halt.c;
|
||||||
ieee1275 = lib/ieee1275/halt.c;
|
ieee1275 = lib/ieee1275/halt.c;
|
||||||
emu = lib/emu/halt.c;
|
emu = lib/emu/halt.c;
|
||||||
@@ -808,11 +858,14 @@ module = {
|
|||||||
ia64_efi = lib/efi/reboot.c;
|
ia64_efi = lib/efi/reboot.c;
|
||||||
x86_64_efi = lib/efi/reboot.c;
|
x86_64_efi = lib/efi/reboot.c;
|
||||||
arm_efi = lib/efi/reboot.c;
|
arm_efi = lib/efi/reboot.c;
|
||||||
|
arm64_efi = lib/efi/reboot.c;
|
||||||
powerpc_ieee1275 = lib/ieee1275/reboot.c;
|
powerpc_ieee1275 = lib/ieee1275/reboot.c;
|
||||||
sparc64_ieee1275 = lib/ieee1275/reboot.c;
|
sparc64_ieee1275 = lib/ieee1275/reboot.c;
|
||||||
mips_arc = lib/mips/arc/reboot.c;
|
mips_arc = lib/mips/arc/reboot.c;
|
||||||
mips_loongson = lib/mips/loongson/reboot.c;
|
mips_loongson = lib/mips/loongson/reboot.c;
|
||||||
mips_qemu_mips = lib/mips/qemu_mips/reboot.c;
|
mips_qemu_mips = lib/mips/qemu_mips/reboot.c;
|
||||||
|
xen = lib/xen/reboot.c;
|
||||||
|
xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
uboot = lib/uboot/reboot.c;
|
uboot = lib/uboot/reboot.c;
|
||||||
common = commands/reboot.c;
|
common = commands/reboot.c;
|
||||||
};
|
};
|
||||||
@@ -1436,6 +1489,11 @@ module = {
|
|||||||
common = io/gzio.c;
|
common = io/gzio.c;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module = {
|
||||||
|
name = offsetio;
|
||||||
|
common = io/offset.c;
|
||||||
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
name = bufio;
|
name = bufio;
|
||||||
common = io/bufio.c;
|
common = io/bufio.c;
|
||||||
@@ -1469,13 +1527,21 @@ module = {
|
|||||||
x86 = lib/i386/relocator64.S;
|
x86 = lib/i386/relocator64.S;
|
||||||
i386 = lib/i386/relocator_asm.S;
|
i386 = lib/i386/relocator_asm.S;
|
||||||
x86_64 = lib/x86_64/relocator_asm.S;
|
x86_64 = lib/x86_64/relocator_asm.S;
|
||||||
|
i386_xen = lib/i386/relocator_asm.S;
|
||||||
|
x86_64_xen = lib/x86_64/relocator_asm.S;
|
||||||
x86 = lib/i386/relocator.c;
|
x86 = lib/i386/relocator.c;
|
||||||
|
x86 = lib/i386/relocator_common_c.c;
|
||||||
ieee1275 = lib/ieee1275/relocator.c;
|
ieee1275 = lib/ieee1275/relocator.c;
|
||||||
efi = lib/efi/relocator.c;
|
efi = lib/efi/relocator.c;
|
||||||
mips = lib/mips/relocator_asm.S;
|
mips = lib/mips/relocator_asm.S;
|
||||||
mips = lib/mips/relocator.c;
|
mips = lib/mips/relocator.c;
|
||||||
powerpc = lib/powerpc/relocator_asm.S;
|
powerpc = lib/powerpc/relocator_asm.S;
|
||||||
powerpc = lib/powerpc/relocator.c;
|
powerpc = lib/powerpc/relocator.c;
|
||||||
|
xen = lib/xen/relocator.c;
|
||||||
|
i386_xen = lib/i386/xen/relocator.S;
|
||||||
|
x86_64_xen = lib/x86_64/xen/relocator.S;
|
||||||
|
xen = lib/i386/relocator_common_c.c;
|
||||||
|
xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
|
|
||||||
extra_dist = lib/i386/relocator_common.S;
|
extra_dist = lib/i386/relocator_common.S;
|
||||||
extra_dist = kern/powerpc/cache_flush.S;
|
extra_dist = kern/powerpc/cache_flush.S;
|
||||||
@@ -1483,6 +1549,7 @@ module = {
|
|||||||
enable = mips;
|
enable = mips;
|
||||||
enable = powerpc;
|
enable = powerpc;
|
||||||
enable = x86;
|
enable = x86;
|
||||||
|
enable = xen;
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
@@ -1494,6 +1561,8 @@ module = {
|
|||||||
powerpc_ieee1275 = lib/ieee1275/datetime.c;
|
powerpc_ieee1275 = lib/ieee1275/datetime.c;
|
||||||
sparc64_ieee1275 = lib/ieee1275/cmos.c;
|
sparc64_ieee1275 = lib/ieee1275/cmos.c;
|
||||||
powerpc_ieee1275 = lib/ieee1275/cmos.c;
|
powerpc_ieee1275 = lib/ieee1275/cmos.c;
|
||||||
|
xen = lib/xen/datetime.c;
|
||||||
|
xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
|
|
||||||
mips_arc = lib/arc/datetime.c;
|
mips_arc = lib/arc/datetime.c;
|
||||||
enable = noemu;
|
enable = noemu;
|
||||||
@@ -1568,6 +1637,7 @@ module = {
|
|||||||
cppflags = "-DGRUB_USE_MULTIBOOT2";
|
cppflags = "-DGRUB_USE_MULTIBOOT2";
|
||||||
|
|
||||||
common = loader/multiboot.c;
|
common = loader/multiboot.c;
|
||||||
|
common = lib/cmdline.c;
|
||||||
common = loader/multiboot_mbi2.c;
|
common = loader/multiboot_mbi2.c;
|
||||||
enable = x86;
|
enable = x86;
|
||||||
enable = mips;
|
enable = mips;
|
||||||
@@ -1576,6 +1646,7 @@ module = {
|
|||||||
module = {
|
module = {
|
||||||
name = multiboot;
|
name = multiboot;
|
||||||
common = loader/multiboot.c;
|
common = loader/multiboot.c;
|
||||||
|
common = lib/cmdline.c;
|
||||||
x86 = loader/i386/multiboot_mbi.c;
|
x86 = loader/i386/multiboot_mbi.c;
|
||||||
extra_dist = loader/multiboot_elfxx.c;
|
extra_dist = loader/multiboot_elfxx.c;
|
||||||
enable = x86;
|
enable = x86;
|
||||||
@@ -1584,6 +1655,12 @@ module = {
|
|||||||
module = {
|
module = {
|
||||||
name = linux;
|
name = linux;
|
||||||
x86 = loader/i386/linux.c;
|
x86 = loader/i386/linux.c;
|
||||||
|
xen = loader/i386/xen.c;
|
||||||
|
xen = loader/i386/xen_file.c;
|
||||||
|
xen = loader/i386/xen_file32.c;
|
||||||
|
xen = loader/i386/xen_file64.c;
|
||||||
|
extra_dist = loader/i386/xen_fileXX.c;
|
||||||
|
xen_cppflags = '$(CPPFLAGS_XEN)';
|
||||||
i386_pc = lib/i386/pc/vesa_modes_table.c;
|
i386_pc = lib/i386/pc/vesa_modes_table.c;
|
||||||
mips = loader/mips/linux.c;
|
mips = loader/mips/linux.c;
|
||||||
powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
|
powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
|
||||||
@@ -1622,6 +1699,7 @@ module = {
|
|||||||
efi = loader/efi/chainloader.c;
|
efi = loader/efi/chainloader.c;
|
||||||
i386_pc = loader/i386/pc/chainloader.c;
|
i386_pc = loader/i386/pc/chainloader.c;
|
||||||
i386_coreboot = loader/i386/coreboot/chainloader.c;
|
i386_coreboot = loader/i386/coreboot/chainloader.c;
|
||||||
|
i386_coreboot = lib/LzmaDec.c;
|
||||||
enable = i386_pc;
|
enable = i386_pc;
|
||||||
enable = i386_coreboot;
|
enable = i386_coreboot;
|
||||||
enable = efi;
|
enable = efi;
|
||||||
@@ -1643,6 +1721,7 @@ module = {
|
|||||||
enable = x86;
|
enable = x86;
|
||||||
enable = ia64_efi;
|
enable = ia64_efi;
|
||||||
enable = arm_efi;
|
enable = arm_efi;
|
||||||
|
enable = arm64_efi;
|
||||||
enable = mips;
|
enable = mips;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1847,6 +1926,37 @@ module = {
|
|||||||
common = tests/setjmp_test.c;
|
common = tests/setjmp_test.c;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module = {
|
||||||
|
name = signature_test;
|
||||||
|
common = tests/signature_test.c;
|
||||||
|
common = tests/signatures.h;
|
||||||
|
};
|
||||||
|
|
||||||
|
module = {
|
||||||
|
name = xnu_uuid_test;
|
||||||
|
common = tests/xnu_uuid_test.c;
|
||||||
|
};
|
||||||
|
|
||||||
|
module = {
|
||||||
|
name = pbkdf2_test;
|
||||||
|
common = tests/pbkdf2_test.c;
|
||||||
|
};
|
||||||
|
|
||||||
|
module = {
|
||||||
|
name = legacy_password_test;
|
||||||
|
common = tests/legacy_password_test.c;
|
||||||
|
enable = i386_pc;
|
||||||
|
enable = i386_efi;
|
||||||
|
enable = x86_64_efi;
|
||||||
|
enable = emu;
|
||||||
|
enable = xen;
|
||||||
|
};
|
||||||
|
|
||||||
|
module = {
|
||||||
|
name = div_test;
|
||||||
|
common = tests/div_test.c;
|
||||||
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
name = videotest_checksum;
|
name = videotest_checksum;
|
||||||
common = tests/videotest_checksum.c;
|
common = tests/videotest_checksum.c;
|
||||||
@@ -2000,11 +2110,13 @@ module = {
|
|||||||
emu = lib/i386/pc/vesa_modes_table.c;
|
emu = lib/i386/pc/vesa_modes_table.c;
|
||||||
i386_efi = lib/i386/pc/vesa_modes_table.c;
|
i386_efi = lib/i386/pc/vesa_modes_table.c;
|
||||||
x86_64_efi = lib/i386/pc/vesa_modes_table.c;
|
x86_64_efi = lib/i386/pc/vesa_modes_table.c;
|
||||||
|
xen = lib/i386/pc/vesa_modes_table.c;
|
||||||
|
|
||||||
enable = i386_pc;
|
enable = i386_pc;
|
||||||
enable = i386_efi;
|
enable = i386_efi;
|
||||||
enable = x86_64_efi;
|
enable = x86_64_efi;
|
||||||
enable = emu;
|
enable = emu;
|
||||||
|
enable = xen;
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
@@ -2038,8 +2150,12 @@ module = {
|
|||||||
module = {
|
module = {
|
||||||
name = backtrace;
|
name = backtrace;
|
||||||
x86 = lib/i386/backtrace.c;
|
x86 = lib/i386/backtrace.c;
|
||||||
|
i386_xen = lib/i386/backtrace.c;
|
||||||
|
x86_64_xen = lib/i386/backtrace.c;
|
||||||
common = lib/backtrace.c;
|
common = lib/backtrace.c;
|
||||||
enable = x86;
|
enable = x86;
|
||||||
|
enable = i386_xen;
|
||||||
|
enable = x86_64_xen;
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
|
|||||||
@@ -31,27 +31,32 @@
|
|||||||
.macro floppy
|
.macro floppy
|
||||||
part_start:
|
part_start:
|
||||||
|
|
||||||
probe_values:
|
LOCAL(probe_values):
|
||||||
.byte 36, 18, 15, 9, 0
|
.byte 36, 18, 15, 9, 0
|
||||||
|
|
||||||
LOCAL(floppy_probe):
|
LOCAL(floppy_probe):
|
||||||
|
pushw %dx
|
||||||
/*
|
/*
|
||||||
* Perform floppy probe.
|
* Perform floppy probe.
|
||||||
*/
|
*/
|
||||||
|
#ifdef __APPLE__
|
||||||
movw $probe_values - 1, %si
|
LOCAL(probe_values_minus_one) = LOCAL(probe_values) - 1
|
||||||
|
movw MACRO_DOLLAR(LOCAL(probe_values_minus_one)), %si
|
||||||
|
#else
|
||||||
|
movw MACRO_DOLLAR(LOCAL(probe_values)) - 1, %si
|
||||||
|
#endif
|
||||||
|
|
||||||
LOCAL(probe_loop):
|
LOCAL(probe_loop):
|
||||||
/* reset floppy controller INT 13h AH=0 */
|
/* reset floppy controller INT 13h AH=0 */
|
||||||
xorw %ax, %ax
|
xorw %ax, %ax
|
||||||
int $0x13
|
int MACRO_DOLLAR(0x13)
|
||||||
|
|
||||||
incw %si
|
incw %si
|
||||||
movb (%si), %cl
|
movb (%si), %cl
|
||||||
|
|
||||||
/* if number of sectors is 0, display error and die */
|
/* if number of sectors is 0, display error and die */
|
||||||
cmpb $0, %cl
|
testb %cl, %cl
|
||||||
jne 1f
|
jnz 1f
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Floppy disk probe failure.
|
* Floppy disk probe failure.
|
||||||
@@ -64,20 +69,20 @@ fd_probe_error_string: .asciz "Floppy"
|
|||||||
|
|
||||||
1:
|
1:
|
||||||
/* perform read */
|
/* perform read */
|
||||||
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
|
movw MACRO_DOLLAR(GRUB_BOOT_MACHINE_BUFFER_SEG), %bx
|
||||||
movw %bx, %es
|
movw %bx, %es
|
||||||
xorw %bx, %bx
|
xorw %bx, %bx
|
||||||
movw $0x201, %ax
|
movw MACRO_DOLLAR(0x201), %ax
|
||||||
movb $0, %ch
|
movb MACRO_DOLLAR(0), %ch
|
||||||
movb $0, %dh
|
movb MACRO_DOLLAR(0), %dh
|
||||||
int $0x13
|
int MACRO_DOLLAR(0x13)
|
||||||
|
|
||||||
/* if error, jump to "LOCAL(probe_loop)" */
|
/* if error, jump to "LOCAL(probe_loop)" */
|
||||||
jc LOCAL(probe_loop)
|
jc LOCAL(probe_loop)
|
||||||
|
|
||||||
/* %cl is already the correct value! */
|
/* %cl is already the correct value! */
|
||||||
movb $1, %dh
|
movb MACRO_DOLLAR(1), %dh
|
||||||
movb $79, %ch
|
movb MACRO_DOLLAR(79), %ch
|
||||||
|
|
||||||
jmp LOCAL(final_init)
|
jmp LOCAL(final_init)
|
||||||
.endm
|
.endm
|
||||||
@@ -180,7 +185,9 @@ kernel_address:
|
|||||||
#ifndef HYBRID_BOOT
|
#ifndef HYBRID_BOOT
|
||||||
. = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR
|
. = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR
|
||||||
kernel_sector:
|
kernel_sector:
|
||||||
.long 1, 0
|
.long 1
|
||||||
|
kernel_sector_high:
|
||||||
|
.long 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
. = _start + GRUB_BOOT_MACHINE_BOOT_DRIVE
|
. = _start + GRUB_BOOT_MACHINE_BOOT_DRIVE
|
||||||
@@ -285,7 +292,7 @@ lba_mode:
|
|||||||
/* the absolute address */
|
/* the absolute address */
|
||||||
movl kernel_sector, %ebx
|
movl kernel_sector, %ebx
|
||||||
movl %ebx, 8(%si)
|
movl %ebx, 8(%si)
|
||||||
movl kernel_sector + 4, %ebx
|
movl kernel_sector_high, %ebx
|
||||||
movl %ebx, 12(%si)
|
movl %ebx, 12(%si)
|
||||||
|
|
||||||
/* the segment of buffer address */
|
/* the segment of buffer address */
|
||||||
@@ -318,11 +325,12 @@ LOCAL(chs_mode):
|
|||||||
int $0x13
|
int $0x13
|
||||||
jnc LOCAL(final_init)
|
jnc LOCAL(final_init)
|
||||||
|
|
||||||
|
popw %dx
|
||||||
/*
|
/*
|
||||||
* The call failed, so maybe use the floppy probe instead.
|
* The call failed, so maybe use the floppy probe instead.
|
||||||
*/
|
*/
|
||||||
testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl
|
testb %dl, %dl
|
||||||
jz LOCAL(floppy_probe)
|
jnb LOCAL(floppy_probe)
|
||||||
|
|
||||||
/* Nope, we definitely have a hard disk, and we're screwed. */
|
/* Nope, we definitely have a hard disk, and we're screwed. */
|
||||||
ERR(hd_probe_error_string)
|
ERR(hd_probe_error_string)
|
||||||
@@ -353,7 +361,7 @@ LOCAL(final_init):
|
|||||||
|
|
||||||
setup_sectors:
|
setup_sectors:
|
||||||
/* load logical sector start (top half) */
|
/* load logical sector start (top half) */
|
||||||
movl kernel_sector + 4, %eax
|
movl kernel_sector_high, %eax
|
||||||
|
|
||||||
orl %eax, %eax
|
orl %eax, %eax
|
||||||
jnz LOCAL(geometry_error)
|
jnz LOCAL(geometry_error)
|
||||||
@@ -505,7 +513,9 @@ LOCAL(message):
|
|||||||
#ifdef HYBRID_BOOT
|
#ifdef HYBRID_BOOT
|
||||||
. = _start + 0x1b0
|
. = _start + 0x1b0
|
||||||
kernel_sector:
|
kernel_sector:
|
||||||
.long 1, 0
|
.long 1
|
||||||
|
kernel_sector_high:
|
||||||
|
.long 0
|
||||||
#endif
|
#endif
|
||||||
. = _start + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC
|
. = _start + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC
|
||||||
nt_magic:
|
nt_magic:
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/i386/pc/memory.h>
|
|
||||||
#include <grub/machine/memory.h>
|
#include <grub/machine/memory.h>
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
#include <grub/machine/kernel.h>
|
#include <grub/machine/kernel.h>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
.extern __bss_start
|
.extern __bss_start
|
||||||
.extern _end
|
.extern _end
|
||||||
|
.extern _edata
|
||||||
|
|
||||||
.globl __start, _start, start
|
.globl __start, _start, start
|
||||||
.set noreorder
|
.set noreorder
|
||||||
@@ -248,8 +249,9 @@ cmdlinedone:
|
|||||||
#include "../../kern/mips/cache_flush.S"
|
#include "../../kern/mips/cache_flush.S"
|
||||||
|
|
||||||
/* Decompress the payload. */
|
/* Decompress the payload. */
|
||||||
lui $a0, %hi(__bss_start)
|
lui $a0, %hi(_edata)
|
||||||
addiu $a0, $a0, %lo(__bss_start)
|
addiu $a0, $a0, %lo(_edata)
|
||||||
|
|
||||||
lui $t0, %hi(base)
|
lui $t0, %hi(base)
|
||||||
addiu $t0, $t0, %lo(base)
|
addiu $t0, $t0, %lo(base)
|
||||||
subu $a0, $a0, $t0
|
subu $a0, $a0, $t0
|
||||||
@@ -265,16 +267,16 @@ cmdlinedone:
|
|||||||
*/
|
*/
|
||||||
move $s6, $a3
|
move $s6, $a3
|
||||||
|
|
||||||
lui $t0, %hi(EXT_C(grub_decompress_core))
|
lui $t9, %hi(EXT_C(grub_decompress_core))
|
||||||
addiu $t0, $t0, %lo(EXT_C(grub_decompress_core))
|
addiu $t9, $t9, %lo(EXT_C(grub_decompress_core))
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_ARC
|
#ifdef GRUB_MACHINE_ARC
|
||||||
lui $sp, %hi(_start - 512)
|
lui $sp, %hi(_start - 512)
|
||||||
jalr $t0
|
jalr $t9
|
||||||
addiu $sp, $sp, %lo(_start - 512)
|
addiu $sp, $sp, %lo(_start - 512)
|
||||||
#else
|
#else
|
||||||
lui $sp, %hi(_start - 256)
|
lui $sp, %hi(_start - 256)
|
||||||
jalr $t0
|
jalr $t9
|
||||||
addiu $sp, $sp, %lo(_start - 256)
|
addiu $sp, $sp, %lo(_start - 256)
|
||||||
#endif
|
#endif
|
||||||
move $a0, $s1
|
move $a0, $s1
|
||||||
@@ -287,3 +289,11 @@ cmdlinedone:
|
|||||||
|
|
||||||
jr $t1
|
jr $t1
|
||||||
nop
|
nop
|
||||||
|
/* Ensure that .data section is created. In code we suppose that _edata
|
||||||
|
is first location not in decompressor image. Strictly speaking it's
|
||||||
|
_edata only when .data is present and _etext otherwise. But checking
|
||||||
|
for .data presence would cost more in code than it is to ensure that
|
||||||
|
.data is created.
|
||||||
|
*/
|
||||||
|
.data
|
||||||
|
.long 0
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2013 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/pci.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/ieee1275/ieee1275.h>
|
||||||
|
|
||||||
|
volatile void *
|
||||||
|
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||||
|
grub_addr_t base,
|
||||||
|
grub_size_t size)
|
||||||
|
{
|
||||||
|
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_REAL_MODE))
|
||||||
|
return (volatile void *) base;
|
||||||
|
if (grub_ieee1275_map (base, base, size, 7))
|
||||||
|
grub_fatal ("couldn't map 0x%lx", base);
|
||||||
|
return (volatile void *) base;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||||
|
volatile void *mem __attribute__ ((unused)),
|
||||||
|
grub_size_t size __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1677,7 +1677,7 @@ grub_ehci_hubports (grub_usb_controller_t dev)
|
|||||||
return portinfo;
|
return portinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_usb_err_t
|
||||||
grub_ehci_portstatus (grub_usb_controller_t dev,
|
grub_ehci_portstatus (grub_usb_controller_t dev,
|
||||||
unsigned int port, unsigned int enable)
|
unsigned int port, unsigned int enable)
|
||||||
{
|
{
|
||||||
@@ -1699,14 +1699,14 @@ grub_ehci_portstatus (grub_usb_controller_t dev,
|
|||||||
endtime = grub_get_time_ms () + 1000;
|
endtime = grub_get_time_ms () + 1000;
|
||||||
while (grub_ehci_port_read (e, port) & GRUB_EHCI_PORT_ENABLED)
|
while (grub_ehci_port_read (e, port) & GRUB_EHCI_PORT_ENABLED)
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "portstatus: EHCI Timed out - disable");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
if (!enable) /* We don't need reset port */
|
if (!enable) /* We don't need reset port */
|
||||||
{
|
{
|
||||||
grub_dprintf ("ehci", "portstatus: Disabled.\n");
|
grub_dprintf ("ehci", "portstatus: Disabled.\n");
|
||||||
grub_dprintf ("ehci", "portstatus: end, status=0x%02x\n",
|
grub_dprintf ("ehci", "portstatus: end, status=0x%02x\n",
|
||||||
grub_ehci_port_read (e, port));
|
grub_ehci_port_read (e, port));
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_dprintf ("ehci", "portstatus: enable\n");
|
grub_dprintf ("ehci", "portstatus: enable\n");
|
||||||
@@ -1724,8 +1724,7 @@ grub_ehci_portstatus (grub_usb_controller_t dev,
|
|||||||
endtime = grub_get_time_ms () + 1000;
|
endtime = grub_get_time_ms () + 1000;
|
||||||
while (grub_ehci_port_read (e, port) & GRUB_EHCI_PORT_RESET)
|
while (grub_ehci_port_read (e, port) & GRUB_EHCI_PORT_RESET)
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO,
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
"portstatus: EHCI Timed out - reset port");
|
|
||||||
grub_boot_time ("Port %d reset", port);
|
grub_boot_time ("Port %d reset", port);
|
||||||
/* Remember "we did the reset" - needed by detect_dev */
|
/* Remember "we did the reset" - needed by detect_dev */
|
||||||
e->reset |= (1 << port);
|
e->reset |= (1 << port);
|
||||||
@@ -1753,7 +1752,7 @@ grub_ehci_portstatus (grub_usb_controller_t dev,
|
|||||||
grub_dprintf ("ehci", "portstatus: end, status=0x%02x\n",
|
grub_dprintf ("ehci", "portstatus: end, status=0x%02x\n",
|
||||||
grub_ehci_port_read (e, port));
|
grub_ehci_port_read (e, port));
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_usb_speed_t
|
static grub_usb_speed_t
|
||||||
@@ -1888,7 +1887,7 @@ grub_ehci_restore_hw (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GRUB_USB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
@@ -1911,7 +1910,7 @@ grub_ehci_fini_hw (int noreturn __attribute__ ((unused)))
|
|||||||
grub_ehci_reset (e);
|
grub_ehci_reset (e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GRUB_USB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct grub_usb_controller_dev usb_controller = {
|
static struct grub_usb_controller_dev usb_controller = {
|
||||||
|
|||||||
@@ -1216,7 +1216,7 @@ grub_ohci_cancel_transfer (grub_usb_controller_t dev,
|
|||||||
return GRUB_USB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_usb_err_t
|
||||||
grub_ohci_portstatus (grub_usb_controller_t dev,
|
grub_ohci_portstatus (grub_usb_controller_t dev,
|
||||||
unsigned int port, unsigned int enable)
|
unsigned int port, unsigned int enable)
|
||||||
{
|
{
|
||||||
@@ -1236,11 +1236,11 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
|
|||||||
while ((grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
while ((grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
||||||
& (1 << 1)))
|
& (1 << 1)))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "OHCI Timed out - disable");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
|
grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OHCI does one reset signal 10ms long but USB spec.
|
/* OHCI does one reset signal 10ms long but USB spec.
|
||||||
@@ -1257,7 +1257,7 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
|
|||||||
while (! (grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
while (! (grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
||||||
& GRUB_OHCI_SET_PORT_RESET_STATUS_CHANGE))
|
& GRUB_OHCI_SET_PORT_RESET_STATUS_CHANGE))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "OHCI Timed out - reset");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
/* End the reset signaling - reset the reset status change */
|
/* End the reset signaling - reset the reset status change */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
@@ -1275,7 +1275,7 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
|
|||||||
while (! (grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
while (! (grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
||||||
& (1 << 1)))
|
& (1 << 1)))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "OHCI Timed out - enable");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
/* Reset bit Connect Status Change */
|
/* Reset bit Connect Status Change */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
@@ -1287,7 +1287,7 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
|
|||||||
grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
|
grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_usb_speed_t
|
static grub_usb_speed_t
|
||||||
|
|||||||
@@ -91,11 +91,13 @@ real_config (struct grub_serial_port *port)
|
|||||||
|
|
||||||
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
||||||
GRUB_FTDI_MODEM_CTRL,
|
GRUB_FTDI_MODEM_CTRL,
|
||||||
GRUB_FTDI_MODEM_CTRL_DTRRTS, 0, 0, 0);
|
port->config.rtscts ? GRUB_FTDI_MODEM_CTRL_DTRRTS : 0,
|
||||||
|
0, 0, 0);
|
||||||
|
|
||||||
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
||||||
GRUB_FTDI_FLOW_CTRL,
|
GRUB_FTDI_FLOW_CTRL,
|
||||||
GRUB_FTDI_FLOW_CTRL_DTRRTS, 0, 0, 0);
|
port->config.rtscts ? GRUB_FTDI_FLOW_CTRL_DTRRTS : 0,
|
||||||
|
0, 0, 0);
|
||||||
|
|
||||||
divisor = get_divisor (port->config.speed);
|
divisor = get_divisor (port->config.speed);
|
||||||
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ real_config (struct grub_serial_port *port)
|
|||||||
0x22, 3, 0, 0, 0);
|
0x22, 3, 0, 0, 0);
|
||||||
|
|
||||||
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
||||||
1, 0, 0x61, 0, 0);
|
1, 0, port->config.rtscts ? 0x61 : 0, 0, 0);
|
||||||
port->configured = 1;
|
port->configured = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -189,11 +189,6 @@ grub_uhci_writereg32 (struct grub_uhci *u,
|
|||||||
grub_outl (val, u->iobase + reg);
|
grub_outl (val, u->iobase + reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_uhci_portstatus (grub_usb_controller_t dev,
|
|
||||||
unsigned int port, unsigned int enable);
|
|
||||||
|
|
||||||
|
|
||||||
/* Iterate over all PCI devices. Determine if a device is an UHCI
|
/* Iterate over all PCI devices. Determine if a device is an UHCI
|
||||||
controller. If this is the case, initialize it. */
|
controller. If this is the case, initialize it. */
|
||||||
static int
|
static int
|
||||||
@@ -715,7 +710,7 @@ grub_uhci_iterate (grub_usb_controller_iterate_hook_t hook, void *hook_data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_usb_err_t
|
||||||
grub_uhci_portstatus (grub_usb_controller_t dev,
|
grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
unsigned int port, unsigned int enable)
|
unsigned int port, unsigned int enable)
|
||||||
{
|
{
|
||||||
@@ -733,8 +728,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
|||||||
else if (port == 1)
|
else if (port == 1)
|
||||||
reg = GRUB_UHCI_REG_PORTSC2;
|
reg = GRUB_UHCI_REG_PORTSC2;
|
||||||
else
|
else
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
"UHCI Root Hub port does not exist");
|
|
||||||
|
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
grub_dprintf ("uhci", "detect=0x%02x\n", status);
|
grub_dprintf ("uhci", "detect=0x%02x\n", status);
|
||||||
@@ -747,11 +741,11 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
|||||||
endtime = grub_get_time_ms () + 1000;
|
endtime = grub_get_time_ms () + 1000;
|
||||||
while ((grub_uhci_readreg16 (u, reg) & (1 << 2)))
|
while ((grub_uhci_readreg16 (u, reg) & (1 << 2)))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "UHCI Timed out - disable");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the port. */
|
/* Reset the port. */
|
||||||
@@ -782,7 +776,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
|||||||
endtime = grub_get_time_ms () + 1000;
|
endtime = grub_get_time_ms () + 1000;
|
||||||
while (! ((status = grub_uhci_readreg16 (u, reg)) & (1 << 2)))
|
while (! ((status = grub_uhci_readreg16 (u, reg)) & (1 << 2)))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "UHCI Timed out - enable");
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
/* Reset recovery time */
|
/* Reset recovery time */
|
||||||
grub_millisleep (10);
|
grub_millisleep (10);
|
||||||
@@ -792,7 +786,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
|||||||
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
||||||
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_usb_speed_t
|
static grub_usb_speed_t
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ grub_usb_add_hub (grub_usb_device_t dev)
|
|||||||
|
|
||||||
rescan = 1;
|
rescan = 1;
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -203,7 +203,7 @@ attach_root_port (struct grub_usb_hub *hub, int portno,
|
|||||||
grub_usb_speed_t speed)
|
grub_usb_speed_t speed)
|
||||||
{
|
{
|
||||||
grub_usb_device_t dev;
|
grub_usb_device_t dev;
|
||||||
grub_err_t err;
|
grub_usb_err_t err;
|
||||||
|
|
||||||
grub_boot_time ("After detect_dev");
|
grub_boot_time ("After detect_dev");
|
||||||
|
|
||||||
|
|||||||
@@ -62,23 +62,47 @@ read_blocklist (grub_disk_addr_t sector, unsigned offset, unsigned length,
|
|||||||
if (ctx->num_sectors > 0)
|
if (ctx->num_sectors > 0)
|
||||||
{
|
{
|
||||||
if (ctx->start_sector + ctx->num_sectors == sector
|
if (ctx->start_sector + ctx->num_sectors == sector
|
||||||
&& offset == 0 && length == GRUB_DISK_SECTOR_SIZE)
|
&& offset == 0 && length >= GRUB_DISK_SECTOR_SIZE)
|
||||||
{
|
{
|
||||||
ctx->num_sectors++;
|
ctx->num_sectors += length >> GRUB_DISK_SECTOR_BITS;
|
||||||
return;
|
sector += length >> GRUB_DISK_SECTOR_BITS;
|
||||||
|
length &= (GRUB_DISK_SECTOR_SIZE - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!length)
|
||||||
|
return;
|
||||||
print_blocklist (ctx->start_sector, ctx->num_sectors, 0, 0, ctx);
|
print_blocklist (ctx->start_sector, ctx->num_sectors, 0, 0, ctx);
|
||||||
ctx->num_sectors = 0;
|
ctx->num_sectors = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset == 0 && length == GRUB_DISK_SECTOR_SIZE)
|
if (offset)
|
||||||
{
|
{
|
||||||
ctx->start_sector = sector;
|
unsigned l = length + offset;
|
||||||
ctx->num_sectors++;
|
l &= (GRUB_DISK_SECTOR_SIZE - 1);
|
||||||
|
l -= offset;
|
||||||
|
print_blocklist (sector, 0, offset, l, ctx);
|
||||||
|
length -= l;
|
||||||
|
sector++;
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!length)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (length & (GRUB_DISK_SECTOR_SIZE - 1))
|
||||||
|
{
|
||||||
|
if (length >> GRUB_DISK_SECTOR_BITS)
|
||||||
|
{
|
||||||
|
print_blocklist (sector, length >> GRUB_DISK_SECTOR_BITS, 0, 0, ctx);
|
||||||
|
sector += length >> GRUB_DISK_SECTOR_BITS;
|
||||||
|
}
|
||||||
|
print_blocklist (sector, 0, 0, length & (GRUB_DISK_SECTOR_SIZE - 1), ctx);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print_blocklist (sector, 0, offset, length, ctx);
|
{
|
||||||
|
ctx->start_sector = sector;
|
||||||
|
ctx->num_sectors = length >> GRUB_DISK_SECTOR_BITS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
|
|||||||
@@ -146,8 +146,7 @@ grub_loader_boot (void)
|
|||||||
return grub_error (GRUB_ERR_NO_KERNEL,
|
return grub_error (GRUB_ERR_NO_KERNEL,
|
||||||
N_("you need to load the kernel first"));
|
N_("you need to load the kernel first"));
|
||||||
|
|
||||||
if (grub_loader_flags & GRUB_LOADER_FLAG_NORETURN)
|
grub_machine_fini (grub_loader_flags);
|
||||||
grub_machine_fini ();
|
|
||||||
|
|
||||||
for (cur = preboots_head; cur; cur = cur->next)
|
for (cur = preboots_head; cur; cur = cur->next)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,17 +63,23 @@ hextoval (char c)
|
|||||||
static grub_err_t
|
static grub_err_t
|
||||||
hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
|
hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
|
||||||
{
|
{
|
||||||
GRUB_PROPERLY_ALIGNED_ARRAY (context, hash->contextsize);
|
void *context;
|
||||||
grub_uint8_t readbuf[4096];
|
grub_uint8_t *readbuf;
|
||||||
|
#define BUF_SIZE 4096
|
||||||
|
readbuf = grub_malloc (BUF_SIZE);
|
||||||
|
if (!readbuf)
|
||||||
|
return grub_errno;
|
||||||
|
context = grub_zalloc (hash->contextsize);
|
||||||
|
if (!readbuf || !context)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
grub_memset (context, 0, sizeof (context));
|
|
||||||
hash->init (context);
|
hash->init (context);
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
grub_ssize_t r;
|
grub_ssize_t r;
|
||||||
r = grub_file_read (file, readbuf, sizeof (readbuf));
|
r = grub_file_read (file, readbuf, BUF_SIZE);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return grub_errno;
|
goto fail;
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
break;
|
break;
|
||||||
hash->write (context, readbuf, r);
|
hash->write (context, readbuf, r);
|
||||||
@@ -81,7 +87,15 @@ hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
|
|||||||
hash->final (context);
|
hash->final (context);
|
||||||
grub_memcpy (result, hash->read (context), hash->mdlen);
|
grub_memcpy (result, hash->read (context), hash->mdlen);
|
||||||
|
|
||||||
|
grub_free (readbuf);
|
||||||
|
grub_free (context);
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
grub_free (readbuf);
|
||||||
|
grub_free (context);
|
||||||
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
@@ -90,12 +104,15 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
|||||||
{
|
{
|
||||||
grub_file_t hashlist, file;
|
grub_file_t hashlist, file;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
grub_uint8_t expected[hash->mdlen];
|
grub_uint8_t expected[GRUB_CRYPTO_MAX_MDLEN];
|
||||||
grub_uint8_t actual[hash->mdlen];
|
grub_uint8_t actual[GRUB_CRYPTO_MAX_MDLEN];
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned unread = 0, mismatch = 0;
|
unsigned unread = 0, mismatch = 0;
|
||||||
|
|
||||||
|
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN)
|
||||||
|
return grub_error (GRUB_ERR_BUG, "mdlen is too long");
|
||||||
|
|
||||||
hashlist = grub_file_open (hashfilename);
|
hashlist = grub_file_open (hashfilename);
|
||||||
if (!hashlist)
|
if (!hashlist)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
@@ -205,6 +222,9 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
|
|||||||
if (!hash)
|
if (!hash)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown hash");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown hash");
|
||||||
|
|
||||||
|
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN)
|
||||||
|
return grub_error (GRUB_ERR_BUG, "mdlen is too long");
|
||||||
|
|
||||||
if (state[2].set)
|
if (state[2].set)
|
||||||
prefix = state[2].arg;
|
prefix = state[2].arg;
|
||||||
|
|
||||||
@@ -218,7 +238,7 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
|
|||||||
|
|
||||||
for (i = 0; i < (unsigned) argc; i++)
|
for (i = 0; i < (unsigned) argc; i++)
|
||||||
{
|
{
|
||||||
GRUB_PROPERLY_ALIGNED_ARRAY (result, hash->mdlen);
|
GRUB_PROPERLY_ALIGNED_ARRAY (result, GRUB_CRYPTO_MAX_MDLEN);
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
unsigned j;
|
unsigned j;
|
||||||
|
|||||||
@@ -81,7 +81,25 @@ grub_cmd_cmosclean (struct grub_command *cmd __attribute__ ((unused)),
|
|||||||
return grub_cmos_write (byte, value & (~(1 << bit)));
|
return grub_cmos_write (byte, value & (~(1 << bit)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_command_t cmd, cmd_clean;
|
static grub_err_t
|
||||||
|
grub_cmd_cmosset (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
|
int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int byte, bit;
|
||||||
|
grub_err_t err;
|
||||||
|
grub_uint8_t value;
|
||||||
|
|
||||||
|
err = parse_args (argc, argv, &byte, &bit);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
err = grub_cmos_read (byte, &value);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
return grub_cmos_write (byte, value | (1 << bit));
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_command_t cmd, cmd_clean, cmd_set;
|
||||||
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(cmostest)
|
GRUB_MOD_INIT(cmostest)
|
||||||
@@ -92,10 +110,14 @@ GRUB_MOD_INIT(cmostest)
|
|||||||
cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclean,
|
cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclean,
|
||||||
N_("BYTE:BIT"),
|
N_("BYTE:BIT"),
|
||||||
N_("Clean bit at BYTE:BIT in CMOS."));
|
N_("Clean bit at BYTE:BIT in CMOS."));
|
||||||
|
cmd_set = grub_register_command ("cmosset", grub_cmd_cmosset,
|
||||||
|
N_("BYTE:BIT"),
|
||||||
|
N_("Set bit at BYTE:BIT in CMOS."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(cmostest)
|
GRUB_MOD_FINI(cmostest)
|
||||||
{
|
{
|
||||||
grub_unregister_command (cmd);
|
grub_unregister_command (cmd);
|
||||||
grub_unregister_command (cmd_clean);
|
grub_unregister_command (cmd_clean);
|
||||||
|
grub_unregister_command (cmd_set);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/* nthibr.c - tests whether an MS Windows system partition is hibernated */
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2013 Peter Lustig
|
||||||
|
* Copyright (C) 2013 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/types.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <grub/file.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/command.h>
|
||||||
|
#include <grub/err.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_nthibr (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
int argc, char **args)
|
||||||
|
{
|
||||||
|
grub_uint8_t hibr_file_magic[4];
|
||||||
|
grub_file_t hibr_file = 0;
|
||||||
|
|
||||||
|
if (argc != 1)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
||||||
|
|
||||||
|
hibr_file = grub_file_open (args[0]);
|
||||||
|
if (!hibr_file)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
/* Try to read magic number of 'hiberfil.sys' */
|
||||||
|
if (grub_file_read (hibr_file, hibr_file_magic,
|
||||||
|
sizeof (hibr_file_magic))
|
||||||
|
!= (grub_ssize_t) sizeof (hibr_file_magic))
|
||||||
|
{
|
||||||
|
if (!grub_errno)
|
||||||
|
grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(grub_memcmp ("hibr", hibr_file_magic, sizeof (hibr_file_magic)) == 0
|
||||||
|
|| grub_memcmp ("HIBR", hibr_file_magic, sizeof (hibr_file_magic)) == 0))
|
||||||
|
grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
||||||
|
|
||||||
|
exit:
|
||||||
|
grub_file_close (hibr_file);
|
||||||
|
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_command_t cmd;
|
||||||
|
|
||||||
|
GRUB_MOD_INIT (check_nt_hiberfil)
|
||||||
|
{
|
||||||
|
cmd = grub_register_command ("check_nt_hiberfil", grub_cmd_nthibr,
|
||||||
|
N_("FILE"),
|
||||||
|
N_("Test whether a hiberfil.sys is "
|
||||||
|
"in hibernated state."));
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI (check_nt_hiberfil)
|
||||||
|
{
|
||||||
|
grub_unregister_command (cmd);
|
||||||
|
}
|
||||||
@@ -358,7 +358,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
|||||||
dev = grub_device_open (0);
|
dev = grub_device_open (0);
|
||||||
if (dev && dev->disk
|
if (dev && dev->disk
|
||||||
&& dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID
|
&& dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID
|
||||||
&& dev->disk->dev->id >= 0x80 && dev->disk->dev->id <= 0x90)
|
&& dev->disk->id >= 0x80 && dev->disk->id <= 0x90)
|
||||||
{
|
{
|
||||||
struct grub_partition *part = dev->disk->partition;
|
struct grub_partition *part = dev->disk->partition;
|
||||||
bsd_device = dev->disk->id - 0x80 - hdbias;
|
bsd_device = dev->disk->id - 0x80 - hdbias;
|
||||||
@@ -546,8 +546,6 @@ struct legacy_md5_password
|
|||||||
grub_uint8_t hash[MD5_HASHLEN];
|
grub_uint8_t hash[MD5_HASHLEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
check_password_md5_real (const char *entered,
|
check_password_md5_real (const char *entered,
|
||||||
struct legacy_md5_password *pw)
|
struct legacy_md5_password *pw)
|
||||||
@@ -555,8 +553,13 @@ check_password_md5_real (const char *entered,
|
|||||||
grub_size_t enteredlen = grub_strlen (entered);
|
grub_size_t enteredlen = grub_strlen (entered);
|
||||||
unsigned char alt_result[MD5_HASHLEN];
|
unsigned char alt_result[MD5_HASHLEN];
|
||||||
unsigned char *digest;
|
unsigned char *digest;
|
||||||
grub_uint8_t ctx[GRUB_MD_MD5->contextsize];
|
grub_uint8_t *ctx;
|
||||||
grub_size_t i;
|
grub_size_t i;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ctx = grub_zalloc (GRUB_MD_MD5->contextsize);
|
||||||
|
if (!ctx)
|
||||||
|
return 0;
|
||||||
|
|
||||||
GRUB_MD_MD5->init (ctx);
|
GRUB_MD_MD5->init (ctx);
|
||||||
GRUB_MD_MD5->write (ctx, entered, enteredlen);
|
GRUB_MD_MD5->write (ctx, entered, enteredlen);
|
||||||
@@ -602,7 +605,9 @@ check_password_md5_real (const char *entered,
|
|||||||
GRUB_MD_MD5->final (ctx);
|
GRUB_MD_MD5->final (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (grub_crypto_memcmp (digest, pw->hash, MD5_HASHLEN) == 0);
|
ret = (grub_crypto_memcmp (digest, pw->hash, MD5_HASHLEN) == 0);
|
||||||
|
grub_free (ctx);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
@@ -725,18 +730,12 @@ grub_cmd_legacy_password (struct grub_command *mycmd __attribute__ ((unused)),
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
int
|
||||||
grub_cmd_legacy_check_password (struct grub_command *mycmd __attribute__ ((unused)),
|
grub_legacy_check_md5_password (int argc, char **args,
|
||||||
int argc, char **args)
|
char *entered)
|
||||||
{
|
{
|
||||||
struct legacy_md5_password *pw = NULL;
|
struct legacy_md5_password *pw = NULL;
|
||||||
char entered[GRUB_AUTH_MAX_PASSLEN];
|
int ret;
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
|
||||||
grub_puts_ (N_("Enter password: "));
|
|
||||||
if (!grub_password_get (entered, GRUB_AUTH_MAX_PASSLEN))
|
|
||||||
return GRUB_ACCESS_DENIED;
|
|
||||||
|
|
||||||
if (args[0][0] != '-' || args[0][1] != '-')
|
if (args[0][0] != '-' || args[0][1] != '-')
|
||||||
{
|
{
|
||||||
@@ -745,17 +744,33 @@ grub_cmd_legacy_check_password (struct grub_command *mycmd __attribute__ ((unuse
|
|||||||
grub_memset (correct, 0, sizeof (correct));
|
grub_memset (correct, 0, sizeof (correct));
|
||||||
grub_strncpy (correct, args[0], sizeof (correct));
|
grub_strncpy (correct, args[0], sizeof (correct));
|
||||||
|
|
||||||
if (grub_crypto_memcmp (entered, correct, GRUB_AUTH_MAX_PASSLEN) != 0)
|
return grub_crypto_memcmp (entered, correct, GRUB_AUTH_MAX_PASSLEN) == 0;
|
||||||
return GRUB_ACCESS_DENIED;
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pw = parse_legacy_md5 (argc, args);
|
pw = parse_legacy_md5 (argc, args);
|
||||||
|
|
||||||
if (!pw)
|
if (!pw)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ret = check_password_md5_real (entered, pw);
|
||||||
|
grub_free (pw);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_legacy_check_password (struct grub_command *mycmd __attribute__ ((unused)),
|
||||||
|
int argc, char **args)
|
||||||
|
{
|
||||||
|
char entered[GRUB_AUTH_MAX_PASSLEN];
|
||||||
|
|
||||||
|
if (argc == 0)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
||||||
|
grub_puts_ (N_("Enter password: "));
|
||||||
|
if (!grub_password_get (entered, GRUB_AUTH_MAX_PASSLEN))
|
||||||
return GRUB_ACCESS_DENIED;
|
return GRUB_ACCESS_DENIED;
|
||||||
|
|
||||||
if (!check_password_md5_real (entered, pw))
|
if (!grub_legacy_check_md5_password (argc, args,
|
||||||
|
entered))
|
||||||
return GRUB_ACCESS_DENIED;
|
return GRUB_ACCESS_DENIED;
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|||||||
@@ -259,10 +259,28 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
|||||||
for (p = blocklists; p; p = p->next)
|
for (p = blocklists; p; p = p->next)
|
||||||
{
|
{
|
||||||
struct blocklist *q;
|
struct blocklist *q;
|
||||||
|
/* Check if any pair of blocks overlap. */
|
||||||
for (q = p->next; q; q = q->next)
|
for (q = p->next; q; q = q->next)
|
||||||
{
|
{
|
||||||
/* Check if any pair of blocks overlap. */
|
grub_disk_addr_t s1, s2;
|
||||||
if (p->sector == q->sector)
|
grub_disk_addr_t e1, e2, t;
|
||||||
|
|
||||||
|
s1 = p->sector;
|
||||||
|
e1 = s1 + ((p->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
|
||||||
|
|
||||||
|
s2 = q->sector;
|
||||||
|
e2 = s2 + ((q->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
|
||||||
|
|
||||||
|
if (s2 > s1)
|
||||||
|
{
|
||||||
|
t = s2;
|
||||||
|
s2 = s1;
|
||||||
|
s1 = t;
|
||||||
|
t = e2;
|
||||||
|
e2 = e1;
|
||||||
|
e1 = t;
|
||||||
|
}
|
||||||
|
if (e1 > s2)
|
||||||
{
|
{
|
||||||
/* This might be actually valid, but it is unbelievable that
|
/* This might be actually valid, but it is unbelievable that
|
||||||
any filesystem makes such a silly allocation. */
|
any filesystem makes such a silly allocation. */
|
||||||
@@ -286,9 +304,18 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
|||||||
part_start = grub_partition_get_start (disk->partition);
|
part_start = grub_partition_get_start (disk->partition);
|
||||||
|
|
||||||
buf = grub_envblk_buffer (envblk);
|
buf = grub_envblk_buffer (envblk);
|
||||||
|
char *blockbuf = NULL;
|
||||||
|
grub_size_t blockbuf_len = 0;
|
||||||
for (p = blocklists, index = 0; p; index += p->length, p = p->next)
|
for (p = blocklists, index = 0; p; index += p->length, p = p->next)
|
||||||
{
|
{
|
||||||
char blockbuf[GRUB_DISK_SECTOR_SIZE];
|
if (p->length > blockbuf_len)
|
||||||
|
{
|
||||||
|
grub_free (blockbuf);
|
||||||
|
blockbuf_len = 2 * p->length;
|
||||||
|
blockbuf = grub_malloc (blockbuf_len);
|
||||||
|
if (!blockbuf)
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
|
||||||
if (grub_disk_read (disk, p->sector - part_start,
|
if (grub_disk_read (disk, p->sector - part_start,
|
||||||
p->offset, p->length, blockbuf))
|
p->offset, p->length, blockbuf))
|
||||||
@@ -340,10 +367,6 @@ save_env_read_hook (grub_disk_addr_t sector, unsigned offset, unsigned length,
|
|||||||
struct grub_cmd_save_env_ctx *ctx = data;
|
struct grub_cmd_save_env_ctx *ctx = data;
|
||||||
struct blocklist *block;
|
struct blocklist *block;
|
||||||
|
|
||||||
if (offset + length > GRUB_DISK_SECTOR_SIZE)
|
|
||||||
/* Seemingly a bug. */
|
|
||||||
return;
|
|
||||||
|
|
||||||
block = grub_malloc (sizeof (*block));
|
block = grub_malloc (sizeof (*block));
|
||||||
if (! block)
|
if (! block)
|
||||||
return;
|
return;
|
||||||
@@ -409,6 +432,8 @@ grub_cmd_save_env (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
grub_envblk_delete (envblk, args[0]);
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
args++;
|
args++;
|
||||||
|
|||||||
+27
-3
@@ -116,11 +116,35 @@ print_files_long (const char *filename, const struct grub_dirhook_info *info,
|
|||||||
|
|
||||||
if (! info->dir)
|
if (! info->dir)
|
||||||
{
|
{
|
||||||
if (! ctx->human)
|
grub_file_t file;
|
||||||
grub_printf ("%-12llu", (unsigned long long) info->size);
|
char *pathname;
|
||||||
|
|
||||||
|
if (ctx->dirname[grub_strlen (ctx->dirname) - 1] == '/')
|
||||||
|
pathname = grub_xasprintf ("%s%s", ctx->dirname, filename);
|
||||||
else
|
else
|
||||||
grub_printf ("%-12s", grub_get_human_size (info->size,
|
pathname = grub_xasprintf ("%s/%s", ctx->dirname, filename);
|
||||||
|
|
||||||
|
if (!pathname)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* XXX: For ext2fs symlinks are detected as files while they
|
||||||
|
should be reported as directories. */
|
||||||
|
grub_file_filter_disable_compression ();
|
||||||
|
file = grub_file_open (pathname);
|
||||||
|
if (! file)
|
||||||
|
{
|
||||||
|
grub_errno = 0;
|
||||||
|
grub_free (pathname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! ctx->human)
|
||||||
|
grub_printf ("%-12llu", (unsigned long long) file->size);
|
||||||
|
else
|
||||||
|
grub_printf ("%-12s", grub_get_human_size (file->size,
|
||||||
GRUB_HUMAN_SIZE_SHORT));
|
GRUB_HUMAN_SIZE_SHORT));
|
||||||
|
grub_file_close (file);
|
||||||
|
grub_free (pathname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
grub_printf ("%-12s", _("DIR"));
|
grub_printf ("%-12s", _("DIR"));
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ get_uuid (const char *name, char **uuid, int getnative)
|
|||||||
/* Native disks. */
|
/* Native disks. */
|
||||||
case GRUB_DISK_DEVICE_ATA_ID:
|
case GRUB_DISK_DEVICE_ATA_ID:
|
||||||
case GRUB_DISK_DEVICE_SCSI_ID:
|
case GRUB_DISK_DEVICE_SCSI_ID:
|
||||||
|
case GRUB_DISK_DEVICE_XEN:
|
||||||
if (getnative)
|
if (getnative)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,12 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||||||
static void
|
static void
|
||||||
read_progress (grub_disk_addr_t sector __attribute__ ((unused)),
|
read_progress (grub_disk_addr_t sector __attribute__ ((unused)),
|
||||||
unsigned offset __attribute__ ((unused)),
|
unsigned offset __attribute__ ((unused)),
|
||||||
unsigned len __attribute__ ((unused)),
|
unsigned len,
|
||||||
void *data __attribute__ ((unused)))
|
void *data __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
|
for (; len >= GRUB_DISK_SECTOR_SIZE; len -= GRUB_DISK_SECTOR_SIZE)
|
||||||
|
grub_xputs (".");
|
||||||
|
if (len)
|
||||||
grub_xputs (".");
|
grub_xputs (".");
|
||||||
grub_refresh ();
|
grub_refresh ();
|
||||||
}
|
}
|
||||||
|
|||||||
+159
-53
@@ -145,16 +145,31 @@ const char *hashes[] = {
|
|||||||
[0x0b] = "sha224"
|
[0x0b] = "sha224"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct gcry_pk_spec *grub_crypto_pk_dsa;
|
||||||
|
struct gcry_pk_spec *grub_crypto_pk_ecdsa;
|
||||||
|
struct gcry_pk_spec *grub_crypto_pk_rsa;
|
||||||
|
|
||||||
|
static int
|
||||||
|
dsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval,
|
||||||
|
const gcry_md_spec_t *hash, struct grub_public_subkey *sk);
|
||||||
|
static int
|
||||||
|
rsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval,
|
||||||
|
const gcry_md_spec_t *hash, struct grub_public_subkey *sk);
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
grub_size_t nmpisig;
|
grub_size_t nmpisig;
|
||||||
grub_size_t nmpipub;
|
grub_size_t nmpipub;
|
||||||
|
struct gcry_pk_spec **algo;
|
||||||
|
int (*pad) (gcry_mpi_t *hmpi, grub_uint8_t *hval,
|
||||||
|
const gcry_md_spec_t *hash, struct grub_public_subkey *sk);
|
||||||
|
const char *module;
|
||||||
} pkalgos[] =
|
} pkalgos[] =
|
||||||
{
|
{
|
||||||
[1] = { "rsa", 1, 2 },
|
[1] = { "rsa", 1, 2, &grub_crypto_pk_rsa, rsa_pad, "gcry_rsa" },
|
||||||
[3] = { "rsa", 1, 2 },
|
[3] = { "rsa", 1, 2, &grub_crypto_pk_rsa, rsa_pad, "gcry_rsa" },
|
||||||
[17] = { "dsa", 2, 4 },
|
[17] = { "dsa", 2, 4, &grub_crypto_pk_dsa, dsa_pad, "gcry_dsa" },
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grub_public_key
|
struct grub_public_key
|
||||||
@@ -177,22 +192,39 @@ free_pk (struct grub_public_key *pk)
|
|||||||
struct grub_public_subkey *nsk, *sk;
|
struct grub_public_subkey *nsk, *sk;
|
||||||
for (sk = pk->subkeys; sk; sk = nsk)
|
for (sk = pk->subkeys; sk; sk = nsk)
|
||||||
{
|
{
|
||||||
|
grub_size_t i;
|
||||||
|
for (i = 0; i < ARRAY_SIZE (sk->mpis); i++)
|
||||||
|
if (sk->mpis[i])
|
||||||
|
gcry_mpi_release (sk->mpis[i]);
|
||||||
nsk = sk->next;
|
nsk = sk->next;
|
||||||
grub_free (sk);
|
grub_free (sk);
|
||||||
}
|
}
|
||||||
grub_free (pk);
|
grub_free (pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define READBUF_SIZE 4096
|
||||||
|
|
||||||
struct grub_public_key *
|
struct grub_public_key *
|
||||||
grub_load_public_key (grub_file_t f)
|
grub_load_public_key (grub_file_t f)
|
||||||
{
|
{
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
struct grub_public_key *ret;
|
struct grub_public_key *ret;
|
||||||
struct grub_public_subkey **last = 0;
|
struct grub_public_subkey **last = 0;
|
||||||
|
void *fingerprint_context = NULL;
|
||||||
|
grub_uint8_t *buffer = NULL;
|
||||||
|
|
||||||
ret = grub_zalloc (sizeof (*ret));
|
ret = grub_zalloc (sizeof (*ret));
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
{
|
||||||
|
grub_free (fingerprint_context);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer = grub_zalloc (READBUF_SIZE);
|
||||||
|
fingerprint_context = grub_zalloc (GRUB_MD_SHA1->contextsize);
|
||||||
|
|
||||||
|
if (!buffer || !fingerprint_context)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
last = &ret->subkeys;
|
last = &ret->subkeys;
|
||||||
|
|
||||||
@@ -206,7 +238,6 @@ grub_load_public_key (grub_file_t f)
|
|||||||
struct grub_public_subkey *sk;
|
struct grub_public_subkey *sk;
|
||||||
grub_size_t i;
|
grub_size_t i;
|
||||||
grub_uint16_t len_be;
|
grub_uint16_t len_be;
|
||||||
GRUB_PROPERLY_ALIGNED_ARRAY (fingerprint_context, GRUB_MD_SHA1->contextsize);
|
|
||||||
|
|
||||||
err = read_packet_header (f, &type, &len);
|
err = read_packet_header (f, &type, &len);
|
||||||
|
|
||||||
@@ -215,7 +246,11 @@ grub_load_public_key (grub_file_t f)
|
|||||||
if (type == 0xfe)
|
if (type == 0xfe)
|
||||||
continue;
|
continue;
|
||||||
if (type == 0xff)
|
if (type == 0xff)
|
||||||
|
{
|
||||||
|
grub_free (fingerprint_context);
|
||||||
|
grub_free (buffer);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
grub_dprintf ("crypt", "len = %x\n", (int) len);
|
grub_dprintf ("crypt", "len = %x\n", (int) len);
|
||||||
|
|
||||||
@@ -279,7 +314,6 @@ grub_load_public_key (grub_file_t f)
|
|||||||
{
|
{
|
||||||
grub_uint16_t l;
|
grub_uint16_t l;
|
||||||
grub_size_t lb;
|
grub_size_t lb;
|
||||||
grub_uint8_t buffer[4096];
|
|
||||||
if (grub_file_read (f, &l, sizeof (l)) != sizeof (l))
|
if (grub_file_read (f, &l, sizeof (l)) != sizeof (l))
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
||||||
@@ -287,7 +321,7 @@ grub_load_public_key (grub_file_t f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lb = (grub_be_to_cpu16 (l) + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT;
|
lb = (grub_be_to_cpu16 (l) + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT;
|
||||||
if (lb > sizeof (buffer) - sizeof (grub_uint16_t))
|
if (lb > READBUF_SIZE - sizeof (grub_uint16_t))
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -322,6 +356,8 @@ grub_load_public_key (grub_file_t f)
|
|||||||
}
|
}
|
||||||
fail:
|
fail:
|
||||||
free_pk (ret);
|
free_pk (ret);
|
||||||
|
grub_free (fingerprint_context);
|
||||||
|
grub_free (buffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,6 +387,51 @@ grub_crypto_pk_locate_subkey_in_trustdb (grub_uint64_t keyid)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
dsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval,
|
||||||
|
const gcry_md_spec_t *hash, struct grub_public_subkey *sk)
|
||||||
|
{
|
||||||
|
unsigned nbits = gcry_mpi_get_nbits (sk->mpis[1]);
|
||||||
|
grub_dprintf ("crypt", "must be %u bits got %d bits\n", nbits,
|
||||||
|
(int)(8 * hash->mdlen));
|
||||||
|
return gcry_mpi_scan (hmpi, GCRYMPI_FMT_USG, hval,
|
||||||
|
nbits / 8 < (unsigned) hash->mdlen ? nbits / 8
|
||||||
|
: (unsigned) hash->mdlen, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
rsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval,
|
||||||
|
const gcry_md_spec_t *hash, struct grub_public_subkey *sk)
|
||||||
|
{
|
||||||
|
grub_size_t tlen, emlen, fflen;
|
||||||
|
grub_uint8_t *em, *emptr;
|
||||||
|
unsigned nbits = gcry_mpi_get_nbits (sk->mpis[0]);
|
||||||
|
int ret;
|
||||||
|
tlen = hash->mdlen + hash->asnlen;
|
||||||
|
emlen = (nbits + 7) / 8;
|
||||||
|
if (emlen < tlen + 11)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
em = grub_malloc (emlen);
|
||||||
|
if (!em)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
em[0] = 0x00;
|
||||||
|
em[1] = 0x01;
|
||||||
|
fflen = emlen - tlen - 3;
|
||||||
|
for (emptr = em + 2; emptr < em + 2 + fflen; emptr++)
|
||||||
|
*emptr = 0xff;
|
||||||
|
*emptr++ = 0x00;
|
||||||
|
grub_memcpy (emptr, hash->asnoid, hash->asnlen);
|
||||||
|
emptr += hash->asnlen;
|
||||||
|
grub_memcpy (emptr, hval, hash->mdlen);
|
||||||
|
|
||||||
|
ret = gcry_mpi_scan (hmpi, GCRYMPI_FMT_USG, em, emlen, 0);
|
||||||
|
grub_free (em);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_verify_signature_real (char *buf, grub_size_t size,
|
grub_verify_signature_real (char *buf, grub_size_t size,
|
||||||
grub_file_t f, grub_file_t sig,
|
grub_file_t f, grub_file_t sig,
|
||||||
@@ -404,7 +485,7 @@ grub_verify_signature_real (char *buf, grub_size_t size,
|
|||||||
grub_dprintf ("crypt", "alive\n");
|
grub_dprintf ("crypt", "alive\n");
|
||||||
|
|
||||||
{
|
{
|
||||||
GRUB_PROPERLY_ALIGNED_ARRAY (context, hash->contextsize);
|
void *context = NULL;
|
||||||
unsigned char *hval;
|
unsigned char *hval;
|
||||||
grub_ssize_t rem = grub_be_to_cpu16 (v4.hashed_sub);
|
grub_ssize_t rem = grub_be_to_cpu16 (v4.hashed_sub);
|
||||||
grub_uint32_t headlen = grub_cpu_to_be32 (rem + 6);
|
grub_uint32_t headlen = grub_cpu_to_be32 (rem + 6);
|
||||||
@@ -415,18 +496,22 @@ grub_verify_signature_real (char *buf, grub_size_t size,
|
|||||||
gcry_mpi_t hmpi;
|
gcry_mpi_t hmpi;
|
||||||
grub_uint64_t keyid = 0;
|
grub_uint64_t keyid = 0;
|
||||||
struct grub_public_subkey *sk;
|
struct grub_public_subkey *sk;
|
||||||
|
grub_uint8_t *readbuf = NULL;
|
||||||
|
|
||||||
|
context = grub_zalloc (hash->contextsize);
|
||||||
|
readbuf = grub_zalloc (READBUF_SIZE);
|
||||||
|
if (!context || !readbuf)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
grub_memset (context, 0, sizeof (context));
|
|
||||||
hash->init (context);
|
hash->init (context);
|
||||||
if (buf)
|
if (buf)
|
||||||
hash->write (context, buf, size);
|
hash->write (context, buf, size);
|
||||||
else
|
else
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
grub_uint8_t readbuf[4096];
|
r = grub_file_read (f, readbuf, READBUF_SIZE);
|
||||||
r = grub_file_read (f, readbuf, sizeof (readbuf));
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return grub_errno;
|
goto fail;
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
break;
|
break;
|
||||||
hash->write (context, readbuf, r);
|
hash->write (context, readbuf, r);
|
||||||
@@ -436,10 +521,10 @@ grub_verify_signature_real (char *buf, grub_size_t size,
|
|||||||
hash->write (context, &v4, sizeof (v4));
|
hash->write (context, &v4, sizeof (v4));
|
||||||
while (rem)
|
while (rem)
|
||||||
{
|
{
|
||||||
grub_uint8_t readbuf[4096];
|
r = grub_file_read (sig, readbuf,
|
||||||
r = grub_file_read (sig, readbuf, rem < (grub_ssize_t) sizeof (readbuf) ? rem : (grub_ssize_t) sizeof (readbuf));
|
rem < READBUF_SIZE ? rem : READBUF_SIZE);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
goto fail;
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
break;
|
break;
|
||||||
hash->write (context, readbuf, r);
|
hash->write (context, readbuf, r);
|
||||||
@@ -451,17 +536,16 @@ grub_verify_signature_real (char *buf, grub_size_t size,
|
|||||||
hash->write (context, &headlen, sizeof (headlen));
|
hash->write (context, &headlen, sizeof (headlen));
|
||||||
r = grub_file_read (sig, &unhashed_sub, sizeof (unhashed_sub));
|
r = grub_file_read (sig, &unhashed_sub, sizeof (unhashed_sub));
|
||||||
if (r != sizeof (unhashed_sub))
|
if (r != sizeof (unhashed_sub))
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
goto fail;
|
||||||
{
|
{
|
||||||
grub_uint8_t readbuf[4096];
|
|
||||||
grub_uint8_t *ptr;
|
grub_uint8_t *ptr;
|
||||||
grub_uint32_t l;
|
grub_uint32_t l;
|
||||||
rem = grub_be_to_cpu16 (unhashed_sub);
|
rem = grub_be_to_cpu16 (unhashed_sub);
|
||||||
if (rem > (int) sizeof (readbuf))
|
if (rem > READBUF_SIZE)
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
goto fail;
|
||||||
r = grub_file_read (sig, readbuf, rem);
|
r = grub_file_read (sig, readbuf, rem);
|
||||||
if (r != rem)
|
if (r != rem)
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
goto fail;
|
||||||
for (ptr = readbuf; ptr < readbuf + rem; ptr += l)
|
for (ptr = readbuf; ptr < readbuf + rem; ptr += l)
|
||||||
{
|
{
|
||||||
if (*ptr < 192)
|
if (*ptr < 192)
|
||||||
@@ -492,9 +576,9 @@ grub_verify_signature_real (char *buf, grub_size_t size,
|
|||||||
hval = hash->read (context);
|
hval = hash->read (context);
|
||||||
|
|
||||||
if (grub_file_read (sig, hash_start, sizeof (hash_start)) != sizeof (hash_start))
|
if (grub_file_read (sig, hash_start, sizeof (hash_start)) != sizeof (hash_start))
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
goto fail;
|
||||||
if (grub_memcmp (hval, hash_start, sizeof (hash_start)) != 0)
|
if (grub_memcmp (hval, hash_start, sizeof (hash_start)) != 0)
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
goto fail;
|
||||||
|
|
||||||
grub_dprintf ("crypt", "@ %x\n", (int)grub_file_tell (sig));
|
grub_dprintf ("crypt", "@ %x\n", (int)grub_file_tell (sig));
|
||||||
|
|
||||||
@@ -502,25 +586,24 @@ grub_verify_signature_real (char *buf, grub_size_t size,
|
|||||||
{
|
{
|
||||||
grub_uint16_t l;
|
grub_uint16_t l;
|
||||||
grub_size_t lb;
|
grub_size_t lb;
|
||||||
grub_uint8_t buffer[4096];
|
|
||||||
grub_dprintf ("crypt", "alive\n");
|
grub_dprintf ("crypt", "alive\n");
|
||||||
if (grub_file_read (sig, &l, sizeof (l)) != sizeof (l))
|
if (grub_file_read (sig, &l, sizeof (l)) != sizeof (l))
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
goto fail;
|
||||||
grub_dprintf ("crypt", "alive\n");
|
grub_dprintf ("crypt", "alive\n");
|
||||||
lb = (grub_be_to_cpu16 (l) + 7) / 8;
|
lb = (grub_be_to_cpu16 (l) + 7) / 8;
|
||||||
grub_dprintf ("crypt", "l = 0x%04x\n", grub_be_to_cpu16 (l));
|
grub_dprintf ("crypt", "l = 0x%04x\n", grub_be_to_cpu16 (l));
|
||||||
if (lb > sizeof (buffer) - sizeof (grub_uint16_t))
|
if (lb > READBUF_SIZE - sizeof (grub_uint16_t))
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
goto fail;
|
||||||
grub_dprintf ("crypt", "alive\n");
|
grub_dprintf ("crypt", "alive\n");
|
||||||
if (grub_file_read (sig, buffer + sizeof (grub_uint16_t), lb) != (grub_ssize_t) lb)
|
if (grub_file_read (sig, readbuf + sizeof (grub_uint16_t), lb) != (grub_ssize_t) lb)
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
goto fail;
|
||||||
grub_dprintf ("crypt", "alive\n");
|
grub_dprintf ("crypt", "alive\n");
|
||||||
grub_memcpy (buffer, &l, sizeof (l));
|
grub_memcpy (readbuf, &l, sizeof (l));
|
||||||
grub_dprintf ("crypt", "alive\n");
|
grub_dprintf ("crypt", "alive\n");
|
||||||
|
|
||||||
if (gcry_mpi_scan (&mpis[i], GCRYMPI_FMT_PGP,
|
if (gcry_mpi_scan (&mpis[i], GCRYMPI_FMT_PGP,
|
||||||
buffer, lb + sizeof (grub_uint16_t), 0))
|
readbuf, lb + sizeof (grub_uint16_t), 0))
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
goto fail;
|
||||||
grub_dprintf ("crypt", "alive\n");
|
grub_dprintf ("crypt", "alive\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,24 +612,42 @@ grub_verify_signature_real (char *buf, grub_size_t size,
|
|||||||
else
|
else
|
||||||
sk = grub_crypto_pk_locate_subkey_in_trustdb (keyid);
|
sk = grub_crypto_pk_locate_subkey_in_trustdb (keyid);
|
||||||
if (!sk)
|
if (!sk)
|
||||||
|
{
|
||||||
/* TRANSLATORS: %08x is 32-bit key id. */
|
/* TRANSLATORS: %08x is 32-bit key id. */
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("public key %08x not found"), keyid);
|
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("public key %08x not found"),
|
||||||
|
keyid);
|
||||||
unsigned nbits = gcry_mpi_get_nbits (sk->mpis[1]);
|
goto fail;
|
||||||
grub_dprintf ("crypt", "must be %u bits got %d bits\n", nbits,
|
|
||||||
(int)(8 * hash->mdlen));
|
|
||||||
|
|
||||||
if (gcry_mpi_scan (&hmpi, GCRYMPI_FMT_USG, hval,
|
|
||||||
nbits / 8 < (unsigned) hash->mdlen ? nbits / 8
|
|
||||||
: (unsigned) hash->mdlen, 0))
|
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
|
||||||
if (!grub_crypto_pk_dsa)
|
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("module `%s' isn't loaded"), "gcry_dsa");
|
|
||||||
if (grub_crypto_pk_dsa->verify (0, hmpi, mpis, sk->mpis, 0, 0))
|
|
||||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pkalgos[pk].pad (&hmpi, hval, hash, sk))
|
||||||
|
goto fail;
|
||||||
|
if (!*pkalgos[pk].algo)
|
||||||
|
{
|
||||||
|
grub_dl_load (pkalgos[pk].module);
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!*pkalgos[pk].algo)
|
||||||
|
{
|
||||||
|
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("module `%s' isn't loaded"),
|
||||||
|
pkalgos[pk].module);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
if ((*pkalgos[pk].algo)->verify (0, hmpi, mpis, sk->mpis, 0, 0))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
grub_free (context);
|
||||||
|
grub_free (readbuf);
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
grub_free (context);
|
||||||
|
grub_free (readbuf);
|
||||||
|
if (!grub_errno)
|
||||||
|
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_err_t
|
grub_err_t
|
||||||
@@ -643,8 +744,8 @@ static grub_err_t
|
|||||||
grub_cmd_verify_signature (grub_extcmd_context_t ctxt,
|
grub_cmd_verify_signature (grub_extcmd_context_t ctxt,
|
||||||
int argc, char **args)
|
int argc, char **args)
|
||||||
{
|
{
|
||||||
grub_file_t f, sig;
|
grub_file_t f = NULL, sig = NULL;
|
||||||
grub_err_t err;
|
grub_err_t err = GRUB_ERR_NONE;
|
||||||
struct grub_public_key *pk = NULL;
|
struct grub_public_key *pk = NULL;
|
||||||
|
|
||||||
grub_dprintf ("crypt", "alive\n");
|
grub_dprintf ("crypt", "alive\n");
|
||||||
@@ -675,19 +776,27 @@ grub_cmd_verify_signature (grub_extcmd_context_t ctxt,
|
|||||||
grub_file_filter_disable_all ();
|
grub_file_filter_disable_all ();
|
||||||
f = grub_file_open (args[0]);
|
f = grub_file_open (args[0]);
|
||||||
if (!f)
|
if (!f)
|
||||||
return grub_errno;
|
{
|
||||||
|
err = grub_errno;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
grub_file_filter_disable_all ();
|
grub_file_filter_disable_all ();
|
||||||
sig = grub_file_open (args[1]);
|
sig = grub_file_open (args[1]);
|
||||||
if (!sig)
|
if (!sig)
|
||||||
{
|
{
|
||||||
grub_file_close (f);
|
err = grub_errno;
|
||||||
return grub_errno;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = grub_verify_signature (f, sig, pk);
|
err = grub_verify_signature (f, sig, pk);
|
||||||
grub_file_close (f);
|
fail:
|
||||||
|
if (sig)
|
||||||
grub_file_close (sig);
|
grub_file_close (sig);
|
||||||
|
if (f)
|
||||||
|
grub_file_close (f);
|
||||||
|
if (pk)
|
||||||
|
free_pk (pk);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,9 +912,6 @@ struct grub_fs pseudo_fs =
|
|||||||
.read = pseudo_read
|
.read = pseudo_read
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gcry_pk_spec *grub_crypto_pk_dsa;
|
|
||||||
struct gcry_pk_spec *grub_crypto_pk_ecdsa;
|
|
||||||
struct gcry_pk_spec *grub_crypto_pk_rsa;
|
|
||||||
|
|
||||||
static grub_extcmd_t cmd, cmd_trust;
|
static grub_extcmd_t cmd, cmd_trust;
|
||||||
static grub_command_t cmd_distrust, cmd_list;
|
static grub_command_t cmd_distrust, cmd_list;
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
#include <grub/xen.h>
|
||||||
|
#include <grub/term.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
|
static int
|
||||||
|
hook (const char *dir, void *hook_data __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
grub_printf ("%s\n", dir);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_lsxen (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
int argc, char **args)
|
||||||
|
{
|
||||||
|
char *dir;
|
||||||
|
grub_err_t err;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
if (argc >= 1)
|
||||||
|
return grub_xenstore_dir (args[0], hook, NULL);
|
||||||
|
|
||||||
|
buf = grub_xenstore_get_file ("domid", NULL);
|
||||||
|
if (!buf)
|
||||||
|
return grub_errno;
|
||||||
|
dir = grub_xasprintf ("/local/domain/%s", buf);
|
||||||
|
grub_free (buf);
|
||||||
|
err = grub_xenstore_dir (dir, hook, NULL);
|
||||||
|
grub_free (dir);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_catxen (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
int argc, char **args)
|
||||||
|
{
|
||||||
|
const char *dir = "domid";
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
if (argc >= 1)
|
||||||
|
dir = args[0];
|
||||||
|
|
||||||
|
buf = grub_xenstore_get_file (dir, NULL);
|
||||||
|
if (!buf)
|
||||||
|
return grub_errno;
|
||||||
|
grub_xputs (buf);
|
||||||
|
grub_xputs ("\n");
|
||||||
|
grub_free (buf);
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_command_t cmd_ls, cmd_cat;
|
||||||
|
|
||||||
|
GRUB_MOD_INIT (lsxen)
|
||||||
|
{
|
||||||
|
cmd_ls = grub_register_command ("xen_ls", grub_cmd_lsxen, "[DIR]",
|
||||||
|
N_("List XEN storage."));
|
||||||
|
cmd_cat = grub_register_command ("xen_cat", grub_cmd_catxen, "[DIR]",
|
||||||
|
N_("List XEN storage."));
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI (lsxen)
|
||||||
|
{
|
||||||
|
grub_unregister_command (cmd_ls);
|
||||||
|
grub_unregister_command (cmd_cat);
|
||||||
|
}
|
||||||
@@ -50,7 +50,7 @@ grub_cmd_xnu_uuid (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
grub_uint8_t *xnu_uuid;
|
grub_uint8_t *xnu_uuid;
|
||||||
char uuid_string[sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")];
|
char uuid_string[sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
grub_uint8_t ctx[GRUB_MD_MD5->contextsize];
|
void *ctx;
|
||||||
int low = 0;
|
int low = 0;
|
||||||
|
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
@@ -65,11 +65,14 @@ grub_cmd_xnu_uuid (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
|
|
||||||
serial = grub_cpu_to_be64 (grub_strtoull (args[0], 0, 16));
|
serial = grub_cpu_to_be64 (grub_strtoull (args[0], 0, 16));
|
||||||
|
|
||||||
GRUB_MD_MD5->init (&ctx);
|
ctx = grub_zalloc (GRUB_MD_MD5->contextsize);
|
||||||
GRUB_MD_MD5->write (&ctx, hash_prefix, sizeof (hash_prefix));
|
if (!ctx)
|
||||||
GRUB_MD_MD5->write (&ctx, &serial, sizeof (serial));
|
return grub_errno;
|
||||||
GRUB_MD_MD5->final (&ctx);
|
GRUB_MD_MD5->init (ctx);
|
||||||
xnu_uuid = GRUB_MD_MD5->read (&ctx);
|
GRUB_MD_MD5->write (ctx, hash_prefix, sizeof (hash_prefix));
|
||||||
|
GRUB_MD_MD5->write (ctx, &serial, sizeof (serial));
|
||||||
|
GRUB_MD_MD5->final (ctx);
|
||||||
|
xnu_uuid = GRUB_MD_MD5->read (ctx);
|
||||||
|
|
||||||
grub_snprintf (uuid_string, sizeof (uuid_string),
|
grub_snprintf (uuid_string, sizeof (uuid_string),
|
||||||
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||||
@@ -91,6 +94,8 @@ grub_cmd_xnu_uuid (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
grub_env_set (args[1], uuid_string);
|
grub_env_set (args[1], uuid_string);
|
||||||
|
|
||||||
|
grub_free (ctx);
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ diffuse (const gcry_md_spec_t * hash, grub_uint8_t * src,
|
|||||||
|
|
||||||
grub_size_t fullblocks = size / hash->mdlen;
|
grub_size_t fullblocks = size / hash->mdlen;
|
||||||
int padding = size % hash->mdlen;
|
int padding = size % hash->mdlen;
|
||||||
grub_uint8_t final[hash->mdlen];
|
grub_uint8_t final[GRUB_CRYPTO_MAX_MDLEN];
|
||||||
grub_uint8_t temp[sizeof (IV) + hash->mdlen];
|
grub_uint8_t temp[sizeof (IV) + GRUB_CRYPTO_MAX_MDLEN];
|
||||||
|
|
||||||
/* hash block the whole data set with different IVs to produce
|
/* hash block the whole data set with different IVs to produce
|
||||||
* more than just a single data block
|
* more than just a single data block
|
||||||
@@ -76,6 +76,9 @@ AF_merge (const gcry_md_spec_t * hash, grub_uint8_t * src, grub_uint8_t * dst,
|
|||||||
if (bufblock == NULL)
|
if (bufblock == NULL)
|
||||||
return GPG_ERR_OUT_OF_MEMORY;
|
return GPG_ERR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN)
|
||||||
|
return GPG_ERR_INV_ARG;
|
||||||
|
|
||||||
grub_memset (bufblock, 0, blocksize);
|
grub_memset (bufblock, 0, blocksize);
|
||||||
for (i = 0; i < blocknumbers - 1; i++)
|
for (i = 0; i < blocknumbers - 1; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ struct grub_ahci_device
|
|||||||
volatile struct grub_ahci_cmd_table *command_table;
|
volatile struct grub_ahci_cmd_table *command_table;
|
||||||
struct grub_pci_dma_chunk *rfis;
|
struct grub_pci_dma_chunk *rfis;
|
||||||
int present;
|
int present;
|
||||||
|
int atapi;
|
||||||
};
|
};
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
@@ -616,6 +617,10 @@ grub_ahci_pciinit (grub_pci_device_t dev,
|
|||||||
grub_dma_free (failed_adevs[i]->rfis);
|
grub_dma_free (failed_adevs[i]->rfis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < nports; i++)
|
||||||
|
if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].sig >> 16) == 0xeb14)
|
||||||
|
adevs[i]->atapi = 1;
|
||||||
|
|
||||||
for (i = 0; i < nports; i++)
|
for (i = 0; i < nports; i++)
|
||||||
if (adevs[i])
|
if (adevs[i])
|
||||||
{
|
{
|
||||||
@@ -1075,6 +1080,7 @@ grub_ahci_open (int id, int devnum, struct grub_ata *ata)
|
|||||||
|
|
||||||
ata->data = dev;
|
ata->data = dev;
|
||||||
ata->dma = 1;
|
ata->dma = 1;
|
||||||
|
ata->atapi = dev->atapi;
|
||||||
ata->maxbuffer = GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH;
|
ata->maxbuffer = GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH;
|
||||||
ata->present = &dev->present;
|
ata->present = &dev->present;
|
||||||
|
|
||||||
|
|||||||
+12
-8
@@ -108,6 +108,9 @@ grub_ata_identify (struct grub_ata *dev)
|
|||||||
grub_uint16_t *info16;
|
grub_uint16_t *info16;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
|
||||||
|
if (dev->atapi)
|
||||||
|
return grub_atapi_identify (dev);
|
||||||
|
|
||||||
info64 = grub_malloc (GRUB_DISK_SECTOR_SIZE);
|
info64 = grub_malloc (GRUB_DISK_SECTOR_SIZE);
|
||||||
info32 = (grub_uint32_t *) info64;
|
info32 = (grub_uint32_t *) info64;
|
||||||
info16 = (grub_uint16_t *) info64;
|
info16 = (grub_uint16_t *) info64;
|
||||||
@@ -285,7 +288,6 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
|
|||||||
|
|
||||||
if (addressing == GRUB_ATA_LBA48 && ((sector + size) >> 28) != 0)
|
if (addressing == GRUB_ATA_LBA48 && ((sector + size) >> 28) != 0)
|
||||||
{
|
{
|
||||||
batch = 65536;
|
|
||||||
if (ata->dma)
|
if (ata->dma)
|
||||||
{
|
{
|
||||||
cmd = GRUB_ATA_CMD_READ_SECTORS_DMA_EXT;
|
cmd = GRUB_ATA_CMD_READ_SECTORS_DMA_EXT;
|
||||||
@@ -301,10 +303,6 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
|
|||||||
{
|
{
|
||||||
if (addressing == GRUB_ATA_LBA48)
|
if (addressing == GRUB_ATA_LBA48)
|
||||||
addressing = GRUB_ATA_LBA;
|
addressing = GRUB_ATA_LBA;
|
||||||
if (addressing != GRUB_ATA_CHS)
|
|
||||||
batch = 256;
|
|
||||||
else
|
|
||||||
batch = 1;
|
|
||||||
if (ata->dma)
|
if (ata->dma)
|
||||||
{
|
{
|
||||||
cmd = GRUB_ATA_CMD_READ_SECTORS_DMA;
|
cmd = GRUB_ATA_CMD_READ_SECTORS_DMA;
|
||||||
@@ -317,8 +315,10 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (batch > (ata->maxbuffer >> ata->log_sector_size))
|
if (addressing != GRUB_ATA_CHS)
|
||||||
batch = (ata->maxbuffer >> ata->log_sector_size);
|
batch = 256;
|
||||||
|
else
|
||||||
|
batch = 1;
|
||||||
|
|
||||||
while (nsectors < size)
|
while (nsectors < size)
|
||||||
{
|
{
|
||||||
@@ -366,7 +366,7 @@ grub_ata_real_open (int id, int bus)
|
|||||||
struct grub_ata *ata;
|
struct grub_ata *ata;
|
||||||
grub_ata_dev_t p;
|
grub_ata_dev_t p;
|
||||||
|
|
||||||
ata = grub_malloc (sizeof (*ata));
|
ata = grub_zalloc (sizeof (*ata));
|
||||||
if (!ata)
|
if (!ata)
|
||||||
return NULL;
|
return NULL;
|
||||||
for (p = grub_ata_dev_list; p; p = p->next)
|
for (p = grub_ata_dev_list; p; p = p->next)
|
||||||
@@ -464,6 +464,10 @@ grub_ata_open (const char *name, grub_disk_t disk)
|
|||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not an ATA harddisk");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not an ATA harddisk");
|
||||||
|
|
||||||
disk->total_sectors = ata->size;
|
disk->total_sectors = ata->size;
|
||||||
|
disk->max_agglomerate = (ata->maxbuffer >> (GRUB_DISK_CACHE_BITS + GRUB_DISK_SECTOR_BITS));
|
||||||
|
if (disk->max_agglomerate > (256U >> (GRUB_DISK_CACHE_BITS + GRUB_DISK_SECTOR_BITS - ata->log_sector_size)))
|
||||||
|
disk->max_agglomerate = (256U >> (GRUB_DISK_CACHE_BITS + GRUB_DISK_SECTOR_BITS - ata->log_sector_size));
|
||||||
|
|
||||||
disk->log_sector_size = ata->log_sector_size;
|
disk->log_sector_size = ata->log_sector_size;
|
||||||
|
|
||||||
disk->id = grub_make_scsi_id (id, bus, 0);
|
disk->id = grub_make_scsi_id (id, bus, 0);
|
||||||
|
|||||||
@@ -109,7 +109,9 @@ grub_crypto_pcbc_decrypt (grub_crypto_cipher_handle_t cipher,
|
|||||||
void *iv)
|
void *iv)
|
||||||
{
|
{
|
||||||
grub_uint8_t *inptr, *outptr, *end;
|
grub_uint8_t *inptr, *outptr, *end;
|
||||||
grub_uint8_t ivt[cipher->cipher->blocksize];
|
grub_uint8_t ivt[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE];
|
||||||
|
if (cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE)
|
||||||
|
return GPG_ERR_INV_ARG;
|
||||||
if (!cipher->cipher->decrypt)
|
if (!cipher->cipher->decrypt)
|
||||||
return GPG_ERR_NOT_SUPPORTED;
|
return GPG_ERR_NOT_SUPPORTED;
|
||||||
if (size % cipher->cipher->blocksize != 0)
|
if (size % cipher->cipher->blocksize != 0)
|
||||||
@@ -132,7 +134,9 @@ grub_crypto_pcbc_encrypt (grub_crypto_cipher_handle_t cipher,
|
|||||||
void *iv)
|
void *iv)
|
||||||
{
|
{
|
||||||
grub_uint8_t *inptr, *outptr, *end;
|
grub_uint8_t *inptr, *outptr, *end;
|
||||||
grub_uint8_t ivt[cipher->cipher->blocksize];
|
grub_uint8_t ivt[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE];
|
||||||
|
if (cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE)
|
||||||
|
return GPG_ERR_INV_ARG;
|
||||||
if (!cipher->cipher->decrypt)
|
if (!cipher->cipher->decrypt)
|
||||||
return GPG_ERR_NOT_SUPPORTED;
|
return GPG_ERR_NOT_SUPPORTED;
|
||||||
if (size % cipher->cipher->blocksize != 0)
|
if (size % cipher->cipher->blocksize != 0)
|
||||||
@@ -218,6 +222,9 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
|||||||
grub_size_t i;
|
grub_size_t i;
|
||||||
gcry_err_code_t err;
|
gcry_err_code_t err;
|
||||||
|
|
||||||
|
if (dev->cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE)
|
||||||
|
return GPG_ERR_INV_ARG;
|
||||||
|
|
||||||
/* The only mode without IV. */
|
/* The only mode without IV. */
|
||||||
if (dev->mode == GRUB_CRYPTODISK_MODE_ECB && !dev->rekey)
|
if (dev->mode == GRUB_CRYPTODISK_MODE_ECB && !dev->rekey)
|
||||||
return (do_encrypt ? grub_crypto_ecb_encrypt (dev->cipher, data, data, len)
|
return (do_encrypt ? grub_crypto_ecb_encrypt (dev->cipher, data, data, len)
|
||||||
@@ -228,7 +235,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
|||||||
grub_size_t sz = ((dev->cipher->cipher->blocksize
|
grub_size_t sz = ((dev->cipher->cipher->blocksize
|
||||||
+ sizeof (grub_uint32_t) - 1)
|
+ sizeof (grub_uint32_t) - 1)
|
||||||
/ sizeof (grub_uint32_t));
|
/ sizeof (grub_uint32_t));
|
||||||
grub_uint32_t iv[sz];
|
grub_uint32_t iv[(GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE + 3) / 4];
|
||||||
|
|
||||||
if (dev->rekey)
|
if (dev->rekey)
|
||||||
{
|
{
|
||||||
@@ -242,7 +249,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_memset (iv, 0, sz * sizeof (iv[0]));
|
grub_memset (iv, 0, sizeof (iv));
|
||||||
switch (dev->mode_iv)
|
switch (dev->mode_iv)
|
||||||
{
|
{
|
||||||
case GRUB_CRYPTODISK_MODE_IV_NULL:
|
case GRUB_CRYPTODISK_MODE_IV_NULL:
|
||||||
@@ -250,9 +257,11 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
|||||||
case GRUB_CRYPTODISK_MODE_IV_BYTECOUNT64_HASH:
|
case GRUB_CRYPTODISK_MODE_IV_BYTECOUNT64_HASH:
|
||||||
{
|
{
|
||||||
grub_uint64_t tmp;
|
grub_uint64_t tmp;
|
||||||
GRUB_PROPERLY_ALIGNED_ARRAY (ctx, dev->iv_hash->contextsize);
|
void *ctx;
|
||||||
|
|
||||||
grub_memset (ctx, 0, sizeof (ctx));
|
ctx = grub_zalloc (dev->iv_hash->contextsize);
|
||||||
|
if (!ctx)
|
||||||
|
return GPG_ERR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
tmp = grub_cpu_to_le64 (sector << dev->log_sector_size);
|
tmp = grub_cpu_to_le64 (sector << dev->log_sector_size);
|
||||||
dev->iv_hash->init (ctx);
|
dev->iv_hash->init (ctx);
|
||||||
@@ -261,6 +270,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
|||||||
dev->iv_hash->final (ctx);
|
dev->iv_hash->final (ctx);
|
||||||
|
|
||||||
grub_memcpy (iv, dev->iv_hash->read (ctx), sizeof (iv));
|
grub_memcpy (iv, dev->iv_hash->read (ctx), sizeof (iv));
|
||||||
|
grub_free (ctx);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GRUB_CRYPTODISK_MODE_IV_PLAIN64:
|
case GRUB_CRYPTODISK_MODE_IV_PLAIN64:
|
||||||
@@ -407,7 +417,9 @@ grub_cryptodisk_setkey (grub_cryptodisk_t dev, grub_uint8_t *key, grub_size_t ke
|
|||||||
if (dev->mode_iv == GRUB_CRYPTODISK_MODE_IV_ESSIV)
|
if (dev->mode_iv == GRUB_CRYPTODISK_MODE_IV_ESSIV)
|
||||||
{
|
{
|
||||||
grub_size_t essiv_keysize = dev->essiv_hash->mdlen;
|
grub_size_t essiv_keysize = dev->essiv_hash->mdlen;
|
||||||
grub_uint8_t hashed_key[essiv_keysize];
|
grub_uint8_t hashed_key[GRUB_CRYPTO_MAX_MDLEN];
|
||||||
|
if (essiv_keysize > GRUB_CRYPTO_MAX_MDLEN)
|
||||||
|
return GPG_ERR_INV_ARG;
|
||||||
|
|
||||||
grub_crypto_hash (dev->essiv_hash, hashed_key, key, keysize);
|
grub_crypto_hash (dev->essiv_hash, hashed_key, key, keysize);
|
||||||
err = grub_crypto_cipher_set_key (dev->essiv_cipher,
|
err = grub_crypto_cipher_set_key (dev->essiv_cipher,
|
||||||
@@ -517,6 +529,7 @@ grub_cryptodisk_open (const char *name, grub_disk_t disk)
|
|||||||
|
|
||||||
disk->data = dev;
|
disk->data = dev;
|
||||||
disk->total_sectors = dev->total_length;
|
disk->total_sectors = dev->total_length;
|
||||||
|
disk->max_agglomerate = GRUB_DISK_MAX_MAX_AGGLOMERATE;
|
||||||
disk->id = dev->id;
|
disk->id = dev->id;
|
||||||
dev->ref++;
|
dev->ref++;
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
@@ -998,12 +1011,14 @@ hex (grub_uint8_t val)
|
|||||||
|
|
||||||
/* Open a file named NAME and initialize FILE. */
|
/* Open a file named NAME and initialize FILE. */
|
||||||
static char *
|
static char *
|
||||||
luks_script_get (void)
|
luks_script_get (grub_size_t *sz)
|
||||||
{
|
{
|
||||||
grub_cryptodisk_t i;
|
grub_cryptodisk_t i;
|
||||||
grub_size_t size = 0;
|
grub_size_t size = 0;
|
||||||
char *ptr, *ret;
|
char *ptr, *ret;
|
||||||
|
|
||||||
|
*sz = 0;
|
||||||
|
|
||||||
for (i = cryptodisk_list; i != NULL; i = i->next)
|
for (i = cryptodisk_list; i != NULL; i = i->next)
|
||||||
if (grub_strcmp (i->modname, "luks") == 0)
|
if (grub_strcmp (i->modname, "luks") == 0)
|
||||||
{
|
{
|
||||||
@@ -1085,6 +1100,7 @@ luks_script_get (void)
|
|||||||
*ptr++ = '\n';
|
*ptr++ = '\n';
|
||||||
}
|
}
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
|
*sz = ptr - ret;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -445,6 +445,7 @@ grub_diskfilter_open (const char *name, grub_disk_t disk)
|
|||||||
disk->data = lv;
|
disk->data = lv;
|
||||||
|
|
||||||
disk->total_sectors = lv->size;
|
disk->total_sectors = lv->size;
|
||||||
|
disk->max_agglomerate = GRUB_DISK_MAX_MAX_AGGLOMERATE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -933,7 +934,7 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb,
|
|||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
totsize = (nmemb - level / 3) * disk_size;
|
totsize = (nmemb - ((unsigned) level / 3U)) * disk_size;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -518,6 +518,8 @@ grub_efidisk_open (const char *name, struct grub_disk *disk)
|
|||||||
grub_dprintf ("efidisk", "m = %p, last block = %llx, block size = %x\n",
|
grub_dprintf ("efidisk", "m = %p, last block = %llx, block size = %x\n",
|
||||||
m, (unsigned long long) m->last_block, m->block_size);
|
m, (unsigned long long) m->last_block, m->block_size);
|
||||||
disk->total_sectors = m->last_block + 1;
|
disk->total_sectors = m->last_block + 1;
|
||||||
|
/* Don't increase this value due to bug in some EFI. */
|
||||||
|
disk->max_agglomerate = 0xa0000 >> (GRUB_DISK_CACHE_BITS + GRUB_DISK_SECTOR_BITS);
|
||||||
if (m->block_size & (m->block_size - 1) || !m->block_size)
|
if (m->block_size & (m->block_size - 1) || !m->block_size)
|
||||||
return grub_error (GRUB_ERR_IO, "invalid sector size %d",
|
return grub_error (GRUB_ERR_IO, "invalid sector size %d",
|
||||||
m->block_size);
|
m->block_size);
|
||||||
@@ -542,32 +544,17 @@ static grub_efi_status_t
|
|||||||
grub_efidisk_readwrite (struct grub_disk *disk, grub_disk_addr_t sector,
|
grub_efidisk_readwrite (struct grub_disk *disk, grub_disk_addr_t sector,
|
||||||
grub_size_t size, char *buf, int wr)
|
grub_size_t size, char *buf, int wr)
|
||||||
{
|
{
|
||||||
/* For now, use the disk io interface rather than the block io's. */
|
|
||||||
struct grub_efidisk_data *d;
|
struct grub_efidisk_data *d;
|
||||||
grub_efi_block_io_t *bio;
|
grub_efi_block_io_t *bio;
|
||||||
grub_efi_status_t status;
|
|
||||||
|
|
||||||
d = disk->data;
|
d = disk->data;
|
||||||
bio = d->block_io;
|
bio = d->block_io;
|
||||||
|
|
||||||
while (size > 0)
|
return efi_call_5 ((wr ? bio->write_blocks : bio->read_blocks), bio,
|
||||||
{
|
|
||||||
grub_size_t len;
|
|
||||||
len = 0x500;
|
|
||||||
if (len > size)
|
|
||||||
len = size;
|
|
||||||
status = efi_call_5 ((wr ? bio->write_blocks : bio->read_blocks), bio,
|
|
||||||
bio->media->media_id,
|
bio->media->media_id,
|
||||||
(grub_efi_uint64_t) sector,
|
(grub_efi_uint64_t) sector,
|
||||||
(grub_efi_uintn_t) len << disk->log_sector_size,
|
(grub_efi_uintn_t) size << disk->log_sector_size,
|
||||||
buf);
|
buf);
|
||||||
size -= len;
|
|
||||||
buf += len << disk->log_sector_size;
|
|
||||||
sector += len;
|
|
||||||
if (status != GRUB_EFI_SUCCESS)
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
return GRUB_EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
|
|||||||
+27
-25
@@ -146,40 +146,33 @@ geli_rekey (struct grub_cryptodisk *dev, grub_uint64_t zoneno)
|
|||||||
grub_uint64_t zone;
|
grub_uint64_t zone;
|
||||||
} __attribute__ ((packed)) tohash
|
} __attribute__ ((packed)) tohash
|
||||||
= { {'e', 'k', 'e', 'y'}, grub_cpu_to_le64 (zoneno) };
|
= { {'e', 'k', 'e', 'y'}, grub_cpu_to_le64 (zoneno) };
|
||||||
GRUB_PROPERLY_ALIGNED_ARRAY (key, dev->hash->mdlen);
|
GRUB_PROPERLY_ALIGNED_ARRAY (key, GRUB_CRYPTO_MAX_MDLEN);
|
||||||
|
|
||||||
|
if (dev->hash->mdlen > GRUB_CRYPTO_MAX_MDLEN)
|
||||||
|
return GPG_ERR_INV_ARG;
|
||||||
|
|
||||||
grub_dprintf ("geli", "rekeying %" PRIuGRUB_UINT64_T " keysize=%d\n",
|
grub_dprintf ("geli", "rekeying %" PRIuGRUB_UINT64_T " keysize=%d\n",
|
||||||
zoneno, dev->rekey_derived_size);
|
zoneno, dev->rekey_derived_size);
|
||||||
gcry_err = grub_crypto_hmac_buffer (dev->hash, dev->rekey_key, 64,
|
gcry_err = grub_crypto_hmac_buffer (dev->hash, dev->rekey_key, 64,
|
||||||
&tohash, sizeof (tohash), key);
|
&tohash, sizeof (tohash), key);
|
||||||
if (gcry_err)
|
if (gcry_err)
|
||||||
return grub_crypto_gcry_error (gcry_err);
|
return gcry_err;
|
||||||
|
|
||||||
return grub_cryptodisk_setkey (dev, (grub_uint8_t *) key,
|
return grub_cryptodisk_setkey (dev, (grub_uint8_t *) key,
|
||||||
dev->rekey_derived_size);
|
dev->rekey_derived_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
|
||||||
ascii2hex (char c)
|
|
||||||
{
|
|
||||||
if (c >= '0' && c <= '9')
|
|
||||||
return c - '0';
|
|
||||||
if (c >= 'a' && c <= 'f')
|
|
||||||
return c - 'a' + 10;
|
|
||||||
if (c >= 'A' && c <= 'F')
|
|
||||||
return c - 'A' + 10;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gcry_err_code_t
|
static inline gcry_err_code_t
|
||||||
make_uuid (const struct grub_geli_phdr *header,
|
make_uuid (const struct grub_geli_phdr *header,
|
||||||
char *uuid)
|
char *uuid)
|
||||||
{
|
{
|
||||||
grub_uint8_t uuidbin[GRUB_MD_SHA256->mdlen];
|
grub_uint8_t uuidbin[GRUB_CRYPTODISK_MAX_UUID_LENGTH];
|
||||||
gcry_err_code_t err;
|
gcry_err_code_t err;
|
||||||
grub_uint8_t *iptr;
|
grub_uint8_t *iptr;
|
||||||
char *optr;
|
char *optr;
|
||||||
|
|
||||||
|
if (2 * GRUB_MD_SHA256->mdlen + 1 > GRUB_CRYPTODISK_MAX_UUID_LENGTH)
|
||||||
|
return GPG_ERR_TOO_LARGE;
|
||||||
err = grub_crypto_hmac_buffer (GRUB_MD_SHA256,
|
err = grub_crypto_hmac_buffer (GRUB_MD_SHA256,
|
||||||
header->salt, sizeof (header->salt),
|
header->salt, sizeof (header->salt),
|
||||||
"uuid", sizeof ("uuid") - 1, uuidbin);
|
"uuid", sizeof ("uuid") - 1, uuidbin);
|
||||||
@@ -187,7 +180,7 @@ make_uuid (const struct grub_geli_phdr *header,
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
optr = uuid;
|
optr = uuid;
|
||||||
for (iptr = uuidbin; iptr < &uuidbin[ARRAY_SIZE (uuidbin)]; iptr++)
|
for (iptr = uuidbin; iptr < &uuidbin[GRUB_MD_SHA256->mdlen]; iptr++)
|
||||||
{
|
{
|
||||||
grub_snprintf (optr, 3, "%02x", *iptr);
|
grub_snprintf (optr, 3, "%02x", *iptr);
|
||||||
optr += 2;
|
optr += 2;
|
||||||
@@ -254,10 +247,13 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
|||||||
const struct gcry_cipher_spec *ciph;
|
const struct gcry_cipher_spec *ciph;
|
||||||
const char *ciphername = NULL;
|
const char *ciphername = NULL;
|
||||||
gcry_err_code_t gcry_err;
|
gcry_err_code_t gcry_err;
|
||||||
char uuid[GRUB_MD_SHA256->mdlen * 2 + 1];
|
char uuid[GRUB_CRYPTODISK_MAX_UUID_LENGTH];
|
||||||
grub_disk_addr_t sector;
|
grub_disk_addr_t sector;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
|
||||||
|
if (2 * GRUB_MD_SHA256->mdlen + 1 > GRUB_CRYPTODISK_MAX_UUID_LENGTH)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
sector = grub_disk_get_size (disk);
|
sector = grub_disk_get_size (disk);
|
||||||
if (sector == GRUB_DISK_SIZE_UNKNOWN || sector == 0)
|
if (sector == GRUB_DISK_SIZE_UNKNOWN || sector == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -391,10 +387,10 @@ static grub_err_t
|
|||||||
recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
||||||
{
|
{
|
||||||
grub_size_t keysize;
|
grub_size_t keysize;
|
||||||
grub_uint8_t digest[dev->hash->mdlen];
|
grub_uint8_t digest[GRUB_CRYPTO_MAX_MDLEN];
|
||||||
grub_uint8_t geomkey[dev->hash->mdlen];
|
grub_uint8_t geomkey[GRUB_CRYPTO_MAX_MDLEN];
|
||||||
grub_uint8_t verify_key[dev->hash->mdlen];
|
grub_uint8_t verify_key[GRUB_CRYPTO_MAX_MDLEN];
|
||||||
grub_uint8_t zero[dev->cipher->cipher->blocksize];
|
grub_uint8_t zero[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE];
|
||||||
char passphrase[MAX_PASSPHRASE] = "";
|
char passphrase[MAX_PASSPHRASE] = "";
|
||||||
unsigned i;
|
unsigned i;
|
||||||
gcry_err_code_t gcry_err;
|
gcry_err_code_t gcry_err;
|
||||||
@@ -403,6 +399,12 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
|||||||
grub_disk_addr_t sector;
|
grub_disk_addr_t sector;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
|
||||||
|
if (dev->cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE)
|
||||||
|
return grub_error (GRUB_ERR_BUG, "cipher block is too long");
|
||||||
|
|
||||||
|
if (dev->hash->mdlen > GRUB_CRYPTO_MAX_MDLEN)
|
||||||
|
return grub_error (GRUB_ERR_BUG, "mdlen is too long");
|
||||||
|
|
||||||
sector = grub_disk_get_size (source);
|
sector = grub_disk_get_size (source);
|
||||||
if (sector == GRUB_DISK_SIZE_UNKNOWN || sector == 0)
|
if (sector == GRUB_DISK_SIZE_UNKNOWN || sector == 0)
|
||||||
return grub_error (GRUB_ERR_BUG, "not a geli");
|
return grub_error (GRUB_ERR_BUG, "not a geli");
|
||||||
@@ -464,12 +466,12 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gcry_err = grub_crypto_hmac_buffer (dev->hash, geomkey,
|
gcry_err = grub_crypto_hmac_buffer (dev->hash, geomkey,
|
||||||
sizeof (geomkey), "\1", 1, digest);
|
dev->hash->mdlen, "\1", 1, digest);
|
||||||
if (gcry_err)
|
if (gcry_err)
|
||||||
return grub_crypto_gcry_error (gcry_err);
|
return grub_crypto_gcry_error (gcry_err);
|
||||||
|
|
||||||
gcry_err = grub_crypto_hmac_buffer (dev->hash, geomkey,
|
gcry_err = grub_crypto_hmac_buffer (dev->hash, geomkey,
|
||||||
sizeof (geomkey), "\0", 1, verify_key);
|
dev->hash->mdlen, "\0", 1, verify_key);
|
||||||
if (gcry_err)
|
if (gcry_err)
|
||||||
return grub_crypto_gcry_error (gcry_err);
|
return grub_crypto_gcry_error (gcry_err);
|
||||||
|
|
||||||
@@ -479,7 +481,7 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
|||||||
for (i = 0; i < ARRAY_SIZE (header.keys); i++)
|
for (i = 0; i < ARRAY_SIZE (header.keys); i++)
|
||||||
{
|
{
|
||||||
struct grub_geli_key candidate_key;
|
struct grub_geli_key candidate_key;
|
||||||
grub_uint8_t key_hmac[dev->hash->mdlen];
|
grub_uint8_t key_hmac[GRUB_CRYPTO_MAX_MDLEN];
|
||||||
|
|
||||||
/* Check if keyslot is enabled. */
|
/* Check if keyslot is enabled. */
|
||||||
if (! (header.keys_used & (1 << i)))
|
if (! (header.keys_used & (1 << i)))
|
||||||
@@ -500,7 +502,7 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
|||||||
return grub_crypto_gcry_error (gcry_err);
|
return grub_crypto_gcry_error (gcry_err);
|
||||||
|
|
||||||
gcry_err = grub_crypto_hmac_buffer (dev->hash, verify_key,
|
gcry_err = grub_crypto_hmac_buffer (dev->hash, verify_key,
|
||||||
sizeof (verify_key),
|
dev->hash->mdlen,
|
||||||
&candidate_key,
|
&candidate_key,
|
||||||
(sizeof (candidate_key)
|
(sizeof (candidate_key)
|
||||||
- sizeof (candidate_key.hmac)),
|
- sizeof (candidate_key.hmac)),
|
||||||
|
|||||||
@@ -20,9 +20,13 @@
|
|||||||
/* When using the disk, make a reference to this module. Otherwise
|
/* When using the disk, make a reference to this module. Otherwise
|
||||||
the user will end up with a useless module :-). */
|
the user will end up with a useless module :-). */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <config-util.h>
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/disk.h>
|
#include <grub/disk.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
|
#include <grub/emu/hostdisk.h>
|
||||||
|
|
||||||
int grub_disk_host_i_want_a_reference;
|
int grub_disk_host_i_want_a_reference;
|
||||||
|
|
||||||
|
|||||||
@@ -424,6 +424,13 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
disk->total_sectors = total_sectors;
|
disk->total_sectors = total_sectors;
|
||||||
|
/* Limit the max to 0x7f because of Phoenix EDD. */
|
||||||
|
disk->max_agglomerate = 0x7f >> GRUB_DISK_CACHE_BITS;
|
||||||
|
COMPILE_TIME_ASSERT ((0x7f >> GRUB_DISK_CACHE_BITS
|
||||||
|
<< (GRUB_DISK_SECTOR_BITS + GRUB_DISK_CACHE_BITS))
|
||||||
|
+ sizeof (struct grub_biosdisk_dap)
|
||||||
|
< GRUB_MEMORY_MACHINE_SCRATCH_SIZE);
|
||||||
|
|
||||||
disk->data = data;
|
disk->data = data;
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
@@ -548,10 +555,6 @@ get_safe_sectors (grub_disk_t disk, grub_disk_addr_t sector)
|
|||||||
|
|
||||||
size = sectors - offset;
|
size = sectors - offset;
|
||||||
|
|
||||||
/* Limit the max to 0x7f because of Phoenix EDD. */
|
|
||||||
if (size > ((0x7fU << GRUB_DISK_SECTOR_BITS) >> disk->log_sector_size))
|
|
||||||
size = ((0x7fU << GRUB_DISK_SECTOR_BITS) >> disk->log_sector_size);
|
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,10 @@ grub_loopback_open (const char *name, grub_disk_t disk)
|
|||||||
/ GRUB_DISK_SECTOR_SIZE);
|
/ GRUB_DISK_SECTOR_SIZE);
|
||||||
else
|
else
|
||||||
disk->total_sectors = GRUB_DISK_SIZE_UNKNOWN;
|
disk->total_sectors = GRUB_DISK_SIZE_UNKNOWN;
|
||||||
|
/* Avoid reading more than 512M. */
|
||||||
|
disk->max_agglomerate = 1 << (29 - GRUB_DISK_SECTOR_BITS
|
||||||
|
- GRUB_DISK_CACHE_BITS);
|
||||||
|
|
||||||
disk->id = (unsigned long) dev;
|
disk->id = (unsigned long) dev;
|
||||||
|
|
||||||
disk->data = dev;
|
disk->data = dev;
|
||||||
|
|||||||
@@ -316,6 +316,8 @@ luks_recover_key (grub_disk_t source,
|
|||||||
|
|
||||||
grub_puts_ (N_("Attempting to decrypt master key..."));
|
grub_puts_ (N_("Attempting to decrypt master key..."));
|
||||||
keysize = grub_be_to_cpu32 (header.keyBytes);
|
keysize = grub_be_to_cpu32 (header.keyBytes);
|
||||||
|
if (keysize > GRUB_CRYPTODISK_MAX_KEYLEN)
|
||||||
|
return grub_error (GRUB_ERR_BAD_FS, "key is too long");
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE (header.keyblock); i++)
|
for (i = 0; i < ARRAY_SIZE (header.keyblock); i++)
|
||||||
if (grub_be_to_cpu32 (header.keyblock[i].active) == LUKS_KEY_ENABLED
|
if (grub_be_to_cpu32 (header.keyblock[i].active) == LUKS_KEY_ENABLED
|
||||||
@@ -344,8 +346,8 @@ luks_recover_key (grub_disk_t source,
|
|||||||
for (i = 0; i < ARRAY_SIZE (header.keyblock); i++)
|
for (i = 0; i < ARRAY_SIZE (header.keyblock); i++)
|
||||||
{
|
{
|
||||||
gcry_err_code_t gcry_err;
|
gcry_err_code_t gcry_err;
|
||||||
grub_uint8_t candidate_key[keysize];
|
grub_uint8_t candidate_key[GRUB_CRYPTODISK_MAX_KEYLEN];
|
||||||
grub_uint8_t digest[keysize];
|
grub_uint8_t digest[GRUB_CRYPTODISK_MAX_KEYLEN];
|
||||||
|
|
||||||
/* Check if keyslot is enabled. */
|
/* Check if keyslot is enabled. */
|
||||||
if (grub_be_to_cpu32 (header.keyblock[i].active) != LUKS_KEY_ENABLED)
|
if (grub_be_to_cpu32 (header.keyblock[i].active) != LUKS_KEY_ENABLED)
|
||||||
|
|||||||
@@ -184,9 +184,10 @@ grub_mdraid_detect (grub_disk_t disk,
|
|||||||
{
|
{
|
||||||
grub_disk_addr_t sector;
|
grub_disk_addr_t sector;
|
||||||
grub_uint64_t size;
|
grub_uint64_t size;
|
||||||
struct grub_raid_super_09 sb;
|
struct grub_raid_super_09 *sb = NULL;
|
||||||
grub_uint32_t *uuid;
|
grub_uint32_t *uuid;
|
||||||
grub_uint32_t level;
|
grub_uint32_t level;
|
||||||
|
struct grub_diskfilter_vg *ret;
|
||||||
|
|
||||||
/* The sector where the mdraid 0.90 superblock is stored, if available. */
|
/* The sector where the mdraid 0.90 superblock is stored, if available. */
|
||||||
size = grub_disk_get_size (disk);
|
size = grub_disk_get_size (disk);
|
||||||
@@ -195,27 +196,31 @@ grub_mdraid_detect (grub_disk_t disk,
|
|||||||
return NULL;
|
return NULL;
|
||||||
sector = NEW_SIZE_SECTORS (size);
|
sector = NEW_SIZE_SECTORS (size);
|
||||||
|
|
||||||
if (grub_disk_read (disk, sector, 0, SB_BYTES, &sb))
|
sb = grub_malloc (sizeof (*sb));
|
||||||
|
if (!sb)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (grub_disk_read (disk, sector, 0, SB_BYTES, sb))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
/* Look whether there is a mdraid 0.90 superblock. */
|
/* Look whether there is a mdraid 0.90 superblock. */
|
||||||
if (sb.md_magic != grub_cpu_to_md32_compile_time (SB_MAGIC))
|
if (sb->md_magic != grub_cpu_to_md32_compile_time (SB_MAGIC))
|
||||||
/* not 0.9x raid. */
|
/* not 0.9x raid. */
|
||||||
return NULL;
|
goto fail;
|
||||||
|
|
||||||
if (sb.major_version != grub_cpu_to_md32_compile_time (0)
|
if (sb->major_version != grub_cpu_to_md32_compile_time (0)
|
||||||
|| sb.minor_version != grub_cpu_to_md32_compile_time (90))
|
|| sb->minor_version != grub_cpu_to_md32_compile_time (90))
|
||||||
/* Unsupported version. */
|
/* Unsupported version. */
|
||||||
return NULL;
|
goto fail;
|
||||||
|
|
||||||
/* No need for explicit check that sb.size is 0 (unspecified) since
|
/* No need for explicit check that sb->size is 0 (unspecified) since
|
||||||
0 >= non-0 is false. */
|
0 >= non-0 is false. */
|
||||||
if (((grub_disk_addr_t) grub_md_to_cpu32 (sb.size)) * 2 >= size)
|
if (((grub_disk_addr_t) grub_md_to_cpu32 (sb->size)) * 2 >= size)
|
||||||
return NULL;
|
goto fail;
|
||||||
|
|
||||||
/* FIXME: Check the checksum. */
|
/* FIXME: Check the checksum. */
|
||||||
|
|
||||||
level = grub_md_to_cpu32 (sb.level);
|
level = grub_md_to_cpu32 (sb->level);
|
||||||
/* Multipath. */
|
/* Multipath. */
|
||||||
if ((int) level == -4)
|
if ((int) level == -4)
|
||||||
level = 1;
|
level = 1;
|
||||||
@@ -225,37 +230,43 @@ grub_mdraid_detect (grub_disk_t disk,
|
|||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
"unsupported RAID level: %d", level);
|
"unsupported RAID level: %d", level);
|
||||||
return NULL;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (grub_md_to_cpu32 (sb.this_disk.number) == 0xffff
|
if (grub_md_to_cpu32 (sb->this_disk.number) == 0xffff
|
||||||
|| grub_md_to_cpu32 (sb.this_disk.number) == 0xfffe)
|
|| grub_md_to_cpu32 (sb->this_disk.number) == 0xfffe)
|
||||||
/* Spares aren't implemented. */
|
/* Spares aren't implemented. */
|
||||||
return NULL;
|
goto fail;
|
||||||
|
|
||||||
uuid = grub_malloc (16);
|
uuid = grub_malloc (16);
|
||||||
if (!uuid)
|
if (!uuid)
|
||||||
return NULL;
|
goto fail;
|
||||||
|
|
||||||
uuid[0] = grub_swap_bytes32 (sb.set_uuid0);
|
uuid[0] = grub_swap_bytes32 (sb->set_uuid0);
|
||||||
uuid[1] = grub_swap_bytes32 (sb.set_uuid1);
|
uuid[1] = grub_swap_bytes32 (sb->set_uuid1);
|
||||||
uuid[2] = grub_swap_bytes32 (sb.set_uuid2);
|
uuid[2] = grub_swap_bytes32 (sb->set_uuid2);
|
||||||
uuid[3] = grub_swap_bytes32 (sb.set_uuid3);
|
uuid[3] = grub_swap_bytes32 (sb->set_uuid3);
|
||||||
|
|
||||||
*start_sector = 0;
|
*start_sector = 0;
|
||||||
|
|
||||||
id->uuidlen = 0;
|
id->uuidlen = 0;
|
||||||
id->id = grub_md_to_cpu32 (sb.this_disk.number);
|
id->id = grub_md_to_cpu32 (sb->this_disk.number);
|
||||||
|
|
||||||
char buf[32];
|
char buf[32];
|
||||||
grub_snprintf (buf, sizeof (buf), "md%d", grub_md_to_cpu32 (sb.md_minor));
|
grub_snprintf (buf, sizeof (buf), "md%d", grub_md_to_cpu32 (sb->md_minor));
|
||||||
return grub_diskfilter_make_raid (16, (char *) uuid,
|
ret = grub_diskfilter_make_raid (16, (char *) uuid,
|
||||||
grub_md_to_cpu32 (sb.raid_disks), buf,
|
grub_md_to_cpu32 (sb->raid_disks), buf,
|
||||||
(sb.size) ? ((grub_disk_addr_t)
|
(sb->size) ? ((grub_disk_addr_t)
|
||||||
grub_md_to_cpu32 (sb.size)) * 2
|
grub_md_to_cpu32 (sb->size)) * 2
|
||||||
: sector,
|
: sector,
|
||||||
grub_md_to_cpu32 (sb.chunk_size) >> 9,
|
grub_md_to_cpu32 (sb->chunk_size) >> 9,
|
||||||
grub_md_to_cpu32 (sb.layout),
|
grub_md_to_cpu32 (sb->layout),
|
||||||
level);
|
level);
|
||||||
|
grub_free (sb);
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
grub_free (sb);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct grub_diskfilter grub_mdraid_dev = {
|
static struct grub_diskfilter grub_mdraid_dev = {
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ grub_memdisk_open (const char *name, grub_disk_t disk)
|
|||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a memdisk");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a memdisk");
|
||||||
|
|
||||||
disk->total_sectors = memdisk_size / GRUB_DISK_SECTOR_SIZE;
|
disk->total_sectors = memdisk_size / GRUB_DISK_SECTOR_SIZE;
|
||||||
|
disk->max_agglomerate = GRUB_DISK_MAX_MAX_AGGLOMERATE;
|
||||||
disk->id = (unsigned long) "mdsk";
|
disk->id = (unsigned long) "mdsk";
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|||||||
+17
-36
@@ -606,6 +606,13 @@ grub_scsi_open (const char *name, grub_disk_t disk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
disk->total_sectors = scsi->last_block + 1;
|
disk->total_sectors = scsi->last_block + 1;
|
||||||
|
/* PATA doesn't support more than 32K reads.
|
||||||
|
Not sure about AHCI and USB. If it's confirmed that either of
|
||||||
|
them can do bigger reads reliably this value can be moved to 'scsi'
|
||||||
|
structure. */
|
||||||
|
disk->max_agglomerate = 32768 >> (GRUB_DISK_SECTOR_BITS
|
||||||
|
+ GRUB_DISK_CACHE_BITS);
|
||||||
|
|
||||||
if (scsi->blocksize & (scsi->blocksize - 1) || !scsi->blocksize)
|
if (scsi->blocksize & (scsi->blocksize - 1) || !scsi->blocksize)
|
||||||
{
|
{
|
||||||
grub_free (scsi);
|
grub_free (scsi);
|
||||||
@@ -647,41 +654,28 @@ grub_scsi_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||||||
|
|
||||||
scsi = disk->data;
|
scsi = disk->data;
|
||||||
|
|
||||||
while (size)
|
|
||||||
{
|
|
||||||
/* PATA doesn't support more than 32K reads.
|
|
||||||
Not sure about AHCI and USB. If it's confirmed that either of
|
|
||||||
them can do bigger reads reliably this value can be moved to 'scsi'
|
|
||||||
structure. */
|
|
||||||
grub_size_t len = 32768 >> disk->log_sector_size;
|
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
if (len > size)
|
|
||||||
len = size;
|
|
||||||
/* Depending on the type, select a read function. */
|
/* Depending on the type, select a read function. */
|
||||||
switch (scsi->devtype)
|
switch (scsi->devtype)
|
||||||
{
|
{
|
||||||
case grub_scsi_devtype_direct:
|
case grub_scsi_devtype_direct:
|
||||||
if (sector >> 32)
|
if (sector >> 32)
|
||||||
err = grub_scsi_read16 (disk, sector, len, buf);
|
err = grub_scsi_read16 (disk, sector, size, buf);
|
||||||
else
|
else
|
||||||
err = grub_scsi_read10 (disk, sector, len, buf);
|
err = grub_scsi_read10 (disk, sector, size, buf);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case grub_scsi_devtype_cdrom:
|
case grub_scsi_devtype_cdrom:
|
||||||
if (sector >> 32)
|
if (sector >> 32)
|
||||||
err = grub_scsi_read16 (disk, sector, len, buf);
|
err = grub_scsi_read16 (disk, sector, size, buf);
|
||||||
else
|
else
|
||||||
err = grub_scsi_read12 (disk, sector, len, buf);
|
err = grub_scsi_read12 (disk, sector, size, buf);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
size -= len;
|
|
||||||
sector += len;
|
|
||||||
buf += len << disk->log_sector_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
@@ -718,10 +712,10 @@ grub_scsi_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_scsi_write (grub_disk_t disk __attribute((unused)),
|
grub_scsi_write (grub_disk_t disk,
|
||||||
grub_disk_addr_t sector __attribute((unused)),
|
grub_disk_addr_t sector,
|
||||||
grub_size_t size __attribute((unused)),
|
grub_size_t size,
|
||||||
const char *buf __attribute((unused)))
|
const char *buf)
|
||||||
{
|
{
|
||||||
grub_scsi_t scsi;
|
grub_scsi_t scsi;
|
||||||
|
|
||||||
@@ -730,32 +724,19 @@ grub_scsi_write (grub_disk_t disk __attribute((unused)),
|
|||||||
if (scsi->devtype == grub_scsi_devtype_cdrom)
|
if (scsi->devtype == grub_scsi_devtype_cdrom)
|
||||||
return grub_error (GRUB_ERR_IO, N_("cannot write to CD-ROM"));
|
return grub_error (GRUB_ERR_IO, N_("cannot write to CD-ROM"));
|
||||||
|
|
||||||
while (size)
|
|
||||||
{
|
|
||||||
/* PATA doesn't support more than 32K reads.
|
|
||||||
Not sure about AHCI and USB. If it's confirmed that either of
|
|
||||||
them can do bigger reads reliably this value can be moved to 'scsi'
|
|
||||||
structure. */
|
|
||||||
grub_size_t len = 32768 >> disk->log_sector_size;
|
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
if (len > size)
|
|
||||||
len = size;
|
|
||||||
/* Depending on the type, select a read function. */
|
/* Depending on the type, select a read function. */
|
||||||
switch (scsi->devtype)
|
switch (scsi->devtype)
|
||||||
{
|
{
|
||||||
case grub_scsi_devtype_direct:
|
case grub_scsi_devtype_direct:
|
||||||
if (sector >> 32)
|
if (sector >> 32)
|
||||||
err = grub_scsi_write16 (disk, sector, len, buf);
|
err = grub_scsi_write16 (disk, sector, size, buf);
|
||||||
else
|
else
|
||||||
err = grub_scsi_write10 (disk, sector, len, buf);
|
err = grub_scsi_write10 (disk, sector, size, buf);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
size -= len;
|
|
||||||
sector += len;
|
|
||||||
buf += len << disk->log_sector_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ grub_ubootdisk_register (struct device_info *newdev)
|
|||||||
{
|
{
|
||||||
case DT_STOR_IDE:
|
case DT_STOR_IDE:
|
||||||
case DT_STOR_SATA:
|
case DT_STOR_SATA:
|
||||||
|
case DT_STOR_SCSI:
|
||||||
case DT_STOR_MMC:
|
case DT_STOR_MMC:
|
||||||
case DT_STOR_USB:
|
case DT_STOR_USB:
|
||||||
/* hd */
|
/* hd */
|
||||||
|
|||||||
+10
-11
@@ -76,7 +76,7 @@ typedef struct grub_usbms_dev *grub_usbms_dev_t;
|
|||||||
static grub_usbms_dev_t grub_usbms_devices[MAX_USBMS_DEVICES];
|
static grub_usbms_dev_t grub_usbms_devices[MAX_USBMS_DEVICES];
|
||||||
static int first_available_slot = 0;
|
static int first_available_slot = 0;
|
||||||
|
|
||||||
static grub_err_t
|
static grub_usb_err_t
|
||||||
grub_usbms_cbi_cmd (grub_usb_device_t dev, int interface,
|
grub_usbms_cbi_cmd (grub_usb_device_t dev, int interface,
|
||||||
grub_uint8_t *cbicb)
|
grub_uint8_t *cbicb)
|
||||||
{
|
{
|
||||||
@@ -86,7 +86,7 @@ grub_usbms_cbi_cmd (grub_usb_device_t dev, int interface,
|
|||||||
GRUB_USBMS_CBI_CMD_SIZE, (char*)cbicb);
|
GRUB_USBMS_CBI_CMD_SIZE, (char*)cbicb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_usb_err_t
|
||||||
grub_usbms_cbi_reset (grub_usb_device_t dev, int interface)
|
grub_usbms_cbi_reset (grub_usb_device_t dev, int interface)
|
||||||
{
|
{
|
||||||
/* Prepare array with Command Block Reset (=CBR) */
|
/* Prepare array with Command Block Reset (=CBR) */
|
||||||
@@ -108,17 +108,13 @@ grub_usbms_cbi_reset (grub_usb_device_t dev, int interface)
|
|||||||
return grub_usbms_cbi_cmd (dev, interface, (grub_uint8_t *)&cbicb);
|
return grub_usbms_cbi_cmd (dev, interface, (grub_uint8_t *)&cbicb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_usb_err_t
|
||||||
grub_usbms_bo_reset (grub_usb_device_t dev, int interface)
|
grub_usbms_bo_reset (grub_usb_device_t dev, int interface)
|
||||||
{
|
{
|
||||||
grub_usb_err_t u;
|
return grub_usb_control_msg (dev, 0x21, 255, 0, interface, 0, 0);
|
||||||
u = grub_usb_control_msg (dev, 0x21, 255, 0, interface, 0, 0);
|
|
||||||
if (u)
|
|
||||||
return grub_error (GRUB_ERR_IO, "USB error %d", u);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_usb_err_t
|
||||||
grub_usbms_reset (grub_usbms_dev_t dev)
|
grub_usbms_reset (grub_usbms_dev_t dev)
|
||||||
{
|
{
|
||||||
if (dev->protocol == GRUB_USBMS_PROTOCOL_BULK)
|
if (dev->protocol == GRUB_USBMS_PROTOCOL_BULK)
|
||||||
@@ -149,7 +145,7 @@ grub_usbms_attach (grub_usb_device_t usbdev, int configno, int interfno)
|
|||||||
int j;
|
int j;
|
||||||
grub_uint8_t luns = 0;
|
grub_uint8_t luns = 0;
|
||||||
unsigned curnum;
|
unsigned curnum;
|
||||||
grub_usb_err_t err = GRUB_ERR_NONE;
|
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
||||||
|
|
||||||
grub_boot_time ("Attaching USB mass storage");
|
grub_boot_time ("Attaching USB mass storage");
|
||||||
|
|
||||||
@@ -572,7 +568,10 @@ grub_usbms_transfer_cbi (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
if (err)
|
||||||
|
return grub_error (GRUB_ERR_IO, "USB error %d", err);
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,458 @@
|
|||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2013 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/disk.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <grub/types.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/err.h>
|
||||||
|
#include <grub/term.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
#include <grub/xen.h>
|
||||||
|
#include <grub/time.h>
|
||||||
|
#include <xen/io/blkif.h>
|
||||||
|
|
||||||
|
struct virtdisk
|
||||||
|
{
|
||||||
|
int handle;
|
||||||
|
char *fullname;
|
||||||
|
char *backend_dir;
|
||||||
|
char *frontend_dir;
|
||||||
|
struct blkif_sring *shared_page;
|
||||||
|
struct blkif_front_ring ring;
|
||||||
|
grub_xen_grant_t grant;
|
||||||
|
grub_xen_evtchn_t evtchn;
|
||||||
|
void *dma_page;
|
||||||
|
grub_xen_grant_t dma_grant;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define xen_wmb() mb()
|
||||||
|
#define xen_mb() mb()
|
||||||
|
|
||||||
|
static struct virtdisk *virtdisks;
|
||||||
|
static grub_size_t vdiskcnt;
|
||||||
|
|
||||||
|
static int
|
||||||
|
grub_virtdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data,
|
||||||
|
grub_disk_pull_t pull)
|
||||||
|
{
|
||||||
|
grub_size_t i;
|
||||||
|
|
||||||
|
if (pull != GRUB_DISK_PULL_NONE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (i = 0; i < vdiskcnt; i++)
|
||||||
|
if (hook (virtdisks[i].fullname, hook_data))
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_virtdisk_open (const char *name, grub_disk_t disk)
|
||||||
|
{
|
||||||
|
grub_size_t i;
|
||||||
|
grub_uint32_t secsize;
|
||||||
|
char fdir[200];
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
for (i = 0; i < vdiskcnt; i++)
|
||||||
|
if (grub_strcmp (name, virtdisks[i].fullname) == 0)
|
||||||
|
break;
|
||||||
|
if (i == vdiskcnt)
|
||||||
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a virtdisk");
|
||||||
|
disk->data = &virtdisks[i];
|
||||||
|
disk->id = i;
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "%s/sectors", virtdisks[i].backend_dir);
|
||||||
|
buf = grub_xenstore_get_file (fdir, NULL);
|
||||||
|
if (!buf)
|
||||||
|
return grub_errno;
|
||||||
|
disk->total_sectors = grub_strtoull (buf, 0, 10);
|
||||||
|
if (grub_errno)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "%s/sector-size",
|
||||||
|
virtdisks[i].backend_dir);
|
||||||
|
buf = grub_xenstore_get_file (fdir, NULL);
|
||||||
|
if (!buf)
|
||||||
|
return grub_errno;
|
||||||
|
secsize = grub_strtoull (buf, 0, 10);
|
||||||
|
if (grub_errno)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
if ((secsize & (secsize - 1)) || !secsize || secsize < 512
|
||||||
|
|| secsize > GRUB_XEN_PAGE_SIZE)
|
||||||
|
return grub_error (GRUB_ERR_IO, "unsupported sector size %d", secsize);
|
||||||
|
|
||||||
|
for (disk->log_sector_size = 0;
|
||||||
|
(1U << disk->log_sector_size) < secsize; disk->log_sector_size++);
|
||||||
|
|
||||||
|
disk->total_sectors >>= disk->log_sector_size - 9;
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
grub_virtdisk_close (grub_disk_t disk __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_virtdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
|
grub_size_t size, char *buf)
|
||||||
|
{
|
||||||
|
struct virtdisk *data = disk->data;
|
||||||
|
|
||||||
|
while (size)
|
||||||
|
{
|
||||||
|
grub_size_t cur;
|
||||||
|
struct blkif_request *req;
|
||||||
|
struct blkif_response *resp;
|
||||||
|
int sta = 0;
|
||||||
|
struct evtchn_send send;
|
||||||
|
cur = size;
|
||||||
|
if (cur > (unsigned) (GRUB_XEN_PAGE_SIZE >> disk->log_sector_size))
|
||||||
|
cur = GRUB_XEN_PAGE_SIZE >> disk->log_sector_size;
|
||||||
|
while (RING_FULL (&data->ring))
|
||||||
|
grub_xen_sched_op (SCHEDOP_yield, 0);
|
||||||
|
req = RING_GET_REQUEST (&data->ring, data->ring.req_prod_pvt);
|
||||||
|
req->operation = BLKIF_OP_READ;
|
||||||
|
req->nr_segments = 1;
|
||||||
|
req->handle = data->handle;
|
||||||
|
req->id = 0;
|
||||||
|
req->sector_number = sector << (disk->log_sector_size - 9);
|
||||||
|
req->seg[0].gref = data->dma_grant;
|
||||||
|
req->seg[0].first_sect = 0;
|
||||||
|
req->seg[0].last_sect = (cur << (disk->log_sector_size - 9)) - 1;
|
||||||
|
data->ring.req_prod_pvt++;
|
||||||
|
RING_PUSH_REQUESTS (&data->ring);
|
||||||
|
mb ();
|
||||||
|
send.port = data->evtchn;
|
||||||
|
grub_xen_event_channel_op (EVTCHNOP_send, &send);
|
||||||
|
|
||||||
|
while (!RING_HAS_UNCONSUMED_RESPONSES (&data->ring))
|
||||||
|
{
|
||||||
|
grub_xen_sched_op (SCHEDOP_yield, 0);
|
||||||
|
mb ();
|
||||||
|
}
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
int wtd;
|
||||||
|
RING_FINAL_CHECK_FOR_RESPONSES (&data->ring, wtd);
|
||||||
|
if (!wtd)
|
||||||
|
break;
|
||||||
|
resp = RING_GET_RESPONSE (&data->ring, data->ring.rsp_cons);
|
||||||
|
data->ring.rsp_cons++;
|
||||||
|
if (resp->status)
|
||||||
|
sta = resp->status;
|
||||||
|
}
|
||||||
|
if (sta)
|
||||||
|
return grub_error (GRUB_ERR_IO, "read failed");
|
||||||
|
grub_memcpy (buf, data->dma_page, cur << disk->log_sector_size);
|
||||||
|
size -= cur;
|
||||||
|
sector += cur;
|
||||||
|
buf += cur << disk->log_sector_size;
|
||||||
|
}
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_virtdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
|
grub_size_t size, const char *buf)
|
||||||
|
{
|
||||||
|
struct virtdisk *data = disk->data;
|
||||||
|
|
||||||
|
while (size)
|
||||||
|
{
|
||||||
|
grub_size_t cur;
|
||||||
|
struct blkif_request *req;
|
||||||
|
struct blkif_response *resp;
|
||||||
|
int sta = 0;
|
||||||
|
struct evtchn_send send;
|
||||||
|
cur = size;
|
||||||
|
if (cur > (unsigned) (GRUB_XEN_PAGE_SIZE >> disk->log_sector_size))
|
||||||
|
cur = GRUB_XEN_PAGE_SIZE >> disk->log_sector_size;
|
||||||
|
|
||||||
|
grub_memcpy (data->dma_page, buf, cur << disk->log_sector_size);
|
||||||
|
|
||||||
|
while (RING_FULL (&data->ring))
|
||||||
|
grub_xen_sched_op (SCHEDOP_yield, 0);
|
||||||
|
req = RING_GET_REQUEST (&data->ring, data->ring.req_prod_pvt);
|
||||||
|
req->operation = BLKIF_OP_WRITE;
|
||||||
|
req->nr_segments = 1;
|
||||||
|
req->handle = data->handle;
|
||||||
|
req->id = 0;
|
||||||
|
req->sector_number = sector << (disk->log_sector_size - 9);
|
||||||
|
req->seg[0].gref = data->dma_grant;
|
||||||
|
req->seg[0].first_sect = 0;
|
||||||
|
req->seg[0].last_sect = (cur << (disk->log_sector_size - 9)) - 1;
|
||||||
|
data->ring.req_prod_pvt++;
|
||||||
|
RING_PUSH_REQUESTS (&data->ring);
|
||||||
|
mb ();
|
||||||
|
send.port = data->evtchn;
|
||||||
|
grub_xen_event_channel_op (EVTCHNOP_send, &send);
|
||||||
|
|
||||||
|
while (!RING_HAS_UNCONSUMED_RESPONSES (&data->ring))
|
||||||
|
{
|
||||||
|
grub_xen_sched_op (SCHEDOP_yield, 0);
|
||||||
|
mb ();
|
||||||
|
}
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
int wtd;
|
||||||
|
RING_FINAL_CHECK_FOR_RESPONSES (&data->ring, wtd);
|
||||||
|
if (!wtd)
|
||||||
|
break;
|
||||||
|
resp = RING_GET_RESPONSE (&data->ring, data->ring.rsp_cons);
|
||||||
|
data->ring.rsp_cons++;
|
||||||
|
if (resp->status)
|
||||||
|
sta = resp->status;
|
||||||
|
}
|
||||||
|
if (sta)
|
||||||
|
return grub_error (GRUB_ERR_IO, "write failed");
|
||||||
|
size -= cur;
|
||||||
|
sector += cur;
|
||||||
|
buf += cur << disk->log_sector_size;
|
||||||
|
}
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct grub_disk_dev grub_virtdisk_dev = {
|
||||||
|
.name = "xen",
|
||||||
|
.id = GRUB_DISK_DEVICE_XEN,
|
||||||
|
.iterate = grub_virtdisk_iterate,
|
||||||
|
.open = grub_virtdisk_open,
|
||||||
|
.close = grub_virtdisk_close,
|
||||||
|
.read = grub_virtdisk_read,
|
||||||
|
.write = grub_virtdisk_write,
|
||||||
|
.next = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
count (const char *dir __attribute__ ((unused)), void *data)
|
||||||
|
{
|
||||||
|
grub_size_t *ctr = data;
|
||||||
|
(*ctr)++;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
fill (const char *dir, void *data)
|
||||||
|
{
|
||||||
|
grub_size_t *ctr = data;
|
||||||
|
domid_t dom;
|
||||||
|
/* "dir" is just a number, at most 19 characters. */
|
||||||
|
char fdir[200];
|
||||||
|
char num[20];
|
||||||
|
grub_err_t err;
|
||||||
|
void *buf;
|
||||||
|
struct evtchn_alloc_unbound alloc_unbound;
|
||||||
|
|
||||||
|
/* Shouldn't happen unles some hotplug happened. */
|
||||||
|
if (vdiskcnt >= *ctr)
|
||||||
|
return 1;
|
||||||
|
virtdisks[vdiskcnt].handle = grub_strtoul (dir, 0, 10);
|
||||||
|
if (grub_errno)
|
||||||
|
{
|
||||||
|
grub_errno = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
virtdisks[vdiskcnt].fullname = 0;
|
||||||
|
virtdisks[vdiskcnt].backend_dir = 0;
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "device/vbd/%s/backend", dir);
|
||||||
|
virtdisks[vdiskcnt].backend_dir = grub_xenstore_get_file (fdir, NULL);
|
||||||
|
if (!virtdisks[vdiskcnt].backend_dir)
|
||||||
|
goto out_fail_1;
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "%s/dev",
|
||||||
|
virtdisks[vdiskcnt].backend_dir);
|
||||||
|
buf = grub_xenstore_get_file (fdir, NULL);
|
||||||
|
if (!buf)
|
||||||
|
{
|
||||||
|
grub_errno = 0;
|
||||||
|
virtdisks[vdiskcnt].fullname = grub_xasprintf ("xenid/%s", dir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
virtdisks[vdiskcnt].fullname = grub_xasprintf ("xen/%s", (char *) buf);
|
||||||
|
grub_free (buf);
|
||||||
|
}
|
||||||
|
if (!virtdisks[vdiskcnt].fullname)
|
||||||
|
goto out_fail_1;
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "device/vbd/%s/backend-id", dir);
|
||||||
|
buf = grub_xenstore_get_file (fdir, NULL);
|
||||||
|
if (!buf)
|
||||||
|
goto out_fail_1;
|
||||||
|
|
||||||
|
dom = grub_strtoul (buf, 0, 10);
|
||||||
|
grub_free (buf);
|
||||||
|
if (grub_errno)
|
||||||
|
goto out_fail_1;
|
||||||
|
|
||||||
|
virtdisks[vdiskcnt].shared_page =
|
||||||
|
grub_xen_alloc_shared_page (dom, &virtdisks[vdiskcnt].grant);
|
||||||
|
if (!virtdisks[vdiskcnt].shared_page)
|
||||||
|
goto out_fail_1;
|
||||||
|
|
||||||
|
virtdisks[vdiskcnt].dma_page =
|
||||||
|
grub_xen_alloc_shared_page (dom, &virtdisks[vdiskcnt].dma_grant);
|
||||||
|
if (!virtdisks[vdiskcnt].dma_page)
|
||||||
|
goto out_fail_2;
|
||||||
|
|
||||||
|
alloc_unbound.dom = DOMID_SELF;
|
||||||
|
alloc_unbound.remote_dom = dom;
|
||||||
|
|
||||||
|
grub_xen_event_channel_op (EVTCHNOP_alloc_unbound, &alloc_unbound);
|
||||||
|
virtdisks[vdiskcnt].evtchn = alloc_unbound.port;
|
||||||
|
|
||||||
|
SHARED_RING_INIT (virtdisks[vdiskcnt].shared_page);
|
||||||
|
FRONT_RING_INIT (&virtdisks[vdiskcnt].ring, virtdisks[vdiskcnt].shared_page,
|
||||||
|
GRUB_XEN_PAGE_SIZE);
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "device/vbd/%s/ring-ref", dir);
|
||||||
|
grub_snprintf (num, sizeof (num), "%u", virtdisks[vdiskcnt].grant);
|
||||||
|
err = grub_xenstore_write_file (fdir, num, grub_strlen (num));
|
||||||
|
if (err)
|
||||||
|
goto out_fail_3;
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "device/vbd/%s/event-channel", dir);
|
||||||
|
grub_snprintf (num, sizeof (num), "%u", virtdisks[vdiskcnt].evtchn);
|
||||||
|
err = grub_xenstore_write_file (fdir, num, grub_strlen (num));
|
||||||
|
if (err)
|
||||||
|
goto out_fail_3;
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "device/vbd/%s/protocol", dir);
|
||||||
|
err = grub_xenstore_write_file (fdir, XEN_IO_PROTO_ABI_NATIVE,
|
||||||
|
grub_strlen (XEN_IO_PROTO_ABI_NATIVE));
|
||||||
|
if (err)
|
||||||
|
goto out_fail_3;
|
||||||
|
|
||||||
|
struct gnttab_dump_table dt;
|
||||||
|
dt.dom = DOMID_SELF;
|
||||||
|
grub_xen_grant_table_op (GNTTABOP_dump_table, (void *) &dt, 1);
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "device/vbd/%s/state", dir);
|
||||||
|
err = grub_xenstore_write_file (fdir, "3", 1);
|
||||||
|
if (err)
|
||||||
|
goto out_fail_3;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "%s/state",
|
||||||
|
virtdisks[vdiskcnt].backend_dir);
|
||||||
|
buf = grub_xenstore_get_file (fdir, NULL);
|
||||||
|
if (!buf)
|
||||||
|
goto out_fail_3;
|
||||||
|
if (grub_strcmp (buf, "2") != 0)
|
||||||
|
break;
|
||||||
|
grub_free (buf);
|
||||||
|
grub_xen_sched_op (SCHEDOP_yield, 0);
|
||||||
|
}
|
||||||
|
grub_dprintf ("xen", "state=%s\n", (char *) buf);
|
||||||
|
grub_free (buf);
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "device/vbd/%s", dir);
|
||||||
|
|
||||||
|
virtdisks[vdiskcnt].frontend_dir = grub_strdup (fdir);
|
||||||
|
|
||||||
|
vdiskcnt++;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
out_fail_3:
|
||||||
|
grub_xen_free_shared_page (virtdisks[vdiskcnt].dma_page);
|
||||||
|
out_fail_2:
|
||||||
|
grub_xen_free_shared_page (virtdisks[vdiskcnt].shared_page);
|
||||||
|
out_fail_1:
|
||||||
|
grub_free (virtdisks[vdiskcnt].backend_dir);
|
||||||
|
grub_free (virtdisks[vdiskcnt].fullname);
|
||||||
|
|
||||||
|
grub_errno = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_xendisk_init (void)
|
||||||
|
{
|
||||||
|
grub_size_t ctr = 0;
|
||||||
|
if (grub_xenstore_dir ("device/vbd", count, &ctr))
|
||||||
|
grub_errno = 0;
|
||||||
|
|
||||||
|
if (!ctr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
virtdisks = grub_malloc (ctr * sizeof (virtdisks[0]));
|
||||||
|
if (!virtdisks)
|
||||||
|
return;
|
||||||
|
if (grub_xenstore_dir ("device/vbd", fill, &ctr))
|
||||||
|
grub_errno = 0;
|
||||||
|
|
||||||
|
grub_disk_dev_register (&grub_virtdisk_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_xendisk_fini (void)
|
||||||
|
{
|
||||||
|
char fdir[200];
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < vdiskcnt; i++)
|
||||||
|
{
|
||||||
|
char *buf;
|
||||||
|
struct evtchn_close close_op = {.port = virtdisks[i].evtchn };
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "%s/state",
|
||||||
|
virtdisks[i].frontend_dir);
|
||||||
|
grub_xenstore_write_file (fdir, "6", 1);
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "%s/state",
|
||||||
|
virtdisks[i].backend_dir);
|
||||||
|
buf = grub_xenstore_get_file (fdir, NULL);
|
||||||
|
grub_dprintf ("xen", "state=%s\n", (char *) buf);
|
||||||
|
|
||||||
|
if (!buf || grub_strcmp (buf, "6") == 0)
|
||||||
|
break;
|
||||||
|
grub_free (buf);
|
||||||
|
grub_xen_sched_op (SCHEDOP_yield, 0);
|
||||||
|
}
|
||||||
|
grub_free (buf);
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "%s/ring-ref",
|
||||||
|
virtdisks[i].frontend_dir);
|
||||||
|
grub_xenstore_write_file (fdir, NULL, 0);
|
||||||
|
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "%s/event-channel",
|
||||||
|
virtdisks[i].frontend_dir);
|
||||||
|
grub_xenstore_write_file (fdir, NULL, 0);
|
||||||
|
|
||||||
|
grub_xen_free_shared_page (virtdisks[i].dma_page);
|
||||||
|
grub_xen_free_shared_page (virtdisks[i].shared_page);
|
||||||
|
|
||||||
|
grub_xen_event_channel_op (EVTCHNOP_close, &close_op);
|
||||||
|
|
||||||
|
/* Prepare for handoff. */
|
||||||
|
grub_snprintf (fdir, sizeof (fdir), "%s/state",
|
||||||
|
virtdisks[i].frontend_dir);
|
||||||
|
grub_xenstore_write_file (fdir, "1", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -122,7 +122,10 @@ SUFFIX (grub_efiemu_crc) (void)
|
|||||||
int handle;
|
int handle;
|
||||||
grub_off_t off;
|
grub_off_t off;
|
||||||
struct SUFFIX (grub_efiemu_runtime_services) *runtime_services;
|
struct SUFFIX (grub_efiemu_runtime_services) *runtime_services;
|
||||||
grub_uint8_t crc32_context[GRUB_MD_CRC32->contextsize];
|
grub_uint32_t crc32_val;
|
||||||
|
|
||||||
|
if (GRUB_MD_CRC32->mdlen != 4)
|
||||||
|
return grub_error (GRUB_ERR_BUG, "incorrect mdlen");
|
||||||
|
|
||||||
/* compute CRC32 of runtime_services */
|
/* compute CRC32 of runtime_services */
|
||||||
err = grub_efiemu_resolve_symbol ("efiemu_runtime_services",
|
err = grub_efiemu_resolve_symbol ("efiemu_runtime_services",
|
||||||
@@ -134,12 +137,11 @@ SUFFIX (grub_efiemu_crc) (void)
|
|||||||
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
|
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
|
||||||
|
|
||||||
runtime_services->hdr.crc32 = 0;
|
runtime_services->hdr.crc32 = 0;
|
||||||
GRUB_MD_CRC32->init(crc32_context);
|
|
||||||
GRUB_MD_CRC32->write(crc32_context, runtime_services, runtime_services->hdr.header_size);
|
|
||||||
GRUB_MD_CRC32->final(crc32_context);
|
|
||||||
|
|
||||||
|
grub_crypto_hash (GRUB_MD_CRC32, &crc32_val,
|
||||||
|
runtime_services, runtime_services->hdr.header_size);
|
||||||
runtime_services->hdr.crc32 =
|
runtime_services->hdr.crc32 =
|
||||||
grub_be_to_cpu32(*(grub_uint32_t*)GRUB_MD_CRC32->read(crc32_context));
|
grub_be_to_cpu32(crc32_val);
|
||||||
|
|
||||||
err = grub_efiemu_resolve_symbol ("efiemu_system_table", &handle, &off);
|
err = grub_efiemu_resolve_symbol ("efiemu_system_table", &handle, &off);
|
||||||
if (err)
|
if (err)
|
||||||
@@ -147,12 +149,11 @@ SUFFIX (grub_efiemu_crc) (void)
|
|||||||
|
|
||||||
/* compute CRC32 of system table */
|
/* compute CRC32 of system table */
|
||||||
SUFFIX (grub_efiemu_system_table)->hdr.crc32 = 0;
|
SUFFIX (grub_efiemu_system_table)->hdr.crc32 = 0;
|
||||||
GRUB_MD_CRC32->init(crc32_context);
|
grub_crypto_hash (GRUB_MD_CRC32, &crc32_val,
|
||||||
GRUB_MD_CRC32->write(crc32_context, SUFFIX (grub_efiemu_system_table),
|
SUFFIX (grub_efiemu_system_table),
|
||||||
SUFFIX (grub_efiemu_system_table)->hdr.header_size);
|
SUFFIX (grub_efiemu_system_table)->hdr.header_size);
|
||||||
GRUB_MD_CRC32->final(crc32_context);
|
|
||||||
SUFFIX (grub_efiemu_system_table)->hdr.crc32 =
|
SUFFIX (grub_efiemu_system_table)->hdr.crc32 =
|
||||||
grub_be_to_cpu32(*(grub_uint32_t*)GRUB_MD_CRC32->read(crc32_context));
|
grub_be_to_cpu32(crc32_val);
|
||||||
|
|
||||||
grub_dprintf ("efiemu","system_table = %p, runtime_services = %p\n",
|
grub_dprintf ("efiemu","system_table = %p, runtime_services = %p\n",
|
||||||
SUFFIX (grub_efiemu_system_table), runtime_services);
|
SUFFIX (grub_efiemu_system_table), runtime_services);
|
||||||
|
|||||||
@@ -19,16 +19,18 @@
|
|||||||
|
|
||||||
#define GRUB_TYPES_CPU_HEADER 1
|
#define GRUB_TYPES_CPU_HEADER 1
|
||||||
|
|
||||||
#ifdef ELF32
|
#ifdef __i386__
|
||||||
# define SIZEOF_VOID_P 4
|
# define SIZEOF_VOID_P 4
|
||||||
# define SIZEOF_LONG 4
|
# define SIZEOF_LONG 4
|
||||||
# define GRUB_TARGET_SIZEOF_VOID_P 4
|
# define GRUB_TARGET_SIZEOF_VOID_P 4
|
||||||
# define GRUB_TARGET_SIZEOF_LONG 4
|
# define GRUB_TARGET_SIZEOF_LONG 4
|
||||||
# define EFI_FUNC(x) x
|
# define EFI_FUNC(x) x
|
||||||
#else
|
#elif defined (__x86_64__)
|
||||||
# define SIZEOF_VOID_P 8
|
# define SIZEOF_VOID_P 8
|
||||||
# define SIZEOF_LONG 8
|
# define SIZEOF_LONG 8
|
||||||
# define GRUB_TARGET_SIZEOF_VOID_P 8
|
# define GRUB_TARGET_SIZEOF_VOID_P 8
|
||||||
# define GRUB_TARGET_SIZEOF_LONG 8
|
# define GRUB_TARGET_SIZEOF_LONG 8
|
||||||
# define EFI_FUNC(x) x ## _real
|
# define EFI_FUNC(x) x ## _real
|
||||||
|
#else
|
||||||
|
#error "Unknown architecture"
|
||||||
#endif
|
#endif
|
||||||
@@ -565,7 +565,6 @@ grub_affs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = aftime2ctime (&node->di.mtime);
|
info.mtime = aftime2ctime (&node->di.mtime);
|
||||||
info.size = grub_be_to_cpu32 (node->di.size);
|
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ handle_symlink (struct grub_archelp_data *data,
|
|||||||
grub_size_t prefixlen;
|
grub_size_t prefixlen;
|
||||||
char *rest;
|
char *rest;
|
||||||
char *linktarget;
|
char *linktarget;
|
||||||
|
grub_size_t linktarget_len;
|
||||||
|
|
||||||
*restart = 0;
|
*restart = 0;
|
||||||
|
|
||||||
@@ -96,7 +97,8 @@ handle_symlink (struct grub_archelp_data *data,
|
|||||||
return grub_errno;
|
return grub_errno;
|
||||||
if (linktarget[0] == '\0')
|
if (linktarget[0] == '\0')
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
target = grub_malloc (grub_strlen (linktarget) + grub_strlen (*name) + 2);
|
linktarget_len = grub_strlen (linktarget);
|
||||||
|
target = grub_malloc (linktarget_len + grub_strlen (*name) + 2);
|
||||||
if (!target)
|
if (!target)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
@@ -121,7 +123,7 @@ handle_symlink (struct grub_archelp_data *data,
|
|||||||
grub_memcpy (target, *name, prefixlen);
|
grub_memcpy (target, *name, prefixlen);
|
||||||
target[prefixlen-1] = '/';
|
target[prefixlen-1] = '/';
|
||||||
}
|
}
|
||||||
grub_strcat (target, rest);
|
grub_strcpy (target + prefixlen + linktarget_len, rest);
|
||||||
grub_dprintf ("archelp", "symlink redirected %s to %s\n",
|
grub_dprintf ("archelp", "symlink redirected %s to %s\n",
|
||||||
*name, target);
|
*name, target);
|
||||||
grub_free (*name);
|
grub_free (*name);
|
||||||
@@ -155,10 +157,9 @@ grub_archelp_dir (struct grub_archelp_data *data,
|
|||||||
{
|
{
|
||||||
grub_int32_t mtime;
|
grub_int32_t mtime;
|
||||||
grub_uint32_t mode;
|
grub_uint32_t mode;
|
||||||
grub_uint64_t size;
|
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
|
||||||
if (arcops->find_file (data, &name, &mtime, &mode, &size))
|
if (arcops->find_file (data, &name, &mtime, &mode))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (mode == GRUB_ARCHELP_ATTR_END)
|
if (mode == GRUB_ARCHELP_ATTR_END)
|
||||||
@@ -190,7 +191,6 @@ grub_archelp_dir (struct grub_archelp_data *data,
|
|||||||
info.mtime = mtime;
|
info.mtime = mtime;
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
}
|
}
|
||||||
info.size = size;
|
|
||||||
if (hook (n, &info, hook_data))
|
if (hook (n, &info, hook_data))
|
||||||
{
|
{
|
||||||
grub_free (name);
|
grub_free (name);
|
||||||
@@ -250,9 +250,8 @@ grub_archelp_open (struct grub_archelp_data *data,
|
|||||||
{
|
{
|
||||||
grub_uint32_t mode;
|
grub_uint32_t mode;
|
||||||
int restart;
|
int restart;
|
||||||
grub_uint64_t size;
|
|
||||||
|
|
||||||
if (arcops->find_file (data, &fn, NULL, &mode, &size))
|
if (arcops->find_file (data, &fn, NULL, &mode))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (mode == GRUB_ARCHELP_ATTR_END)
|
if (mode == GRUB_ARCHELP_ATTR_END)
|
||||||
|
|||||||
@@ -889,7 +889,6 @@ grub_bfs_dir_iter (const char *name, grub_uint64_t value,
|
|||||||
info.mtime = grub_bfs_to_cpu64 (ino.mtime) >> 16;
|
info.mtime = grub_bfs_to_cpu64 (ino.mtime) >> 16;
|
||||||
#endif
|
#endif
|
||||||
info.dir = ((grub_bfs_to_cpu32 (ino.mode) & ATTR_TYPE) == ATTR_DIR);
|
info.dir = ((grub_bfs_to_cpu32 (ino.mode) & ATTR_TYPE) == ATTR_DIR);
|
||||||
info.size = grub_bfs_to_cpu64 (ino.size);
|
|
||||||
return ctx->hook (name, &info, ctx->hook_data);
|
return ctx->hook (name, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+53
-55
@@ -1,7 +1,7 @@
|
|||||||
/* btrfs.c - B-tree file system. */
|
/* btrfs.c - B-tree file system. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2010 Free Software Foundation, Inc.
|
* Copyright (C) 2010,2011,2012,2013 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <grub/deflate.h>
|
#include <grub/deflate.h>
|
||||||
#include <minilzo.h>
|
#include <minilzo.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
#include <grub/btrfs.h>
|
||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
@@ -106,24 +107,6 @@ struct grub_btrfs_data
|
|||||||
struct grub_btrfs_extent_data *extent;
|
struct grub_btrfs_extent_data *extent;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
GRUB_BTRFS_ITEM_TYPE_INODE_ITEM = 0x01,
|
|
||||||
GRUB_BTRFS_ITEM_TYPE_INODE_REF = 0x0c,
|
|
||||||
GRUB_BTRFS_ITEM_TYPE_DIR_ITEM = 0x54,
|
|
||||||
GRUB_BTRFS_ITEM_TYPE_EXTENT_ITEM = 0x6c,
|
|
||||||
GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM = 0x84,
|
|
||||||
GRUB_BTRFS_ITEM_TYPE_DEVICE = 0xd8,
|
|
||||||
GRUB_BTRFS_ITEM_TYPE_CHUNK = 0xe4
|
|
||||||
};
|
|
||||||
|
|
||||||
struct grub_btrfs_key
|
|
||||||
{
|
|
||||||
grub_uint64_t object_id;
|
|
||||||
grub_uint8_t type;
|
|
||||||
grub_uint64_t offset;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
struct grub_btrfs_chunk_item
|
struct grub_btrfs_chunk_item
|
||||||
{
|
{
|
||||||
grub_uint64_t size;
|
grub_uint64_t size;
|
||||||
@@ -188,13 +171,6 @@ struct grub_btrfs_leaf_descriptor
|
|||||||
} *data;
|
} *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grub_btrfs_root_item
|
|
||||||
{
|
|
||||||
grub_uint8_t dummy[0xb0];
|
|
||||||
grub_uint64_t tree;
|
|
||||||
grub_uint64_t inode;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct grub_btrfs_time
|
struct grub_btrfs_time
|
||||||
{
|
{
|
||||||
grub_int64_t sec;
|
grub_int64_t sec;
|
||||||
@@ -935,7 +911,6 @@ grub_btrfs_lzo_decompress(char *ibuf, grub_size_t isize, grub_off_t off,
|
|||||||
{
|
{
|
||||||
grub_uint32_t total_size, cblock_size;
|
grub_uint32_t total_size, cblock_size;
|
||||||
grub_size_t ret = 0;
|
grub_size_t ret = 0;
|
||||||
unsigned char buf[GRUB_BTRFS_LZO_BLOCK_SIZE];
|
|
||||||
char *ibuf0 = ibuf;
|
char *ibuf0 = ibuf;
|
||||||
|
|
||||||
total_size = grub_le_to_cpu32 (grub_get_unaligned32 (ibuf));
|
total_size = grub_le_to_cpu32 (grub_get_unaligned32 (ibuf));
|
||||||
@@ -979,13 +954,21 @@ grub_btrfs_lzo_decompress(char *ibuf, grub_size_t isize, grub_off_t off,
|
|||||||
if (off > 0 || osize < GRUB_BTRFS_LZO_BLOCK_SIZE)
|
if (off > 0 || osize < GRUB_BTRFS_LZO_BLOCK_SIZE)
|
||||||
{
|
{
|
||||||
grub_size_t to_copy = GRUB_BTRFS_LZO_BLOCK_SIZE - off;
|
grub_size_t to_copy = GRUB_BTRFS_LZO_BLOCK_SIZE - off;
|
||||||
|
grub_uint8_t *buf;
|
||||||
|
|
||||||
if (to_copy > osize)
|
if (to_copy > osize)
|
||||||
to_copy = osize;
|
to_copy = osize;
|
||||||
|
|
||||||
|
buf = grub_malloc (GRUB_BTRFS_LZO_BLOCK_SIZE);
|
||||||
|
if (!buf)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (lzo1x_decompress_safe ((lzo_bytep)ibuf, cblock_size, buf, &usize,
|
if (lzo1x_decompress_safe ((lzo_bytep)ibuf, cblock_size, buf, &usize,
|
||||||
NULL) != LZO_E_OK)
|
NULL) != LZO_E_OK)
|
||||||
|
{
|
||||||
|
grub_free (buf);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (to_copy > usize)
|
if (to_copy > usize)
|
||||||
to_copy = usize;
|
to_copy = usize;
|
||||||
@@ -996,6 +979,8 @@ grub_btrfs_lzo_decompress(char *ibuf, grub_size_t isize, grub_off_t off,
|
|||||||
obuf += to_copy;
|
obuf += to_copy;
|
||||||
ibuf += cblock_size;
|
ibuf += cblock_size;
|
||||||
off = 0;
|
off = 0;
|
||||||
|
|
||||||
|
grub_free (buf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1196,6 +1181,40 @@ grub_btrfs_extent_read (struct grub_btrfs_data *data,
|
|||||||
return pos - pos0;
|
return pos - pos0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key,
|
||||||
|
grub_uint64_t *tree, grub_uint8_t *type)
|
||||||
|
{
|
||||||
|
grub_err_t err;
|
||||||
|
grub_disk_addr_t elemaddr;
|
||||||
|
grub_size_t elemsize;
|
||||||
|
struct grub_btrfs_key key_out, key_in;
|
||||||
|
struct grub_btrfs_root_item ri;
|
||||||
|
|
||||||
|
key_in.object_id = GRUB_BTRFS_ROOT_VOL_OBJECTID;
|
||||||
|
key_in.offset = 0;
|
||||||
|
key_in.type = GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM;
|
||||||
|
err = lower_bound (data, &key_in, &key_out,
|
||||||
|
data->sblock.root_tree,
|
||||||
|
&elemaddr, &elemsize, NULL, 0);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
if (key_in.object_id != key_out.object_id
|
||||||
|
|| key_in.type != key_out.type
|
||||||
|
|| key_in.offset != key_out.offset)
|
||||||
|
return grub_error (GRUB_ERR_BAD_FS, "no root");
|
||||||
|
err = grub_btrfs_read_logical (data, elemaddr, &ri,
|
||||||
|
sizeof (ri), 0);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM;
|
||||||
|
key->offset = 0;
|
||||||
|
key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK);
|
||||||
|
*tree = ri.tree;
|
||||||
|
*type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
find_path (struct grub_btrfs_data *data,
|
find_path (struct grub_btrfs_data *data,
|
||||||
const char *path, struct grub_btrfs_key *key,
|
const char *path, struct grub_btrfs_key *key,
|
||||||
@@ -1208,26 +1227,21 @@ find_path (struct grub_btrfs_data *data,
|
|||||||
grub_size_t allocated = 0;
|
grub_size_t allocated = 0;
|
||||||
struct grub_btrfs_dir_item *direl = NULL;
|
struct grub_btrfs_dir_item *direl = NULL;
|
||||||
struct grub_btrfs_key key_out;
|
struct grub_btrfs_key key_out;
|
||||||
int skip_default;
|
|
||||||
const char *ctoken;
|
const char *ctoken;
|
||||||
grub_size_t ctokenlen;
|
grub_size_t ctokenlen;
|
||||||
char *path_alloc = NULL;
|
char *path_alloc = NULL;
|
||||||
char *origpath = NULL;
|
char *origpath = NULL;
|
||||||
unsigned symlinks_max = 32;
|
unsigned symlinks_max = 32;
|
||||||
|
|
||||||
*type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
|
err = get_root (data, key, tree, type);
|
||||||
*tree = data->sblock.root_tree;
|
if (err)
|
||||||
key->object_id = data->sblock.root_dir_objectid;
|
return err;
|
||||||
key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM;
|
|
||||||
key->offset = 0;
|
|
||||||
skip_default = 1;
|
|
||||||
origpath = grub_strdup (path);
|
origpath = grub_strdup (path);
|
||||||
if (!origpath)
|
if (!origpath)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
|
||||||
if (!skip_default)
|
|
||||||
{
|
{
|
||||||
while (path[0] == '/')
|
while (path[0] == '/')
|
||||||
path++;
|
path++;
|
||||||
@@ -1238,12 +1252,6 @@ find_path (struct grub_btrfs_data *data,
|
|||||||
slash = path + grub_strlen (path);
|
slash = path + grub_strlen (path);
|
||||||
ctoken = path;
|
ctoken = path;
|
||||||
ctokenlen = slash - path;
|
ctokenlen = slash - path;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ctoken = "default";
|
|
||||||
ctokenlen = sizeof ("default") - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY)
|
if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY)
|
||||||
{
|
{
|
||||||
@@ -1254,9 +1262,7 @@ find_path (struct grub_btrfs_data *data,
|
|||||||
|
|
||||||
if (ctokenlen == 1 && ctoken[0] == '.')
|
if (ctokenlen == 1 && ctoken[0] == '.')
|
||||||
{
|
{
|
||||||
if (!skip_default)
|
|
||||||
path = slash;
|
path = slash;
|
||||||
skip_default = 0;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.')
|
if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.')
|
||||||
@@ -1287,9 +1293,7 @@ find_path (struct grub_btrfs_data *data,
|
|||||||
*type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
|
*type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
|
||||||
key->object_id = key_out.offset;
|
key->object_id = key_out.offset;
|
||||||
|
|
||||||
if (!skip_default)
|
|
||||||
path = slash;
|
path = slash;
|
||||||
skip_default = 0;
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1359,9 +1363,7 @@ find_path (struct grub_btrfs_data *data,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip_default)
|
|
||||||
path = slash;
|
path = slash;
|
||||||
skip_default = 0;
|
|
||||||
if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK)
|
if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK)
|
||||||
{
|
{
|
||||||
struct grub_btrfs_inode inode;
|
struct grub_btrfs_inode inode;
|
||||||
@@ -1411,12 +1413,9 @@ find_path (struct grub_btrfs_data *data,
|
|||||||
path = path_alloc = tmp;
|
path = path_alloc = tmp;
|
||||||
if (path[0] == '/')
|
if (path[0] == '/')
|
||||||
{
|
{
|
||||||
*type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
|
err = get_root (data, key, tree, type);
|
||||||
*tree = data->sblock.root_tree;
|
if (err)
|
||||||
key->object_id = data->sblock.root_dir_objectid;
|
return err;
|
||||||
key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM;
|
|
||||||
key->offset = 0;
|
|
||||||
skip_default = 1;
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1580,7 +1579,6 @@ grub_btrfs_dir (grub_device_t device, const char *path,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
info.mtime = grub_le_to_cpu64 (inode.mtime.sec);
|
info.mtime = grub_le_to_cpu64 (inode.mtime.sec);
|
||||||
info.size = grub_le_to_cpu64 (inode.size);
|
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
}
|
}
|
||||||
c = cdirel->name[grub_le_to_cpu16 (cdirel->n)];
|
c = cdirel->name[grub_le_to_cpu16 (cdirel->n)];
|
||||||
|
|||||||
+6
-6
@@ -44,8 +44,7 @@ struct grub_archelp_data
|
|||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cbfs_find_file (struct grub_archelp_data *data, char **name,
|
grub_cbfs_find_file (struct grub_archelp_data *data, char **name,
|
||||||
grub_int32_t *mtime,
|
grub_int32_t *mtime,
|
||||||
grub_uint32_t *mode,
|
grub_uint32_t *mode)
|
||||||
grub_uint64_t *size)
|
|
||||||
{
|
{
|
||||||
grub_size_t offset;
|
grub_size_t offset;
|
||||||
for (;;
|
for (;;
|
||||||
@@ -72,7 +71,6 @@ grub_cbfs_find_file (struct grub_archelp_data *data, char **name,
|
|||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
data->size = grub_be_to_cpu32 (hd.len);
|
data->size = grub_be_to_cpu32 (hd.len);
|
||||||
*size = grub_be_to_cpu32 (hd.len);
|
|
||||||
(void) mtime;
|
(void) mtime;
|
||||||
offset = grub_be_to_cpu32 (hd.offset);
|
offset = grub_be_to_cpu32 (hd.offset);
|
||||||
|
|
||||||
@@ -269,7 +267,8 @@ grub_cbfs_close (grub_file_t file)
|
|||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined (__i386__) || defined (__x86_64__)) && !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
|
#if (defined (__i386__) || defined (__x86_64__)) && !defined (GRUB_UTIL) \
|
||||||
|
&& !defined (GRUB_MACHINE_EMU) && !defined (GRUB_MACHINE_XEN)
|
||||||
|
|
||||||
static char *cbfsdisk_addr;
|
static char *cbfsdisk_addr;
|
||||||
static grub_off_t cbfsdisk_size = 0;
|
static grub_off_t cbfsdisk_size = 0;
|
||||||
@@ -291,6 +290,7 @@ grub_cbfsdisk_open (const char *name, grub_disk_t disk)
|
|||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a cbfsdisk");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a cbfsdisk");
|
||||||
|
|
||||||
disk->total_sectors = cbfsdisk_size / GRUB_DISK_SECTOR_SIZE;
|
disk->total_sectors = cbfsdisk_size / GRUB_DISK_SECTOR_SIZE;
|
||||||
|
disk->max_agglomerate = GRUB_DISK_MAX_MAX_AGGLOMERATE;
|
||||||
disk->id = (unsigned long) "cbfs";
|
disk->id = (unsigned long) "cbfs";
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
@@ -376,7 +376,7 @@ static struct grub_fs grub_cbfs_fs = {
|
|||||||
|
|
||||||
GRUB_MOD_INIT (cbfs)
|
GRUB_MOD_INIT (cbfs)
|
||||||
{
|
{
|
||||||
#if (defined (__i386__) || defined (__x86_64__)) && !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
|
#if (defined (__i386__) || defined (__x86_64__)) && !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU) && !defined (GRUB_MACHINE_XEN)
|
||||||
init_cbfsdisk ();
|
init_cbfsdisk ();
|
||||||
#endif
|
#endif
|
||||||
grub_fs_register (&grub_cbfs_fs);
|
grub_fs_register (&grub_cbfs_fs);
|
||||||
@@ -385,7 +385,7 @@ GRUB_MOD_INIT (cbfs)
|
|||||||
GRUB_MOD_FINI (cbfs)
|
GRUB_MOD_FINI (cbfs)
|
||||||
{
|
{
|
||||||
grub_fs_unregister (&grub_cbfs_fs);
|
grub_fs_unregister (&grub_cbfs_fs);
|
||||||
#if (defined (__i386__) || defined (__x86_64__)) && !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
|
#if (defined (__i386__) || defined (__x86_64__)) && !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU) && !defined (GRUB_MACHINE_XEN)
|
||||||
fini_cbfsdisk ();
|
fini_cbfsdisk ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -38,8 +38,7 @@ struct grub_archelp_data
|
|||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
||||||
grub_int32_t *mtime, grub_uint32_t *mode,
|
grub_int32_t *mtime, grub_uint32_t *mode)
|
||||||
grub_uint64_t *size)
|
|
||||||
{
|
{
|
||||||
struct head hd;
|
struct head hd;
|
||||||
grub_size_t namesize;
|
grub_size_t namesize;
|
||||||
@@ -87,7 +86,6 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
|||||||
|
|
||||||
data->dofs = data->hofs + ALIGN_CPIO (sizeof (hd) + namesize);
|
data->dofs = data->hofs + ALIGN_CPIO (sizeof (hd) + namesize);
|
||||||
data->next_hofs = data->dofs + ALIGN_CPIO (data->size);
|
data->next_hofs = data->dofs + ALIGN_CPIO (data->size);
|
||||||
*size = data->size;
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+64
-90
@@ -247,6 +247,7 @@ struct ext2_dirent
|
|||||||
{
|
{
|
||||||
grub_uint32_t inode;
|
grub_uint32_t inode;
|
||||||
grub_uint16_t direntlen;
|
grub_uint16_t direntlen;
|
||||||
|
#define MAX_NAMELEN 255
|
||||||
grub_uint8_t namelen;
|
grub_uint8_t namelen;
|
||||||
grub_uint8_t filetype;
|
grub_uint8_t filetype;
|
||||||
};
|
};
|
||||||
@@ -344,11 +345,12 @@ grub_ext2_blockgroup (struct grub_ext2_data *data, int group,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct grub_ext4_extent_header *
|
static struct grub_ext4_extent_header *
|
||||||
grub_ext4_find_leaf (struct grub_ext2_data *data, grub_properly_aligned_t *buf,
|
grub_ext4_find_leaf (struct grub_ext2_data *data,
|
||||||
struct grub_ext4_extent_header *ext_block,
|
struct grub_ext4_extent_header *ext_block,
|
||||||
grub_uint32_t fileblock)
|
grub_uint32_t fileblock)
|
||||||
{
|
{
|
||||||
struct grub_ext4_extent_idx *index;
|
struct grub_ext4_extent_idx *index;
|
||||||
|
void *buf = NULL;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@@ -357,8 +359,8 @@ grub_ext4_find_leaf (struct grub_ext2_data *data, grub_properly_aligned_t *buf,
|
|||||||
|
|
||||||
index = (struct grub_ext4_extent_idx *) (ext_block + 1);
|
index = (struct grub_ext4_extent_idx *) (ext_block + 1);
|
||||||
|
|
||||||
if (grub_le_to_cpu16(ext_block->magic) != EXT4_EXT_MAGIC)
|
if (ext_block->magic != grub_cpu_to_le16_compile_time (EXT4_EXT_MAGIC))
|
||||||
return 0;
|
goto fail;
|
||||||
|
|
||||||
if (ext_block->depth == 0)
|
if (ext_block->depth == 0)
|
||||||
return ext_block;
|
return ext_block;
|
||||||
@@ -370,17 +372,24 @@ grub_ext4_find_leaf (struct grub_ext2_data *data, grub_properly_aligned_t *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (--i < 0)
|
if (--i < 0)
|
||||||
return 0;
|
goto fail;
|
||||||
|
|
||||||
block = grub_le_to_cpu16 (index[i].leaf_hi);
|
block = grub_le_to_cpu16 (index[i].leaf_hi);
|
||||||
block = (block << 32) | grub_le_to_cpu32 (index[i].leaf);
|
block = (block << 32) | grub_le_to_cpu32 (index[i].leaf);
|
||||||
|
if (!buf)
|
||||||
|
buf = grub_malloc (EXT2_BLOCK_SIZE(data));
|
||||||
|
if (!buf)
|
||||||
|
goto fail;
|
||||||
if (grub_disk_read (data->disk,
|
if (grub_disk_read (data->disk,
|
||||||
block << LOG2_EXT2_BLOCK_SIZE (data),
|
block << LOG2_EXT2_BLOCK_SIZE (data),
|
||||||
0, EXT2_BLOCK_SIZE(data), buf))
|
0, EXT2_BLOCK_SIZE(data), buf))
|
||||||
return 0;
|
goto fail;
|
||||||
|
|
||||||
ext_block = (struct grub_ext4_extent_header *) buf;
|
ext_block = buf;
|
||||||
}
|
}
|
||||||
|
fail:
|
||||||
|
grub_free (buf);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_disk_addr_t
|
static grub_disk_addr_t
|
||||||
@@ -388,20 +397,21 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
|||||||
{
|
{
|
||||||
struct grub_ext2_data *data = node->data;
|
struct grub_ext2_data *data = node->data;
|
||||||
struct grub_ext2_inode *inode = &node->inode;
|
struct grub_ext2_inode *inode = &node->inode;
|
||||||
grub_disk_addr_t blknr = -1;
|
|
||||||
unsigned int blksz = EXT2_BLOCK_SIZE (data);
|
unsigned int blksz = EXT2_BLOCK_SIZE (data);
|
||||||
|
grub_disk_addr_t blksz_quarter = blksz / 4;
|
||||||
int log2_blksz = LOG2_EXT2_BLOCK_SIZE (data);
|
int log2_blksz = LOG2_EXT2_BLOCK_SIZE (data);
|
||||||
|
int log_perblock = log2_blksz + 9 - 2;
|
||||||
|
grub_uint32_t indir;
|
||||||
|
int shift;
|
||||||
|
|
||||||
if (inode->flags & grub_cpu_to_le32_compile_time (EXT4_EXTENTS_FLAG))
|
if (inode->flags & grub_cpu_to_le32_compile_time (EXT4_EXTENTS_FLAG))
|
||||||
{
|
{
|
||||||
GRUB_PROPERLY_ALIGNED_ARRAY (buf, EXT2_BLOCK_SIZE(data));
|
|
||||||
struct grub_ext4_extent_header *leaf;
|
struct grub_ext4_extent_header *leaf;
|
||||||
struct grub_ext4_extent *ext;
|
struct grub_ext4_extent *ext;
|
||||||
int i;
|
int i;
|
||||||
|
grub_disk_addr_t ret;
|
||||||
|
|
||||||
leaf = grub_ext4_find_leaf (data, buf,
|
leaf = grub_ext4_find_leaf (data, (struct grub_ext4_extent_header *) inode->blocks.dir_blocks, fileblock);
|
||||||
(struct grub_ext4_extent_header *) inode->blocks.dir_blocks,
|
|
||||||
fileblock);
|
|
||||||
if (! leaf)
|
if (! leaf)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_FS, "invalid extent");
|
grub_error (GRUB_ERR_BAD_FS, "invalid extent");
|
||||||
@@ -419,7 +429,7 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
|||||||
{
|
{
|
||||||
fileblock -= grub_le_to_cpu32 (ext[i].block);
|
fileblock -= grub_le_to_cpu32 (ext[i].block);
|
||||||
if (fileblock >= grub_le_to_cpu16 (ext[i].len))
|
if (fileblock >= grub_le_to_cpu16 (ext[i].len))
|
||||||
return 0;
|
ret = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grub_disk_addr_t start;
|
grub_disk_addr_t start;
|
||||||
@@ -427,98 +437,64 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
|||||||
start = grub_le_to_cpu16 (ext[i].start_hi);
|
start = grub_le_to_cpu16 (ext[i].start_hi);
|
||||||
start = (start << 32) + grub_le_to_cpu32 (ext[i].start);
|
start = (start << 32) + grub_le_to_cpu32 (ext[i].start);
|
||||||
|
|
||||||
return fileblock + start;
|
ret = fileblock + start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_FS, "something wrong with extent");
|
grub_error (GRUB_ERR_BAD_FS, "something wrong with extent");
|
||||||
return -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (leaf != (struct grub_ext4_extent_header *) inode->blocks.dir_blocks)
|
||||||
|
grub_free (leaf);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Direct blocks. */
|
/* Direct blocks. */
|
||||||
if (fileblock < INDIRECT_BLOCKS)
|
if (fileblock < INDIRECT_BLOCKS)
|
||||||
blknr = grub_le_to_cpu32 (inode->blocks.dir_blocks[fileblock]);
|
return grub_le_to_cpu32 (inode->blocks.dir_blocks[fileblock]);
|
||||||
|
fileblock -= INDIRECT_BLOCKS;
|
||||||
/* Indirect. */
|
/* Indirect. */
|
||||||
else if (fileblock < INDIRECT_BLOCKS + blksz / 4)
|
if (fileblock < blksz_quarter)
|
||||||
{
|
{
|
||||||
grub_uint32_t indir[blksz / 4];
|
indir = inode->blocks.indir_block;
|
||||||
|
shift = 0;
|
||||||
if (grub_disk_read (data->disk,
|
goto indirect;
|
||||||
((grub_disk_addr_t)
|
|
||||||
grub_le_to_cpu32 (inode->blocks.indir_block))
|
|
||||||
<< log2_blksz,
|
|
||||||
0, blksz, indir))
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
blknr = grub_le_to_cpu32 (indir[fileblock - INDIRECT_BLOCKS]);
|
|
||||||
}
|
}
|
||||||
|
fileblock -= blksz_quarter;
|
||||||
/* Double indirect. */
|
/* Double indirect. */
|
||||||
else if (fileblock < INDIRECT_BLOCKS
|
if (fileblock < blksz_quarter * blksz_quarter)
|
||||||
+ blksz / 4 * ((grub_disk_addr_t) blksz / 4 + 1))
|
|
||||||
{
|
{
|
||||||
int log_perblock = log2_blksz + 9 - 2;
|
indir = inode->blocks.double_indir_block;
|
||||||
grub_disk_addr_t rblock = fileblock - (INDIRECT_BLOCKS
|
shift = 1;
|
||||||
+ blksz / 4);
|
goto indirect;
|
||||||
grub_uint32_t indir[blksz / 4];
|
|
||||||
|
|
||||||
if (grub_disk_read (data->disk,
|
|
||||||
((grub_disk_addr_t)
|
|
||||||
grub_le_to_cpu32 (inode->blocks.double_indir_block))
|
|
||||||
<< log2_blksz,
|
|
||||||
0, blksz, indir))
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (grub_disk_read (data->disk,
|
|
||||||
((grub_disk_addr_t)
|
|
||||||
grub_le_to_cpu32 (indir[rblock >> log_perblock]))
|
|
||||||
<< log2_blksz,
|
|
||||||
0, blksz, indir))
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
|
|
||||||
blknr = grub_le_to_cpu32 (indir[rblock & ((1 << log_perblock) - 1)]);
|
|
||||||
}
|
}
|
||||||
/* triple indirect. */
|
fileblock -= blksz_quarter * blksz_quarter;
|
||||||
else if (fileblock < INDIRECT_BLOCKS + blksz / 4 * ((grub_disk_addr_t) blksz / 4 + 1)
|
/* Triple indirect. */
|
||||||
+ ((grub_disk_addr_t) blksz / 4) * ((grub_disk_addr_t) blksz / 4)
|
if (fileblock < blksz_quarter * blksz_quarter * (blksz_quarter + 1))
|
||||||
* ((grub_disk_addr_t) blksz / 4 + 1))
|
|
||||||
{
|
{
|
||||||
int log_perblock = log2_blksz + 9 - 2;
|
indir = inode->blocks.triple_indir_block;
|
||||||
grub_disk_addr_t rblock = fileblock - (INDIRECT_BLOCKS + blksz / 4
|
shift = 2;
|
||||||
* (blksz / 4 + 1));
|
goto indirect;
|
||||||
grub_uint32_t indir[blksz / 4];
|
|
||||||
|
|
||||||
if (grub_disk_read (data->disk,
|
|
||||||
((grub_disk_addr_t)
|
|
||||||
grub_le_to_cpu32 (inode->blocks.triple_indir_block))
|
|
||||||
<< log2_blksz,
|
|
||||||
0, blksz, indir))
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (grub_disk_read (data->disk,
|
|
||||||
((grub_disk_addr_t)
|
|
||||||
grub_le_to_cpu32 (indir[(rblock >> log_perblock) >> log_perblock]))
|
|
||||||
<< log2_blksz,
|
|
||||||
0, blksz, indir))
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (grub_disk_read (data->disk,
|
|
||||||
((grub_disk_addr_t)
|
|
||||||
grub_le_to_cpu32 (indir[(rblock >> log_perblock) & ((1 << log_perblock) - 1)]))
|
|
||||||
<< log2_blksz,
|
|
||||||
0, blksz, indir))
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
blknr = grub_le_to_cpu32 (indir[rblock & ((1 << log_perblock) - 1)]);
|
|
||||||
}
|
}
|
||||||
else
|
return grub_error (GRUB_ERR_BAD_FS,
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
||||||
"ext2fs doesn't support quadruple indirect blocks");
|
"ext2fs doesn't support quadruple indirect blocks");
|
||||||
}
|
|
||||||
|
|
||||||
return blknr;
|
indirect:
|
||||||
|
do {
|
||||||
|
if (grub_disk_read (data->disk,
|
||||||
|
((grub_disk_addr_t) grub_le_to_cpu32 (indir))
|
||||||
|
<< log2_blksz,
|
||||||
|
((fileblock >> (log_perblock * shift))
|
||||||
|
& ((1 << log_perblock) - 1))
|
||||||
|
* sizeof (indir),
|
||||||
|
sizeof (indir), &indir))
|
||||||
|
return grub_errno;
|
||||||
|
} while (shift--);
|
||||||
|
|
||||||
|
return grub_le_to_cpu32 (indir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read LEN bytes from the file described by DATA starting with byte
|
/* Read LEN bytes from the file described by DATA starting with byte
|
||||||
@@ -670,8 +646,8 @@ grub_ext2_read_symlink (grub_fshelp_node_t node)
|
|||||||
/* If the filesize of the symlink is bigger than
|
/* If the filesize of the symlink is bigger than
|
||||||
60 the symlink is stored in a separate block,
|
60 the symlink is stored in a separate block,
|
||||||
otherwise it is stored in the inode. */
|
otherwise it is stored in the inode. */
|
||||||
if (grub_le_to_cpu32 (diro->inode.size) <= 60)
|
if (grub_le_to_cpu32 (diro->inode.size) <= sizeof (diro->inode.symlink))
|
||||||
grub_strncpy (symlink,
|
grub_memcpy (symlink,
|
||||||
diro->inode.symlink,
|
diro->inode.symlink,
|
||||||
grub_le_to_cpu32 (diro->inode.size));
|
grub_le_to_cpu32 (diro->inode.size));
|
||||||
else
|
else
|
||||||
@@ -719,7 +695,7 @@ grub_ext2_iterate_dir (grub_fshelp_node_t dir,
|
|||||||
|
|
||||||
if (dirent.inode != 0 && dirent.namelen != 0)
|
if (dirent.inode != 0 && dirent.namelen != 0)
|
||||||
{
|
{
|
||||||
char filename[dirent.namelen + 1];
|
char filename[MAX_NAMELEN + 1];
|
||||||
struct grub_fshelp_node *fdiro;
|
struct grub_fshelp_node *fdiro;
|
||||||
enum grub_fshelp_filetype type = GRUB_FSHELP_UNKNOWN;
|
enum grub_fshelp_filetype type = GRUB_FSHELP_UNKNOWN;
|
||||||
|
|
||||||
@@ -884,8 +860,6 @@ grub_ext2_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
{
|
{
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_le_to_cpu32 (node->inode.mtime);
|
info.mtime = grub_le_to_cpu32 (node->inode.mtime);
|
||||||
info.size = grub_le_to_cpu32 (node->inode.size);
|
|
||||||
info.size |= ((grub_off_t) grub_le_to_cpu32 (node->inode.size_high)) << 32;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
|
|||||||
@@ -938,8 +938,6 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data,
|
|||||||
#endif
|
#endif
|
||||||
data->cur_cluster_num = ~0U;
|
data->cur_cluster_num = ~0U;
|
||||||
|
|
||||||
info.size = data->file_size;
|
|
||||||
|
|
||||||
if (call_hook)
|
if (call_hook)
|
||||||
hook (ctxt.filename, &info, hook_data);
|
hook (ctxt.filename, &info, hook_data);
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ find_file (const char *currpath, grub_fshelp_node_t currroot,
|
|||||||
if (ctx->type == GRUB_FSHELP_SYMLINK)
|
if (ctx->type == GRUB_FSHELP_SYMLINK)
|
||||||
{
|
{
|
||||||
char *symlink;
|
char *symlink;
|
||||||
|
const char *next;
|
||||||
|
|
||||||
/* Test if the symlink does not loop. */
|
/* Test if the symlink does not loop. */
|
||||||
if (++ctx->symlinknest == 8)
|
if (++ctx->symlinknest == 8)
|
||||||
@@ -164,8 +165,10 @@ find_file (const char *currpath, grub_fshelp_node_t currroot,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup the node the symlink points to. */
|
/* Lookup the node the symlink points to. */
|
||||||
|
next = ctx->next;
|
||||||
find_file (symlink, ctx->oldnode, &ctx->currnode,
|
find_file (symlink, ctx->oldnode, &ctx->currnode,
|
||||||
iterate_dir, read_symlink, ctx);
|
iterate_dir, read_symlink, ctx);
|
||||||
|
ctx->next = next;
|
||||||
ctx->type = ctx->foundtype;
|
ctx->type = ctx->foundtype;
|
||||||
grub_free (symlink);
|
grub_free (symlink);
|
||||||
|
|
||||||
|
|||||||
@@ -1237,7 +1237,6 @@ grub_hfs_dir_hook (struct grub_hfs_record *rec, void *hook_arg)
|
|||||||
info.dir = 0;
|
info.dir = 0;
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_be_to_cpu32 (frec->mtime) - 2082844800;
|
info.mtime = grub_be_to_cpu32 (frec->mtime) - 2082844800;
|
||||||
info.size = grub_be_to_cpu32 (frec->size);
|
|
||||||
return ctx->hook (fname, &info, ctx->hook_data);
|
return ctx->hook (fname, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -888,6 +888,8 @@ grub_hfsplus_read (grub_file_t file, char *buf, grub_size_t len)
|
|||||||
struct grub_hfsplus_data *data =
|
struct grub_hfsplus_data *data =
|
||||||
(struct grub_hfsplus_data *) file->data;
|
(struct grub_hfsplus_data *) file->data;
|
||||||
|
|
||||||
|
data->opened_file.file = file;
|
||||||
|
|
||||||
if (grub_hfsplus_read_compressed && data->opened_file.compressed)
|
if (grub_hfsplus_read_compressed && data->opened_file.compressed)
|
||||||
return grub_hfsplus_read_compressed (&data->opened_file,
|
return grub_hfsplus_read_compressed (&data->opened_file,
|
||||||
file->offset, len, buf);
|
file->offset, len, buf);
|
||||||
@@ -917,7 +919,6 @@ grub_hfsplus_dir_iter (const char *filename,
|
|||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = node->mtime;
|
info.mtime = node->mtime;
|
||||||
info.size = node->size;
|
|
||||||
info.case_insensitive = !! (filetype & GRUB_FSHELP_CASE_INSENSITIVE);
|
info.case_insensitive = !! (filetype & GRUB_FSHELP_CASE_INSENSITIVE);
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/deflate.h>
|
#include <grub/deflate.h>
|
||||||
|
#include <grub/file.h>
|
||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
@@ -121,6 +122,8 @@ hfsplus_read_compressed_real (struct grub_hfsplus_file *node,
|
|||||||
if (node->compressed == 1)
|
if (node->compressed == 1)
|
||||||
{
|
{
|
||||||
grub_memcpy (buf, node->cbuf + pos, len);
|
grub_memcpy (buf, node->cbuf + pos, len);
|
||||||
|
if (grub_file_progress_hook && node->file)
|
||||||
|
grub_file_progress_hook (0, 0, len, node->file);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,6 +165,8 @@ hfsplus_read_compressed_real (struct grub_hfsplus_file *node,
|
|||||||
}
|
}
|
||||||
grub_memcpy (buf, node->cbuf + (pos % HFSPLUS_COMPRESS_BLOCK_SIZE),
|
grub_memcpy (buf, node->cbuf + (pos % HFSPLUS_COMPRESS_BLOCK_SIZE),
|
||||||
curlen);
|
curlen);
|
||||||
|
if (grub_file_progress_hook && node->file)
|
||||||
|
grub_file_progress_hook (0, 0, curlen, node->file);
|
||||||
buf += curlen;
|
buf += curlen;
|
||||||
pos += curlen;
|
pos += curlen;
|
||||||
len -= curlen;
|
len -= curlen;
|
||||||
|
|||||||
@@ -861,7 +861,7 @@ grub_iso9660_dir_iter (const char *filename,
|
|||||||
grub_memset (&info, 0, sizeof (info));
|
grub_memset (&info, 0, sizeof (info));
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtimeset = !!iso9660_to_unixtime2 (&node->dirents[0].mtime, &info.mtime);
|
info.mtimeset = !!iso9660_to_unixtime2 (&node->dirents[0].mtime, &info.mtime);
|
||||||
info.size = get_node_size (node);
|
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-14
@@ -72,10 +72,13 @@ struct grub_jfs_extent
|
|||||||
grub_uint32_t blk2;
|
grub_uint32_t blk2;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
#define GRUB_JFS_IAG_INODES_OFFSET 3072
|
||||||
|
#define GRUB_JFS_IAG_INODES_COUNT 128
|
||||||
|
|
||||||
struct grub_jfs_iag
|
struct grub_jfs_iag
|
||||||
{
|
{
|
||||||
grub_uint8_t unused[3072];
|
grub_uint8_t unused[GRUB_JFS_IAG_INODES_OFFSET];
|
||||||
struct grub_jfs_extent inodes[128];
|
struct grub_jfs_extent inodes[GRUB_JFS_IAG_INODES_COUNT];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
|
||||||
@@ -283,20 +286,25 @@ getblk (struct grub_jfs_treehead *treehead,
|
|||||||
|
|
||||||
if (found != -1)
|
if (found != -1)
|
||||||
{
|
{
|
||||||
|
grub_int64_t ret = -1;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
struct grub_jfs_treehead treehead;
|
struct grub_jfs_treehead treehead;
|
||||||
struct grub_jfs_tree_extent extents[254];
|
struct grub_jfs_tree_extent extents[254];
|
||||||
} tree;
|
} *tree;
|
||||||
|
|
||||||
if (grub_disk_read (data->disk,
|
tree = grub_zalloc (sizeof (*tree));
|
||||||
|
if (!tree)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (!grub_disk_read (data->disk,
|
||||||
((grub_disk_addr_t) grub_le_to_cpu32 (extents[found].extent.blk2))
|
((grub_disk_addr_t) grub_le_to_cpu32 (extents[found].extent.blk2))
|
||||||
<< (grub_le_to_cpu16 (data->sblock.log2_blksz)
|
<< (grub_le_to_cpu16 (data->sblock.log2_blksz)
|
||||||
- GRUB_DISK_SECTOR_BITS), 0,
|
- GRUB_DISK_SECTOR_BITS), 0,
|
||||||
sizeof (tree), (char *) &tree))
|
sizeof (*tree), (char *) tree))
|
||||||
return -1;
|
ret = getblk (&tree->treehead, &tree->extents[0], data, blk);
|
||||||
|
grub_free (tree);
|
||||||
return getblk (&tree.treehead, &tree.extents[0], data, blk);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@@ -316,7 +324,7 @@ static grub_err_t
|
|||||||
grub_jfs_read_inode (struct grub_jfs_data *data, grub_uint32_t ino,
|
grub_jfs_read_inode (struct grub_jfs_data *data, grub_uint32_t ino,
|
||||||
struct grub_jfs_inode *inode)
|
struct grub_jfs_inode *inode)
|
||||||
{
|
{
|
||||||
struct grub_jfs_iag iag;
|
struct grub_jfs_extent iag_inodes[GRUB_JFS_IAG_INODES_COUNT];
|
||||||
grub_uint32_t iagnum = ino / 4096;
|
grub_uint32_t iagnum = ino / 4096;
|
||||||
unsigned inoext = (ino % 4096) / 32;
|
unsigned inoext = (ino % 4096) / 32;
|
||||||
unsigned inonum = (ino % 4096) % 32;
|
unsigned inonum = (ino % 4096) % 32;
|
||||||
@@ -330,11 +338,12 @@ grub_jfs_read_inode (struct grub_jfs_data *data, grub_uint32_t ino,
|
|||||||
/* Read in the IAG. */
|
/* Read in the IAG. */
|
||||||
if (grub_disk_read (data->disk,
|
if (grub_disk_read (data->disk,
|
||||||
iagblk << (grub_le_to_cpu16 (data->sblock.log2_blksz)
|
iagblk << (grub_le_to_cpu16 (data->sblock.log2_blksz)
|
||||||
- GRUB_DISK_SECTOR_BITS), 0,
|
- GRUB_DISK_SECTOR_BITS),
|
||||||
sizeof (struct grub_jfs_iag), &iag))
|
GRUB_JFS_IAG_INODES_OFFSET,
|
||||||
|
sizeof (iag_inodes), &iag_inodes))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
inoblk = grub_le_to_cpu32 (iag.inodes[inoext].blk2);
|
inoblk = grub_le_to_cpu32 (iag_inodes[inoext].blk2);
|
||||||
inoblk <<= (grub_le_to_cpu16 (data->sblock.log2_blksz)
|
inoblk <<= (grub_le_to_cpu16 (data->sblock.log2_blksz)
|
||||||
- GRUB_DISK_SECTOR_BITS);
|
- GRUB_DISK_SECTOR_BITS);
|
||||||
inoblk += inonum;
|
inoblk += inonum;
|
||||||
@@ -723,7 +732,7 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino)
|
|||||||
if (!symlink)
|
if (!symlink)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
if (size <= sizeof (data->currinode.symlink.path))
|
if (size <= sizeof (data->currinode.symlink.path))
|
||||||
grub_strncpy (symlink, (char *) (data->currinode.symlink.path), size);
|
grub_memcpy (symlink, (char *) (data->currinode.symlink.path), size);
|
||||||
else if (grub_jfs_read_file (data, 0, 0, 0, size, symlink) < 0)
|
else if (grub_jfs_read_file (data, 0, 0, 0, size, symlink) < 0)
|
||||||
{
|
{
|
||||||
grub_free (symlink);
|
grub_free (symlink);
|
||||||
@@ -778,7 +787,6 @@ grub_jfs_dir (grub_device_t device, const char *path,
|
|||||||
& GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_DIR;
|
& GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_DIR;
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_le_to_cpu32 (inode.mtime.sec);
|
info.mtime = grub_le_to_cpu32 (inode.mtime.sec);
|
||||||
info.size = grub_le_to_cpu64 (inode.size);
|
|
||||||
if (hook (diro->name, &info, hook_data))
|
if (hook (diro->name, &info, hook_data))
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -576,7 +576,6 @@ grub_minix_dir (grub_device_t device, const char *path,
|
|||||||
& GRUB_MINIX_IFDIR) == GRUB_MINIX_IFDIR);
|
& GRUB_MINIX_IFDIR) == GRUB_MINIX_IFDIR);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_minix_to_cpu32 (data->inode.mtime);
|
info.mtime = grub_minix_to_cpu32 (data->inode.mtime);
|
||||||
info.size = GRUB_MINIX_INODE_SIZE (data);
|
|
||||||
|
|
||||||
if (hook (filename, &info, hook_data) ? 1 : 0)
|
if (hook (filename, &info, hook_data) ? 1 : 0)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1066,7 +1066,6 @@ grub_nilfs2_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
{
|
{
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_le_to_cpu64 (node->inode.i_mtime);
|
info.mtime = grub_le_to_cpu64 (node->inode.i_mtime);
|
||||||
info.size = grub_le_to_cpu64 (node->inode.i_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
|
|||||||
+3
-3
@@ -378,6 +378,9 @@ read_data (struct grub_ntfs_attr *at, grub_uint8_t *pa, grub_uint8_t *dest,
|
|||||||
ctx->comp.log_spc = at->mft->data->log_spc;
|
ctx->comp.log_spc = at->mft->data->log_spc;
|
||||||
ctx->comp.disk = at->mft->data->disk;
|
ctx->comp.disk = at->mft->data->disk;
|
||||||
|
|
||||||
|
if (read_hook == grub_file_progress_hook)
|
||||||
|
ctx->file = read_hook_data;
|
||||||
|
|
||||||
if (pa[8] == 0)
|
if (pa[8] == 0)
|
||||||
{
|
{
|
||||||
if (ofs + len > u32at (pa, 0x10))
|
if (ofs + len > u32at (pa, 0x10))
|
||||||
@@ -981,13 +984,10 @@ grub_ntfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
|
|
||||||
grub_memset (&info, 0, sizeof (info));
|
grub_memset (&info, 0, sizeof (info));
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
init_file (node, node->ino);
|
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_divmod64 (node->mtime, 10000000, 0)
|
info.mtime = grub_divmod64 (node->mtime, 10000000, 0)
|
||||||
- 86400ULL * 365 * (1970 - 1601)
|
- 86400ULL * 365 * (1970 - 1601)
|
||||||
- 86400ULL * ((1970 - 1601) / 4) + 86400ULL * ((1970 - 1601) / 100);
|
- 86400ULL * ((1970 - 1601) / 4) + 86400ULL * ((1970 - 1601) / 100);
|
||||||
info.mtime = node->size;
|
|
||||||
free_file (node);
|
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,6 +226,9 @@ read_block (struct grub_ntfs_rlst *ctx, grub_uint8_t *buf, grub_size_t num)
|
|||||||
{
|
{
|
||||||
grub_memset (buf, 0, nn * GRUB_NTFS_COM_LEN);
|
grub_memset (buf, 0, nn * GRUB_NTFS_COM_LEN);
|
||||||
buf += nn * GRUB_NTFS_COM_LEN;
|
buf += nn * GRUB_NTFS_COM_LEN;
|
||||||
|
if (grub_file_progress_hook && ctx->file)
|
||||||
|
grub_file_progress_hook (0, 0, nn * GRUB_NTFS_COM_LEN,
|
||||||
|
ctx->file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -236,6 +239,9 @@ read_block (struct grub_ntfs_rlst *ctx, grub_uint8_t *buf, grub_size_t num)
|
|||||||
return grub_errno;
|
return grub_errno;
|
||||||
if (buf)
|
if (buf)
|
||||||
buf += GRUB_NTFS_COM_LEN;
|
buf += GRUB_NTFS_COM_LEN;
|
||||||
|
if (grub_file_progress_hook && ctx->file)
|
||||||
|
grub_file_progress_hook (0, 0, GRUB_NTFS_COM_LEN,
|
||||||
|
ctx->file);
|
||||||
nn--;
|
nn--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -262,6 +268,11 @@ read_block (struct grub_ntfs_rlst *ctx, grub_uint8_t *buf, grub_size_t num)
|
|||||||
ctx->target_vcn)) << ctx->comp.log_spc, 0,
|
ctx->target_vcn)) << ctx->comp.log_spc, 0,
|
||||||
tt << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR), buf))
|
tt << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR), buf))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
if (grub_file_progress_hook && ctx->file)
|
||||||
|
grub_file_progress_hook (0, 0,
|
||||||
|
tt << (ctx->comp.log_spc
|
||||||
|
+ GRUB_NTFS_BLK_SHR),
|
||||||
|
ctx->file);
|
||||||
buf += tt << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
|
buf += tt << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
|
||||||
}
|
}
|
||||||
nn -= tt;
|
nn -= tt;
|
||||||
@@ -280,6 +291,11 @@ read_block (struct grub_ntfs_rlst *ctx, grub_uint8_t *buf, grub_size_t num)
|
|||||||
nn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR), buf))
|
nn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR), buf))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
buf += nn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
|
buf += nn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
|
||||||
|
if (grub_file_progress_hook && ctx->file)
|
||||||
|
grub_file_progress_hook (0, 0,
|
||||||
|
nn << (ctx->comp.log_spc
|
||||||
|
+ GRUB_NTFS_BLK_SHR),
|
||||||
|
ctx->file);
|
||||||
}
|
}
|
||||||
ctx->target_vcn += nn;
|
ctx->target_vcn += nn;
|
||||||
}
|
}
|
||||||
@@ -306,6 +322,8 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
|
|||||||
n = len;
|
n = len;
|
||||||
|
|
||||||
grub_memcpy (dest, ctx->attr->sbuf + ofs - ctx->attr->save_pos, n);
|
grub_memcpy (dest, ctx->attr->sbuf + ofs - ctx->attr->save_pos, n);
|
||||||
|
if (grub_file_progress_hook && ctx->file)
|
||||||
|
grub_file_progress_hook (0, 0, n, ctx->file);
|
||||||
if (n == len)
|
if (n == len)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -351,6 +369,9 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
|
|||||||
if (ofs % GRUB_NTFS_COM_LEN)
|
if (ofs % GRUB_NTFS_COM_LEN)
|
||||||
{
|
{
|
||||||
grub_uint32_t t, n, o;
|
grub_uint32_t t, n, o;
|
||||||
|
void *file = ctx->file;
|
||||||
|
|
||||||
|
ctx->file = 0;
|
||||||
|
|
||||||
t = ctx->target_vcn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
|
t = ctx->target_vcn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
|
||||||
if (read_block (ctx, ctx->attr->sbuf, 1))
|
if (read_block (ctx, ctx->attr->sbuf, 1))
|
||||||
@@ -359,6 +380,8 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
|
|||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->file = file;
|
||||||
|
|
||||||
ctx->attr->save_pos = t;
|
ctx->attr->save_pos = t;
|
||||||
|
|
||||||
o = ofs % GRUB_NTFS_COM_LEN;
|
o = ofs % GRUB_NTFS_COM_LEN;
|
||||||
@@ -366,6 +389,8 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
|
|||||||
if (n > len)
|
if (n > len)
|
||||||
n = len;
|
n = len;
|
||||||
grub_memcpy (dest, &ctx->attr->sbuf[o], n);
|
grub_memcpy (dest, &ctx->attr->sbuf[o], n);
|
||||||
|
if (grub_file_progress_hook && ctx->file)
|
||||||
|
grub_file_progress_hook (0, 0, n, ctx->file);
|
||||||
if (n == len)
|
if (n == len)
|
||||||
goto quit;
|
goto quit;
|
||||||
dest += n;
|
dest += n;
|
||||||
@@ -383,7 +408,9 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
|
|||||||
if (len)
|
if (len)
|
||||||
{
|
{
|
||||||
grub_uint32_t t;
|
grub_uint32_t t;
|
||||||
|
void *file = ctx->file;
|
||||||
|
|
||||||
|
ctx->file = 0;
|
||||||
t = ctx->target_vcn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
|
t = ctx->target_vcn << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
|
||||||
if (read_block (ctx, ctx->attr->sbuf, 1))
|
if (read_block (ctx, ctx->attr->sbuf, 1))
|
||||||
{
|
{
|
||||||
@@ -394,6 +421,8 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs,
|
|||||||
ctx->attr->save_pos = t;
|
ctx->attr->save_pos = t;
|
||||||
|
|
||||||
grub_memcpy (dest, ctx->attr->sbuf, len);
|
grub_memcpy (dest, ctx->attr->sbuf, len);
|
||||||
|
if (grub_file_progress_hook && file)
|
||||||
|
grub_file_progress_hook (0, 0, len, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
quit:
|
quit:
|
||||||
|
|||||||
+3
-2
@@ -128,10 +128,11 @@ grub_procfs_open (struct grub_file *file, const char *path)
|
|||||||
FOR_LIST_ELEMENTS((entry), (grub_procfs_entries))
|
FOR_LIST_ELEMENTS((entry), (grub_procfs_entries))
|
||||||
if (grub_strcmp (pathptr, entry->name) == 0)
|
if (grub_strcmp (pathptr, entry->name) == 0)
|
||||||
{
|
{
|
||||||
file->data = entry->get_contents ();
|
grub_size_t sz;
|
||||||
|
file->data = entry->get_contents (&sz);
|
||||||
if (!file->data)
|
if (!file->data)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
file->size = grub_strlen (file->data);
|
file->size = sz;
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -781,7 +781,7 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
|
|||||||
= grub_le_to_cpu16 (directory_header->state);
|
= grub_le_to_cpu16 (directory_header->state);
|
||||||
grub_fshelp_node_t entry_item;
|
grub_fshelp_node_t entry_item;
|
||||||
struct grub_reiserfs_key entry_key;
|
struct grub_reiserfs_key entry_key;
|
||||||
enum grub_reiserfs_item_type entry_type;
|
enum grub_fshelp_filetype entry_type;
|
||||||
char *entry_name;
|
char *entry_name;
|
||||||
|
|
||||||
if (!(entry_state & GRUB_REISERFS_VISIBLE_MASK))
|
if (!(entry_state & GRUB_REISERFS_VISIBLE_MASK))
|
||||||
@@ -1271,7 +1271,6 @@ grub_reiserfs_dir_iter (const char *filename,
|
|||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = node->mtime;
|
info.mtime = node->mtime;
|
||||||
info.size = node->size;
|
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,7 +331,6 @@ grub_romfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
grub_memset (&info, 0, sizeof (info));
|
grub_memset (&info, 0, sizeof (info));
|
||||||
|
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.size = grub_be_to_cpu32 (node->file.size);
|
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -671,7 +671,6 @@ grub_sfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtime = node->mtime + 8 * 365 * 86400 + 86400 * 2;
|
info.mtime = node->mtime + 8 * 365 * 86400 + 86400 * 2;
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.size = node->size;
|
|
||||||
grub_free (node->cache);
|
grub_free (node->cache);
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
|
|||||||
@@ -656,15 +656,6 @@ grub_squash_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_le_to_cpu32 (node->ino.mtime);
|
info.mtime = grub_le_to_cpu32 (node->ino.mtime);
|
||||||
switch (node->ino.type)
|
|
||||||
{
|
|
||||||
case grub_cpu_to_le16_compile_time (SQUASH_TYPE_LONG_REGULAR):
|
|
||||||
info.size = grub_le_to_cpu64 (node->ino.long_file.size);
|
|
||||||
break;
|
|
||||||
case grub_cpu_to_le16_compile_time (SQUASH_TYPE_REGULAR):
|
|
||||||
info.size = grub_le_to_cpu32 (node->ino.file.size);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-4
@@ -72,8 +72,7 @@ struct grub_archelp_data
|
|||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
||||||
grub_int32_t *mtime,
|
grub_int32_t *mtime,
|
||||||
grub_uint32_t *mode,
|
grub_uint32_t *mode)
|
||||||
grub_uint64_t *size)
|
|
||||||
{
|
{
|
||||||
struct head hd;
|
struct head hd;
|
||||||
int reread = 0, have_longname = 0, have_longlink = 0;
|
int reread = 0, have_longname = 0, have_longlink = 0;
|
||||||
@@ -201,7 +200,6 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
|||||||
grub_memcpy (data->linkname, hd.linkname, sizeof (hd.linkname));
|
grub_memcpy (data->linkname, hd.linkname, sizeof (hd.linkname));
|
||||||
data->linkname[100] = 0;
|
data->linkname[100] = 0;
|
||||||
}
|
}
|
||||||
*size = data->size;
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
@@ -299,10 +297,17 @@ static grub_ssize_t
|
|||||||
grub_cpio_read (grub_file_t file, char *buf, grub_size_t len)
|
grub_cpio_read (grub_file_t file, char *buf, grub_size_t len)
|
||||||
{
|
{
|
||||||
struct grub_archelp_data *data;
|
struct grub_archelp_data *data;
|
||||||
|
grub_ssize_t ret;
|
||||||
|
|
||||||
data = file->data;
|
data = file->data;
|
||||||
return (grub_disk_read (data->disk, 0, data->dofs + file->offset,
|
|
||||||
|
data->disk->read_hook = file->read_hook;
|
||||||
|
data->disk->read_hook_data = file->read_hook_data;
|
||||||
|
ret = (grub_disk_read (data->disk, 0, data->dofs + file->offset,
|
||||||
len, buf)) ? -1 : (grub_ssize_t) len;
|
len, buf)) ? -1 : (grub_ssize_t) len;
|
||||||
|
data->disk->read_hook = 0;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
|
|||||||
@@ -1072,7 +1072,6 @@ grub_udf_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
info.mtimeset = !!grub_datetime2unixtime (&datetime, &info.mtime);
|
info.mtimeset = !!grub_datetime2unixtime (&datetime, &info.mtime);
|
||||||
|
|
||||||
info.mtime -= 60 * tz;
|
info.mtime -= 60 * tz;
|
||||||
info.size = U64 (node->block.fe.file_size);
|
|
||||||
}
|
}
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
return ctx->hook (filename, &info, ctx->hook_data);
|
return ctx->hook (filename, &info, ctx->hook_data);
|
||||||
|
|||||||
@@ -711,8 +711,6 @@ grub_ufs_dir (grub_device_t device, const char *path,
|
|||||||
#endif
|
#endif
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
|
|
||||||
info.size = grub_ufs_to_cpu64 (inode.size);
|
|
||||||
|
|
||||||
if (hook (filename, &info, hook_data))
|
if (hook (filename, &info, hook_data))
|
||||||
{
|
{
|
||||||
grub_free (filename);
|
grub_free (filename);
|
||||||
|
|||||||
@@ -732,7 +732,6 @@ grub_xfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
|||||||
{
|
{
|
||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_be_to_cpu32 (node->inode.mtime.sec);
|
info.mtime = grub_be_to_cpu32 (node->inode.mtime.sec);
|
||||||
info.size = grub_be_to_cpu64 (node->inode.size);
|
|
||||||
}
|
}
|
||||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||||
grub_free (node);
|
grub_free (node);
|
||||||
|
|||||||
+16
-20
@@ -129,7 +129,7 @@ LEAF_HASH (int bs, grub_uint64_t h, zap_leaf_phys_t *l)
|
|||||||
static inline int
|
static inline int
|
||||||
ZAP_LEAF_NUMCHUNKS (int bs)
|
ZAP_LEAF_NUMCHUNKS (int bs)
|
||||||
{
|
{
|
||||||
return (((1 << bs) - 2 * ZAP_LEAF_HASH_NUMENTRIES (bs)) /
|
return (((1U << bs) - 2 * ZAP_LEAF_HASH_NUMENTRIES (bs)) /
|
||||||
ZAP_LEAF_CHUNKSIZE - 2);
|
ZAP_LEAF_CHUNKSIZE - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,18 +877,13 @@ nvlist_next_nvpair (const char *nvl, const char *nvpair)
|
|||||||
* containing the name of nvpair is saved in buf.
|
* containing the name of nvpair is saved in buf.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
nvpair_name (const char *nvp, char **buf, int *buflen)
|
nvpair_name (const char *nvp, char **buf, grub_size_t *buflen)
|
||||||
{
|
{
|
||||||
int len;
|
|
||||||
|
|
||||||
/* skip over encode/decode size */
|
/* skip over encode/decode size */
|
||||||
nvp += 4 * 2;
|
nvp += 4 * 2;
|
||||||
|
|
||||||
len = grub_be_to_cpu32 (grub_get_unaligned32 (nvp));
|
*buf = (char *) (nvp + 4);
|
||||||
nvp=nvp+4;
|
*buflen = grub_be_to_cpu32 (grub_get_unaligned32 (nvp));
|
||||||
|
|
||||||
*buf=(char*)nvp;
|
|
||||||
*buflen=len;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1113,15 +1108,15 @@ check_pool_label (struct grub_zfs_data *data,
|
|||||||
const char *nvp=NULL;
|
const char *nvp=NULL;
|
||||||
char name[MAX_SUPPORTED_FEATURE_STRLEN + 1];
|
char name[MAX_SUPPORTED_FEATURE_STRLEN + 1];
|
||||||
char *nameptr;
|
char *nameptr;
|
||||||
int namelen;
|
grub_size_t namelen;
|
||||||
while ((nvp = nvlist_next_nvpair(features, nvp)) != NULL)
|
while ((nvp = nvlist_next_nvpair(features, nvp)) != NULL)
|
||||||
{
|
{
|
||||||
nvpair_name(nvp, &nameptr,&namelen);
|
nvpair_name (nvp, &nameptr, &namelen);
|
||||||
if(namelen > MAX_SUPPORTED_FEATURE_STRLEN)
|
if(namelen > MAX_SUPPORTED_FEATURE_STRLEN)
|
||||||
namelen = MAX_SUPPORTED_FEATURE_STRLEN;
|
namelen = MAX_SUPPORTED_FEATURE_STRLEN;
|
||||||
grub_strncpy(name,nameptr,namelen);
|
grub_memcpy (name, nameptr, namelen);
|
||||||
name[namelen]=0;
|
name[namelen] = '\0';
|
||||||
grub_dprintf("zfs","namelen=%u str=%s\n",namelen,name);
|
grub_dprintf("zfs","str=%s\n",name);
|
||||||
if (check_feature(name,1, NULL) != 0)
|
if (check_feature(name,1, NULL) != 0)
|
||||||
{
|
{
|
||||||
grub_dprintf("zfs","feature missing in check_pool_label:%s\n",name);
|
grub_dprintf("zfs","feature missing in check_pool_label:%s\n",name);
|
||||||
@@ -3308,7 +3303,8 @@ nvlist_find_value (const char *nvlist_in, const char *name,
|
|||||||
int valtype, char **val,
|
int valtype, char **val,
|
||||||
grub_size_t *size_out, grub_size_t *nelm_out)
|
grub_size_t *size_out, grub_size_t *nelm_out)
|
||||||
{
|
{
|
||||||
int name_len, type ;
|
grub_size_t nvp_name_len, name_len = grub_strlen(name);
|
||||||
|
int type;
|
||||||
const char *nvpair=NULL,*nvlist=nvlist_in;
|
const char *nvpair=NULL,*nvlist=nvlist_in;
|
||||||
char *nvp_name;
|
char *nvp_name;
|
||||||
|
|
||||||
@@ -3329,9 +3325,12 @@ nvlist_find_value (const char *nvlist_in, const char *name,
|
|||||||
*/
|
*/
|
||||||
while ((nvpair=nvlist_next_nvpair(nvlist,nvpair)))
|
while ((nvpair=nvlist_next_nvpair(nvlist,nvpair)))
|
||||||
{
|
{
|
||||||
nvpair_name(nvpair,&nvp_name,&name_len);
|
nvpair_name(nvpair,&nvp_name, &nvp_name_len);
|
||||||
type = nvpair_type(nvpair);
|
type = nvpair_type(nvpair);
|
||||||
if ((grub_strncmp (nvp_name, name, grub_strlen(name)) == 0) && type == valtype)
|
if (type == valtype
|
||||||
|
&& (nvp_name_len == name_len
|
||||||
|
|| (nvp_name_len > name_len && nvp_name[name_len] == '\0'))
|
||||||
|
&& grub_memcmp (nvp_name, name, name_len) == 0)
|
||||||
{
|
{
|
||||||
return nvpair_value(nvpair,val,size_out,nelm_out);
|
return nvpair_value(nvpair,val,size_out,nelm_out);
|
||||||
}
|
}
|
||||||
@@ -3999,8 +3998,6 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx)
|
|||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + hdrsize + SA_MTIME_OFFSET), dn.endian);
|
info.mtime = grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + hdrsize + SA_MTIME_OFFSET), dn.endian);
|
||||||
info.case_insensitive = ctx->data->subvol.case_insensitive;
|
info.case_insensitive = ctx->data->subvol.case_insensitive;
|
||||||
info.size = grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + hdrsize + SA_SIZE_OFFSET), dn.endian);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dn.dn.dn_bonustype == DMU_OT_ZNODE)
|
if (dn.dn.dn_bonustype == DMU_OT_ZNODE)
|
||||||
@@ -4008,7 +4005,6 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx)
|
|||||||
info.mtimeset = 1;
|
info.mtimeset = 1;
|
||||||
info.mtime = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_mtime[0],
|
info.mtime = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_mtime[0],
|
||||||
dn.endian);
|
dn.endian);
|
||||||
info.size = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_size, dn.endian);
|
|
||||||
}
|
}
|
||||||
info.dir = (dn.dn.dn_type == DMU_OT_DIRECTORY_CONTENTS);
|
info.dir = (dn.dn.dn_type == DMU_OT_DIRECTORY_CONTENTS);
|
||||||
grub_dprintf ("zfs", "type=%d, name=%s\n",
|
grub_dprintf ("zfs", "type=%d, name=%s\n",
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ grub_ccm_decrypt (grub_crypto_cipher_handle_t cipher,
|
|||||||
return err;
|
return err;
|
||||||
if (mac_out)
|
if (mac_out)
|
||||||
grub_crypto_xor (mac_out, mac, mul, m);
|
grub_crypto_xor (mac_out, mac, mul, m);
|
||||||
return GRUB_ERR_NONE;
|
return GPG_ERR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -244,7 +244,7 @@ grub_gcm_decrypt (grub_crypto_cipher_handle_t cipher,
|
|||||||
if (mac_out)
|
if (mac_out)
|
||||||
grub_crypto_xor (mac_out, mac, mac_xor, m);
|
grub_crypto_xor (mac_out, mac, mac_xor, m);
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GPG_ERR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -258,13 +258,14 @@ algo_decrypt (grub_crypto_cipher_handle_t cipher, grub_uint64_t algo,
|
|||||||
switch (algo)
|
switch (algo)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return grub_ccm_decrypt (cipher, out, in, psize, mac_out, nonce, l, m);
|
return grub_ccm_decrypt (cipher, out, in, psize,
|
||||||
|
mac_out, nonce, l, m);
|
||||||
case 1:
|
case 1:
|
||||||
return grub_gcm_decrypt (cipher, out, in, psize, mac_out, nonce,
|
return grub_gcm_decrypt (cipher, out, in, psize,
|
||||||
|
mac_out, nonce,
|
||||||
15 - l, m);
|
15 - l, m);
|
||||||
default:
|
default:
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "algorithm %lld is not supported yet",
|
return GPG_ERR_CIPHER_ALGO;
|
||||||
(long long) algo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,7 +280,7 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher,
|
|||||||
grub_uint32_t mac[4];
|
grub_uint32_t mac[4];
|
||||||
unsigned i;
|
unsigned i;
|
||||||
grub_uint32_t sw[4];
|
grub_uint32_t sw[4];
|
||||||
grub_err_t err;
|
gcry_err_code_t err;
|
||||||
|
|
||||||
grub_memcpy (sw, nonce, 16);
|
grub_memcpy (sw, nonce, 16);
|
||||||
if (endian != GRUB_ZFS_BIG_ENDIAN)
|
if (endian != GRUB_ZFS_BIG_ENDIAN)
|
||||||
@@ -295,7 +296,7 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher,
|
|||||||
size, mac,
|
size, mac,
|
||||||
sw + 1, 3, 12);
|
sw + 1, 3, 12);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return grub_crypto_gcry_error (err);
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
if (grub_zfs_to_cpu32 (expected_mac[i], endian)
|
if (grub_zfs_to_cpu32 (expected_mac[i], endian)
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ grub_gdb_hex2int (char **ptr, grub_uint64_t *int_value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This function does all command procesing for interfacing to gdb. */
|
/* This function does all command procesing for interfacing to gdb. */
|
||||||
void
|
void __attribute__ ((regparm(3)))
|
||||||
grub_gdb_trap (int trap_no)
|
grub_gdb_trap (int trap_no)
|
||||||
{
|
{
|
||||||
unsigned int sig_no;
|
unsigned int sig_no;
|
||||||
|
|||||||
@@ -71,11 +71,7 @@ VARIABLE(grub_gdb_stack)
|
|||||||
#define REG \reg
|
#define REG \reg
|
||||||
#define NDX \ndx
|
#define NDX \ndx
|
||||||
#endif
|
#endif
|
||||||
#ifdef __APPLE__
|
|
||||||
xorl %eax, %eax
|
xorl %eax, %eax
|
||||||
#else
|
|
||||||
movl $0, %eax
|
|
||||||
#endif
|
|
||||||
movw REG, EXT_C(grub_gdb_regs)+(NDX * 4)
|
movw REG, EXT_C(grub_gdb_regs)+(NDX * 4)
|
||||||
movw %ax, EXT_C(grub_gdb_regs)+(NDX * 4 + 2)
|
movw %ax, EXT_C(grub_gdb_regs)+(NDX * 4 + 2)
|
||||||
movl EXT_C(grub_gdb_regs)+(EAX * 4), %eax
|
movl EXT_C(grub_gdb_regs)+(EAX * 4), %eax
|
||||||
@@ -190,11 +186,7 @@ VARIABLE(grub_gdb_stack)
|
|||||||
.text
|
.text
|
||||||
1:
|
1:
|
||||||
.if EC
|
.if EC
|
||||||
#ifdef __APPLE__
|
add MACRO_DOLLAR(4), %esp
|
||||||
add $$4, %esp
|
|
||||||
#else
|
|
||||||
add $4, %esp
|
|
||||||
#endif
|
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
save_context
|
save_context
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ deps=`grep ^$modname: $moddep | sed s@^.*:@@`
|
|||||||
# remove old files if any
|
# remove old files if any
|
||||||
rm -f $tmpfile $outfile
|
rm -f $tmpfile $outfile
|
||||||
|
|
||||||
if test x@TARGET_APPLE_CC@ != x1; then
|
if test x@TARGET_APPLE_LINKER@ != x1; then
|
||||||
# stripout .modname and .moddeps sections from input module
|
# stripout .modname and .moddeps sections from input module
|
||||||
@TARGET_OBJCOPY@ -R .modname -R .moddeps $infile $tmpfile
|
@TARGET_OBJCOPY@ -R .modname -R .moddeps $infile $tmpfile
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ BEGIN {
|
|||||||
} else if ($1 == "undefined") {
|
} else if ($1 == "undefined") {
|
||||||
if ($3 in symtab)
|
if ($3 in symtab)
|
||||||
modtab[$2] = modtab[$2] " " symtab[$3];
|
modtab[$2] = modtab[$2] " " symtab[$3];
|
||||||
else if ($3 != "__gnu_local_gp") {
|
else if ($3 != "__gnu_local_gp" && $3 != "_gp_disp") {
|
||||||
printf "%s in %s is not defined\n", $3, $2 >"/dev/stderr";
|
printf "%s in %s is not defined\n", $3, $2 >"/dev/stderr";
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,12 @@ module=$1
|
|||||||
modname=`echo $module | sed -e 's@\.module.*$@@'`
|
modname=`echo $module | sed -e 's@\.module.*$@@'`
|
||||||
|
|
||||||
# Print all symbols defined by module
|
# Print all symbols defined by module
|
||||||
if test x"@TARGET_NMFLAGS_DEFINED_ONLY@" = x; then
|
if test x"@TARGET_NMFLAGS_DEFINED_ONLY@" = x && test x"@TARGET_NMFLAGS_MINUS_P@" = x; then
|
||||||
@TARGET_NM@ -g @TARGET_NMFLAGS_MINUS_P@ -p $module | \
|
@TARGET_NM@ -g -p $module | \
|
||||||
sed -n "s@^\([0-9a-fA-F]*\) *[TBRDS] *\([^ ]*\).*@defined $modname \2@p"
|
sed -n "s@^\([0-9a-fA-F]*\) *[TBRDS] *\([^ ]*\).*@defined $modname \2@p"
|
||||||
|
elif test x"@TARGET_NMFLAGS_DEFINED_ONLY@" = x; then
|
||||||
|
@TARGET_NM@ -g @TARGET_NMFLAGS_MINUS_P@ -p $module | \
|
||||||
|
sed -n "s@^\([^ ]*\) *[TBRDS] *\([0-9a-fA-F]*\).*@defined $modname \1@p"
|
||||||
else
|
else
|
||||||
@TARGET_NM@ -g --defined-only @TARGET_NMFLAGS_MINUS_P@ -p $module | \
|
@TARGET_NM@ -g --defined-only @TARGET_NMFLAGS_MINUS_P@ -p $module | \
|
||||||
sed "s@^\([^ ]*\).*@defined $modname \1@g"
|
sed "s@^\([^ ]*\).*@defined $modname \1@g"
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||||||
http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html .
|
http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct grub_gettext_context main_context, secondary_context;
|
|
||||||
|
|
||||||
static const char *(*grub_gettext_original) (const char *s);
|
static const char *(*grub_gettext_original) (const char *s);
|
||||||
|
|
||||||
struct grub_gettext_msg
|
struct grub_gettext_msg
|
||||||
@@ -69,6 +67,8 @@ struct grub_gettext_context
|
|||||||
struct grub_gettext_msg *grub_gettext_msg_list;
|
struct grub_gettext_msg *grub_gettext_msg_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct grub_gettext_context main_context, secondary_context;
|
||||||
|
|
||||||
#define MO_MAGIC_NUMBER 0x950412de
|
#define MO_MAGIC_NUMBER 0x950412de
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
@@ -423,6 +423,10 @@ grub_gettext_init_ext (struct grub_gettext_context *ctx,
|
|||||||
|
|
||||||
grub_free (lang);
|
grub_free (lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (locale[0] == 'e' && locale[1] == 'n'
|
||||||
|
&& (locale[2] == '\0' || locale[2] == '_'))
|
||||||
|
grub_errno = err = GRUB_ERR_NONE;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,14 +234,30 @@ static void
|
|||||||
box_paint (void *vself, const grub_video_rect_t *region)
|
box_paint (void *vself, const grub_video_rect_t *region)
|
||||||
{
|
{
|
||||||
grub_gui_box_t self = vself;
|
grub_gui_box_t self = vself;
|
||||||
|
|
||||||
struct component_node *cur;
|
struct component_node *cur;
|
||||||
grub_video_rect_t vpsave;
|
grub_video_rect_t vpsave;
|
||||||
|
|
||||||
|
grub_video_area_status_t box_area_status;
|
||||||
|
grub_video_get_area_status (&box_area_status);
|
||||||
|
|
||||||
grub_gui_set_viewport (&self->bounds, &vpsave);
|
grub_gui_set_viewport (&self->bounds, &vpsave);
|
||||||
for (cur = self->chead.next; cur != &self->ctail; cur = cur->next)
|
for (cur = self->chead.next; cur != &self->ctail; cur = cur->next)
|
||||||
{
|
{
|
||||||
grub_gui_component_t comp = cur->component;
|
grub_gui_component_t comp = cur->component;
|
||||||
|
grub_video_rect_t r;
|
||||||
|
comp->ops->get_bounds(comp, &r);
|
||||||
|
|
||||||
|
if (!grub_video_have_common_points (region, &r))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Paint the child. */
|
||||||
|
if (box_area_status == GRUB_VIDEO_AREA_ENABLED
|
||||||
|
&& grub_video_bounds_inside_region (&r, region))
|
||||||
|
grub_video_set_area_status (GRUB_VIDEO_AREA_DISABLED);
|
||||||
comp->ops->paint (comp, region);
|
comp->ops->paint (comp, region);
|
||||||
|
if (box_area_status == GRUB_VIDEO_AREA_ENABLED)
|
||||||
|
grub_video_set_area_status (GRUB_VIDEO_AREA_ENABLED);
|
||||||
}
|
}
|
||||||
grub_gui_restore_viewport (&vpsave);
|
grub_gui_restore_viewport (&vpsave);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,9 +80,13 @@ static void
|
|||||||
canvas_paint (void *vself, const grub_video_rect_t *region)
|
canvas_paint (void *vself, const grub_video_rect_t *region)
|
||||||
{
|
{
|
||||||
grub_gui_canvas_t self = vself;
|
grub_gui_canvas_t self = vself;
|
||||||
|
|
||||||
struct component_node *cur;
|
struct component_node *cur;
|
||||||
grub_video_rect_t vpsave;
|
grub_video_rect_t vpsave;
|
||||||
|
|
||||||
|
grub_video_area_status_t canvas_area_status;
|
||||||
|
grub_video_get_area_status (&canvas_area_status);
|
||||||
|
|
||||||
grub_gui_set_viewport (&self->bounds, &vpsave);
|
grub_gui_set_viewport (&self->bounds, &vpsave);
|
||||||
for (cur = self->components.next; cur; cur = cur->next)
|
for (cur = self->components.next; cur; cur = cur->next)
|
||||||
{
|
{
|
||||||
@@ -135,9 +139,16 @@ canvas_paint (void *vself, const grub_video_rect_t *region)
|
|||||||
r.height = h;
|
r.height = h;
|
||||||
comp->ops->set_bounds (comp, &r);
|
comp->ops->set_bounds (comp, &r);
|
||||||
|
|
||||||
|
if (!grub_video_have_common_points (region, &r))
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Paint the child. */
|
/* Paint the child. */
|
||||||
if (grub_video_have_common_points (region, &r))
|
if (canvas_area_status == GRUB_VIDEO_AREA_ENABLED
|
||||||
|
&& grub_video_bounds_inside_region (&r, region))
|
||||||
|
grub_video_set_area_status (GRUB_VIDEO_AREA_DISABLED);
|
||||||
comp->ops->paint (comp, region);
|
comp->ops->paint (comp, region);
|
||||||
|
if (canvas_area_status == GRUB_VIDEO_AREA_ENABLED)
|
||||||
|
grub_video_set_area_status (GRUB_VIDEO_AREA_ENABLED);
|
||||||
}
|
}
|
||||||
grub_gui_restore_viewport (&vpsave);
|
grub_gui_restore_viewport (&vpsave);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ struct grub_gui_circular_progress
|
|||||||
int start;
|
int start;
|
||||||
int end;
|
int end;
|
||||||
int value;
|
int value;
|
||||||
int num_ticks;
|
unsigned num_ticks;
|
||||||
int start_angle;
|
int start_angle;
|
||||||
int ticks_disappear;
|
int ticks_disappear;
|
||||||
char *theme_dir;
|
char *theme_dir;
|
||||||
@@ -139,15 +139,16 @@ circprog_paint (void *vself, const grub_video_rect_t *region)
|
|||||||
center_width, center_height);
|
center_width, center_height);
|
||||||
|
|
||||||
int radius = grub_min (height, width) / 2 - grub_max (tick_height, tick_width) / 2 - 1;
|
int radius = grub_min (height, width) / 2 - grub_max (tick_height, tick_width) / 2 - 1;
|
||||||
int nticks;
|
unsigned nticks;
|
||||||
int tick_begin;
|
unsigned tick_begin;
|
||||||
int tick_end;
|
unsigned tick_end;
|
||||||
if (self->end == self->start)
|
if (self->end <= self->start
|
||||||
|
|| self->value <= self->start)
|
||||||
nticks = 0;
|
nticks = 0;
|
||||||
else
|
else
|
||||||
nticks = (self->num_ticks
|
nticks = ((unsigned) (self->num_ticks
|
||||||
* (self->value - self->start)
|
* (self->value - self->start)))
|
||||||
/ (self->end - self->start));
|
/ ((unsigned) (self->end - self->start));
|
||||||
/* Do ticks appear or disappear as the value approached the end? */
|
/* Do ticks appear or disappear as the value approached the end? */
|
||||||
if (self->ticks_disappear)
|
if (self->ticks_disappear)
|
||||||
{
|
{
|
||||||
@@ -160,7 +161,7 @@ circprog_paint (void *vself, const grub_video_rect_t *region)
|
|||||||
tick_end = nticks;
|
tick_end = nticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
unsigned i;
|
||||||
for (i = tick_begin; i < tick_end; i++)
|
for (i = tick_begin; i < tick_end; i++)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
@@ -168,7 +169,8 @@ circprog_paint (void *vself, const grub_video_rect_t *region)
|
|||||||
int angle;
|
int angle;
|
||||||
|
|
||||||
/* Calculate the location of the tick. */
|
/* Calculate the location of the tick. */
|
||||||
angle = self->start_angle + i * GRUB_TRIG_ANGLE_MAX / self->num_ticks;
|
angle = self->start_angle
|
||||||
|
+ i * GRUB_TRIG_ANGLE_MAX / self->num_ticks;
|
||||||
x = width / 2 + (grub_cos (angle) * radius / GRUB_TRIG_FRACTION_SCALE);
|
x = width / 2 + (grub_cos (angle) * radius / GRUB_TRIG_FRACTION_SCALE);
|
||||||
y = height / 2 + (grub_sin (angle) * radius / GRUB_TRIG_FRACTION_SCALE);
|
y = height / 2 + (grub_sin (angle) * radius / GRUB_TRIG_FRACTION_SCALE);
|
||||||
|
|
||||||
@@ -238,7 +240,7 @@ parse_angle (const char *value)
|
|||||||
/* Unicode symbol of degrees (a circle, U+b0). Put here in UTF-8 to
|
/* Unicode symbol of degrees (a circle, U+b0). Put here in UTF-8 to
|
||||||
avoid potential problem with text file reesncoding */
|
avoid potential problem with text file reesncoding */
|
||||||
|| grub_strcmp (ptr, "\xc2\xb0") == 0)
|
|| grub_strcmp (ptr, "\xc2\xb0") == 0)
|
||||||
angle = (angle * 64 + 45) / 90;
|
angle = grub_divide_round (angle * 64, 90);
|
||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,7 +250,7 @@ circprog_set_property (void *vself, const char *name, const char *value)
|
|||||||
circular_progress_t self = vself;
|
circular_progress_t self = vself;
|
||||||
if (grub_strcmp (name, "num_ticks") == 0)
|
if (grub_strcmp (name, "num_ticks") == 0)
|
||||||
{
|
{
|
||||||
self->num_ticks = grub_strtol (value, 0, 10);
|
self->num_ticks = grub_strtoul (value, 0, 10);
|
||||||
}
|
}
|
||||||
else if (grub_strcmp (name, "start_angle") == 0)
|
else if (grub_strcmp (name, "start_angle") == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -251,18 +251,24 @@ draw_scrollbar (list_impl_t self,
|
|||||||
int value, int extent, int min, int max,
|
int value, int extent, int min, int max,
|
||||||
int scrollbar_width, int scrollbar_height)
|
int scrollbar_width, int scrollbar_height)
|
||||||
{
|
{
|
||||||
|
unsigned thumby, thumbheight;
|
||||||
|
|
||||||
grub_gfxmenu_box_t frame = self->scrollbar_frame;
|
grub_gfxmenu_box_t frame = self->scrollbar_frame;
|
||||||
grub_gfxmenu_box_t thumb = self->scrollbar_thumb;
|
grub_gfxmenu_box_t thumb = self->scrollbar_thumb;
|
||||||
int frame_vertical_pad = (frame->get_top_pad (frame)
|
int frame_vertical_pad = (frame->get_top_pad (frame)
|
||||||
+ frame->get_bottom_pad (frame));
|
+ frame->get_bottom_pad (frame));
|
||||||
int frame_horizontal_pad = (frame->get_left_pad (frame)
|
int frame_horizontal_pad = (frame->get_left_pad (frame)
|
||||||
+ frame->get_right_pad (frame));
|
+ frame->get_right_pad (frame));
|
||||||
int thumb_vertical_pad = (thumb->get_top_pad (thumb)
|
unsigned thumb_vertical_pad = (thumb->get_top_pad (thumb)
|
||||||
+ thumb->get_bottom_pad (thumb));
|
+ thumb->get_bottom_pad (thumb));
|
||||||
int thumb_horizontal_pad = (thumb->get_left_pad (thumb)
|
int thumb_horizontal_pad = (thumb->get_left_pad (thumb)
|
||||||
+ thumb->get_right_pad (thumb));
|
+ thumb->get_right_pad (thumb));
|
||||||
int tracktop = frame->get_top_pad (frame);
|
int tracktop = frame->get_top_pad (frame);
|
||||||
int tracklen = scrollbar_height - frame_vertical_pad;
|
unsigned tracklen;
|
||||||
|
if (scrollbar_height <= frame_vertical_pad)
|
||||||
|
tracklen = 0;
|
||||||
|
else
|
||||||
|
tracklen = scrollbar_height - frame_vertical_pad;
|
||||||
frame->set_content_size (frame,
|
frame->set_content_size (frame,
|
||||||
scrollbar_width - frame_horizontal_pad,
|
scrollbar_width - frame_horizontal_pad,
|
||||||
tracklen);
|
tracklen);
|
||||||
@@ -271,15 +277,28 @@ draw_scrollbar (list_impl_t self,
|
|||||||
tracklen += thumb_vertical_pad;
|
tracklen += thumb_vertical_pad;
|
||||||
tracktop -= thumb->get_top_pad (thumb);
|
tracktop -= thumb->get_top_pad (thumb);
|
||||||
}
|
}
|
||||||
int thumby = tracktop + tracklen * (value - min) / (max - min);
|
if (value <= min || max <= min)
|
||||||
int thumbheight = tracklen * extent / (max - min) + 1;
|
thumby = 0;
|
||||||
|
else
|
||||||
|
thumby = ((unsigned) tracklen * (value - min))
|
||||||
|
/ ((unsigned) (max - min));
|
||||||
|
if (max <= min)
|
||||||
|
thumbheight = 1;
|
||||||
|
else
|
||||||
|
thumbheight = ((unsigned) (tracklen * extent)
|
||||||
|
/ ((unsigned) (max - min))) + 1;
|
||||||
/* Rare occasion: too many entries or too low height. */
|
/* Rare occasion: too many entries or too low height. */
|
||||||
if (thumbheight < thumb_vertical_pad)
|
if (thumbheight < thumb_vertical_pad)
|
||||||
{
|
{
|
||||||
thumbheight = thumb_vertical_pad;
|
thumbheight = thumb_vertical_pad;
|
||||||
thumby = tracktop + ((tracklen - thumb_vertical_pad) * (value - min)
|
if (value <= min || max <= extent
|
||||||
/ (max - extent));
|
|| tracklen <= thumb_vertical_pad)
|
||||||
|
thumby = 0;
|
||||||
|
else
|
||||||
|
thumby = ((unsigned) ((tracklen - thumb_vertical_pad) * (value - min))
|
||||||
|
/ ((unsigned)(max - extent)));
|
||||||
}
|
}
|
||||||
|
thumby += tracktop;
|
||||||
int thumbx = frame->get_left_pad (frame);
|
int thumbx = frame->get_left_pad (frame);
|
||||||
int thumbwidth = scrollbar_width - frame_horizontal_pad;
|
int thumbwidth = scrollbar_width - frame_horizontal_pad;
|
||||||
if (!self->scrollbar_thumb_overlay)
|
if (!self->scrollbar_thumb_overlay)
|
||||||
|
|||||||
@@ -169,8 +169,12 @@ draw_pixmap_bar (grub_gui_progress_bar_t self)
|
|||||||
else
|
else
|
||||||
hlheight -= hl_v_pad;
|
hlheight -= hl_v_pad;
|
||||||
|
|
||||||
barwidth = (tracklen * (self->value - self->start)
|
if (self->value <= self->start
|
||||||
/ (self->end - self->start));
|
|| self->end <= self->start)
|
||||||
|
barwidth = 0;
|
||||||
|
else
|
||||||
|
barwidth = ((unsigned) (tracklen * (self->value - self->start))
|
||||||
|
/ ((unsigned) (self->end - self->start)));
|
||||||
|
|
||||||
if (barwidth >= hl_h_pad)
|
if (barwidth >= hl_h_pad)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -137,23 +137,19 @@ static struct grub_video_bitmap *
|
|||||||
try_loading_icon (grub_gfxmenu_icon_manager_t mgr,
|
try_loading_icon (grub_gfxmenu_icon_manager_t mgr,
|
||||||
const char *dir, const char *class_name)
|
const char *dir, const char *class_name)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path, *ptr;
|
||||||
int l;
|
|
||||||
|
|
||||||
path = grub_malloc (grub_strlen (dir) + grub_strlen (class_name)
|
path = grub_malloc (grub_strlen (dir) + grub_strlen (class_name)
|
||||||
+ grub_strlen (icon_extension) + 3);
|
+ grub_strlen (icon_extension) + 3);
|
||||||
if (! path)
|
if (! path)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
grub_strcpy (path, dir);
|
ptr = grub_stpcpy (path, dir);
|
||||||
l = grub_strlen (path);
|
if (path == ptr || ptr[-1] != '/')
|
||||||
if (path[l-1] != '/')
|
*ptr++ = '/';
|
||||||
{
|
ptr = grub_stpcpy (ptr, class_name);
|
||||||
path[l] = '/';
|
ptr = grub_stpcpy (ptr, icon_extension);
|
||||||
path[l+1] = 0;
|
*ptr = '\0';
|
||||||
}
|
|
||||||
grub_strcat (path, class_name);
|
|
||||||
grub_strcat (path, icon_extension);
|
|
||||||
|
|
||||||
struct grub_video_bitmap *raw_bitmap;
|
struct grub_video_bitmap *raw_bitmap;
|
||||||
grub_video_bitmap_load (&raw_bitmap, path);
|
grub_video_bitmap_load (&raw_bitmap, path);
|
||||||
|
|||||||
Loaded 100 of 462 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user