mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-28 10:10:29 +00:00
Compare commits
211
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b14d85db89 | ||
|
|
21143c3fde | ||
|
|
872dec5684 | ||
|
|
3bac4caa2b | ||
|
|
6866f2ba37 | ||
|
|
44b38e4988 | ||
|
|
68581b009f | ||
|
|
69aee43fa6 | ||
|
|
ac8bac2496 | ||
|
|
4e0a25a4c0 | ||
|
|
b666e01b9c | ||
|
|
2e62352bc2 | ||
|
|
e360b5d176 | ||
|
|
c453760c71 | ||
|
|
e95685dab1 | ||
|
|
4816dcac19 | ||
|
|
750f4bacd3 | ||
|
|
1b6aaddc45 | ||
|
|
475bffeae6 | ||
|
|
9deb46e363 | ||
|
|
065ed900d4 | ||
|
|
111ab3b9cc | ||
|
|
4200ad44fe | ||
|
|
f1959b1695 | ||
|
|
935863518f | ||
|
|
98f74998d5 | ||
|
|
5ed3a5d049 | ||
|
|
47cd2645dd | ||
|
|
245e21b2b5 | ||
|
|
9201cd79a3 | ||
|
|
f27ccb584c | ||
|
|
1dfe3f973e | ||
|
|
44461d5af2 | ||
|
|
30e177a05b | ||
|
|
af435524cd | ||
|
|
66ce4d1aef | ||
|
|
59d4036594 | ||
|
|
ba3031f996 | ||
|
|
bac5d1a64a | ||
|
|
17328db3b3 | ||
|
|
58f66137a3 | ||
|
|
cdae5bf208 | ||
|
|
06eadf5ebf | ||
|
|
ebb3d958aa | ||
|
|
272e0466da | ||
|
|
4b94e3227b | ||
|
|
3173c7501c | ||
|
|
03d79a878b | ||
|
|
dbbac5a04c | ||
|
|
343dad410e | ||
|
|
f07784e890 | ||
|
|
bbbcb791ed | ||
|
|
740c08ed2f | ||
|
|
ea44693fc8 | ||
|
|
0415dbe28f | ||
|
|
478b567520 | ||
|
|
7c4b6b7bb4 | ||
|
|
e2dd6daa8c | ||
|
|
2ccaa3b9fd | ||
|
|
004a2b1efd | ||
|
|
72ec399ad8 | ||
|
|
9a67e1ac8e | ||
|
|
77063f4cb6 | ||
|
|
5d90f6e533 | ||
|
|
954fe77163 | ||
|
|
6d05b6383c | ||
|
|
0f1f95c7b7 | ||
|
|
41c6f91fce | ||
|
|
7c378c3964 | ||
|
|
2988a849fc | ||
|
|
5e42618e00 | ||
|
|
0aece00c54 | ||
|
|
631a820038 | ||
|
|
60049a0e72 | ||
|
|
a276b84046 | ||
|
|
54bd9a0610 | ||
|
|
2a5a532c00 | ||
|
|
4d94b2db58 | ||
|
|
1de3a48098 | ||
|
|
c291f47b2c | ||
|
|
3c05833249 | ||
|
|
d1224d209b | ||
|
|
0af3ae2d8b | ||
|
|
79c80b06b8 | ||
|
|
33f6ce671f | ||
|
|
0901e7855f | ||
|
|
4250f552a6 | ||
|
|
1f6af2a9f8 | ||
|
|
fa33530870 | ||
|
|
15bd333e10 | ||
|
|
3f3ec8ef44 | ||
|
|
87de66d9d8 | ||
|
|
2c2c5c720d | ||
|
|
480c89858e | ||
|
|
4b8b9135f1 | ||
|
|
5a6db38d62 | ||
|
|
3a310e842f | ||
|
|
c4badfe836 | ||
|
|
a72fc329eb | ||
|
|
2009da62f2 | ||
|
|
6f6d4aa02c | ||
|
|
8063ce197f | ||
|
|
9706066791 | ||
|
|
4afd0107ef | ||
|
|
24024dac7f | ||
|
|
9b35fe819f | ||
|
|
46b74dd3cb | ||
|
|
68f17b2b30 | ||
|
|
e4a1fe3919 | ||
|
|
86402b4e0f | ||
|
|
bec35dad2a | ||
|
|
dfc5ccfa97 | ||
|
|
4a70fed815 | ||
|
|
f94b2b4eeb | ||
|
|
d0949e3747 | ||
|
|
9585647a25 | ||
|
|
e4dbf247b6 | ||
|
|
006c78f378 | ||
|
|
511ece7ceb | ||
|
|
9abbaae7cd | ||
|
|
d6b94c5eb2 | ||
|
|
07ea8daa86 | ||
|
|
3142b2feac | ||
|
|
4686e163f2 | ||
|
|
ba424f37a9 | ||
|
|
3beabdc8e4 | ||
|
|
ba584da163 | ||
|
|
7f64fb590c | ||
|
|
35f2d96c0d | ||
|
|
9afe2053c9 | ||
|
|
5ae584c0b0 | ||
|
|
1440b7ebae | ||
|
|
61c8482b20 | ||
|
|
95cd131ea0 | ||
|
|
d08059309f | ||
|
|
eec4237a32 | ||
|
|
443b322262 | ||
|
|
36387ece6b | ||
|
|
6f65e36cc4 | ||
|
|
d99d2f8416 | ||
|
|
049f63824c | ||
|
|
015045471e | ||
|
|
b204b718cc | ||
|
|
41155a5722 | ||
|
|
e0a850947f | ||
|
|
0b47c57ad6 | ||
|
|
6ba983559d | ||
|
|
6c519b5c6c | ||
|
|
f371dd5da8 | ||
|
|
1ecf96fcc4 | ||
|
|
5ef569df5b | ||
|
|
9b9c4686f0 | ||
|
|
3abb956371 | ||
|
|
dcecae1a49 | ||
|
|
ae80f31270 | ||
|
|
7e7293d745 | ||
|
|
5acc8020b4 | ||
|
|
ff66b8e7d8 | ||
|
|
09a836e59c | ||
|
|
0776112c53 | ||
|
|
ccd21a65ed | ||
|
|
4d21c10199 | ||
|
|
e7cfa8d5e1 | ||
|
|
94cee4a4c2 | ||
|
|
c9e839e2ca | ||
|
|
668add258f | ||
|
|
0e309454f6 | ||
|
|
093dec7370 | ||
|
|
989af02582 | ||
|
|
8442d3e956 | ||
|
|
645ff636fe | ||
|
|
30a338460a | ||
|
|
51f941a0d8 | ||
|
|
5bda44d7f9 | ||
|
|
a6e7719bbe | ||
|
|
e8f07821cc | ||
|
|
dc3286ade4 | ||
|
|
46f8d358ef | ||
|
|
09c479006c | ||
|
|
4d6c69536e | ||
|
|
faf4a65e1e | ||
|
|
e5fa26e573 | ||
|
|
569766e49b | ||
|
|
4127206896 | ||
|
|
f7c7c4d4ad | ||
|
|
57bc5d431b | ||
|
|
6a7957f9f5 | ||
|
|
e88f0420b9 | ||
|
|
da98622662 | ||
|
|
fba31b5f69 | ||
|
|
72f099578e | ||
|
|
808e97c4e7 | ||
|
|
e388db904c | ||
|
|
cef394032d | ||
|
|
a4d610026f | ||
|
|
0c930a841e | ||
|
|
3d369a01ac | ||
|
|
5b83ef97e5 | ||
|
|
16f7455b04 | ||
|
|
74fa9ac1a6 | ||
|
|
62956fe7b9 | ||
|
|
260632161f | ||
|
|
4cd0b55fd0 | ||
|
|
95b56e3a97 | ||
|
|
bbc52c228f | ||
|
|
943981ff65 | ||
|
|
adabfb5418 | ||
|
|
77ec462a56 | ||
|
|
3bf2db8959 | ||
|
|
30a9ab952f | ||
|
|
c415eaa98f |
No files matched your search
@@ -58,6 +58,8 @@ grub-emu.exe
|
||||
grub-emu-lite.exe
|
||||
grub_emu_init.c
|
||||
grub_emu_init.h
|
||||
/grub-file
|
||||
/grub-file.exe
|
||||
grub-fstest
|
||||
grub-fstest.exe
|
||||
grub_fstest_init.c
|
||||
@@ -66,6 +68,8 @@ grub_func_test
|
||||
grub-install
|
||||
grub-install.exe
|
||||
grub-kbdcomp
|
||||
/grub-macbless
|
||||
/grub-macbless.exe
|
||||
grub-macho2img
|
||||
/grub-menulst2cfg
|
||||
/grub-menulst2cfg.exe
|
||||
@@ -120,6 +124,8 @@ grub-shell
|
||||
grub-shell-tester
|
||||
grub-sparc64-setup
|
||||
grub-sparc64-setup.exe
|
||||
/grub-syslinux2cfg
|
||||
/grub-syslinux2cfg.exe
|
||||
gzcompress_test
|
||||
hddboot_test
|
||||
help_test
|
||||
@@ -194,6 +200,7 @@ grub-core/modinfo.sh
|
||||
grub-core/*.module
|
||||
grub-core/*.module.exe
|
||||
grub-core/*.pp
|
||||
grub-core/kernel.img.bin
|
||||
util/bash-completion.d/grub
|
||||
grub-core/gnulib/alloca.h
|
||||
grub-core/gnulib/arg-nonnull.h
|
||||
|
||||
@@ -35,6 +35,7 @@ configuring the GRUB.
|
||||
* GNU binutils 2.9.1.0.23 or later
|
||||
* Flex 2.5.35 or later
|
||||
* Other standard GNU/Unix tools
|
||||
* a libc with large file support (e.g. glibc 2.1 or later)
|
||||
|
||||
On GNU/Linux, you also need:
|
||||
|
||||
@@ -140,7 +141,7 @@ If build and host are different make check isn't available.
|
||||
If build and host are different man pages are not generated.
|
||||
|
||||
As an example imagine you have a build system running on FreeBSD on sparc
|
||||
which prepares packages for developpers running amd64 GNU/Linux laptop and
|
||||
which prepares packages for developers running amd64 GNU/Linux laptop and
|
||||
they need to make images for ARM board running U-boot. In this case:
|
||||
|
||||
build=sparc64-freebsd
|
||||
@@ -149,7 +150,7 @@ target=arm-uboot
|
||||
|
||||
For this example the configure line might look like (more details below)
|
||||
(some options are optional and included here for completeness but some rarely
|
||||
used options are omited):
|
||||
used options are omitted):
|
||||
|
||||
./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
|
||||
CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
|
||||
@@ -168,7 +169,8 @@ corresponding platform are not needed for the platform in question.
|
||||
generate sin and cos tables.
|
||||
2. BUILD_CFLAGS= for C options for build.
|
||||
3. BUILD_CPPFLAGS= for C preprocessor options for build.
|
||||
4. BUILD_FREETYPE= for freetype-config for build (optional).
|
||||
4. BUILD_LDFLAGS= for linker options for build.
|
||||
5. BUILD_FREETYPE= for freetype-config for build (optional).
|
||||
|
||||
- For host
|
||||
1. --host= to autoconf name of host.
|
||||
@@ -196,9 +198,9 @@ corresponding platform are not needed for the platform in question.
|
||||
11. TARGET_RANLIB= for ranlib for target.
|
||||
|
||||
- Additionally for emu, for host and target.
|
||||
1. SDL is looked for in stadard linker directories (-lSDL) (optional)
|
||||
2. libpciaccess is looked for in stadard linker directories (-lpciaccess) (optional)
|
||||
3. libusb is looked for in stadard linker directories (-lusb) (optional)
|
||||
1. SDL is looked for in standard linker directories (-lSDL) (optional)
|
||||
2. libpciaccess is looked for in standard linker directories (-lpciaccess) (optional)
|
||||
3. libusb is looked for in standard linker directories (-lusb) (optional)
|
||||
|
||||
- Platform-agnostic tools and data.
|
||||
1. make is the tool you execute after ./configure.
|
||||
|
||||
+29
-17
@@ -1,7 +1,11 @@
|
||||
AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
|
||||
|
||||
DEPDIR = .deps-util
|
||||
SUBDIRS = grub-core/gnulib . grub-core po docs util/bash-completion.d
|
||||
SUBDIRS = grub-core/gnulib .
|
||||
if COND_real_platform
|
||||
SUBDIRS += grub-core
|
||||
endif
|
||||
SUBDIRS += po docs util/bash-completion.d
|
||||
|
||||
include $(top_srcdir)/conf/Makefile.common
|
||||
include $(top_srcdir)/conf/Makefile.extra-dist
|
||||
@@ -66,22 +70,22 @@ endif
|
||||
|
||||
starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
|
||||
|
||||
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)
|
||||
CLEANFILES += build-grub-mkfont
|
||||
build-grub-mkfont$(BUILD_EXEEXT): 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) $(BUILD_LDFLAGS) -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$(BUILD_EXEEXT)
|
||||
|
||||
garbage-gen: util/garbage-gen.c
|
||||
$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $^
|
||||
CLEANFILES += garbage-gen
|
||||
garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
|
||||
$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $^
|
||||
CLEANFILES += garbage-gen$(BUILD_EXEEXT)
|
||||
EXTRA_DIST += util/garbage-gen.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
|
||||
CLEANFILES += build-grub-gen-asciih
|
||||
build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
|
||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
|
||||
CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
|
||||
|
||||
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
|
||||
CLEANFILES += build-grub-gen-widthspec
|
||||
build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
|
||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
|
||||
CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
|
||||
|
||||
if COND_STARFIELD
|
||||
starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
|
||||
@@ -127,11 +131,13 @@ widthspec.h: $(FONT_SOURCE) build-grub-gen-widthspec
|
||||
CLEANFILES += widthspec.h
|
||||
|
||||
# Install config.h into platformdir
|
||||
platform_HEADERS = config.h
|
||||
nodist_platform_HEADERS = config.h
|
||||
|
||||
pkgdata_DATA += grub-mkconfig_lib
|
||||
|
||||
|
||||
if COND_real_platform
|
||||
|
||||
if COND_i386_coreboot
|
||||
QEMU32=qemu-system-i386
|
||||
endif
|
||||
@@ -383,8 +389,6 @@ if COND_powerpc_ieee1275
|
||||
BOOTCHECKS = bootcheck-linux-ppc
|
||||
endif
|
||||
|
||||
EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg grub-core/tests/boot/qemu-shutdown-x86.S
|
||||
|
||||
.PHONY: bootcheck-linux-i386 bootcheck-linux-x86_64 \
|
||||
bootcheck-kfreebsd-i386 bootcheck-kfreebsd-x86_64 \
|
||||
bootcheck-knetbsd-i386 bootcheck-knetbsd-x86_64 \
|
||||
@@ -399,9 +403,13 @@ 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 serial' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
|
||||
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 serial multiboot cbmemc linux16 gzio echo help' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg grub-core/tests/boot/qemu-shutdown-x86.S
|
||||
|
||||
windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows
|
||||
windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
|
||||
test -d $(windowsdir) && rm -rf $(windowsdir) || true
|
||||
@@ -420,10 +428,14 @@ windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
|
||||
for x in $(starfield_DATA); do \
|
||||
cp -fp $$x $(windowsdir)/themes/starfield/$$(basename $$x); \
|
||||
done
|
||||
for x in $(GRUB_WINDOWS_EXTRA_DIST); do \
|
||||
cp -fp $$x $(windowsdir); \
|
||||
done
|
||||
|
||||
windowszip=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows.zip
|
||||
windowszip: windowsdir
|
||||
test -f $(windowszip) && rm $(windowszip) || true
|
||||
zip -r $(windowszip) $(windowsdir)
|
||||
rm -rf $(windowsdir)
|
||||
|
||||
EXTRA_DIST += linguas.sh
|
||||
+16
-3
@@ -384,7 +384,7 @@ program = {
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBGEOM)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
program = {
|
||||
@@ -405,7 +405,7 @@ program = {
|
||||
program = {
|
||||
name = grub-macbless;
|
||||
installdir = sbin;
|
||||
mansection = 1;
|
||||
mansection = 8;
|
||||
common = util/grub-macbless.c;
|
||||
common = grub-core/osdep/init.c;
|
||||
common = grub-core/kern/emu/argp_common.c;
|
||||
@@ -439,42 +439,49 @@ script = {
|
||||
name = '10_hurd';
|
||||
common = util/grub.d/10_hurd.in;
|
||||
installdir = grubconf;
|
||||
condition = COND_HOST_HURD;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '10_kfreebsd';
|
||||
common = util/grub.d/10_kfreebsd.in;
|
||||
installdir = grubconf;
|
||||
condition = COND_HOST_KFREEBSD;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '10_illumos';
|
||||
common = util/grub.d/10_illumos.in;
|
||||
installdir = grubconf;
|
||||
condition = COND_HOST_ILLUMOS;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '10_netbsd';
|
||||
common = util/grub.d/10_netbsd.in;
|
||||
installdir = grubconf;
|
||||
condition = COND_HOST_NETBSD;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '10_linux';
|
||||
common = util/grub.d/10_linux.in;
|
||||
installdir = grubconf;
|
||||
condition = COND_HOST_LINUX;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '10_xnu';
|
||||
common = util/grub.d/10_xnu.in;
|
||||
installdir = grubconf;
|
||||
condition = COND_HOST_XNU;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '20_linux_xen';
|
||||
common = util/grub.d/20_linux_xen.in;
|
||||
installdir = grubconf;
|
||||
condition = COND_HOST_LINUX;
|
||||
};
|
||||
|
||||
script = {
|
||||
@@ -701,7 +708,7 @@ script = {
|
||||
name = grub-fs-tester;
|
||||
common = tests/util/grub-fs-tester.in;
|
||||
installdir = noinst;
|
||||
dependencies = garbage-gen;
|
||||
dependencies = 'garbage-gen$(BUILD_EXEEXT)';
|
||||
};
|
||||
|
||||
script = {
|
||||
@@ -1143,6 +1150,12 @@ script = {
|
||||
common = tests/grub_cmd_tr.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = file_filter_test;
|
||||
common = tests/file_filter_test.in;
|
||||
};
|
||||
|
||||
program = {
|
||||
testcase;
|
||||
name = example_unit_test;
|
||||
|
||||
@@ -1,3 +1,151 @@
|
||||
New in 2.02:
|
||||
|
||||
* New/improved filesystem and disk support:
|
||||
* Big-endian UFS1.
|
||||
* Experimental 64-bit ext2 support.
|
||||
* Various fixes for non-512-byte sector devices.
|
||||
* New `proc' filesystem framework, used by LUKS disks.
|
||||
* Fix DM-RAID partition handling.
|
||||
* New `nativedisk' command to switch from firmware to native disk drivers.
|
||||
* Compressed HFS+.
|
||||
* DragonFly BSD labels.
|
||||
* CBFS (coreboot).
|
||||
* Handle partitioned LVM properly.
|
||||
* Use LVM UUIDs whenever possible.
|
||||
* GPT PReP.
|
||||
* New `progress' module that shows progress information while reading
|
||||
files.
|
||||
* ZFS features support.
|
||||
* ZFS LZ4 support.
|
||||
|
||||
* New/improved terminal and video support:
|
||||
* Monochrome text (matching `hercules' in GRUB Legacy).
|
||||
* Morse code output using system speaker.
|
||||
* `spkmodem' output (simple data protocol using system speaker).
|
||||
* Handle Japanese special keys.
|
||||
* coreboot framebuffer.
|
||||
* Serial on ARC.
|
||||
* Native vt100 handling for grub-emu, replacing the use of the curses
|
||||
library.
|
||||
* New gfxmenu options for terminal window positioning, theme background
|
||||
image handling, and scrollbar padding, plus `item_pixmap_style' and
|
||||
`highlight_overlay'.
|
||||
* Support several more image types (paletted and greyscale).
|
||||
|
||||
* Boot protocol improvements:
|
||||
* Support Apple FAT binaries on non-Apple platforms.
|
||||
* Improve FreeDOS direct loading support compatibility.
|
||||
* Enable `linux16' on all x86 platforms, not just BIOS.
|
||||
* New TrueCrypt ISO loader.
|
||||
* multiboot2 boot-services EFI specification.
|
||||
* multiboot2 EFI memory map specification.
|
||||
* multiboot2 full-file specfication.
|
||||
|
||||
* New/improved network support:
|
||||
* New variables `net_default_*' containing properties of the default
|
||||
interface.
|
||||
* Autoload `http' and `tftp' modules if necessary.
|
||||
* Improve TFTP robustness.
|
||||
* Parse `nd' disk names in GRUB Legacy configuration files.
|
||||
* Issue separate DNS queries for IPv4 and IPv6.
|
||||
|
||||
* Coreboot improvements:
|
||||
* CBFS support both in on-disk images (loopback) and flash.
|
||||
* Ability to launch another payload from flash or disk
|
||||
* Coreboot framebuffer
|
||||
* CBMEMC support (both logging and inspecting logs)
|
||||
* Command for inspecting coreboot timestamps (`coreboot_boottime').
|
||||
* Command for inspecting coreboot tables (`lscoreboot').
|
||||
* New target default_payload.elf.
|
||||
* Increased maximal core size.
|
||||
|
||||
* New/improved platform support:
|
||||
* New `efifwsetup' and `lsefi' commands on EFI platforms.
|
||||
* New `cmosdump' and `cmosset' commands on platforms with CMOS support.
|
||||
* New command `pcidump' for PCI platforms.
|
||||
* Improve opcode parsing in ACPI halt implementation.
|
||||
* Use the TSC as a possible time source on i386-ieee1275.
|
||||
* Merge PowerPC grub-mkrescue implementation with the common one.
|
||||
* Support grub-mkrescue on i386-ieee1275, sparc64, bootinfo machines such
|
||||
as pSeries, and mips-arc.
|
||||
* Make grub-mkrescue better support Apple Intel Macs on CD.
|
||||
* Enable GRUB Legacy configuration file parsing on EFI.
|
||||
* Support halt for Loongson 2E.
|
||||
* ARM U-Boot and EFI ports.
|
||||
* Reorganise platform-dependent code in utilities to avoid #ifdef mess.
|
||||
* AROS and Haiku support for userspace utilities.
|
||||
* Xen PV port.
|
||||
* Fix EFI stack alignment.
|
||||
* ARM64 EFI port.
|
||||
* On Linux, read partition start offsets from sysfs if possible.
|
||||
* New grub-macbless utility, and better integration with Mac firmware in
|
||||
grub-install.
|
||||
* Support Yeeloong 3A.
|
||||
* Add `cpuid --pae' option to detect Physical Address Extension on x86.
|
||||
* Support for USB debug dongles.
|
||||
* Support for *-emu on all platforms (previously only i386/x86_64 worked).
|
||||
* Support *-emu on Windows.
|
||||
|
||||
* Security:
|
||||
* Add optional facility to enforce that all files read by the core image
|
||||
from disk have a valid detached digital signature.
|
||||
|
||||
* Performance:
|
||||
* Avoid costly division operations in many places.
|
||||
* New boot time analysis framework (`./configure --enable-boot-time').
|
||||
* Initialise USB ports in parallel.
|
||||
* New `testspeed' command to test file read speed.
|
||||
* Speed-up gfxterm by storing intermediate results in more compact format.
|
||||
* Lazy LVM/mdraid scan.
|
||||
* Disk hints.
|
||||
|
||||
* Scripting:
|
||||
* New `eval' and `tr' commands.
|
||||
* grub-script-check fails on scripts containing no commands.
|
||||
|
||||
* Installation and other utility improvements:
|
||||
* Add option to compress files on installation or image creation.
|
||||
* Using grub-reboot no longer requires setting `GRUB_DEFAULT=saved'.
|
||||
* Support probing EFI System Partition (requires os-prober >= 1.58).
|
||||
* Fix inconsistent use of `GRUB_CRYPTODISK_ENABLE' and
|
||||
`GRUB_ENABLE_CRYPTODISK'; the latter is now used consistently.
|
||||
* grub-mount handles symbolic links to directories.
|
||||
* Support disabling submenus with `GRUB_DISABLE_SUBMENU' configuration key
|
||||
for grub-mkconfig.
|
||||
* grub-install, grub-mknetdir, grub-mkrescue, and grub-mkstandalone
|
||||
rewritten in C. They should now work in supported non-Unix-like
|
||||
environments.
|
||||
* Native mingw support.
|
||||
* Ability to install on EFI under windows.
|
||||
* Reorganise timeout handling using new `timeout_style' environment
|
||||
variable and `GRUB_TIMEOUT_STYLE' configuration key for grub-mkconfig.
|
||||
Menu hotkeys pressed during a hidden timeout now boot the corresponding
|
||||
menu entry immediately.
|
||||
* New `file' command and grub-file utility to check file types.
|
||||
* New syslinux configuration file parser.
|
||||
|
||||
* Build system:
|
||||
* Remove all uses of nested functions; GRUB no longer requires an
|
||||
executable stack.
|
||||
* Fix documentation build with Texinfo >= 5.1.
|
||||
* More robust and documented cross-compiling support.
|
||||
* Partial clang support for some platforms (experimental).
|
||||
* Partial mingw64 x86_64-efi compile support (highly experimental).
|
||||
* Partial mingw32 i386-* (other than already present i386-pc)
|
||||
compile support (highly experimental).
|
||||
* Support for grub-mkpasswd on Windows.
|
||||
* Eliminate the use of AutoGen. This allowed some performance
|
||||
improvements to the build system.
|
||||
* Remove variable length arrays.
|
||||
* OpenBSD compile and tools support (NetBSD and FreeBSD were already supported).
|
||||
* Fix build with FreeType >= 2.5.1.
|
||||
* Make gentpl.py compatible with Python 3. It now requires at least
|
||||
Python 2.6.
|
||||
* modinfo.sh contains build information now.
|
||||
* Added many new tests to improve robustness.
|
||||
|
||||
* Revision control moved to git.
|
||||
|
||||
New in 2.00:
|
||||
|
||||
* Appearance:
|
||||
@@ -24,7 +172,6 @@ New in 2.00:
|
||||
* IEEE1275 serial.
|
||||
* EFI serial.
|
||||
* Network stack for BIOS, IEEE1275, EMU and EFI, including TFTP, HTTP and DNS.
|
||||
* VBE on coreboot support.
|
||||
|
||||
* New filesystem, filters and disks formats:
|
||||
* DVH partition map.
|
||||
@@ -48,7 +195,7 @@ New in 2.00:
|
||||
* multidevice, mirrored and raidz(2,3) ZFS support.
|
||||
* RAID LVM (internal RAIDing) support.
|
||||
* ZFS crypto support.
|
||||
* ZLE and GZIP on ZFS support.
|
||||
* ZLE, LZ4 and GZIP on ZFS support.
|
||||
* Support ZFS up to 33.
|
||||
* HFS string is now treated like mac-roman and not UTF-8
|
||||
* HFS mtime support.
|
||||
|
||||
+3
-3
@@ -418,15 +418,15 @@ else
|
||||
[fi]
|
||||
])
|
||||
|
||||
dnl Check if ln can handle directories properly (mingw).
|
||||
dnl Check if ln -s can handle directories properly (mingw).
|
||||
AC_DEFUN([grub_CHECK_LINK_DIR],[
|
||||
AC_MSG_CHECKING([whether ln can handle directories properly])
|
||||
AC_MSG_CHECKING([whether ln -s can handle directories properly])
|
||||
[mkdir testdir 2>/dev/null
|
||||
case $srcdir in
|
||||
[\\/$]* | ?:[\\/]* ) reldir=$srcdir/include/grub/util ;;
|
||||
*) reldir=../$srcdir/include/grub/util ;;
|
||||
esac
|
||||
if ln -s $reldir testdir/util 2>/dev/null ; then]
|
||||
if ln -s $reldir testdir/util 2>/dev/null && rm -f testdir/util 2>/dev/null ; then]
|
||||
AC_MSG_RESULT([yes])
|
||||
[link_dir=yes
|
||||
else
|
||||
|
||||
@@ -8,7 +8,7 @@ unexport LC_ALL
|
||||
# Platform specific options
|
||||
if COND_sparc64_ieee1275
|
||||
CFLAGS_PLATFORM += -mno-app-regs
|
||||
LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax
|
||||
LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
|
||||
endif
|
||||
if COND_sparc64_emu
|
||||
CFLAGS_PLATFORM += -mno-app-regs
|
||||
|
||||
@@ -110,3 +110,14 @@ EXTRA_DIST += tests/dfly-mbr-mbexample.mbr.img.gz
|
||||
EXTRA_DIST += tests/dfly-mbr-mbexample.dfly.img.gz
|
||||
|
||||
EXTRA_DIST += coreboot.cfg
|
||||
|
||||
EXTRA_DIST += tests/file_filter/file
|
||||
EXTRA_DIST += tests/file_filter/file.gz
|
||||
EXTRA_DIST += tests/file_filter/file.gz.sig
|
||||
EXTRA_DIST += tests/file_filter/file.lzop
|
||||
EXTRA_DIST += tests/file_filter/file.lzop.sig
|
||||
EXTRA_DIST += tests/file_filter/file.xz
|
||||
EXTRA_DIST += tests/file_filter/file.xz.sig
|
||||
EXTRA_DIST += tests/file_filter/keys
|
||||
EXTRA_DIST += tests/file_filter/keys.pub
|
||||
EXTRA_DIST += tests/file_filter/test.cfg
|
||||
@@ -51,12 +51,6 @@
|
||||
#define PACKAGE_NAME "@PACKAGE_NAME@"
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
|
||||
/* Default boot directory name" */
|
||||
#define GRUB_BOOT_DIR_NAME "@bootdirname@"
|
||||
/* Default grub directory name */
|
||||
#define GRUB_DIR_NAME "@grubdirname@"
|
||||
/* Define to 1 if GCC generates calls to __register_frame_info(). */
|
||||
#define NEED_REGISTER_FRAME_INFO @NEED_REGISTER_FRAME_INFO@
|
||||
|
||||
#define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@"
|
||||
#define GRUB_PLATFORM "@GRUB_PLATFORM@"
|
||||
|
||||
+117
-61
@@ -26,20 +26,20 @@ dnl This is necessary because the target type in autoconf does not
|
||||
dnl describe such a system very well.
|
||||
dnl
|
||||
dnl The current strategy is to use variables with no prefix (such as
|
||||
dnl CC, CFLAGS, etc.) for the host type as well as the build type,
|
||||
dnl because GRUB does not need to use those variables for the build
|
||||
dnl type, so there is no conflict. Variables with the prefix "TARGET_"
|
||||
dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
|
||||
dnl type.
|
||||
dnl CC, CFLAGS, etc.) for the host type, variables with prefix "BUILD_"
|
||||
dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables
|
||||
dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are
|
||||
dnl used for the target type. See INSTALL for full list of variables.
|
||||
|
||||
AC_INIT([GRUB],[2.02~beta1],[bug-grub@gnu.org])
|
||||
AC_INIT([GRUB],[2.02~beta2],[bug-grub@gnu.org])
|
||||
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
|
||||
# We don't want -g -O2 by default in CFLAGS
|
||||
: ${CFLAGS=""}
|
||||
|
||||
# Checks for host and target systems.
|
||||
# Checks for build, host and target systems.
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
save_program_prefix="${program_prefix}"
|
||||
AC_CANONICAL_TARGET
|
||||
@@ -90,18 +90,18 @@ case "$target_cpu" in
|
||||
amd64) target_cpu=x86_64 ;;
|
||||
sparc) target_cpu=sparc64 ;;
|
||||
mipsel|mips64el)
|
||||
target_cpu=mipsel;
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
|
||||
target_cpu=mipsel
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1"
|
||||
;;
|
||||
mips|mips64)
|
||||
target_cpu=mips;
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1";
|
||||
target_cpu=mips
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1"
|
||||
;;
|
||||
arm*)
|
||||
target_cpu=arm;
|
||||
target_cpu=arm
|
||||
;;
|
||||
aarch64*)
|
||||
target_cpu=arm64;
|
||||
target_cpu=arm64
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -119,13 +119,17 @@ if test "x$with_platform" = x; then
|
||||
x86_64-*) platform=pc ;;
|
||||
powerpc-*) platform=ieee1275 ;;
|
||||
powerpc64-*) platform=ieee1275 ;;
|
||||
powerpc64le-*) platform=ieee1275 ;;
|
||||
sparc64-*) platform=ieee1275 ;;
|
||||
mipsel-*) platform=loongson ;;
|
||||
mips-*) platform=arc ;;
|
||||
ia64-*) platform=efi ;;
|
||||
arm-*) platform=uboot ;;
|
||||
arm64-*) platform=efi ;;
|
||||
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
||||
*)
|
||||
AC_MSG_WARN([unsupported CPU: "$target_cpu" - only building utilities])
|
||||
platform=none
|
||||
;;
|
||||
esac
|
||||
else
|
||||
platform="$with_platform"
|
||||
@@ -135,8 +139,10 @@ case "$target_cpu"-"$platform" in
|
||||
x86_64-efi) ;;
|
||||
x86_64-emu) ;;
|
||||
x86_64-xen) ;;
|
||||
x86_64-none) ;;
|
||||
x86_64-*) target_cpu=i386 ;;
|
||||
powerpc64-ieee1275) target_cpu=powerpc ;;
|
||||
powerpc64le-ieee1275) target_cpu=powerpc ;;
|
||||
esac
|
||||
|
||||
# Check if the platform is supported, make final adjustments.
|
||||
@@ -167,6 +173,7 @@ case "$target_cpu"-"$platform" in
|
||||
arm-efi) ;;
|
||||
arm64-efi) ;;
|
||||
*-emu) ;;
|
||||
*-none) ;;
|
||||
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
||||
esac
|
||||
|
||||
@@ -178,7 +185,7 @@ if test x$platform != xemu ; then
|
||||
fi
|
||||
|
||||
if test x"$target_cpu-$platform" = xsparc64-emu ; then
|
||||
target_m64=1 ;
|
||||
target_m64=1
|
||||
fi
|
||||
|
||||
case "$target_os" in
|
||||
@@ -214,20 +221,14 @@ case "$platform" in
|
||||
qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
|
||||
pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
|
||||
emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
|
||||
loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1" ;;
|
||||
qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1" ;;
|
||||
arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
|
||||
esac
|
||||
case "$target_cpu" in
|
||||
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" ;;
|
||||
sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
||||
esac
|
||||
if test x${target_cpu} = xmipsel ; then
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
||||
else
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,` -DGRUB_TARGET_CPU_`echo ${target_cpu} | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`=1"
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
||||
fi
|
||||
|
||||
case "${target_cpu}-$platform" in
|
||||
@@ -367,6 +368,14 @@ case "$host_os" in
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$host_os" in
|
||||
cygwin | windows* | mingw32* | aros*)
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_SIZEOF(off_t)
|
||||
test x"$ac_cv_sizeof_off_t" = x8 || AC_MSG_ERROR([Large file support is required]);;
|
||||
esac
|
||||
|
||||
if test x$USE_NLS = xno; then
|
||||
HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
|
||||
fi
|
||||
@@ -429,6 +438,16 @@ case "$build_os" in
|
||||
haiku*) BUILD_LIBM= ;;
|
||||
*) BUILD_LIBM=-lm ;;
|
||||
esac
|
||||
|
||||
dnl FIXME proper test seems to require too deep dive into Autoconf internals.
|
||||
dnl For now just list known platforms that we support.
|
||||
|
||||
case "$build_os" in
|
||||
cygwin*|mingw32*|mingw64*) BUILD_EXEEXT=.exe ;;
|
||||
*) BUILD_EXEEXT= ;;
|
||||
esac
|
||||
AC_SUBST(BUILD_EXEEXT)
|
||||
|
||||
# For gnulib.
|
||||
gl_INIT
|
||||
|
||||
@@ -483,6 +502,7 @@ AC_SUBST(HOST_CC)
|
||||
AC_SUBST(BUILD_CC)
|
||||
AC_SUBST(BUILD_CFLAGS)
|
||||
AC_SUBST(BUILD_CPPFLAGS)
|
||||
AC_SUBST(BUILD_LDFLAGS)
|
||||
AC_SUBST(TARGET_CC)
|
||||
AC_SUBST(TARGET_NM)
|
||||
AC_SUBST(TARGET_RANLIB)
|
||||
@@ -509,6 +529,8 @@ if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
|
||||
fi
|
||||
|
||||
TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
|
||||
|
||||
AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
|
||||
LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
|
||||
|
||||
@@ -574,6 +596,12 @@ if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
|
||||
fi
|
||||
|
||||
if test x$target_cpu = xpowerpc && test x$ac_cv_c_bigendian = xno; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -mbig-endian"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -mbig-endian"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -static -mbig-endian"
|
||||
fi
|
||||
|
||||
if test "x$target_m32" = x1; then
|
||||
# Force 32-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||
@@ -735,7 +763,7 @@ if test x"$efiemu_excuse" = x ; then
|
||||
]], [[]])], [flag=1], [flag=0])
|
||||
if test x"$flag" = x1; then
|
||||
grub_cv_target_cc_efiemu64_link_format="$format"
|
||||
break;
|
||||
break
|
||||
fi
|
||||
done])
|
||||
if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
|
||||
@@ -768,12 +796,12 @@ if test x"$platform" = xemu ; then
|
||||
;;
|
||||
*windows* | *cygwin* | *mingw*)
|
||||
if test x${target_cpu} = xi386 ; then
|
||||
grub_cv_target_cc_link_format=-mi386pe;
|
||||
TARGET_OBJ2ELF='./build-grub-pe2elf';
|
||||
grub_cv_target_cc_link_format=-mi386pe
|
||||
TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'
|
||||
fi
|
||||
if test x${target_cpu} = xx86_64 ; then
|
||||
grub_cv_target_cc_link_format=-mi386pep;
|
||||
TARGET_OBJ2ELF='./build-grub-pep2elf';
|
||||
grub_cv_target_cc_link_format=-mi386pep
|
||||
TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'
|
||||
fi
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
|
||||
;;
|
||||
@@ -799,7 +827,7 @@ elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
|
||||
]], [[]])], [flag=1], [flag=0])
|
||||
if test x"$flag" = x1; then
|
||||
grub_cv_target_cc_link_format="$format"
|
||||
break;
|
||||
break
|
||||
fi
|
||||
done])
|
||||
if test x"$grub_cv_target_cc_link_format" = xunknown; then
|
||||
@@ -807,10 +835,10 @@ elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
|
||||
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';
|
||||
TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'
|
||||
fi
|
||||
if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
|
||||
TARGET_OBJ2ELF='./build-grub-pep2elf';
|
||||
TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -855,7 +883,7 @@ LDFLAGS="$TARGET_LDFLAGS"
|
||||
if test "$target_cpu" = x86_64 || test "$target_cpu-$platform" = sparc64-emu ; then
|
||||
# Use large model to support 4G memory
|
||||
AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
|
||||
CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large"
|
||||
CFLAGS="$TARGET_CFLAGS -mcmodel=large"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_mcmodel=yes],
|
||||
[grub_cv_cc_mcmodel=no])
|
||||
@@ -870,7 +898,7 @@ fi
|
||||
if test "$target_cpu"-"$platform" = x86_64-efi; then
|
||||
# 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, [
|
||||
CFLAGS="$TARGET_CFLAGS -m64 -mno-red-zone"
|
||||
CFLAGS="$TARGET_CFLAGS -mno-red-zone"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_no_red_zone=yes],
|
||||
[grub_cv_cc_no_red_zone=no])
|
||||
@@ -917,6 +945,15 @@ if test "x$target_cpu" = xarm; then
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether option -Qn works], grub_cv_target_cc_qn, [
|
||||
CFLAGS="$TARGET_CFLAGS -Qn -Werror"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_target_cc_qn=yes],
|
||||
[grub_cv_target_cc_qn=no])])
|
||||
if test "x$grub_cv_target_cc_qn" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -Qn"
|
||||
fi
|
||||
|
||||
#
|
||||
# Compiler features.
|
||||
#
|
||||
@@ -979,7 +1016,7 @@ if test "$target_cpu" = arm; then
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
|
||||
if test x"$flag" = x1; then
|
||||
grub_cv_target_cc_strict_align="$arg"
|
||||
break;
|
||||
break
|
||||
fi
|
||||
done])
|
||||
|
||||
@@ -1008,7 +1045,7 @@ else
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
|
||||
fi
|
||||
CPPFLAGS="$TARGET_CPPFLAGS"
|
||||
if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then
|
||||
if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test x$target_cpu = xpowerpc || test "x$grub_cv_cc_target_clang" = xyes; then
|
||||
TARGET_LIBGCC=
|
||||
else
|
||||
TARGET_LIBGCC=-lgcc
|
||||
@@ -1026,8 +1063,10 @@ fi
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib $DEFSYM"
|
||||
fi
|
||||
|
||||
# Check for libgcc symbols
|
||||
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x)
|
||||
if ! test x$target_cpu = xpowerpc; then
|
||||
# Check for libgcc symbols
|
||||
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x)
|
||||
fi
|
||||
|
||||
if test "x$TARGET_APPLE_LINKER" = x1 ; then
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -static"
|
||||
@@ -1174,7 +1213,7 @@ enable_grub_emu_usb=no
|
||||
fi
|
||||
|
||||
if test x"$enable_grub_emu_sdl" = xno ; then
|
||||
grub_emu_sdl_excuse="explicitely disabled"
|
||||
grub_emu_sdl_excuse="explicitly disabled"
|
||||
fi
|
||||
[if [ x"$grub_emu_sdl_excuse" = x ]; then
|
||||
# Check for libSDL libraries.]
|
||||
@@ -1190,7 +1229,7 @@ AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
|
||||
[fi]
|
||||
|
||||
if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
|
||||
AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled ($grub_emu_sdl_excuse)])
|
||||
AC_MSG_ERROR([SDL support for grub-emu was explicitly requested but can't be compiled ($grub_emu_sdl_excuse)])
|
||||
fi
|
||||
if test x"$grub_emu_sdl_excuse" = x ; then
|
||||
enable_grub_emu_sdl=yes
|
||||
@@ -1285,10 +1324,12 @@ SAVED_CC="$CC"
|
||||
SAVED_CPP="$CPP"
|
||||
SAVED_CFLAGS="$CFLAGS"
|
||||
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||
SAVED_LDFLAGS="$LDFLAGS"
|
||||
CC="$BUILD_CC"
|
||||
CPP="$BUILD_CPP"
|
||||
CFLAGS="$BUILD_CFLAGS"
|
||||
CPPFLAGS="$BUILD_CPPFLAGS"
|
||||
LDFLAGS="$BUILD_LDFAGS"
|
||||
|
||||
unset ac_cv_c_bigendian
|
||||
unset ac_cv_header_ft2build_h
|
||||
@@ -1351,6 +1392,7 @@ CC="$SAVED_CC"
|
||||
CPP="$SAVED_CPP"
|
||||
CFLAGS="$SAVED_CFLAGS"
|
||||
CPPFLAGS="$SAVED_CPPFLAGS"
|
||||
LDFLAGS="$SAVED_LDFLAGS"
|
||||
|
||||
|
||||
DJVU_FONT_SOURCE=
|
||||
@@ -1370,7 +1412,7 @@ fi
|
||||
|
||||
if test x"$starfield_excuse" = x; then
|
||||
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
|
||||
for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
|
||||
for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do
|
||||
if test -f "$dir/DejaVuSans.$ext"; then
|
||||
DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
|
||||
break 2
|
||||
@@ -1397,7 +1439,7 @@ for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
|
||||
md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')"
|
||||
# PCF and BDF from version 6.3 isn't hanled properly by libfreetype.
|
||||
if test "$md5" = 0a54834d2788c83886a3e1785a6a1e61 || test "$md5" = 28f2565c7a41d8d407e2551159385edb || test "$md5" = dae5e588461b3b92b87b6ffee734f936 || test "$md5" = 4a3d687aa5bb329ed05f4263a1016791 ; then
|
||||
continue;
|
||||
continue
|
||||
fi
|
||||
FONT_SOURCE="$dir/unifont.$ext"
|
||||
break 2
|
||||
@@ -1482,7 +1524,7 @@ if test x"$device_mapper_excuse" = x ; then
|
||||
fi
|
||||
|
||||
if test x"$device_mapper_excuse" = x ; then
|
||||
LIBDEVMAPPER="-ldevmapper";
|
||||
LIBDEVMAPPER="-ldevmapper"
|
||||
AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
|
||||
[Define to 1 if you have the devmapper library.])
|
||||
fi
|
||||
@@ -1580,7 +1622,6 @@ AC_SUBST(BSS_START_SYMBOL)
|
||||
AC_SUBST(END_SYMBOL)
|
||||
AC_SUBST(PACKAGE)
|
||||
AC_SUBST(VERSION)
|
||||
AC_SUBST(NEED_REGISTER_FRAME_INFO)
|
||||
|
||||
AC_ARG_ENABLE([werror],
|
||||
[AS_HELP_STRING([--disable-werror],
|
||||
@@ -1590,7 +1631,7 @@ if test x"$enable_werror" != xno ; then
|
||||
HOST_CFLAGS="$HOST_CFLAGS -Werror"
|
||||
fi
|
||||
|
||||
if test "x$grub_cv_cc_target_clang" = xno; then
|
||||
if test "x$grub_cv_cc_target_clang" = xno && test x$target_cpu != xpowerpc; then
|
||||
TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc"
|
||||
else
|
||||
TARGET_LDFLAGS_STATIC_LIBGCC=
|
||||
@@ -1612,6 +1653,7 @@ AC_SUBST(TARGET_CPP)
|
||||
AC_SUBST(TARGET_CCAS)
|
||||
AC_SUBST(TARGET_OBJ2ELF)
|
||||
AC_SUBST(TARGET_MODULE_FORMAT)
|
||||
AC_SUBST(TARGET_CC_VERSION)
|
||||
|
||||
AC_SUBST(TARGET_CFLAGS)
|
||||
AC_SUBST(TARGET_LDFLAGS)
|
||||
@@ -1634,6 +1676,7 @@ AC_SUBST(BUILD_LIBM)
|
||||
# Automake conditionals
|
||||
#
|
||||
|
||||
AM_CONDITIONAL([COND_real_platform], [test x$platform != xnone])
|
||||
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])
|
||||
@@ -1661,7 +1704,13 @@ 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_LINUX], [test x$host_kernel = xlinux])
|
||||
AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
|
||||
AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
|
||||
AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
|
||||
AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
|
||||
AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
|
||||
|
||||
AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
|
||||
AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
|
||||
@@ -1701,24 +1750,30 @@ AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir])
|
||||
|
||||
|
||||
# Output files.
|
||||
cpudir="${target_cpu}"
|
||||
if test x${cpudir} = xmipsel; then
|
||||
cpudir=mips;
|
||||
fi
|
||||
grub_CHECK_LINK_DIR
|
||||
if test x"$link_dir" = xyes ; then
|
||||
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
|
||||
if test "$platform" != emu ; then
|
||||
AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
|
||||
if test "$platform" != none; then
|
||||
cpudir="${target_cpu}"
|
||||
if test x${cpudir} = xmipsel; then
|
||||
cpudir=mips;
|
||||
fi
|
||||
grub_CHECK_LINK_DIR
|
||||
if test x"$link_dir" = xyes ; then
|
||||
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
|
||||
if test "$platform" != emu ; then
|
||||
AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
|
||||
fi
|
||||
else
|
||||
mkdir -p include/grub 2>/dev/null
|
||||
rm -rf include/grub/cpu
|
||||
cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
|
||||
if test "$platform" != emu ; then
|
||||
rm -rf include/grub/machine
|
||||
cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
else
|
||||
mkdir -p include/grub 2>/dev/null
|
||||
rm -rf include/grub/cpu
|
||||
cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
|
||||
if test "$platform" != emu ; then
|
||||
rm -rf include/grub/machine
|
||||
cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
|
||||
fi
|
||||
# Just enough to stop the compiler failing with -I$(srcdir)/include.
|
||||
mkdir -p include 2>/dev/null
|
||||
rm -rf include/grub/cpu include/grub/machine
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
@@ -1791,6 +1846,7 @@ echo grub-mount: No "($grub_mount_excuse)"
|
||||
fi
|
||||
if [ x"$starfield_excuse" = x ]; then
|
||||
echo starfield theme: Yes
|
||||
echo With DejaVuSans font from $DJVU_FONT_SOURCE
|
||||
else
|
||||
echo starfield theme: No "($starfield_excuse)"
|
||||
fi
|
||||
|
||||
+7
-7
@@ -108,16 +108,16 @@ The branches available are:
|
||||
|
||||
@table @samp
|
||||
@item master
|
||||
Main developpement branch.
|
||||
Main development 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.
|
||||
@item developer branches
|
||||
Prefixed with developer name. Every developer of a team manages his own branches.
|
||||
Developer branches do not need changelog entries.
|
||||
@end table
|
||||
|
||||
Once you have used @kbd{git clone} to fetch an initial copy of a branch, you
|
||||
@@ -228,12 +228,12 @@ The opening @samp{/*} and closing @samp{*/} should be placed together on a line
|
||||
Here is a brief map of the GRUB code base.
|
||||
|
||||
GRUB uses Autoconf and Automake, with most of the Automake input generated
|
||||
by AutoGen. The top-level build rules are in @file{configure.ac},
|
||||
by a Python script. The top-level build rules are in @file{configure.ac},
|
||||
@file{grub-core/Makefile.core.def}, and @file{Makefile.util.def}. Each
|
||||
block in a @file{*.def} file represents a build target, and specifies the
|
||||
source files used to build it on various platforms. The @file{*.def} files
|
||||
are processed into AutoGen input by @file{gentpl.py} (which you only need to
|
||||
look at if you are extending the build system). If you are adding a new
|
||||
are processed into Automake input by @file{gentpl.py} (which you only need
|
||||
to look at if you are extending the build system). If you are adding a new
|
||||
module which follows an existing pattern, such as a new command or a new
|
||||
filesystem implementation, it is usually easiest to grep
|
||||
@file{grub-core/Makefile.core.def} and @file{Makefile.util.def} for an
|
||||
|
||||
+1
-1
@@ -6385,7 +6385,7 @@ just do:
|
||||
@end group
|
||||
@end example
|
||||
|
||||
Also, the latest version is available using Bazaar. See
|
||||
Also, the latest version is available using Git. See
|
||||
@uref{http://www.gnu.org/software/grub/grub-download.html} for more
|
||||
information.
|
||||
|
||||
|
||||
+18
-13
@@ -26,20 +26,22 @@ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
|
||||
CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
|
||||
CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
|
||||
|
||||
build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
|
||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^
|
||||
build-grub-pep2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
|
||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^
|
||||
CLEANFILES += build-grub-pep2elf$(BUILD_EXEEXT)
|
||||
|
||||
build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
|
||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
|
||||
build-grub-pe2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
|
||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
|
||||
CLEANFILES += build-grub-pe2elf$(BUILD_EXEEXT)
|
||||
|
||||
# gentrigtables
|
||||
gentrigtables: gentrigtables.c
|
||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< $(BUILD_LIBM)
|
||||
CLEANFILES += gentrigtables
|
||||
gentrigtables$(BUILD_EXEEXT): gentrigtables.c
|
||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
|
||||
CLEANFILES += gentrigtables$(BUILD_EXEEXT)
|
||||
|
||||
# trigtables.c
|
||||
trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac
|
||||
./gentrigtables > $@
|
||||
trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac
|
||||
./gentrigtables$(BUILD_EXEEXT) > $@
|
||||
CLEANFILES += trigtables.c
|
||||
|
||||
# XXX Use Automake's LEX & YACC support
|
||||
@@ -74,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h
|
||||
@@ -221,12 +224,14 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/uboot.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/disk.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/arm/system.h
|
||||
endif
|
||||
|
||||
if COND_arm_efi
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.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/arm/system.h
|
||||
endif
|
||||
|
||||
if COND_arm64_efi
|
||||
@@ -290,12 +295,12 @@ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
|
||||
kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
|
||||
grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
|
||||
|
||||
grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
|
||||
rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
|
||||
grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
|
||||
rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
|
||||
CLEANFILES += grub_emu_init.h
|
||||
|
||||
grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
|
||||
rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
|
||||
grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MODULE_FILES)
|
||||
rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
|
||||
CLEANFILES += grub_emu_init.c
|
||||
endif
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ kernel = {
|
||||
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';
|
||||
arm64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version -R .eh_frame';
|
||||
|
||||
i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
|
||||
i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x9000';
|
||||
@@ -132,6 +132,7 @@ kernel = {
|
||||
common = kern/rescue_reader.c;
|
||||
common = kern/term.c;
|
||||
|
||||
noemu = kern/compiler-rt.c;
|
||||
noemu = kern/mm.c;
|
||||
noemu = kern/time.c;
|
||||
noemu = kern/generic/millisleep.c;
|
||||
@@ -252,6 +253,7 @@ kernel = {
|
||||
|
||||
powerpc_ieee1275 = kern/powerpc/cache.S;
|
||||
powerpc_ieee1275 = kern/powerpc/dl.c;
|
||||
powerpc_ieee1275 = kern/powerpc/compiler-rt.S;
|
||||
|
||||
sparc64_ieee1275 = kern/sparc64/cache.S;
|
||||
sparc64_ieee1275 = kern/sparc64/dl.c;
|
||||
@@ -1672,7 +1674,8 @@ module = {
|
||||
sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
|
||||
ia64_efi = loader/ia64/efi/linux.c;
|
||||
arm = loader/arm/linux.c;
|
||||
arm = lib/fdt.c;
|
||||
arm64 = loader/arm64/linux.c;
|
||||
fdt = lib/fdt.c;
|
||||
common = loader/linux.c;
|
||||
common = lib/cmdline.c;
|
||||
enable = noemu;
|
||||
|
||||
+22
-22
@@ -670,23 +670,23 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
|
||||
for (i = 0; i < (GRUB_EHCI_N_TD - 1); i++)
|
||||
{
|
||||
e->td_virt[i].link_td = e->td_phys + (i + 1) * sizeof (struct grub_ehci_td);
|
||||
e->td_virt[i].next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
e->td_virt[i].alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
e->td_virt[i].next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
e->td_virt[i].alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
}
|
||||
e->td_virt[GRUB_EHCI_N_TD - 1].next_td =
|
||||
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
e->td_virt[GRUB_EHCI_N_TD - 1].alt_next_td =
|
||||
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
e->tdfree_virt = e->td_virt;
|
||||
/* Set Terminate in first QH, which is used in framelist */
|
||||
e->qh_virt[0].qh_hptr = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH);
|
||||
e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
e->qh_virt[0].qh_hptr = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH);
|
||||
e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
e->qh_virt[0].td_overlay.alt_next_td =
|
||||
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
/* Also set Halted bit in token */
|
||||
e->qh_virt[0].td_overlay.token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
|
||||
e->qh_virt[0].td_overlay.token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
|
||||
/* Set the H bit in first QH used for AL */
|
||||
e->qh_virt[1].ep_char = grub_cpu_to_le32 (GRUB_EHCI_H);
|
||||
e->qh_virt[1].ep_char = grub_cpu_to_le32_compile_time (GRUB_EHCI_H);
|
||||
/* Set Terminate into TD in rest of QHs and set horizontal link
|
||||
* pointer to itself - these QHs will be used for asynchronous
|
||||
* schedule and they should have valid value in horiz. link */
|
||||
@@ -697,12 +697,12 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
|
||||
e->qh_chunk) &
|
||||
GRUB_EHCI_POINTER_MASK) | GRUB_EHCI_HPTR_TYPE_QH);
|
||||
e->qh_virt[i].td_overlay.next_td =
|
||||
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
e->qh_virt[i].td_overlay.alt_next_td =
|
||||
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
/* Also set Halted bit in token */
|
||||
e->qh_virt[i].td_overlay.token =
|
||||
grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
|
||||
grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
|
||||
}
|
||||
|
||||
/* Note: QH 0 and QH 1 are reserved and must not be used anywhere.
|
||||
@@ -991,7 +991,7 @@ grub_ehci_find_qh (struct grub_ehci *e, grub_usb_transfer_t transfer)
|
||||
target = ((transfer->endpoint << GRUB_EHCI_EP_NUM_OFF) |
|
||||
transfer->devaddr) & GRUB_EHCI_TARGET_MASK;
|
||||
target = grub_cpu_to_le32 (target);
|
||||
mask = grub_cpu_to_le32 (GRUB_EHCI_TARGET_MASK);
|
||||
mask = grub_cpu_to_le32_compile_time (GRUB_EHCI_TARGET_MASK);
|
||||
|
||||
/* low speed interrupt transfers are linked to the periodic */
|
||||
/* schedule, everything else to the asynchronous schedule */
|
||||
@@ -1200,7 +1200,7 @@ grub_ehci_transaction (struct grub_ehci *e,
|
||||
grub_memset ((void *) td, 0, sizeof (struct grub_ehci_td));
|
||||
|
||||
/* Don't point to any TD yet, just terminate. */
|
||||
td->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
td->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
/* Set alternate pointer. When short packet occurs, alternate TD
|
||||
* will not be really fetched because it is not active. But don't
|
||||
* forget, EHCI will try to fetch alternate TD every scan of AL
|
||||
@@ -1325,9 +1325,9 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
|
||||
/* Fill whole alternate TD by zeros (= inactive) and set
|
||||
* Terminate bits and Halt bit */
|
||||
grub_memset ((void *) cdata->td_alt_virt, 0, sizeof (struct grub_ehci_td));
|
||||
cdata->td_alt_virt->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
cdata->td_alt_virt->token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
|
||||
cdata->td_alt_virt->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
cdata->td_alt_virt->token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
|
||||
|
||||
/* Allocate appropriate number of TDs and set */
|
||||
for (i = 0; i < transfer->transcnt; i++)
|
||||
@@ -1364,7 +1364,7 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
|
||||
cdata->td_last_virt = td;
|
||||
cdata->td_last_phys = grub_dma_virt2phys (td, e->td_chunk);
|
||||
/* Last TD should not have set alternate TD */
|
||||
cdata->td_last_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
cdata->td_last_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
|
||||
grub_dprintf ("ehci", "setup_transfer: cdata=%p, qh=%p\n",
|
||||
cdata,cdata->qh_virt);
|
||||
@@ -1377,14 +1377,14 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
|
||||
/* Start transfer: */
|
||||
/* Unlink possible alternate pointer in QH */
|
||||
cdata->qh_virt->td_overlay.alt_next_td =
|
||||
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
|
||||
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
|
||||
/* Link new TDs with QH via next_td */
|
||||
cdata->qh_virt->td_overlay.next_td =
|
||||
grub_cpu_to_le32 (grub_dma_virt2phys
|
||||
(cdata->td_first_virt, e->td_chunk));
|
||||
/* Reset Active and Halted bits in QH to activate Advance Queue,
|
||||
* i.e. reset token */
|
||||
cdata->qh_virt->td_overlay.token = grub_cpu_to_le32 (0);
|
||||
cdata->qh_virt->td_overlay.token = grub_cpu_to_le32_compile_time (0);
|
||||
|
||||
/* Finito */
|
||||
transfer->controller_data = cdata;
|
||||
@@ -1408,9 +1408,9 @@ grub_ehci_pre_finish_transfer (grub_usb_transfer_t transfer)
|
||||
* safely manipulate with QH TD part. */
|
||||
cdata->qh_virt->td_overlay.token = (cdata->qh_virt->td_overlay.token
|
||||
|
|
||||
grub_cpu_to_le32
|
||||
grub_cpu_to_le32_compile_time
|
||||
(GRUB_EHCI_STATUS_HALTED)) &
|
||||
grub_cpu_to_le32 (~GRUB_EHCI_STATUS_ACTIVE);
|
||||
grub_cpu_to_le32_compile_time (~GRUB_EHCI_STATUS_ACTIVE);
|
||||
|
||||
/* Print debug data here if necessary */
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
|
||||
grub_memset ((void *) o->ed_ctrl, 0, sizeof (struct grub_ohci_ed)
|
||||
* GRUB_OHCI_CTRL_EDS);
|
||||
for (j=0; j < GRUB_OHCI_CTRL_EDS; j++)
|
||||
o->ed_ctrl[j].target = grub_cpu_to_le32 (1 << 14); /* skip */
|
||||
o->ed_ctrl[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */
|
||||
|
||||
grub_dprintf ("ohci", "EDs-C: chunk=%p, virt=%p, phys=0x%02x\n",
|
||||
o->ed_ctrl_chunk, o->ed_ctrl, o->ed_ctrl_addr);
|
||||
@@ -329,7 +329,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
|
||||
/* Preset EDs */
|
||||
grub_memset ((void*)o->ed_bulk, 0, sizeof(struct grub_ohci_ed) * GRUB_OHCI_BULK_EDS);
|
||||
for (j=0; j < GRUB_OHCI_BULK_EDS; j++)
|
||||
o->ed_bulk[j].target = grub_cpu_to_le32 (1 << 14); /* skip */
|
||||
o->ed_bulk[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */
|
||||
|
||||
grub_dprintf ("ohci", "EDs-B: chunk=%p, virt=%p, phys=0x%02x\n",
|
||||
o->ed_bulk_chunk, o->ed_bulk, o->ed_bulk_addr);
|
||||
@@ -1349,10 +1349,10 @@ grub_ohci_fini_hw (int noreturn __attribute__ ((unused)))
|
||||
/* Set skip in all EDs */
|
||||
if (o->ed_bulk)
|
||||
for (i=0; i < GRUB_OHCI_BULK_EDS; i++)
|
||||
o->ed_bulk[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */
|
||||
o->ed_bulk[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */
|
||||
if (o->ed_ctrl)
|
||||
for (i=0; i < GRUB_OHCI_CTRL_EDS; i++)
|
||||
o->ed_ctrl[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */
|
||||
o->ed_ctrl[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */
|
||||
|
||||
/* We should wait for next SOF to be sure that all EDs are
|
||||
* unaccessed by OHCI. But OHCI can be non-functional, so
|
||||
|
||||
@@ -31,7 +31,7 @@ grub_usb_bulk_maxpacket (grub_usb_device_t dev,
|
||||
struct grub_usb_desc_endp *endpoint)
|
||||
{
|
||||
/* Use the maximum packet size given in the endpoint descriptor. */
|
||||
if (dev->initialized && endpoint)
|
||||
if (dev->initialized && endpoint && (unsigned int) endpoint->maxpacket)
|
||||
return endpoint->maxpacket;
|
||||
|
||||
return 64;
|
||||
|
||||
@@ -135,6 +135,49 @@ skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||
}
|
||||
}
|
||||
|
||||
static inline grub_uint32_t
|
||||
skip_term (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||
{
|
||||
grub_uint32_t add;
|
||||
const grub_uint8_t *ptr0 = ptr;
|
||||
|
||||
switch(*ptr)
|
||||
{
|
||||
case GRUB_ACPI_OPCODE_ADD:
|
||||
case GRUB_ACPI_OPCODE_AND:
|
||||
case GRUB_ACPI_OPCODE_CONCAT:
|
||||
case GRUB_ACPI_OPCODE_CONCATRES:
|
||||
case GRUB_ACPI_OPCODE_DIVIDE:
|
||||
case GRUB_ACPI_OPCODE_INDEX:
|
||||
case GRUB_ACPI_OPCODE_LSHIFT:
|
||||
case GRUB_ACPI_OPCODE_MOD:
|
||||
case GRUB_ACPI_OPCODE_MULTIPLY:
|
||||
case GRUB_ACPI_OPCODE_NAND:
|
||||
case GRUB_ACPI_OPCODE_NOR:
|
||||
case GRUB_ACPI_OPCODE_OR:
|
||||
case GRUB_ACPI_OPCODE_RSHIFT:
|
||||
case GRUB_ACPI_OPCODE_SUBTRACT:
|
||||
case GRUB_ACPI_OPCODE_TOSTRING:
|
||||
case GRUB_ACPI_OPCODE_XOR:
|
||||
/*
|
||||
* Parameters for these opcodes: TermArg, TermArg Target, see ACPI
|
||||
* spec r5.0, page 828f.
|
||||
*/
|
||||
ptr++;
|
||||
ptr += add = skip_term (ptr, end);
|
||||
if (!add)
|
||||
return 0;
|
||||
ptr += add = skip_term (ptr, end);
|
||||
if (!add)
|
||||
return 0;
|
||||
ptr += skip_name_string (ptr, end);
|
||||
break;
|
||||
default:
|
||||
return skip_data_ref_object (ptr, end);
|
||||
}
|
||||
return ptr - ptr0;
|
||||
}
|
||||
|
||||
static inline grub_uint32_t
|
||||
skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||
{
|
||||
@@ -156,10 +199,10 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||
ptr++;
|
||||
ptr += skip_name_string (ptr, end);
|
||||
ptr++;
|
||||
ptr += add = skip_data_ref_object (ptr, end);
|
||||
ptr += add = skip_term (ptr, end);
|
||||
if (!add)
|
||||
return 0;
|
||||
ptr += add = skip_data_ref_object (ptr, end);
|
||||
ptr += add = skip_term (ptr, end);
|
||||
if (!add)
|
||||
return 0;
|
||||
break;
|
||||
@@ -180,6 +223,7 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||
return ptr - ptr0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
|
||||
grub_uint8_t *scope, int scope_len)
|
||||
@@ -214,8 +258,8 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
|
||||
}
|
||||
case GRUB_ACPI_OPCODE_NAME:
|
||||
ptr++;
|
||||
if ((!scope || memcmp (scope, "\\", scope_len) == 0) &&
|
||||
(memcmp (ptr, "_S5_", 4) == 0 || memcmp (ptr, "\\_S5_", 4) == 0))
|
||||
if ((!scope || grub_memcmp (scope, "\\", scope_len) == 0) &&
|
||||
(grub_memcmp (ptr, "_S5_", 4) == 0 || grub_memcmp (ptr, "\\_S5_", 4) == 0))
|
||||
{
|
||||
int ll;
|
||||
grub_uint8_t *ptr2 = ptr;
|
||||
@@ -250,6 +294,17 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
|
||||
if (!add)
|
||||
return -1;
|
||||
break;
|
||||
case GRUB_ACPI_OPCODE_ALIAS:
|
||||
ptr++;
|
||||
/* We need to skip two name strings */
|
||||
ptr += add = skip_name_string (ptr, end);
|
||||
if (!add)
|
||||
return -1;
|
||||
ptr += add = skip_name_string (ptr, end);
|
||||
if (!add)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case GRUB_ACPI_OPCODE_SCOPE:
|
||||
{
|
||||
int scope_sleep_type;
|
||||
|
||||
@@ -52,6 +52,7 @@ grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)),
|
||||
grub_efi_configuration_table_t *t;
|
||||
unsigned int i;
|
||||
|
||||
grub_printf ("Address: %p\n", st);
|
||||
grub_printf ("Signature: %016" PRIxGRUB_UINT64_T " revision: %08x\n",
|
||||
st->hdr.signature, st->hdr.revision);
|
||||
{
|
||||
|
||||
@@ -48,6 +48,8 @@ static const struct grub_arg_option options[] = {
|
||||
N_("Check if FILE can be used as x86 multiboot2 kernel"), 0, 0},
|
||||
{"is-arm-linux", 0, 0,
|
||||
N_("Check if FILE is ARM Linux"), 0, 0},
|
||||
{"is-arm64-linux", 0, 0,
|
||||
N_("Check if FILE is ARM64 Linux"), 0, 0},
|
||||
{"is-ia64-linux", 0, 0,
|
||||
N_("Check if FILE is IA64 Linux"), 0, 0},
|
||||
{"is-mips-linux", 0, 0,
|
||||
@@ -82,6 +84,8 @@ static const struct grub_arg_option options[] = {
|
||||
N_("Check if FILE is x86_64 EFI file"), 0, 0},
|
||||
{"is-ia64-efi", 0, 0,
|
||||
N_("Check if FILE is IA64 EFI file"), 0, 0},
|
||||
{"is-arm64-efi", 0, 0,
|
||||
N_("Check if FILE is ARM64 EFI file"), 0, 0},
|
||||
{"is-arm-efi", 0, 0,
|
||||
N_("Check if FILE is ARM EFI file"), 0, 0},
|
||||
{"is-hibernated-hiberfil", 0, 0,
|
||||
@@ -105,6 +109,7 @@ enum
|
||||
IS_MULTIBOOT,
|
||||
IS_MULTIBOOT2,
|
||||
IS_ARM_LINUX,
|
||||
IS_ARM64_LINUX,
|
||||
IS_IA64_LINUX,
|
||||
IS_MIPS_LINUX,
|
||||
IS_MIPSEL_LINUX,
|
||||
@@ -121,6 +126,7 @@ enum
|
||||
IS_32_EFI,
|
||||
IS_64_EFI,
|
||||
IS_IA_EFI,
|
||||
IS_ARM64_EFI,
|
||||
IS_ARM_EFI,
|
||||
IS_HIBERNATED,
|
||||
IS_XNU64,
|
||||
@@ -377,14 +383,40 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
}
|
||||
case IS_ARM_LINUX:
|
||||
{
|
||||
grub_uint32_t sig;
|
||||
grub_uint32_t sig, sig_pi;
|
||||
if (grub_file_read (file, &sig_pi, 4) != 4)
|
||||
break;
|
||||
/* Raspberry pi. */
|
||||
if (sig_pi == grub_cpu_to_le32_compile_time (0xea000006))
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (grub_file_seek (file, 0x24) == (grub_size_t) -1)
|
||||
break;
|
||||
if (grub_file_read (file, &sig, 4) != 4)
|
||||
break;
|
||||
if (sig != grub_cpu_to_le32_compile_time (0x016f2818))
|
||||
if (sig == grub_cpu_to_le32_compile_time (0x016f2818))
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IS_ARM64_LINUX:
|
||||
{
|
||||
grub_uint32_t sig;
|
||||
|
||||
if (grub_file_seek (file, 0x38) == (grub_size_t) -1)
|
||||
break;
|
||||
ret = 1;
|
||||
if (grub_file_read (file, &sig, 4) != 4)
|
||||
break;
|
||||
if (sig == grub_cpu_to_le32_compile_time (0x644d5241))
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IS_PAE_DOMU ... IS_DOM0:
|
||||
@@ -535,6 +567,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
case IS_32_EFI:
|
||||
case IS_64_EFI:
|
||||
case IS_IA_EFI:
|
||||
case IS_ARM64_EFI:
|
||||
case IS_ARM_EFI:
|
||||
{
|
||||
char signature[4];
|
||||
@@ -573,11 +606,15 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
&& coff_head.machine !=
|
||||
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_IA64))
|
||||
break;
|
||||
if (type == IS_ARM64_EFI
|
||||
&& coff_head.machine !=
|
||||
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_ARM64))
|
||||
break;
|
||||
if (type == IS_ARM_EFI
|
||||
&& coff_head.machine !=
|
||||
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_ARMTHUMB_MIXED))
|
||||
break;
|
||||
if (type == IS_64_EFI || type == IS_64_EFI)
|
||||
if (type == IS_IA_EFI || type == IS_64_EFI || type == IS_ARM64_EFI)
|
||||
{
|
||||
struct grub_pe64_optional_header o64;
|
||||
if (grub_file_read (file, &o64, sizeof (o64)) != sizeof (o64))
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <grub/fileid.h>
|
||||
#include <grub/elfload.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
||||
}
|
||||
|
||||
/* Check if it is valid. */
|
||||
if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
|
||||
if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE))
|
||||
{
|
||||
grub_device_close (dev);
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
|
||||
@@ -216,7 +216,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
||||
first_sector--;
|
||||
mbr.entries[0].flag = 0;
|
||||
mbr.entries[0].type = GRUB_PC_PARTITION_TYPE_GPT_DISK;
|
||||
mbr.entries[0].start = grub_cpu_to_le32 (1);
|
||||
mbr.entries[0].start = grub_cpu_to_le32_compile_time (1);
|
||||
lba_to_chs (1,
|
||||
&(mbr.entries[0].start_sector),
|
||||
&(mbr.entries[0].start_cylinder),
|
||||
@@ -227,7 +227,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
||||
&(mbr.entries[0].end_head));
|
||||
mbr.entries[0].length = grub_cpu_to_le32 (first_sector);
|
||||
|
||||
mbr.signature = grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE);
|
||||
mbr.signature = grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE);
|
||||
|
||||
if (grub_disk_write (dev->disk, 0, 0, sizeof (mbr), &mbr))
|
||||
{
|
||||
|
||||
@@ -107,6 +107,14 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
if (!tempo)
|
||||
{
|
||||
grub_file_close (file);
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"),
|
||||
args[0]);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
tempo = grub_le_to_cpu32 (tempo);
|
||||
grub_dprintf ("play","tempo = %d\n", tempo);
|
||||
|
||||
@@ -131,6 +139,13 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
tempo = grub_strtoul (args[0], &end, 0);
|
||||
|
||||
if (!tempo)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"),
|
||||
args[0]);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
if (*end)
|
||||
/* Was not a number either, assume it was supposed to be a file name. */
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), args[0]);
|
||||
|
||||
@@ -292,7 +292,7 @@ find_key_code (char *key)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(keysym_table); i++)
|
||||
{
|
||||
if (keysym_table[i].unshifted_name
|
||||
&& grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
|
||||
@@ -311,7 +311,7 @@ find_ascii_code (char *key)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(keysym_table); i++)
|
||||
{
|
||||
if (keysym_table[i].unshifted_name
|
||||
&& grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
|
||||
@@ -352,15 +352,13 @@ grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < sizeof (simple_flag_offsets)
|
||||
/ sizeof (simple_flag_offsets[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(simple_flag_offsets); i++)
|
||||
grub_sendkey_set_simple_flag (simple_flag_offsets[i],
|
||||
grub_sendkey_parse_op(state[i]));
|
||||
}
|
||||
|
||||
/* Set noled. */
|
||||
noled = (state[sizeof (simple_flag_offsets)
|
||||
/ sizeof (simple_flag_offsets[0])].set);
|
||||
noled = (state[ARRAY_SIZE(simple_flag_offsets)].set);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
@@ -173,8 +173,10 @@ grub_term_map_key (grub_keyboard_key_t code, int status)
|
||||
|
||||
key = map_key_core (code, status, &alt_gr_consumed);
|
||||
|
||||
if (key == 0 || key == GRUB_TERM_SHIFT)
|
||||
if (key == 0 || key == GRUB_TERM_SHIFT) {
|
||||
grub_printf ("Unknown key 0x%x detected\n", code);
|
||||
return GRUB_TERM_NO_KEY;
|
||||
}
|
||||
|
||||
if (status & GRUB_TERM_STATUS_CAPS)
|
||||
{
|
||||
|
||||
@@ -580,7 +580,7 @@ check_password_md5_real (const char *entered,
|
||||
GRUB_MD_MD5->write (ctx, entered, enteredlen);
|
||||
digest = GRUB_MD_MD5->read (ctx);
|
||||
GRUB_MD_MD5->final (ctx);
|
||||
memcpy (alt_result, digest, MD5_HASHLEN);
|
||||
grub_memcpy (alt_result, digest, MD5_HASHLEN);
|
||||
|
||||
GRUB_MD_MD5->init (ctx);
|
||||
GRUB_MD_MD5->write (ctx, entered, enteredlen);
|
||||
@@ -596,7 +596,7 @@ check_password_md5_real (const char *entered,
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
memcpy (alt_result, digest, 16);
|
||||
grub_memcpy (alt_result, digest, 16);
|
||||
|
||||
GRUB_MD_MD5->init (ctx);
|
||||
if ((i & 1) != 0)
|
||||
|
||||
@@ -263,7 +263,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||
for (q = p->next; q; q = q->next)
|
||||
{
|
||||
grub_disk_addr_t s1, s2;
|
||||
grub_disk_addr_t e1, e2, t;
|
||||
grub_disk_addr_t e1, e2;
|
||||
|
||||
s1 = p->sector;
|
||||
e1 = s1 + ((p->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
|
||||
@@ -271,16 +271,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||
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)
|
||||
if (s1 < e2 && s2 < e1)
|
||||
{
|
||||
/* This might be actually valid, but it is unbelievable that
|
||||
any filesystem makes such a silly allocation. */
|
||||
|
||||
@@ -37,7 +37,7 @@ struct find_node_context
|
||||
grub_uint64_t inode_found;
|
||||
char *dirname;
|
||||
enum
|
||||
{ NONE, FILE, DIR } found;
|
||||
{ FOUND_NONE, FOUND_FILE, FOUND_DIR } found;
|
||||
};
|
||||
|
||||
static int
|
||||
@@ -53,7 +53,7 @@ find_inode (const char *filename,
|
||||
&& grub_strcasecmp (ctx->dirname, filename) == 0)))
|
||||
{
|
||||
ctx->inode_found = info->inode;
|
||||
ctx->found = info->dir ? DIR : FILE;
|
||||
ctx->found = info->dir ? FOUND_DIR : FOUND_FILE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ grub_mac_bless_file (grub_device_t dev, const char *path_in, int intel)
|
||||
grub_free (path);
|
||||
|
||||
return grub_mac_bless_inode (dev, (grub_uint32_t) ctx.inode_found,
|
||||
(ctx.found == DIR), intel);
|
||||
(ctx.found == FOUND_DIR), intel);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
|
||||
@@ -133,7 +133,7 @@ show_help (grub_device_t dev)
|
||||
}
|
||||
}
|
||||
if (! found)
|
||||
grub_printf_ (N_("Sorry no parttool is available for %s\n"),
|
||||
grub_printf_ (N_("Sorry, no parttool is available for %s\n"),
|
||||
dev->disk->partition->partmap->name);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ static const struct grub_arg_option options[] =
|
||||
N_("root directory of the syslinux disk [default=/]."),
|
||||
N_("DIR"), ARG_TYPE_STRING},
|
||||
{"cwd", 'c', 0,
|
||||
N_("current directory of the syslinux [default is parent directory of input file]."),
|
||||
N_("current directory of syslinux [default is parent directory of input file]."),
|
||||
N_("DIR"), ARG_TYPE_STRING},
|
||||
{"isolinux", 'i', 0, N_("assume input is an isolinux configuration file."), 0, 0},
|
||||
{"pxelinux", 'p', 0, N_("assume input is a pxelinux configuration file."), 0, 0},
|
||||
|
||||
+66
-16
@@ -33,6 +33,13 @@
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
struct grub_verified
|
||||
{
|
||||
grub_file_t file;
|
||||
void *buf;
|
||||
};
|
||||
typedef struct grub_verified *grub_verified_t;
|
||||
|
||||
enum
|
||||
{
|
||||
OPTION_SKIP_SIG = 0
|
||||
@@ -802,19 +809,39 @@ grub_cmd_verify_signature (grub_extcmd_context_t ctxt,
|
||||
|
||||
static int sec = 0;
|
||||
|
||||
static void
|
||||
verified_free (grub_verified_t verified)
|
||||
{
|
||||
if (verified)
|
||||
{
|
||||
grub_free (verified->buf);
|
||||
grub_free (verified);
|
||||
}
|
||||
}
|
||||
|
||||
static grub_ssize_t
|
||||
verified_read (struct grub_file *file, char *buf, grub_size_t len)
|
||||
{
|
||||
grub_memcpy (buf, (char *) file->data + file->offset, len);
|
||||
grub_verified_t verified = file->data;
|
||||
|
||||
grub_memcpy (buf, (char *) verified->buf + file->offset, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
verified_close (struct grub_file *file)
|
||||
{
|
||||
grub_free (file->data);
|
||||
grub_verified_t verified = file->data;
|
||||
|
||||
grub_file_close (verified->file);
|
||||
verified_free (verified);
|
||||
file->data = 0;
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
/* device and name are freed by parent */
|
||||
file->device = 0;
|
||||
file->name = 0;
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
struct grub_fs verified_fs =
|
||||
@@ -832,10 +859,13 @@ grub_pubkey_open (grub_file_t io, const char *filename)
|
||||
grub_err_t err;
|
||||
grub_file_filter_t curfilt[GRUB_FILE_FILTER_MAX];
|
||||
grub_file_t ret;
|
||||
grub_verified_t verified;
|
||||
|
||||
if (!sec)
|
||||
return io;
|
||||
if (io->device->disk && io->device->disk->id == GRUB_DISK_DEVICE_MEMDISK_ID)
|
||||
if (io->device->disk &&
|
||||
(io->device->disk->dev->id == GRUB_DISK_DEVICE_MEMDISK_ID
|
||||
|| io->device->disk->dev->id == GRUB_DISK_DEVICE_PROCFS_ID))
|
||||
return io;
|
||||
fsuf = grub_malloc (grub_strlen (filename) + sizeof (".sig"));
|
||||
if (!fsuf)
|
||||
@@ -855,7 +885,10 @@ grub_pubkey_open (grub_file_t io, const char *filename)
|
||||
|
||||
ret = grub_malloc (sizeof (*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
{
|
||||
grub_file_close (sig);
|
||||
return NULL;
|
||||
}
|
||||
*ret = *io;
|
||||
|
||||
ret->fs = &verified_fs;
|
||||
@@ -864,29 +897,46 @@ grub_pubkey_open (grub_file_t io, const char *filename)
|
||||
{
|
||||
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"big file signature isn't implemented yet");
|
||||
return NULL;
|
||||
}
|
||||
ret->data = grub_malloc (ret->size);
|
||||
if (!ret->data)
|
||||
{
|
||||
grub_file_close (sig);
|
||||
grub_free (ret);
|
||||
return NULL;
|
||||
}
|
||||
if (grub_file_read (io, ret->data, ret->size) != (grub_ssize_t) ret->size)
|
||||
verified = grub_malloc (sizeof (*verified));
|
||||
if (!verified)
|
||||
{
|
||||
grub_file_close (sig);
|
||||
grub_free (ret);
|
||||
return NULL;
|
||||
}
|
||||
verified->buf = grub_malloc (ret->size);
|
||||
if (!verified->buf)
|
||||
{
|
||||
grub_file_close (sig);
|
||||
grub_free (verified);
|
||||
grub_free (ret);
|
||||
return NULL;
|
||||
}
|
||||
if (grub_file_read (io, verified->buf, ret->size) != (grub_ssize_t) ret->size)
|
||||
{
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
|
||||
filename);
|
||||
grub_file_close (sig);
|
||||
verified_free (verified);
|
||||
grub_free (ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err = grub_verify_signature_real (ret->data, ret->size, 0, sig, NULL);
|
||||
err = grub_verify_signature_real (verified->buf, ret->size, 0, sig, NULL);
|
||||
grub_file_close (sig);
|
||||
if (err)
|
||||
return NULL;
|
||||
io->device = 0;
|
||||
io->name = 0;
|
||||
grub_file_close (io);
|
||||
{
|
||||
verified_free (verified);
|
||||
grub_free (ret);
|
||||
return NULL;
|
||||
}
|
||||
verified->file = io;
|
||||
ret->data = verified;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ AF_merge (const gcry_md_spec_t * hash, grub_uint8_t * src, grub_uint8_t * dst,
|
||||
if (bufblock == NULL)
|
||||
return GPG_ERR_OUT_OF_MEMORY;
|
||||
|
||||
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN)
|
||||
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN || hash->mdlen == 0)
|
||||
return GPG_ERR_INV_ARG;
|
||||
|
||||
grub_memset (bufblock, 0, blocksize);
|
||||
|
||||
+30
-9
@@ -194,10 +194,8 @@ grub_ahci_pciinit (grub_pci_device_t dev,
|
||||
return 0;
|
||||
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
|
||||
grub_pci_write_word (addr, grub_pci_read_word (addr) |
|
||||
GRUB_PCI_COMMAND_IO_ENABLED
|
||||
| GRUB_PCI_COMMAND_MEM_ENABLED
|
||||
| GRUB_PCI_COMMAND_BUS_MASTER);
|
||||
grub_pci_write_word (addr, grub_pci_read_word (addr)
|
||||
| GRUB_PCI_COMMAND_MEM_ENABLED);
|
||||
|
||||
hba = grub_pci_device_map_range (dev, bar & GRUB_PCI_ADDR_MEM_MASK,
|
||||
sizeof (hba));
|
||||
@@ -324,7 +322,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
|
||||
|
||||
grub_dprintf ("ahci", "GLC:%x\n", hba->global_control);
|
||||
|
||||
nports = (hba->cap & GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1;
|
||||
nports = (GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1;
|
||||
|
||||
grub_dprintf ("ahci", "%d AHCI ports, PI = 0x%x\n", nports,
|
||||
hba->ports_implemented);
|
||||
@@ -360,7 +358,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
|
||||
grub_dprintf ("ahci", "err: %x\n",
|
||||
adevs[i]->hba->ports[adevs[i]->port].sata_error);
|
||||
|
||||
adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head));
|
||||
adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head) * 32);
|
||||
if (!adevs[i]->command_list_chunk)
|
||||
{
|
||||
adevs[i] = 0;
|
||||
@@ -378,6 +376,12 @@ grub_ahci_pciinit (grub_pci_device_t dev,
|
||||
|
||||
adevs[i]->command_list = grub_dma_get_virt (adevs[i]->command_list_chunk);
|
||||
adevs[i]->command_table = grub_dma_get_virt (adevs[i]->command_table_chunk);
|
||||
|
||||
grub_memset ((void *) adevs[i]->command_list, 0,
|
||||
sizeof (struct grub_ahci_cmd_table));
|
||||
grub_memset ((void *) adevs[i]->command_table, 0,
|
||||
sizeof (struct grub_ahci_cmd_head) * 32);
|
||||
|
||||
adevs[i]->command_list->command_table_base
|
||||
= grub_dma_get_phys (adevs[i]->command_table_chunk);
|
||||
|
||||
@@ -450,6 +454,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
|
||||
adevs[i]->hba->ports[adevs[i]->port].fis_base = grub_dma_get_phys (adevs[i]->rfis);
|
||||
adevs[i]->hba->ports[adevs[i]->port].command_list_base
|
||||
= grub_dma_get_phys (adevs[i]->command_list_chunk);
|
||||
adevs[i]->hba->ports[adevs[i]->port].command_issue = 0;
|
||||
adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_FRE;
|
||||
}
|
||||
|
||||
@@ -596,6 +601,9 @@ grub_ahci_pciinit (grub_pci_device_t dev,
|
||||
failed_adevs[i] = adevs[i];
|
||||
adevs[i] = 0;
|
||||
}
|
||||
|
||||
grub_dprintf ("ahci", "cleaning up failed devs\n");
|
||||
|
||||
for (i = 0; i < nports; i++)
|
||||
if (failed_adevs[i] && (fr_running & (1 << i)))
|
||||
failed_adevs[i]->hba->ports[failed_adevs[i]->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_FRE;
|
||||
@@ -621,6 +629,10 @@ grub_ahci_pciinit (grub_pci_device_t dev,
|
||||
if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].sig >> 16) == 0xeb14)
|
||||
adevs[i]->atapi = 1;
|
||||
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
|
||||
grub_pci_write_word (addr, grub_pci_read_word (addr)
|
||||
| GRUB_PCI_COMMAND_BUS_MASTER);
|
||||
|
||||
for (i = 0; i < nports; i++)
|
||||
if (adevs[i])
|
||||
{
|
||||
@@ -847,6 +859,12 @@ grub_ahci_reset_port (struct grub_ahci_device *dev, int force)
|
||||
{
|
||||
struct grub_disk_ata_pass_through_parms parms2;
|
||||
dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST;
|
||||
dev->hba->ports[dev->port].command_issue = 0;
|
||||
dev->command_list[0].config = 0;
|
||||
dev->command_table[0].prdt[0].unused = 0;
|
||||
dev->command_table[0].prdt[0].size = 0;
|
||||
dev->command_table[0].prdt[0].data_base = 0;
|
||||
|
||||
endtime = grub_get_time_ms () + 1000;
|
||||
while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR))
|
||||
if (grub_get_time_ms () > endtime)
|
||||
@@ -914,7 +932,10 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
|
||||
if (parms->size > GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH)
|
||||
return grub_error (GRUB_ERR_BUG, "too big data buffer");
|
||||
|
||||
bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
|
||||
if (parms->size)
|
||||
bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
|
||||
else
|
||||
bufc = grub_memalign_dma32 (1024, 512);
|
||||
|
||||
grub_dprintf ("ahci", "AHCI tfd = %x, CL=%p\n",
|
||||
dev->hba->ports[dev->port].task_file_data,
|
||||
@@ -924,7 +945,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
|
||||
= (5 << GRUB_AHCI_CONFIG_CFIS_LENGTH_SHIFT)
|
||||
// | GRUB_AHCI_CONFIG_CLEAR_R_OK
|
||||
| (0 << GRUB_AHCI_CONFIG_PMP_SHIFT)
|
||||
| (1 << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT)
|
||||
| ((parms->size ? 1 : 0) << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT)
|
||||
| (parms->cmdsize ? GRUB_AHCI_CONFIG_ATAPI : 0)
|
||||
| (parms->write ? GRUB_AHCI_CONFIG_WRITE : GRUB_AHCI_CONFIG_READ)
|
||||
| (parms->taskfile.cmd == 8 ? (1 << 8) : 0);
|
||||
@@ -1001,7 +1022,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
|
||||
grub_dprintf ("ahci", "AHCI tfd = %x\n",
|
||||
dev->hba->ports[dev->port].task_file_data);
|
||||
|
||||
endtime = grub_get_time_ms () + (spinup ? 10000 : 5000);
|
||||
endtime = grub_get_time_ms () + (spinup ? 20000 : 20000);
|
||||
while ((dev->hba->ports[dev->port].command_issue & 1))
|
||||
if (grub_get_time_ms () > endtime)
|
||||
{
|
||||
|
||||
@@ -216,6 +216,12 @@ grub_ata_setaddress (struct grub_ata *dev,
|
||||
unsigned int head;
|
||||
unsigned int sect;
|
||||
|
||||
if (dev->sectors_per_track == 0
|
||||
|| dev->heads == 0)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"sector %d cannot be addressed "
|
||||
"using CHS addressing", sector);
|
||||
|
||||
/* Calculate the sector, cylinder and head to use. */
|
||||
sect = ((grub_uint32_t) sector % dev->sectors_per_track) + 1;
|
||||
cylinder = (((grub_uint32_t) sector / dev->sectors_per_track)
|
||||
|
||||
@@ -762,25 +762,26 @@ grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name,
|
||||
|
||||
void
|
||||
grub_util_cryptodisk_get_abstraction (grub_disk_t disk,
|
||||
void (*cb) (const char *val))
|
||||
void (*cb) (const char *val, void *data),
|
||||
void *data)
|
||||
{
|
||||
grub_cryptodisk_t dev = (grub_cryptodisk_t) disk->data;
|
||||
|
||||
cb ("cryptodisk");
|
||||
cb (dev->modname);
|
||||
cb ("cryptodisk", data);
|
||||
cb (dev->modname, data);
|
||||
|
||||
if (dev->cipher)
|
||||
cb (dev->cipher->cipher->modname);
|
||||
cb (dev->cipher->cipher->modname, data);
|
||||
if (dev->secondary_cipher)
|
||||
cb (dev->secondary_cipher->cipher->modname);
|
||||
cb (dev->secondary_cipher->cipher->modname, data);
|
||||
if (dev->essiv_cipher)
|
||||
cb (dev->essiv_cipher->cipher->modname);
|
||||
cb (dev->essiv_cipher->cipher->modname, data);
|
||||
if (dev->hash)
|
||||
cb (dev->hash->modname);
|
||||
cb (dev->hash->modname, data);
|
||||
if (dev->essiv_hash)
|
||||
cb (dev->essiv_hash->modname);
|
||||
cb (dev->essiv_hash->modname, data);
|
||||
if (dev->iv_hash)
|
||||
cb (dev->iv_hash->modname);
|
||||
cb (dev->iv_hash->modname, data);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
||||
+121
-7
@@ -354,7 +354,8 @@ grub_diskfilter_memberlist (grub_disk_t disk)
|
||||
|
||||
void
|
||||
grub_diskfilter_get_partmap (grub_disk_t disk,
|
||||
void (*cb) (const char *pm))
|
||||
void (*cb) (const char *pm, void *data),
|
||||
void *data)
|
||||
{
|
||||
struct grub_diskfilter_lv *lv = disk->data;
|
||||
struct grub_diskfilter_pv *pv;
|
||||
@@ -376,7 +377,7 @@ grub_diskfilter_get_partmap (grub_disk_t disk,
|
||||
continue;
|
||||
}
|
||||
for (s = 0; pv->partmaps[s]; s++)
|
||||
cb (pv->partmaps[s]);
|
||||
cb (pv->partmaps[s], data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,6 +483,96 @@ grub_diskfilter_read_node (const struct grub_diskfilter_node *node,
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown node '%s'", node->name);
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
validate_segment (struct grub_diskfilter_segment *seg);
|
||||
|
||||
static grub_err_t
|
||||
validate_lv (struct grub_diskfilter_lv *lv)
|
||||
{
|
||||
unsigned int i;
|
||||
if (!lv)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown volume");
|
||||
|
||||
if (lv->vg->extent_size == 0)
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "invalid volume");
|
||||
|
||||
for (i = 0; i < lv->segment_count; i++)
|
||||
{
|
||||
grub_err_t err;
|
||||
err = validate_segment (&lv->segments[1]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
validate_node (const struct grub_diskfilter_node *node)
|
||||
{
|
||||
/* Check whether we actually know the physical volume we want to
|
||||
read from. */
|
||||
if (node->pv)
|
||||
return GRUB_ERR_NONE;
|
||||
if (node->lv)
|
||||
return validate_lv (node->lv);
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown node '%s'", node->name);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
validate_segment (struct grub_diskfilter_segment *seg)
|
||||
{
|
||||
grub_err_t err;
|
||||
|
||||
if (seg->stripe_size == 0 || seg->node_count == 0)
|
||||
return grub_error(GRUB_ERR_BAD_FS, "invalid segment");
|
||||
|
||||
switch (seg->type)
|
||||
{
|
||||
case GRUB_DISKFILTER_RAID10:
|
||||
{
|
||||
grub_uint8_t near, far;
|
||||
near = seg->layout & 0xFF;
|
||||
far = (seg->layout >> 8) & 0xFF;
|
||||
if ((seg->layout >> 16) == 0 && far == 0)
|
||||
return grub_error(GRUB_ERR_BAD_FS, "invalid segment");
|
||||
if (near > seg->node_count)
|
||||
return grub_error(GRUB_ERR_BAD_FS, "invalid segment");
|
||||
break;
|
||||
}
|
||||
|
||||
case GRUB_DISKFILTER_STRIPED:
|
||||
case GRUB_DISKFILTER_MIRROR:
|
||||
break;
|
||||
|
||||
case GRUB_DISKFILTER_RAID4:
|
||||
case GRUB_DISKFILTER_RAID5:
|
||||
if (seg->node_count <= 1)
|
||||
return grub_error(GRUB_ERR_BAD_FS, "invalid segment");
|
||||
break;
|
||||
|
||||
case GRUB_DISKFILTER_RAID6:
|
||||
if (seg->node_count <= 2)
|
||||
return grub_error(GRUB_ERR_BAD_FS, "invalid segment");
|
||||
break;
|
||||
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"unsupported RAID level %d", seg->type);
|
||||
}
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < seg->node_count; i++)
|
||||
{
|
||||
err = validate_node (&seg->nodes[i]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
read_segment (struct grub_diskfilter_segment *seg, grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf)
|
||||
@@ -847,6 +938,32 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg)
|
||||
|
||||
for (lv = vg->lvs; lv; lv = lv->next)
|
||||
{
|
||||
/* RAID 1 and single-disk RAID 0 don't use a chunksize but code assumes one so set
|
||||
one. */
|
||||
for (i = 0; i < lv->segment_count; i++)
|
||||
{
|
||||
if (lv->segments[i].type == 1)
|
||||
lv->segments[i].stripe_size = 64;
|
||||
if (lv->segments[i].type == GRUB_DISKFILTER_STRIPED
|
||||
&& lv->segments[i].node_count == 1
|
||||
&& lv->segments[i].stripe_size == 0)
|
||||
lv->segments[i].stripe_size = 64;
|
||||
}
|
||||
}
|
||||
|
||||
for (lv = vg->lvs; lv; lv = lv->next)
|
||||
{
|
||||
grub_err_t err;
|
||||
|
||||
/* RAID 1 doesn't use a chunksize but code assumes one so set
|
||||
one. */
|
||||
for (i = 0; i < lv->segment_count; i++)
|
||||
if (lv->segments[i].type == 1)
|
||||
lv->segments[i].stripe_size = 64;
|
||||
|
||||
err = validate_lv(lv);
|
||||
if (err)
|
||||
return err;
|
||||
lv->number = lv_num++;
|
||||
|
||||
if (lv->fullname)
|
||||
@@ -887,11 +1004,6 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg)
|
||||
lv->fullname = tmp;
|
||||
}
|
||||
}
|
||||
/* RAID 1 doesn't use a chunksize but code assumes one so set
|
||||
one. */
|
||||
for (i = 0; i < lv->segment_count; i++)
|
||||
if (lv->segments[i].type == 1)
|
||||
lv->segments[i].stripe_size = 64;
|
||||
lv->vg = vg;
|
||||
}
|
||||
/* Add our new array to the list. */
|
||||
@@ -925,6 +1037,8 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb,
|
||||
n = layout & 0xFF;
|
||||
if (n == 1)
|
||||
n = (layout >> 8) & 0xFF;
|
||||
if (n == 0)
|
||||
return NULL;
|
||||
|
||||
totsize = grub_divmod64 (nmemb * disk_size, n, 0);
|
||||
}
|
||||
|
||||
@@ -129,6 +129,9 @@ grub_dmraid_nv_detect (grub_disk_t disk,
|
||||
case NV_LEVEL_0:
|
||||
level = 0;
|
||||
disk_size = sb.capacity / sb.array.total_volumes;
|
||||
if (sb.array.total_volumes == 0)
|
||||
/* Not RAID. */
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
case NV_LEVEL_1:
|
||||
@@ -139,6 +142,9 @@ grub_dmraid_nv_detect (grub_disk_t disk,
|
||||
case NV_LEVEL_5:
|
||||
level = 5;
|
||||
disk_size = sb.capacity / (sb.array.total_volumes - 1);
|
||||
if (sb.array.total_volumes == 0 || sb.array.total_volumes == 1)
|
||||
/* Not RAID. */
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -333,6 +333,21 @@ name_devices (struct grub_efidisk_data *devices)
|
||||
if (! dp)
|
||||
continue;
|
||||
|
||||
/* Ghosts proudly presented by Apple. */
|
||||
if (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE
|
||||
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (dp)
|
||||
== GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE)
|
||||
{
|
||||
grub_efi_vendor_device_path_t *vendor = (grub_efi_vendor_device_path_t *) dp;
|
||||
const struct grub_efi_guid apple = GRUB_EFI_VENDOR_APPLE_GUID;
|
||||
|
||||
if (vendor->header.length == sizeof (*vendor)
|
||||
&& grub_memcmp (&vendor->vendor_guid, &apple,
|
||||
sizeof (vendor->vendor_guid)) == 0
|
||||
&& find_parent_device (devices, d))
|
||||
continue;
|
||||
}
|
||||
|
||||
m = d->block_io->media;
|
||||
if (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_ACPI_DEVICE_PATH_TYPE
|
||||
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (dp)
|
||||
|
||||
+32
-8
@@ -225,7 +225,7 @@ grub_util_get_geli_uuid (const char *dev)
|
||||
|
||||
/* Look for GELI magic sequence. */
|
||||
if (grub_memcmp (header->magic, GELI_MAGIC, sizeof (GELI_MAGIC))
|
||||
|| grub_le_to_cpu32 (header->version) > 5
|
||||
|| grub_le_to_cpu32 (header->version) > 7
|
||||
|| grub_le_to_cpu32 (header->version) < 1)
|
||||
grub_util_error ("%s", _("wrong ELI magic or version"));
|
||||
|
||||
@@ -265,7 +265,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
|
||||
/* Look for GELI magic sequence. */
|
||||
if (grub_memcmp (header.magic, GELI_MAGIC, sizeof (GELI_MAGIC))
|
||||
|| grub_le_to_cpu32 (header.version) > 5
|
||||
|| grub_le_to_cpu32 (header.version) > 7
|
||||
|| grub_le_to_cpu32 (header.version) < 1)
|
||||
{
|
||||
grub_dprintf ("geli", "wrong magic %02x\n", header.magic[0]);
|
||||
@@ -332,19 +332,29 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
{
|
||||
secondary_cipher = grub_crypto_cipher_open (ciph);
|
||||
if (!secondary_cipher)
|
||||
return NULL;
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (grub_le_to_cpu16 (header.keylen) > 1024)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid keysize %d",
|
||||
grub_le_to_cpu16 (header.keylen));
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_crypto_cipher_close (secondary_cipher);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
newdev = grub_zalloc (sizeof (struct grub_cryptodisk));
|
||||
if (!newdev)
|
||||
return NULL;
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_crypto_cipher_close (secondary_cipher);
|
||||
return NULL;
|
||||
}
|
||||
newdev->cipher = cipher;
|
||||
newdev->secondary_cipher = secondary_cipher;
|
||||
newdev->offset = 0;
|
||||
@@ -391,6 +401,7 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
||||
grub_uint8_t geomkey[GRUB_CRYPTO_MAX_MDLEN];
|
||||
grub_uint8_t verify_key[GRUB_CRYPTO_MAX_MDLEN];
|
||||
grub_uint8_t zero[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE];
|
||||
grub_uint8_t geli_cipher_key[64];
|
||||
char passphrase[MAX_PASSPHRASE] = "";
|
||||
unsigned i;
|
||||
gcry_err_code_t gcry_err;
|
||||
@@ -514,6 +525,19 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
||||
continue;
|
||||
grub_printf_ (N_("Slot %d opened\n"), i);
|
||||
|
||||
if (grub_le_to_cpu32 (header.version) >= 7)
|
||||
{
|
||||
/* GELI >=7 uses the cipher_key */
|
||||
grub_memcpy (geli_cipher_key, candidate_key.cipher_key,
|
||||
sizeof (candidate_key.cipher_key));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* GELI <=6 uses the iv_key */
|
||||
grub_memcpy (geli_cipher_key, candidate_key.iv_key,
|
||||
sizeof (candidate_key.iv_key));
|
||||
}
|
||||
|
||||
/* Set the master key. */
|
||||
if (!dev->rekey)
|
||||
{
|
||||
@@ -530,13 +554,13 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
||||
grub_size_t real_keysize = keysize;
|
||||
if (grub_le_to_cpu16 (header.alg) == 0x16)
|
||||
real_keysize *= 2;
|
||||
/* For a reason I don't know, the IV key is used in rekeying. */
|
||||
grub_memcpy (dev->rekey_key, candidate_key.iv_key,
|
||||
sizeof (candidate_key.iv_key));
|
||||
|
||||
grub_memcpy (dev->rekey_key, geli_cipher_key,
|
||||
sizeof (geli_cipher_key));
|
||||
dev->rekey_derived_size = real_keysize;
|
||||
dev->last_rekey = -1;
|
||||
COMPILE_TIME_ASSERT (sizeof (dev->rekey_key)
|
||||
>= sizeof (candidate_key.iv_key));
|
||||
>= sizeof (geli_cipher_key));
|
||||
}
|
||||
|
||||
dev->iv_prefix_len = sizeof (candidate_key.iv_key);
|
||||
|
||||
@@ -419,6 +419,11 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)
|
||||
}
|
||||
}
|
||||
|
||||
if (data->sectors == 0)
|
||||
data->sectors = 63;
|
||||
if (data->heads == 0)
|
||||
data->heads = 255;
|
||||
|
||||
if (! total_sectors)
|
||||
total_sectors = data->cylinders * data->heads * data->sectors;
|
||||
}
|
||||
@@ -455,6 +460,14 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
||||
{
|
||||
struct grub_biosdisk_data *data = disk->data;
|
||||
|
||||
/* VirtualBox fails with sectors above 2T on CDs.
|
||||
Since even BD-ROMS are never that big anyway, return error. */
|
||||
if ((data->flags & GRUB_BIOSDISK_FLAG_CDROM)
|
||||
&& (sector >> 32))
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read or write outside of disk `%s'"),
|
||||
disk->name);
|
||||
|
||||
if (data->flags & GRUB_BIOSDISK_FLAG_LBA)
|
||||
{
|
||||
struct grub_biosdisk_dap *dap;
|
||||
|
||||
@@ -113,6 +113,11 @@ grub_nand_open (const char *name, grub_disk_t disk)
|
||||
}
|
||||
|
||||
data->block_size = (args.size1 >> GRUB_DISK_SECTOR_BITS);
|
||||
if (!data->block_size)
|
||||
{
|
||||
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "invalid block size");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 3);
|
||||
args.method = (grub_ieee1275_cell_t) "size";
|
||||
|
||||
@@ -1012,7 +1012,7 @@ grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors,
|
||||
usable for bootloaders (called generically
|
||||
"embedding zone") and this operation is
|
||||
called "embedding". */
|
||||
N_("your LDM embedding Partition is too small;"
|
||||
N_("your LDM Embedding Partition is too small;"
|
||||
" embedding won't be possible"));
|
||||
*nsectors = lv->size;
|
||||
if (*nsectors > max_nsectors)
|
||||
|
||||
+16
-3
@@ -143,6 +143,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid keysize %d",
|
||||
grub_be_to_cpu32 (header.keyBytes));
|
||||
grub_crypto_cipher_close (cipher);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -181,9 +182,10 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
}
|
||||
if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES)
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported XTS block size: %d",
|
||||
cipher->cipher->blocksize);
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_crypto_cipher_close (secondary_cipher);
|
||||
return NULL;
|
||||
}
|
||||
if (secondary_cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES)
|
||||
@@ -191,6 +193,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported XTS block size: %d",
|
||||
secondary_cipher->cipher->blocksize);
|
||||
grub_crypto_cipher_close (secondary_cipher);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -200,9 +203,9 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
cipheriv = ciphermode + sizeof ("lrw-") - 1;
|
||||
if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES)
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported LRW block size: %d",
|
||||
cipher->cipher->blocksize);
|
||||
grub_crypto_cipher_close (cipher);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -225,6 +228,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
|| cipher->cipher->blocksize == 0)
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported benbi blocksize: %d",
|
||||
cipher->cipher->blocksize);
|
||||
/* FIXME should we return an error here? */
|
||||
for (benbi_log = 0;
|
||||
(cipher->cipher->blocksize << benbi_log) < GRUB_DISK_SECTOR_SIZE;
|
||||
benbi_log++);
|
||||
@@ -243,6 +247,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
if (!essiv_hash)
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_crypto_cipher_close (secondary_cipher);
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND,
|
||||
"Couldn't load %s hash", hash_str);
|
||||
return NULL;
|
||||
@@ -251,12 +256,14 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
if (!essiv_cipher)
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_crypto_cipher_close (secondary_cipher);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_crypto_cipher_close (secondary_cipher);
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown IV mode: %s",
|
||||
cipheriv);
|
||||
return NULL;
|
||||
@@ -276,7 +283,12 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
|
||||
newdev = grub_zalloc (sizeof (struct grub_cryptodisk));
|
||||
if (!newdev)
|
||||
return NULL;
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_crypto_cipher_close (essiv_cipher);
|
||||
grub_crypto_cipher_close (secondary_cipher);
|
||||
return NULL;
|
||||
}
|
||||
newdev->cipher = cipher;
|
||||
newdev->offset = grub_be_to_cpu32 (header.payloadOffset);
|
||||
newdev->source_disk = NULL;
|
||||
@@ -451,6 +463,7 @@ luks_recover_key (grub_disk_t source,
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_free (split_key);
|
||||
return GRUB_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
|
||||
@@ -333,10 +333,10 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
}
|
||||
}
|
||||
|
||||
p = grub_strstr (p, "logical_volumes");
|
||||
p = grub_strstr (p, "logical_volumes {");
|
||||
if (p)
|
||||
{
|
||||
p += sizeof ("logical_volumes = ") - 1;
|
||||
p += sizeof ("logical_volumes {") - 1;
|
||||
|
||||
/* And add all the lvs to the volume group. */
|
||||
while (1)
|
||||
|
||||
@@ -33,16 +33,16 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
#define grub_md_to_cpu64 grub_be_to_cpu64
|
||||
#define grub_md_to_cpu32 grub_be_to_cpu32
|
||||
#define grub_md_to_cpu16 grub_be_to_cpu16
|
||||
#define grub_cpu_to_md64_compile_time grub_cpu_to_be64
|
||||
#define grub_cpu_to_md32_compile_time grub_cpu_to_be32
|
||||
#define grub_cpu_to_md16_compile_time grub_cpu_to_be16
|
||||
#define grub_cpu_to_md64_compile_time grub_cpu_to_be64_compile_time
|
||||
#define grub_cpu_to_md32_compile_time grub_cpu_to_be32_compile_time
|
||||
#define grub_cpu_to_md16_compile_time grub_cpu_to_be16_compile_time
|
||||
#else
|
||||
#define grub_md_to_cpu64 grub_le_to_cpu64
|
||||
#define grub_md_to_cpu32 grub_le_to_cpu32
|
||||
#define grub_md_to_cpu16 grub_le_to_cpu16
|
||||
#define grub_cpu_to_md64_compile_time grub_cpu_to_le64
|
||||
#define grub_cpu_to_md32_compile_time grub_cpu_to_le32
|
||||
#define grub_cpu_to_md16_compile_time grub_cpu_to_le16
|
||||
#define grub_cpu_to_md64_compile_time grub_cpu_to_le64_compile_time
|
||||
#define grub_cpu_to_md32_compile_time grub_cpu_to_le32_compile_time
|
||||
#define grub_cpu_to_md16_compile_time grub_cpu_to_le16_compile_time
|
||||
#endif
|
||||
|
||||
#define RESERVED_BYTES (64 * 1024)
|
||||
|
||||
@@ -201,7 +201,7 @@ grub_scsi_read_capacity16 (grub_scsi_t scsi)
|
||||
rc.opcode = grub_scsi_cmd_read_capacity16;
|
||||
rc.lun = (scsi->lun << GRUB_SCSI_LUN_SHIFT) | 0x10;
|
||||
rc.logical_block_addr = 0;
|
||||
rc.alloc_len = grub_cpu_to_be32 (sizeof (rcd));
|
||||
rc.alloc_len = grub_cpu_to_be32_compile_time (sizeof (rcd));
|
||||
rc.PMI = 0;
|
||||
rc.control = 0;
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ grub_usbms_transfer_bo (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
||||
|
||||
/* Setup the request. */
|
||||
grub_memset (&cbw, 0, sizeof (cbw));
|
||||
cbw.signature = grub_cpu_to_le32 (0x43425355);
|
||||
cbw.signature = grub_cpu_to_le32_compile_time (0x43425355);
|
||||
cbw.tag = tag;
|
||||
cbw.transfer_length = grub_cpu_to_le32 (size);
|
||||
cbw.flags = (!read_write) << GRUB_USBMS_DIRECTION_BIT;
|
||||
@@ -414,7 +414,7 @@ CheckCSW:
|
||||
|
||||
/* If phase error or not valid signature, do bulk-only reset device. */
|
||||
if ((status.status == 2) ||
|
||||
(status.signature != grub_cpu_to_le32(0x53425355)))
|
||||
(status.signature != grub_cpu_to_le32_compile_time(0x53425355)))
|
||||
{ /* Bulk-only reset device. */
|
||||
grub_dprintf ("usb", "Bulk-only reset device - bad status\n");
|
||||
grub_usbms_reset (dev);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <grub/err.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/efiemu/efiemu.h>
|
||||
#include <grub/crypto.h>
|
||||
|
||||
|
||||
+23
-16
@@ -680,6 +680,8 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
||||
grub_uint64_t stripen;
|
||||
grub_uint64_t stripe_offset;
|
||||
grub_uint64_t off = addr - grub_le_to_cpu64 (key->offset);
|
||||
grub_uint64_t chunk_stripe_length;
|
||||
grub_uint16_t nstripes;
|
||||
unsigned redundancy = 1;
|
||||
unsigned i, j;
|
||||
|
||||
@@ -690,15 +692,17 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
||||
"couldn't find the chunk descriptor");
|
||||
}
|
||||
|
||||
nstripes = grub_le_to_cpu16 (chunk->nstripes) ? : 1;
|
||||
chunk_stripe_length = grub_le_to_cpu64 (chunk->stripe_length) ? : 512;
|
||||
grub_dprintf ("btrfs", "chunk 0x%" PRIxGRUB_UINT64_T
|
||||
"+0x%" PRIxGRUB_UINT64_T
|
||||
" (%d stripes (%d substripes) of %"
|
||||
PRIxGRUB_UINT64_T ")\n",
|
||||
grub_le_to_cpu64 (key->offset),
|
||||
grub_le_to_cpu64 (chunk->size),
|
||||
grub_le_to_cpu16 (chunk->nstripes),
|
||||
nstripes,
|
||||
grub_le_to_cpu16 (chunk->nsubstripes),
|
||||
grub_le_to_cpu64 (chunk->stripe_length));
|
||||
chunk_stripe_length);
|
||||
|
||||
switch (grub_le_to_cpu64 (chunk->type)
|
||||
& ~GRUB_BTRFS_CHUNK_TYPE_BITS_DONTCARE)
|
||||
@@ -708,8 +712,10 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
||||
grub_uint64_t stripe_length;
|
||||
grub_dprintf ("btrfs", "single\n");
|
||||
stripe_length = grub_divmod64 (grub_le_to_cpu64 (chunk->size),
|
||||
grub_le_to_cpu16 (chunk->nstripes),
|
||||
nstripes,
|
||||
NULL);
|
||||
if (stripe_length == 0)
|
||||
stripe_length = 512;
|
||||
stripen = grub_divmod64 (off, stripe_length, &stripe_offset);
|
||||
csize = (stripen + 1) * stripe_length - off;
|
||||
break;
|
||||
@@ -730,33 +736,34 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
||||
grub_uint64_t low;
|
||||
grub_dprintf ("btrfs", "RAID0\n");
|
||||
middle = grub_divmod64 (off,
|
||||
grub_le_to_cpu64 (chunk->stripe_length),
|
||||
chunk_stripe_length,
|
||||
&low);
|
||||
|
||||
high = grub_divmod64 (middle, grub_le_to_cpu16 (chunk->nstripes),
|
||||
high = grub_divmod64 (middle, nstripes,
|
||||
&stripen);
|
||||
stripe_offset =
|
||||
low + grub_le_to_cpu64 (chunk->stripe_length) * high;
|
||||
csize = grub_le_to_cpu64 (chunk->stripe_length) - low;
|
||||
low + chunk_stripe_length * high;
|
||||
csize = chunk_stripe_length - low;
|
||||
break;
|
||||
}
|
||||
case GRUB_BTRFS_CHUNK_TYPE_RAID10:
|
||||
{
|
||||
grub_uint64_t middle, high;
|
||||
grub_uint64_t low;
|
||||
grub_uint16_t nsubstripes;
|
||||
nsubstripes = grub_le_to_cpu16 (chunk->nsubstripes) ? : 1;
|
||||
middle = grub_divmod64 (off,
|
||||
grub_le_to_cpu64 (chunk->stripe_length),
|
||||
chunk_stripe_length,
|
||||
&low);
|
||||
|
||||
high = grub_divmod64 (middle,
|
||||
grub_le_to_cpu16 (chunk->nstripes)
|
||||
/ grub_le_to_cpu16 (chunk->nsubstripes),
|
||||
nstripes / nsubstripes ? : 1,
|
||||
&stripen);
|
||||
stripen *= grub_le_to_cpu16 (chunk->nsubstripes);
|
||||
redundancy = grub_le_to_cpu16 (chunk->nsubstripes);
|
||||
stripe_offset = low + grub_le_to_cpu64 (chunk->stripe_length)
|
||||
stripen *= nsubstripes;
|
||||
redundancy = nsubstripes;
|
||||
stripe_offset = low + chunk_stripe_length
|
||||
* high;
|
||||
csize = grub_le_to_cpu64 (chunk->stripe_length) - low;
|
||||
csize = chunk_stripe_length - low;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -1051,7 +1058,7 @@ grub_btrfs_extent_read (struct grub_btrfs_data *data,
|
||||
|
||||
data->extend = data->extstart + grub_le_to_cpu64 (data->extent->size);
|
||||
if (data->extent->type == GRUB_BTRFS_EXTENT_REGULAR
|
||||
&& (char *) &data->extent + elemsize
|
||||
&& (char *) data->extent + elemsize
|
||||
>= (char *) &data->extent->filled + sizeof (data->extent->filled))
|
||||
data->extend =
|
||||
data->extstart + grub_le_to_cpu64 (data->extent->filled);
|
||||
@@ -1201,7 +1208,7 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key,
|
||||
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.object_id = grub_cpu_to_le64_compile_time (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,
|
||||
|
||||
@@ -149,6 +149,9 @@ grub_cbfs_mount (grub_disk_t disk)
|
||||
grub_off_t header_off;
|
||||
struct cbfs_header head;
|
||||
|
||||
if (grub_disk_get_size (disk) == GRUB_DISK_SIZE_UNKNOWN)
|
||||
goto fail;
|
||||
|
||||
if (grub_disk_read (disk, grub_disk_get_size (disk) - 1,
|
||||
GRUB_DISK_SECTOR_SIZE - sizeof (ptr),
|
||||
sizeof (ptr), &ptr))
|
||||
|
||||
+10
-1
@@ -484,6 +484,10 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
||||
|
||||
indirect:
|
||||
do {
|
||||
/* If the indirect block is zero, all child blocks are absent
|
||||
(i.e. filled with zeros.) */
|
||||
if (indir == 0)
|
||||
return 0;
|
||||
if (grub_disk_read (data->disk,
|
||||
((grub_disk_addr_t) grub_le_to_cpu32 (indir))
|
||||
<< log2_blksz,
|
||||
@@ -573,7 +577,12 @@ grub_ext2_mount (grub_disk_t disk)
|
||||
|
||||
/* Make sure this is an ext2 filesystem. */
|
||||
if (data->sblock.magic != grub_cpu_to_le16_compile_time (EXT2_MAGIC)
|
||||
|| grub_le_to_cpu32 (data->sblock.log2_block_size) >= 16)
|
||||
|| grub_le_to_cpu32 (data->sblock.log2_block_size) >= 16
|
||||
|| data->sblock.inodes_per_group == 0
|
||||
/* 20 already means 1GiB blocks. We don't want to deal with blocks overflowing int32. */
|
||||
|| grub_le_to_cpu32 (data->sblock.log2_block_size) > 20
|
||||
|| EXT2_INODE_SIZE (data) == 0
|
||||
|| EXT2_BLOCK_SIZE (data) / EXT2_INODE_SIZE (data) == 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem");
|
||||
goto fail;
|
||||
|
||||
@@ -252,6 +252,13 @@ grub_fshelp_read_file (grub_disk_t disk, grub_fshelp_node_t node,
|
||||
grub_disk_addr_t i, blockcnt;
|
||||
int blocksize = 1 << (log2blocksize + GRUB_DISK_SECTOR_BITS);
|
||||
|
||||
if (pos > filesize)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read past the end of file"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Adjust LEN so it we can't read past the end of the file. */
|
||||
if (pos + len > filesize)
|
||||
len = filesize - pos;
|
||||
|
||||
+7
-1
@@ -330,6 +330,7 @@ grub_hfs_mount (grub_disk_t disk)
|
||||
|
||||
/* Check if this is a HFS filesystem. */
|
||||
if (grub_be_to_cpu16 (data->sblock.magic) != GRUB_HFS_MAGIC
|
||||
|| data->sblock.blksz == 0
|
||||
|| (data->sblock.blksz & grub_cpu_to_be32_compile_time (0xc00001ff)))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "not an HFS filesystem");
|
||||
@@ -367,9 +368,14 @@ grub_hfs_mount (grub_disk_t disk)
|
||||
data->cat_root = grub_be_to_cpu32 (treehead.head.root_node);
|
||||
data->cat_size = grub_be_to_cpu16 (treehead.head.node_size);
|
||||
|
||||
if (data->cat_size == 0
|
||||
|| data->blksz < data->cat_size
|
||||
|| data->blksz < data->ext_size)
|
||||
goto fail;
|
||||
|
||||
/* Lookup the root directory node in the catalog tree using the
|
||||
volume name. */
|
||||
key.parent_dir = grub_cpu_to_be32 (1);
|
||||
key.parent_dir = grub_cpu_to_be32_compile_time (1);
|
||||
key.strlen = data->sblock.volname[0];
|
||||
grub_strcpy ((char *) key.str, (char *) (data->sblock.volname + 1));
|
||||
|
||||
|
||||
+25
-16
@@ -65,7 +65,6 @@ typedef grub_uint16_t grub_minix_uintn_t;
|
||||
#define grub_minix_to_cpu_n grub_minix_to_cpu16
|
||||
#endif
|
||||
|
||||
#define GRUB_MINIX_INODE_BLKSZ(data) sizeof (grub_minix_uintn_t)
|
||||
#ifdef MODE_MINIX3
|
||||
typedef grub_uint32_t grub_minix_ino_t;
|
||||
#define grub_minix_to_cpu_ino grub_minix_to_cpu32
|
||||
@@ -87,8 +86,6 @@ typedef grub_uint16_t grub_minix_ino_t;
|
||||
#define GRUB_MINIX_LOG2_ZONESZ (GRUB_MINIX_LOG2_BSIZE \
|
||||
+ grub_minix_to_cpu16 (data->sblock.log2_zone_size))
|
||||
#endif
|
||||
#define GRUB_MINIX_ZONESZ ((grub_uint64_t) data->block_size << \
|
||||
(GRUB_DISK_SECTOR_BITS + grub_minix_to_cpu16 (data->sblock.log2_zone_size)))
|
||||
|
||||
#ifdef MODE_MINIX3
|
||||
#define GRUB_MINIX_ZONE2SECT(zone) ((zone) * data->block_size)
|
||||
@@ -172,6 +169,7 @@ struct grub_minix_data
|
||||
{
|
||||
struct grub_minix_sblock sblock;
|
||||
struct grub_minix_inode inode;
|
||||
grub_uint32_t block_per_zone;
|
||||
grub_minix_ino_t ino;
|
||||
int linknest;
|
||||
grub_disk_t disk;
|
||||
@@ -202,8 +200,6 @@ static grub_minix_uintn_t
|
||||
grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
|
||||
{
|
||||
grub_minix_uintn_t indir;
|
||||
const grub_uint32_t block_per_zone = (GRUB_MINIX_ZONESZ
|
||||
/ GRUB_MINIX_INODE_BLKSZ (data));
|
||||
|
||||
/* Direct block. */
|
||||
if (blk < GRUB_MINIX_INODE_DIR_BLOCKS)
|
||||
@@ -211,33 +207,33 @@ grub_minix_get_file_block (struct grub_minix_data *data, unsigned int blk)
|
||||
|
||||
/* Indirect block. */
|
||||
blk -= GRUB_MINIX_INODE_DIR_BLOCKS;
|
||||
if (blk < block_per_zone)
|
||||
if (blk < data->block_per_zone)
|
||||
{
|
||||
indir = grub_get_indir (data, GRUB_MINIX_INODE_INDIR_ZONE (data), blk);
|
||||
return indir;
|
||||
}
|
||||
|
||||
/* Double indirect block. */
|
||||
blk -= block_per_zone;
|
||||
if (blk < block_per_zone * block_per_zone)
|
||||
blk -= data->block_per_zone;
|
||||
if (blk < (grub_uint64_t) data->block_per_zone * (grub_uint64_t) data->block_per_zone)
|
||||
{
|
||||
indir = grub_get_indir (data, GRUB_MINIX_INODE_DINDIR_ZONE (data),
|
||||
blk / block_per_zone);
|
||||
blk / data->block_per_zone);
|
||||
|
||||
indir = grub_get_indir (data, indir, blk % block_per_zone);
|
||||
indir = grub_get_indir (data, indir, blk % data->block_per_zone);
|
||||
|
||||
return indir;
|
||||
}
|
||||
|
||||
#if defined (MODE_MINIX3) || defined (MODE_MINIX2)
|
||||
blk -= block_per_zone * block_per_zone;
|
||||
if (blk < ((grub_uint64_t) block_per_zone * (grub_uint64_t) block_per_zone
|
||||
* (grub_uint64_t) block_per_zone))
|
||||
blk -= data->block_per_zone * data->block_per_zone;
|
||||
if (blk < ((grub_uint64_t) data->block_per_zone * (grub_uint64_t) data->block_per_zone
|
||||
* (grub_uint64_t) data->block_per_zone))
|
||||
{
|
||||
indir = grub_get_indir (data, grub_minix_to_cpu_n (data->inode.triple_indir_zone),
|
||||
(blk / block_per_zone) / block_per_zone);
|
||||
indir = grub_get_indir (data, indir, (blk / block_per_zone) % block_per_zone);
|
||||
indir = grub_get_indir (data, indir, blk % block_per_zone);
|
||||
(blk / data->block_per_zone) / data->block_per_zone);
|
||||
indir = grub_get_indir (data, indir, (blk / data->block_per_zone) % data->block_per_zone);
|
||||
indir = grub_get_indir (data, indir, blk % data->block_per_zone);
|
||||
|
||||
return indir;
|
||||
}
|
||||
@@ -262,6 +258,13 @@ grub_minix_read_file (struct grub_minix_data *data,
|
||||
grub_uint32_t posblock;
|
||||
grub_uint32_t blockoff;
|
||||
|
||||
if (pos > GRUB_MINIX_INODE_SIZE (data))
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read past the end of file"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Adjust len so it we can't read past the end of the file. */
|
||||
if (len + pos > GRUB_MINIX_INODE_SIZE (data))
|
||||
len = GRUB_MINIX_INODE_SIZE (data) - pos;
|
||||
@@ -508,6 +511,12 @@ grub_minix_mount (grub_disk_t disk)
|
||||
data->block_size = 2;
|
||||
#endif
|
||||
|
||||
data->block_per_zone = (((grub_uint64_t) data->block_size << \
|
||||
(GRUB_DISK_SECTOR_BITS + grub_minix_to_cpu16 (data->sblock.log2_zone_size)))
|
||||
/ sizeof (grub_minix_uintn_t));
|
||||
if (!data->block_per_zone)
|
||||
goto fail;
|
||||
|
||||
return data;
|
||||
|
||||
fail:
|
||||
|
||||
@@ -724,6 +724,10 @@ grub_nilfs2_valid_sb (struct grub_nilfs2_super_block *sbp)
|
||||
if (grub_le_to_cpu32 (sbp->s_rev_level) != NILFS_SUPORT_REV)
|
||||
return 0;
|
||||
|
||||
/* 20 already means 1GiB blocks. We don't want to deal with blocks overflowing int32. */
|
||||
if (grub_le_to_cpu32 (sbp->s_log_block_size) > 20)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ grub_reiserfs_set_key_offset (struct grub_reiserfs_key *key,
|
||||
key->u.v1.offset = grub_cpu_to_le32 (value);
|
||||
else
|
||||
key->u.v2.offset_type \
|
||||
= ((key->u.v2.offset_type & grub_cpu_to_le64 (15ULL << 60))
|
||||
= ((key->u.v2.offset_type & grub_cpu_to_le64_compile_time (15ULL << 60))
|
||||
| grub_cpu_to_le64 (value & (~0ULL >> 4)));
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ grub_reiserfs_set_key_type (struct grub_reiserfs_key *key,
|
||||
key->u.v1.type = grub_cpu_to_le32 (type);
|
||||
else
|
||||
key->u.v2.offset_type
|
||||
= ((key->u.v2.offset_type & grub_cpu_to_le64 (~0ULL >> 4))
|
||||
= ((key->u.v2.offset_type & grub_cpu_to_le64_compile_time (~0ULL >> 4))
|
||||
| grub_cpu_to_le64 ((grub_uint64_t) type << 60));
|
||||
|
||||
assert (grub_reiserfs_get_key_type (key) == grub_type);
|
||||
@@ -997,8 +997,8 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
|
||||
data = grub_reiserfs_mount (file->device->disk);
|
||||
if (! data)
|
||||
goto fail;
|
||||
key.directory_id = grub_cpu_to_le32 (1);
|
||||
key.object_id = grub_cpu_to_le32 (2);
|
||||
key.directory_id = grub_cpu_to_le32_compile_time (1);
|
||||
key.object_id = grub_cpu_to_le32_compile_time (2);
|
||||
key.u.v2.offset_type = 0;
|
||||
grub_reiserfs_set_key_type (&key, GRUB_REISERFS_DIRECTORY, 2);
|
||||
grub_reiserfs_set_key_offset (&key, 1);
|
||||
@@ -1289,8 +1289,8 @@ grub_reiserfs_dir (grub_device_t device, const char *path,
|
||||
data = grub_reiserfs_mount (device->disk);
|
||||
if (! data)
|
||||
goto fail;
|
||||
root_key.directory_id = grub_cpu_to_le32 (1);
|
||||
root_key.object_id = grub_cpu_to_le32 (2);
|
||||
root_key.directory_id = grub_cpu_to_le32_compile_time (1);
|
||||
root_key.object_id = grub_cpu_to_le32_compile_time (2);
|
||||
root_key.u.v2.offset_type = 0;
|
||||
grub_reiserfs_set_key_type (&root_key, GRUB_REISERFS_DIRECTORY, 2);
|
||||
grub_reiserfs_set_key_offset (&root_key, 1);
|
||||
|
||||
+2
-1
@@ -604,7 +604,8 @@ grub_ufs_mount (grub_disk_t disk)
|
||||
endiannesses. */
|
||||
if (data->sblock.magic == grub_cpu_to_ufs32_compile_time (GRUB_UFS_MAGIC)
|
||||
&& data->sblock.bsize != 0
|
||||
&& ((data->sblock.bsize & (data->sblock.bsize - 1)) == 0))
|
||||
&& ((data->sblock.bsize & (data->sblock.bsize - 1)) == 0)
|
||||
&& data->sblock.ino_per_group != 0)
|
||||
{
|
||||
for (data->log2_blksz = 0;
|
||||
(1U << data->log2_blksz) < grub_ufs_to_cpu32 (data->sblock.bsize);
|
||||
|
||||
@@ -1501,6 +1501,9 @@ read_device (grub_uint64_t offset, struct grub_zfs_device_desc *desc,
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"raidz%d is not supported", desc->nparity);
|
||||
|
||||
if (desc->n_children <= desc->nparity || desc->n_children < 1)
|
||||
return grub_error(GRUB_ERR_BAD_FS, "too little devices for given parity");
|
||||
|
||||
orig_s = (((len + (1 << desc->ashift) - 1) >> desc->ashift)
|
||||
+ (desc->n_children - desc->nparity) - 1);
|
||||
s = orig_s;
|
||||
@@ -2804,6 +2807,9 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
|
||||
dnode_path->dn.endian)
|
||||
<< SPA_MINBLOCKSHIFT);
|
||||
|
||||
if (blksz == 0)
|
||||
return grub_error(GRUB_ERR_BAD_FS, "0-sized block");
|
||||
|
||||
sym_value = grub_malloc (sym_sz);
|
||||
if (!sym_value)
|
||||
return grub_errno;
|
||||
@@ -3798,6 +3804,12 @@ grub_zfs_read (grub_file_t file, char *buf, grub_size_t len)
|
||||
blksz = grub_zfs_to_cpu16 (data->dnode.dn.dn_datablkszsec,
|
||||
data->dnode.endian) << SPA_MINBLOCKSHIFT;
|
||||
|
||||
if (blksz == 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "0-sized block");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Entire Dnode is too big to fit into the space available. We
|
||||
* will need to read it in chunks. This could be optimized to
|
||||
|
||||
@@ -130,10 +130,12 @@ print_vdev_info (char *nvlist, int tab)
|
||||
grub_free (bootpath);
|
||||
grub_free (devid);
|
||||
grub_free (path);
|
||||
grub_free (type);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
char is_mirror=(grub_strcmp(type,VDEV_TYPE_MIRROR) == 0);
|
||||
char is_raidz=(grub_strcmp(type,VDEV_TYPE_RAIDZ) == 0);
|
||||
grub_free (type);
|
||||
|
||||
if (is_mirror || is_raidz)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ EOF
|
||||
read mods
|
||||
for line in $mods; do
|
||||
if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
|
||||
echo "grub_${line}_init ();" | sed 's,\.mod,,g;'
|
||||
echo "grub_${line%%.*}_init ();"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -63,7 +63,7 @@ EOF
|
||||
|
||||
for line in $mods; do
|
||||
if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
|
||||
echo "grub_${line}_fini ();" | sed 's,\.mod,,g;'
|
||||
echo "grub_${line%%.*}_fini ();"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ EOF
|
||||
read mods
|
||||
for line in $mods; do
|
||||
if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
|
||||
echo "void grub_${line}_init (void);" | sed 's,\.mod,,g;'
|
||||
echo "void grub_${line%%.*}_init (void);"
|
||||
fi
|
||||
if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
|
||||
echo "void grub_${line}_fini (void);" | sed 's,\.mod,,g;'
|
||||
echo "void grub_${line%%.*}_fini (void);"
|
||||
fi
|
||||
done
|
||||
@@ -138,51 +138,53 @@ circprog_paint (void *vself, const grub_video_rect_t *region)
|
||||
(height - center_height) / 2, 0, 0,
|
||||
center_width, center_height);
|
||||
|
||||
int radius = grub_min (height, width) / 2 - grub_max (tick_height, tick_width) / 2 - 1;
|
||||
unsigned nticks;
|
||||
unsigned tick_begin;
|
||||
unsigned tick_end;
|
||||
if (self->end <= self->start
|
||||
|| self->value <= self->start)
|
||||
nticks = 0;
|
||||
else
|
||||
nticks = ((unsigned) (self->num_ticks
|
||||
* (self->value - self->start)))
|
||||
/ ((unsigned) (self->end - self->start));
|
||||
/* Do ticks appear or disappear as the value approached the end? */
|
||||
if (self->ticks_disappear)
|
||||
if (self->num_ticks)
|
||||
{
|
||||
tick_begin = nticks;
|
||||
tick_end = self->num_ticks;
|
||||
int radius = grub_min (height, width) / 2 - grub_max (tick_height, tick_width) / 2 - 1;
|
||||
unsigned nticks;
|
||||
unsigned tick_begin;
|
||||
unsigned tick_end;
|
||||
if (self->end <= self->start
|
||||
|| self->value <= self->start)
|
||||
nticks = 0;
|
||||
else
|
||||
nticks = ((unsigned) (self->num_ticks
|
||||
* (self->value - self->start)))
|
||||
/ ((unsigned) (self->end - self->start));
|
||||
/* Do ticks appear or disappear as the value approached the end? */
|
||||
if (self->ticks_disappear)
|
||||
{
|
||||
tick_begin = nticks;
|
||||
tick_end = self->num_ticks;
|
||||
}
|
||||
else
|
||||
{
|
||||
tick_begin = 0;
|
||||
tick_end = nticks;
|
||||
}
|
||||
|
||||
unsigned i;
|
||||
for (i = tick_begin; i < tick_end; i++)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int angle;
|
||||
|
||||
/* Calculate the location of the tick. */
|
||||
angle = self->start_angle
|
||||
+ i * GRUB_TRIG_ANGLE_MAX / self->num_ticks;
|
||||
x = width / 2 + (grub_cos (angle) * radius / GRUB_TRIG_FRACTION_SCALE);
|
||||
y = height / 2 + (grub_sin (angle) * radius / GRUB_TRIG_FRACTION_SCALE);
|
||||
|
||||
/* Adjust (x,y) so the tick is centered. */
|
||||
x -= tick_width / 2;
|
||||
y -= tick_height / 2;
|
||||
|
||||
/* Draw the tick. */
|
||||
grub_video_blit_bitmap (self->tick_bitmap, GRUB_VIDEO_BLIT_BLEND,
|
||||
x, y, 0, 0, tick_width, tick_height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tick_begin = 0;
|
||||
tick_end = nticks;
|
||||
}
|
||||
|
||||
unsigned i;
|
||||
for (i = tick_begin; i < tick_end; i++)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int angle;
|
||||
|
||||
/* Calculate the location of the tick. */
|
||||
angle = self->start_angle
|
||||
+ i * GRUB_TRIG_ANGLE_MAX / self->num_ticks;
|
||||
x = width / 2 + (grub_cos (angle) * radius / GRUB_TRIG_FRACTION_SCALE);
|
||||
y = height / 2 + (grub_sin (angle) * radius / GRUB_TRIG_FRACTION_SCALE);
|
||||
|
||||
/* Adjust (x,y) so the tick is centered. */
|
||||
x -= tick_width / 2;
|
||||
y -= tick_height / 2;
|
||||
|
||||
/* Draw the tick. */
|
||||
grub_video_blit_bitmap (self->tick_bitmap, GRUB_VIDEO_BLIT_BLEND,
|
||||
x, y, 0, 0, tick_width, tick_height);
|
||||
}
|
||||
|
||||
grub_gui_restore_viewport (&vpsave);
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +131,9 @@ get_num_shown_items (list_impl_t self)
|
||||
int max_top_pad = grub_max (item_top_pad, sel_top_pad);
|
||||
int max_bottom_pad = grub_max (item_bottom_pad, sel_bottom_pad);
|
||||
|
||||
if (item_height + item_vspace <= 0)
|
||||
return 1;
|
||||
|
||||
return (self->bounds.height + item_vspace - 2 * boxpad
|
||||
- max_top_pad - max_bottom_pad
|
||||
- box_top_pad - box_bottom_pad) / (item_height + item_vspace);
|
||||
|
||||
@@ -118,9 +118,15 @@ draw_filled_rect_bar (grub_gui_progress_bar_t self)
|
||||
f.width + 2, f.height + 2);
|
||||
|
||||
/* Bar background. */
|
||||
int barwidth = (f.width
|
||||
* (self->value - self->start)
|
||||
/ (self->end - self->start));
|
||||
unsigned barwidth;
|
||||
|
||||
if (self->end <= self->start
|
||||
|| self->value <= self->start)
|
||||
barwidth = 0;
|
||||
else
|
||||
barwidth = (f.width
|
||||
* (self->value - self->start)
|
||||
/ (self->end - self->start));
|
||||
grub_video_fill_rect (grub_video_map_rgba_color (self->bg_color),
|
||||
f.x + barwidth, f.y,
|
||||
f.width - barwidth, f.height);
|
||||
|
||||
@@ -23,7 +23,7 @@ while (<>) {
|
||||
}
|
||||
|
||||
print " -s $2 $sections{$1}"
|
||||
if ($sections{$1} ne '0x0');
|
||||
if ($sections{$1} ne '0x0' and $sections{$1} ne '');
|
||||
};
|
||||
close (READELF);
|
||||
print "\n";
|
||||
|
||||
@@ -403,8 +403,6 @@ test_header (grub_file_t file)
|
||||
return 1;
|
||||
|
||||
CORRUPTED:
|
||||
grub_free(name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+12
-32
@@ -37,20 +37,16 @@
|
||||
* Simple cache maintenance functions
|
||||
*/
|
||||
|
||||
dlinesz_addr:
|
||||
.long EXT_C(grub_arch_cache_dlinesz)
|
||||
ilinesz_addr:
|
||||
.long EXT_C(grub_arch_cache_ilinesz)
|
||||
|
||||
@ r0 - *beg (inclusive)
|
||||
@ r1 - *end (exclusive)
|
||||
clean_dcache_range:
|
||||
@void grub_arm_clean_dcache_range (grub_addr_t start, grub_addr_t end, grub_addr_t dlinesz)
|
||||
#ifdef ARMV6
|
||||
FUNCTION(grub_arm_clean_dcache_range_armv6)
|
||||
#else
|
||||
FUNCTION(grub_arm_clean_dcache_range_armv7)
|
||||
#endif
|
||||
DSB
|
||||
@ Clean data cache for range to point-of-unification
|
||||
ldr r2, dlinesz_addr
|
||||
ldr r2, [r2]
|
||||
sub r3, r2, #1 @ align "beg" to start of line
|
||||
mvn r3, r3
|
||||
and r0, r0, r3
|
||||
1: cmp r0, r1
|
||||
bge 2f
|
||||
#ifdef ARMV6
|
||||
@@ -65,13 +61,12 @@ clean_dcache_range:
|
||||
|
||||
@ r0 - *beg (inclusive)
|
||||
@ r1 - *end (exclusive)
|
||||
invalidate_icache_range:
|
||||
#ifdef ARMV6
|
||||
FUNCTION(grub_arm_invalidate_icache_range_armv6)
|
||||
#else
|
||||
FUNCTION(grub_arm_invalidate_icache_range_armv7)
|
||||
#endif
|
||||
@ Invalidate instruction cache for range to point-of-unification
|
||||
ldr r2, ilinesz_addr
|
||||
ldr r2, [r2]
|
||||
sub r3, r2, #1 @ align "beg" to start of line
|
||||
mvn r3, r3
|
||||
and r0, r0, r3
|
||||
1: cmp r0, r1
|
||||
bge 2f
|
||||
mcr p15, 0, r0, c7, c5, 1 @ ICIMVAU
|
||||
@@ -83,21 +78,6 @@ invalidate_icache_range:
|
||||
ISB
|
||||
bx lr
|
||||
|
||||
@void grub_arch_sync_caches (void *address, grub_size_t len)
|
||||
#ifdef ARMV6
|
||||
FUNCTION(grub_arch_sync_caches_armv6)
|
||||
#else
|
||||
FUNCTION(grub_arch_sync_caches_armv7)
|
||||
#endif
|
||||
DSB
|
||||
add r1, r0, r1
|
||||
push {r0-r2, lr}
|
||||
bl clean_dcache_range
|
||||
pop {r0, r1}
|
||||
bl invalidate_icache_range
|
||||
pop {r2, lr}
|
||||
bx lr
|
||||
|
||||
#ifdef ARMV6
|
||||
FUNCTION(grub_arm_disable_caches_mmu_armv6)
|
||||
#else
|
||||
|
||||
+152
-9
@@ -1,6 +1,11 @@
|
||||
#include <grub/dl.h>
|
||||
#include <grub/cache.h>
|
||||
#include <grub/arm/system.h>
|
||||
#ifdef GRUB_MACHINE_UBOOT
|
||||
#include <grub/uboot/uboot.h>
|
||||
#include <grub/uboot/api_public.h>
|
||||
#include <grub/mm.h>
|
||||
#endif
|
||||
|
||||
/* This is only about cache architecture. It doesn't imply
|
||||
the CPU architecture. */
|
||||
@@ -13,12 +18,21 @@ static enum
|
||||
ARCH_ARMV7
|
||||
} type = ARCH_UNKNOWN;
|
||||
|
||||
grub_uint32_t grub_arch_cache_dlinesz;
|
||||
grub_uint32_t grub_arch_cache_ilinesz;
|
||||
static int is_v6_mmu;
|
||||
|
||||
static grub_uint32_t grub_arch_cache_dlinesz;
|
||||
static grub_uint32_t grub_arch_cache_ilinesz;
|
||||
static grub_uint32_t grub_arch_cache_max_linesz;
|
||||
|
||||
/* Prototypes for asm functions. */
|
||||
void grub_arch_sync_caches_armv6 (void *address, grub_size_t len);
|
||||
void grub_arch_sync_caches_armv7 (void *address, grub_size_t len);
|
||||
void grub_arm_clean_dcache_range_armv6 (grub_addr_t start, grub_addr_t end,
|
||||
grub_addr_t dlinesz);
|
||||
void grub_arm_clean_dcache_range_armv7 (grub_addr_t start, grub_addr_t end,
|
||||
grub_addr_t dlinesz);
|
||||
void grub_arm_invalidate_icache_range_armv6 (grub_addr_t start, grub_addr_t end,
|
||||
grub_addr_t dlinesz);
|
||||
void grub_arm_invalidate_icache_range_armv7 (grub_addr_t start, grub_addr_t end,
|
||||
grub_addr_t dlinesz);
|
||||
void grub_arm_disable_caches_mmu_armv6 (void);
|
||||
void grub_arm_disable_caches_mmu_armv7 (void);
|
||||
grub_uint32_t grub_arm_main_id (void);
|
||||
@@ -38,8 +52,11 @@ probe_caches (void)
|
||||
case 0x4:
|
||||
case 0x5:
|
||||
case 0x6:
|
||||
is_v6_mmu = 0;
|
||||
break;
|
||||
case 0x7:
|
||||
case 0xf:
|
||||
is_v6_mmu = 1;
|
||||
break;
|
||||
default:
|
||||
grub_fatal ("Unsupported ARM ID 0x%x", main_id);
|
||||
@@ -82,20 +99,148 @@ probe_caches (void)
|
||||
default:
|
||||
grub_fatal ("Unsupported cache type 0x%x", cache_type);
|
||||
}
|
||||
if (grub_arch_cache_dlinesz > grub_arch_cache_ilinesz)
|
||||
grub_arch_cache_max_linesz = grub_arch_cache_dlinesz;
|
||||
else
|
||||
grub_arch_cache_max_linesz = grub_arch_cache_ilinesz;
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_UBOOT
|
||||
|
||||
static void subdivide (grub_uint32_t *table, grub_uint32_t *subtable,
|
||||
grub_uint32_t addr)
|
||||
{
|
||||
grub_uint32_t j;
|
||||
addr = addr >> 20 << 20;
|
||||
table[addr >> 20] = (grub_addr_t) subtable | 1;
|
||||
for (j = 0; j < 256; j++)
|
||||
subtable[j] = addr | (j << 12)
|
||||
| (3 << 4) | (3 << 6) | (3 << 8) | (3 << 10)
|
||||
| (0 << 3) | (1 << 2) | 2;
|
||||
}
|
||||
|
||||
void
|
||||
grub_arm_enable_caches_mmu (void)
|
||||
{
|
||||
grub_uint32_t *table;
|
||||
grub_uint32_t i;
|
||||
grub_uint32_t border_crossing = 0;
|
||||
grub_uint32_t *subtable;
|
||||
struct sys_info *si = grub_uboot_get_sys_info ();
|
||||
|
||||
if (!si || (si->mr_no == 0))
|
||||
{
|
||||
grub_printf ("couldn't get memory map, not enabling caches");
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == ARCH_UNKNOWN)
|
||||
probe_caches ();
|
||||
|
||||
for (i = 0; (signed) i < si->mr_no; i++)
|
||||
{
|
||||
if (si->mr[i].start & ((1 << 20) - 1))
|
||||
border_crossing++;
|
||||
if ((si->mr[i].start + si->mr[i].size) & ((1 << 20) - 1))
|
||||
border_crossing++;
|
||||
}
|
||||
|
||||
grub_printf ("%d crossers\n", border_crossing);
|
||||
|
||||
table = grub_memalign (1 << 14, (1 << 14) + (border_crossing << 10));
|
||||
if (!table)
|
||||
{
|
||||
grub_printf ("couldn't allocate place for MMU table, not enabling caches");
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
subtable = table + (1 << 12);
|
||||
/* Map all unknown as device. */
|
||||
for (i = 0; i < (1 << 12); i++)
|
||||
table[i] = (i << 20) | (3 << 10) | (0 << 3) | (1 << 2) | 2;
|
||||
/*
|
||||
Device: TEX= 0, C=0, B=1
|
||||
normal: TEX= 0, C=1, B=1
|
||||
AP = 3
|
||||
IMP = 0
|
||||
Domain = 0
|
||||
*/
|
||||
|
||||
for (i = 0; (signed) i < si->mr_no; i++)
|
||||
{
|
||||
if (si->mr[i].start & ((1 << 20) - 1))
|
||||
{
|
||||
subdivide (table, subtable, si->mr[i].start);
|
||||
subtable += (1 << 8);
|
||||
}
|
||||
if ((si->mr[i].start + si->mr[i].size) & ((1 << 20) - 1))
|
||||
{
|
||||
subdivide (table, subtable, si->mr[i].start + si->mr[i].size);
|
||||
subtable += (1 << 8);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; (signed) i < si->mr_no; i++)
|
||||
if ((si->mr[i].flags & MR_ATTR_MASK) == MR_ATTR_DRAM
|
||||
|| (si->mr[i].flags & MR_ATTR_MASK) == MR_ATTR_SRAM
|
||||
|| (si->mr[i].flags & MR_ATTR_MASK) == MR_ATTR_FLASH)
|
||||
{
|
||||
grub_uint32_t cur, end;
|
||||
cur = si->mr[i].start;
|
||||
end = si->mr[i].start + si->mr[i].size;
|
||||
while (cur < end)
|
||||
{
|
||||
grub_uint32_t *st;
|
||||
if ((table[cur >> 20] & 3) == 2)
|
||||
{
|
||||
cur = cur >> 20 << 20;
|
||||
table[cur >> 20] = cur | (3 << 10) | (1 << 3) | (1 << 2) | 2;
|
||||
cur += (1 << 20);
|
||||
continue;
|
||||
}
|
||||
cur = cur >> 12 << 12;
|
||||
st = (grub_uint32_t *) (table[cur >> 20] & ~0x3ff);
|
||||
st[(cur >> 12) & 0xff] = cur | (3 << 4) | (3 << 6)
|
||||
| (3 << 8) | (3 << 10)
|
||||
| (1 << 3) | (1 << 2) | 2;
|
||||
cur += (1 << 12);
|
||||
}
|
||||
}
|
||||
|
||||
grub_printf ("MMU tables generated\n");
|
||||
if (is_v6_mmu)
|
||||
grub_arm_clear_mmu_v6 ();
|
||||
|
||||
grub_printf ("enabling MMU\n");
|
||||
grub_arm_enable_mmu (table);
|
||||
grub_printf ("MMU enabled\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
grub_arch_sync_caches (void *address, grub_size_t len)
|
||||
{
|
||||
grub_addr_t start = (grub_addr_t) address;
|
||||
grub_addr_t end = start + len;
|
||||
|
||||
if (type == ARCH_UNKNOWN)
|
||||
probe_caches ();
|
||||
start = ALIGN_DOWN (start, grub_arch_cache_max_linesz);
|
||||
end = ALIGN_UP (end, grub_arch_cache_max_linesz);
|
||||
switch (type)
|
||||
{
|
||||
case ARCH_ARMV6:
|
||||
grub_arch_sync_caches_armv6 (address, len);
|
||||
grub_arm_clean_dcache_range_armv6 (start, end, grub_arch_cache_dlinesz);
|
||||
grub_arm_invalidate_icache_range_armv6 (start, end,
|
||||
grub_arch_cache_ilinesz);
|
||||
break;
|
||||
case ARCH_ARMV7:
|
||||
grub_arch_sync_caches_armv7 (address, len);
|
||||
grub_arm_clean_dcache_range_armv7 (start, end, grub_arch_cache_dlinesz);
|
||||
grub_arm_invalidate_icache_range_armv7 (start, end,
|
||||
grub_arch_cache_ilinesz);
|
||||
break;
|
||||
/* Nothing to do. */
|
||||
case ARCH_ARMV5_WRITE_THROUGH:
|
||||
@@ -114,15 +259,13 @@ grub_arm_disable_caches_mmu (void)
|
||||
probe_caches ();
|
||||
switch (type)
|
||||
{
|
||||
case ARCH_ARMV5_WRITE_THROUGH:
|
||||
case ARCH_ARMV6_UNIFIED:
|
||||
case ARCH_ARMV6:
|
||||
grub_arm_disable_caches_mmu_armv6 ();
|
||||
break;
|
||||
case ARCH_ARMV7:
|
||||
grub_arm_disable_caches_mmu_armv7 ();
|
||||
break;
|
||||
/* Nothing to do. */
|
||||
case ARCH_ARMV5_WRITE_THROUGH:
|
||||
break;
|
||||
/* Pacify GCC. */
|
||||
case ARCH_UNKNOWN:
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
.text
|
||||
.syntax unified
|
||||
.arm
|
||||
.arch armv6
|
||||
|
||||
# define DMB mcr p15, 0, r0, c7, c10, 5
|
||||
# define DSB mcr p15, 0, r0, c7, c10, 4
|
||||
@@ -41,4 +40,33 @@ FUNCTION(grub_arm_main_id)
|
||||
|
||||
FUNCTION(grub_arm_cache_type)
|
||||
mrc p15, 0, r0, c0, c0, 1
|
||||
bx lr
|
||||
bx lr
|
||||
|
||||
FUNCTION(grub_arm_clear_mmu_v6)
|
||||
mov r0, #0
|
||||
mcr p15, 0, r0, c2, c0, 2
|
||||
bx lr
|
||||
|
||||
FUNCTION(grub_arm_enable_mmu)
|
||||
mcr p15, 0, r0, c2, c0, 0
|
||||
|
||||
mvn r0, #0
|
||||
mcr p15, 0, r0, c3, c0, 0
|
||||
|
||||
mrc p15, 0, r0, c1, c0, 0
|
||||
bic r0, r0, #(1 << 23)
|
||||
mcr p15, 0, r0, c1, c0, 0
|
||||
|
||||
mrc p15, 0, r0, c1, c0, 0
|
||||
orr r0, r0, #(1 << 0)
|
||||
mcr p15, 0, r0, c1, c0, 0
|
||||
|
||||
mrc p15, 0, r0, c1, c0, 0
|
||||
orr r0, r0, #(1 << 2)
|
||||
mcr p15, 0, r0, c1, c0, 0
|
||||
|
||||
mrc p15, 0, r0, c1, c0, 0
|
||||
orr r0, r0, #(1 << 12)
|
||||
mcr p15, 0, r0, c1, c0, 0
|
||||
|
||||
bx lr
|
||||
@@ -198,6 +198,5 @@ grub_efi_prepare_platform (void)
|
||||
if (err != GRUB_ERR_NONE)
|
||||
return err;
|
||||
|
||||
grub_arm_disable_caches_mmu();
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
@@ -60,17 +60,17 @@ FUNCTION(__aeabi_lmul)
|
||||
|
||||
.macro division parent
|
||||
|
||||
stmfd sp!, {lr}
|
||||
sub sp, sp, #12
|
||||
sub sp, sp, #8 @ Allocate naturally aligned 64-bit space
|
||||
stmfd sp!, {r3,lr} @ Dummy r3 to maintain stack alignment
|
||||
add r3, sp, #8 @ Set r3 to address of 64-bit space
|
||||
str r3, [sp] @ Stack parameter, pointer to 64-bit space
|
||||
mov r2, r1
|
||||
add r1, sp, #4
|
||||
str r1, [sp, #0]
|
||||
mov r1, #0
|
||||
mov r3, #0
|
||||
bl \parent
|
||||
ldr r1, [sp, #4]
|
||||
add sp, sp, #12
|
||||
ldmfd sp!, {lr}
|
||||
ldr r1, [sp, #8] @ Extract remainder
|
||||
ldmfd sp!, {r3,lr} @ Pop into an unused arg/scratch register
|
||||
add sp, sp, #8
|
||||
bx lr
|
||||
.endm
|
||||
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
/* compiler-rt.c - compiler helpers. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010-2014 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/misc.h>
|
||||
#include <grub/compiler-rt.h>
|
||||
|
||||
#if defined (__powerpc__)
|
||||
|
||||
union component64
|
||||
{
|
||||
grub_uint64_t full;
|
||||
struct
|
||||
{
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
grub_uint32_t high;
|
||||
grub_uint32_t low;
|
||||
#else
|
||||
grub_uint32_t low;
|
||||
grub_uint32_t high;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
/* Based on libgcc2.c from gcc suite. */
|
||||
grub_uint64_t
|
||||
__lshrdi3 (grub_uint64_t u, int b)
|
||||
{
|
||||
if (b == 0)
|
||||
return u;
|
||||
|
||||
const union component64 uu = {.full = u};
|
||||
const int bm = 32 - b;
|
||||
union component64 w;
|
||||
|
||||
if (bm <= 0)
|
||||
{
|
||||
w.high = 0;
|
||||
w.low = (grub_uint32_t) uu.high >> -bm;
|
||||
}
|
||||
else
|
||||
{
|
||||
const grub_uint32_t carries = (grub_uint32_t) uu.high << bm;
|
||||
|
||||
w.high = (grub_uint32_t) uu.high >> b;
|
||||
w.low = ((grub_uint32_t) uu.low >> b) | carries;
|
||||
}
|
||||
|
||||
return w.full;
|
||||
}
|
||||
|
||||
/* Based on libgcc2.c from gcc suite. */
|
||||
grub_uint64_t
|
||||
__ashrdi3 (grub_uint64_t u, int b)
|
||||
{
|
||||
if (b == 0)
|
||||
return u;
|
||||
|
||||
const union component64 uu = {.full = u};
|
||||
const int bm = 32 - b;
|
||||
union component64 w;
|
||||
|
||||
if (bm <= 0)
|
||||
{
|
||||
/* w.high = 1..1 or 0..0 */
|
||||
w.high = uu.high >> (32 - 1);
|
||||
w.low = uu.high >> -bm;
|
||||
}
|
||||
else
|
||||
{
|
||||
const grub_uint32_t carries = (grub_uint32_t) uu.high << bm;
|
||||
|
||||
w.high = uu.high >> b;
|
||||
w.low = ((grub_uint32_t) uu.low >> b) | carries;
|
||||
}
|
||||
|
||||
return w.full;
|
||||
}
|
||||
|
||||
/* Based on libgcc2.c from gcc suite. */
|
||||
grub_uint64_t
|
||||
__ashldi3 (grub_uint64_t u, int b)
|
||||
{
|
||||
if (b == 0)
|
||||
return u;
|
||||
|
||||
const union component64 uu = {.full = u};
|
||||
const int bm = 32 - b;
|
||||
union component64 w;
|
||||
|
||||
if (bm <= 0)
|
||||
{
|
||||
w.low = 0;
|
||||
w.high = (grub_uint32_t) uu.low << -bm;
|
||||
}
|
||||
else
|
||||
{
|
||||
const grub_uint32_t carries = (grub_uint32_t) uu.low >> bm;
|
||||
|
||||
w.low = (grub_uint32_t) uu.low << b;
|
||||
w.high = ((grub_uint32_t) uu.high << b) | carries;
|
||||
}
|
||||
|
||||
return w.full;
|
||||
}
|
||||
|
||||
/* Based on libgcc2.c from gcc suite. */
|
||||
int
|
||||
__ucmpdi2 (grub_uint64_t a, grub_uint64_t b)
|
||||
{
|
||||
union component64 ac, bc;
|
||||
ac.full = a;
|
||||
bc.full = b;
|
||||
|
||||
if (ac.high < bc.high)
|
||||
return 0;
|
||||
else if (ac.high > bc.high)
|
||||
return 2;
|
||||
|
||||
if (ac.low < bc.low)
|
||||
return 0;
|
||||
else if (ac.low > bc.low)
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Based on libgcc2.c from gcc suite. */
|
||||
grub_uint32_t
|
||||
__bswapsi2 (grub_uint32_t u)
|
||||
{
|
||||
return ((((u) & 0xff000000) >> 24)
|
||||
| (((u) & 0x00ff0000) >> 8)
|
||||
| (((u) & 0x0000ff00) << 8)
|
||||
| (((u) & 0x000000ff) << 24));
|
||||
}
|
||||
|
||||
/* Based on libgcc2.c from gcc suite. */
|
||||
grub_uint64_t
|
||||
__bswapdi2 (grub_uint64_t u)
|
||||
{
|
||||
return ((((u) & 0xff00000000000000ull) >> 56)
|
||||
| (((u) & 0x00ff000000000000ull) >> 40)
|
||||
| (((u) & 0x0000ff0000000000ull) >> 24)
|
||||
| (((u) & 0x000000ff00000000ull) >> 8)
|
||||
| (((u) & 0x00000000ff000000ull) << 8)
|
||||
| (((u) & 0x0000000000ff0000ull) << 24)
|
||||
| (((u) & 0x000000000000ff00ull) << 40)
|
||||
| (((u) & 0x00000000000000ffull) << 56));
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -7,6 +7,8 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
|
||||
grub_off_t *offset, grub_size_t size)
|
||||
{
|
||||
grub_partition_t part;
|
||||
grub_disk_addr_t total_sectors;
|
||||
|
||||
*sector += *offset >> GRUB_DISK_SECTOR_BITS;
|
||||
*offset &= GRUB_DISK_SECTOR_SIZE - 1;
|
||||
|
||||
@@ -27,12 +29,20 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
|
||||
*sector += start;
|
||||
}
|
||||
|
||||
if (disk->total_sectors != GRUB_DISK_SIZE_UNKNOWN
|
||||
&& ((disk->total_sectors << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)) <= *sector
|
||||
|| ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1)
|
||||
>> GRUB_DISK_SECTOR_BITS) > (disk->total_sectors
|
||||
<< (disk->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS)) - *sector))
|
||||
/* Transform total_sectors to number of 512B blocks. */
|
||||
total_sectors = disk->total_sectors << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
|
||||
|
||||
/* Some drivers have problems with disks above reasonable.
|
||||
Treat unknown as 1EiB disk. While on it, clamp the size to 1EiB.
|
||||
Just one condition is enough since GRUB_DISK_UNKNOWN_SIZE << ls is always
|
||||
above 9EiB.
|
||||
*/
|
||||
if (total_sectors > (1ULL << 51))
|
||||
total_sectors = (1ULL << 51);
|
||||
|
||||
if ((total_sectors <= *sector
|
||||
|| ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1)
|
||||
>> GRUB_DISK_SECTOR_BITS) > total_sectors - *sector))
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read or write outside of disk `%s'"), disk->name);
|
||||
|
||||
|
||||
+194
-186
@@ -309,7 +309,7 @@ grub_efi_modules_addr (void)
|
||||
char *
|
||||
grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
{
|
||||
char *name = 0, *p;
|
||||
char *name = 0, *p, *pi;
|
||||
grub_size_t filesize = 0;
|
||||
grub_efi_device_path_t *dp;
|
||||
|
||||
@@ -328,7 +328,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
grub_efi_uint16_t len;
|
||||
len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4)
|
||||
/ sizeof (grub_efi_char16_t));
|
||||
filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 1;
|
||||
filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 2;
|
||||
}
|
||||
|
||||
dp = GRUB_EFI_NEXT_DEVICE_PATH (dp);
|
||||
@@ -356,12 +356,12 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
grub_efi_file_path_device_path_t *fp;
|
||||
grub_efi_uint16_t len;
|
||||
|
||||
if (p != name)
|
||||
*p++ = '/';
|
||||
*p++ = '/';
|
||||
|
||||
len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4)
|
||||
/ sizeof (grub_efi_char16_t));
|
||||
fp = (grub_efi_file_path_device_path_t *) dp;
|
||||
|
||||
p = (char *) grub_utf16_to_utf8 ((unsigned char *) p, fp->path_name, len);
|
||||
}
|
||||
|
||||
@@ -370,10 +370,19 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
|
||||
*p = '\0';
|
||||
|
||||
/* EFI breaks paths with backslashes. */
|
||||
for (p = name; *p; p++)
|
||||
if (*p == '\\')
|
||||
*p = '/';
|
||||
for (pi = name, p = name; *pi;)
|
||||
{
|
||||
/* EFI breaks paths with backslashes. */
|
||||
if (*pi == '\\' || *pi == '/')
|
||||
{
|
||||
*p++ = '/';
|
||||
while (*pi == '\\' || *pi == '/')
|
||||
pi++;
|
||||
continue;
|
||||
}
|
||||
*p++ = *pi++;
|
||||
}
|
||||
*p = '\0';
|
||||
|
||||
return name;
|
||||
}
|
||||
@@ -385,6 +394,34 @@ grub_efi_get_device_path (grub_efi_handle_t handle)
|
||||
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_vendor_path (const char *type, grub_efi_vendor_device_path_t *vendor)
|
||||
{
|
||||
grub_uint32_t vendor_data_len = vendor->header.length - sizeof (*vendor);
|
||||
grub_printf ("/%sVendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)[%x: ",
|
||||
type,
|
||||
(unsigned) vendor->vendor_guid.data1,
|
||||
(unsigned) vendor->vendor_guid.data2,
|
||||
(unsigned) vendor->vendor_guid.data3,
|
||||
(unsigned) vendor->vendor_guid.data4[0],
|
||||
(unsigned) vendor->vendor_guid.data4[1],
|
||||
(unsigned) vendor->vendor_guid.data4[2],
|
||||
(unsigned) vendor->vendor_guid.data4[3],
|
||||
(unsigned) vendor->vendor_guid.data4[4],
|
||||
(unsigned) vendor->vendor_guid.data4[5],
|
||||
(unsigned) vendor->vendor_guid.data4[6],
|
||||
(unsigned) vendor->vendor_guid.data4[7],
|
||||
vendor_data_len);
|
||||
if (vendor->header.length > sizeof (*vendor))
|
||||
{
|
||||
grub_uint32_t i;
|
||||
for (i = 0; i < vendor_data_len; i++)
|
||||
grub_printf ("%02x ", vendor->vendor_defined_data[i]);
|
||||
}
|
||||
grub_printf ("]");
|
||||
}
|
||||
|
||||
|
||||
/* Print the chain of Device Path nodes. This is mainly for debugging. */
|
||||
void
|
||||
grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
@@ -419,53 +456,40 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
{
|
||||
case GRUB_EFI_PCI_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_pci_device_path_t pci;
|
||||
grub_memcpy (&pci, dp, len);
|
||||
grub_efi_pci_device_path_t *pci
|
||||
= (grub_efi_pci_device_path_t *) dp;
|
||||
grub_printf ("/PCI(%x,%x)",
|
||||
(unsigned) pci.function, (unsigned) pci.device);
|
||||
(unsigned) pci->function, (unsigned) pci->device);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_pccard_device_path_t pccard;
|
||||
grub_memcpy (&pccard, dp, len);
|
||||
grub_efi_pccard_device_path_t *pccard
|
||||
= (grub_efi_pccard_device_path_t *) dp;
|
||||
grub_printf ("/PCCARD(%x)",
|
||||
(unsigned) pccard.function);
|
||||
(unsigned) pccard->function);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_memory_mapped_device_path_t mmapped;
|
||||
grub_memcpy (&mmapped, dp, len);
|
||||
grub_efi_memory_mapped_device_path_t *mmapped
|
||||
= (grub_efi_memory_mapped_device_path_t *) dp;
|
||||
grub_printf ("/MMap(%x,%llx,%llx)",
|
||||
(unsigned) mmapped.memory_type,
|
||||
(unsigned long long) mmapped.start_address,
|
||||
(unsigned long long) mmapped.end_address);
|
||||
(unsigned) mmapped->memory_type,
|
||||
(unsigned long long) mmapped->start_address,
|
||||
(unsigned long long) mmapped->end_address);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_vendor_device_path_t *vendor = (grub_efi_vendor_device_path_t *) dp;
|
||||
grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
|
||||
(unsigned) vendor->vendor_guid.data1,
|
||||
(unsigned) vendor->vendor_guid.data2,
|
||||
(unsigned) vendor->vendor_guid.data3,
|
||||
(unsigned) vendor->vendor_guid.data4[0],
|
||||
(unsigned) vendor->vendor_guid.data4[1],
|
||||
(unsigned) vendor->vendor_guid.data4[2],
|
||||
(unsigned) vendor->vendor_guid.data4[3],
|
||||
(unsigned) vendor->vendor_guid.data4[4],
|
||||
(unsigned) vendor->vendor_guid.data4[5],
|
||||
(unsigned) vendor->vendor_guid.data4[6],
|
||||
(unsigned) vendor->vendor_guid.data4[7]);
|
||||
}
|
||||
dump_vendor_path ("Hardware",
|
||||
(grub_efi_vendor_device_path_t *) dp);
|
||||
break;
|
||||
case GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_controller_device_path_t controller;
|
||||
grub_memcpy (&controller, dp, len);
|
||||
grub_efi_controller_device_path_t *controller
|
||||
= (grub_efi_controller_device_path_t *) dp;
|
||||
grub_printf ("/Ctrl(%x)",
|
||||
(unsigned) controller.controller_number);
|
||||
(unsigned) controller->controller_number);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -479,31 +503,31 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
{
|
||||
case GRUB_EFI_ACPI_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_acpi_device_path_t acpi;
|
||||
grub_memcpy (&acpi, dp, len);
|
||||
grub_efi_acpi_device_path_t *acpi
|
||||
= (grub_efi_acpi_device_path_t *) dp;
|
||||
grub_printf ("/ACPI(%x,%x)",
|
||||
(unsigned) acpi.hid,
|
||||
(unsigned) acpi.uid);
|
||||
(unsigned) acpi->hid,
|
||||
(unsigned) acpi->uid);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_expanded_acpi_device_path_t eacpi;
|
||||
grub_memcpy (&eacpi, dp, sizeof (eacpi));
|
||||
grub_efi_expanded_acpi_device_path_t *eacpi
|
||||
= (grub_efi_expanded_acpi_device_path_t *) dp;
|
||||
grub_printf ("/ACPI(");
|
||||
|
||||
if (GRUB_EFI_EXPANDED_ACPI_HIDSTR (dp)[0] == '\0')
|
||||
grub_printf ("%x,", (unsigned) eacpi.hid);
|
||||
grub_printf ("%x,", (unsigned) eacpi->hid);
|
||||
else
|
||||
grub_printf ("%s,", GRUB_EFI_EXPANDED_ACPI_HIDSTR (dp));
|
||||
|
||||
if (GRUB_EFI_EXPANDED_ACPI_UIDSTR (dp)[0] == '\0')
|
||||
grub_printf ("%x,", (unsigned) eacpi.uid);
|
||||
grub_printf ("%x,", (unsigned) eacpi->uid);
|
||||
else
|
||||
grub_printf ("%s,", GRUB_EFI_EXPANDED_ACPI_UIDSTR (dp));
|
||||
|
||||
if (GRUB_EFI_EXPANDED_ACPI_CIDSTR (dp)[0] == '\0')
|
||||
grub_printf ("%x)", (unsigned) eacpi.cid);
|
||||
grub_printf ("%x)", (unsigned) eacpi->cid);
|
||||
else
|
||||
grub_printf ("%s)", GRUB_EFI_EXPANDED_ACPI_CIDSTR (dp));
|
||||
}
|
||||
@@ -519,167 +543,165 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
{
|
||||
case GRUB_EFI_ATAPI_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_atapi_device_path_t atapi;
|
||||
grub_memcpy (&atapi, dp, len);
|
||||
grub_efi_atapi_device_path_t *atapi
|
||||
= (grub_efi_atapi_device_path_t *) dp;
|
||||
grub_printf ("/ATAPI(%x,%x,%x)",
|
||||
(unsigned) atapi.primary_secondary,
|
||||
(unsigned) atapi.slave_master,
|
||||
(unsigned) atapi.lun);
|
||||
(unsigned) atapi->primary_secondary,
|
||||
(unsigned) atapi->slave_master,
|
||||
(unsigned) atapi->lun);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_SCSI_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_scsi_device_path_t scsi;
|
||||
grub_memcpy (&scsi, dp, len);
|
||||
grub_efi_scsi_device_path_t *scsi
|
||||
= (grub_efi_scsi_device_path_t *) dp;
|
||||
grub_printf ("/SCSI(%x,%x)",
|
||||
(unsigned) scsi.pun,
|
||||
(unsigned) scsi.lun);
|
||||
(unsigned) scsi->pun,
|
||||
(unsigned) scsi->lun);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_fibre_channel_device_path_t fc;
|
||||
grub_memcpy (&fc, dp, len);
|
||||
grub_efi_fibre_channel_device_path_t *fc
|
||||
= (grub_efi_fibre_channel_device_path_t *) dp;
|
||||
grub_printf ("/FibreChannel(%llx,%llx)",
|
||||
(unsigned long long) fc.wwn,
|
||||
(unsigned long long) fc.lun);
|
||||
(unsigned long long) fc->wwn,
|
||||
(unsigned long long) fc->lun);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_1394_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_1394_device_path_t firewire;
|
||||
grub_memcpy (&firewire, dp, len);
|
||||
grub_printf ("/1394(%llx)", (unsigned long long) firewire.guid);
|
||||
grub_efi_1394_device_path_t *firewire
|
||||
= (grub_efi_1394_device_path_t *) dp;
|
||||
grub_printf ("/1394(%llx)",
|
||||
(unsigned long long) firewire->guid);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_USB_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_usb_device_path_t usb;
|
||||
grub_memcpy (&usb, dp, len);
|
||||
grub_efi_usb_device_path_t *usb
|
||||
= (grub_efi_usb_device_path_t *) dp;
|
||||
grub_printf ("/USB(%x,%x)",
|
||||
(unsigned) usb.parent_port_number,
|
||||
(unsigned) usb.usb_interface);
|
||||
(unsigned) usb->parent_port_number,
|
||||
(unsigned) usb->usb_interface);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_usb_class_device_path_t usb_class;
|
||||
grub_memcpy (&usb_class, dp, len);
|
||||
grub_efi_usb_class_device_path_t *usb_class
|
||||
= (grub_efi_usb_class_device_path_t *) dp;
|
||||
grub_printf ("/USBClass(%x,%x,%x,%x,%x)",
|
||||
(unsigned) usb_class.vendor_id,
|
||||
(unsigned) usb_class.product_id,
|
||||
(unsigned) usb_class.device_class,
|
||||
(unsigned) usb_class.device_subclass,
|
||||
(unsigned) usb_class.device_protocol);
|
||||
(unsigned) usb_class->vendor_id,
|
||||
(unsigned) usb_class->product_id,
|
||||
(unsigned) usb_class->device_class,
|
||||
(unsigned) usb_class->device_subclass,
|
||||
(unsigned) usb_class->device_protocol);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_i2o_device_path_t i2o;
|
||||
grub_memcpy (&i2o, dp, len);
|
||||
grub_printf ("/I2O(%x)", (unsigned) i2o.tid);
|
||||
grub_efi_i2o_device_path_t *i2o
|
||||
= (grub_efi_i2o_device_path_t *) dp;
|
||||
grub_printf ("/I2O(%x)", (unsigned) i2o->tid);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_mac_address_device_path_t mac;
|
||||
grub_memcpy (&mac, dp, len);
|
||||
grub_efi_mac_address_device_path_t *mac
|
||||
= (grub_efi_mac_address_device_path_t *) dp;
|
||||
grub_printf ("/MacAddr(%02x:%02x:%02x:%02x:%02x:%02x,%x)",
|
||||
(unsigned) mac.mac_address[0],
|
||||
(unsigned) mac.mac_address[1],
|
||||
(unsigned) mac.mac_address[2],
|
||||
(unsigned) mac.mac_address[3],
|
||||
(unsigned) mac.mac_address[4],
|
||||
(unsigned) mac.mac_address[5],
|
||||
(unsigned) mac.if_type);
|
||||
(unsigned) mac->mac_address[0],
|
||||
(unsigned) mac->mac_address[1],
|
||||
(unsigned) mac->mac_address[2],
|
||||
(unsigned) mac->mac_address[3],
|
||||
(unsigned) mac->mac_address[4],
|
||||
(unsigned) mac->mac_address[5],
|
||||
(unsigned) mac->if_type);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_ipv4_device_path_t ipv4;
|
||||
grub_memcpy (&ipv4, dp, len);
|
||||
grub_efi_ipv4_device_path_t *ipv4
|
||||
= (grub_efi_ipv4_device_path_t *) dp;
|
||||
grub_printf ("/IPv4(%u.%u.%u.%u,%u.%u.%u.%u,%u,%u,%x,%x)",
|
||||
(unsigned) ipv4.local_ip_address[0],
|
||||
(unsigned) ipv4.local_ip_address[1],
|
||||
(unsigned) ipv4.local_ip_address[2],
|
||||
(unsigned) ipv4.local_ip_address[3],
|
||||
(unsigned) ipv4.remote_ip_address[0],
|
||||
(unsigned) ipv4.remote_ip_address[1],
|
||||
(unsigned) ipv4.remote_ip_address[2],
|
||||
(unsigned) ipv4.remote_ip_address[3],
|
||||
(unsigned) ipv4.local_port,
|
||||
(unsigned) ipv4.remote_port,
|
||||
(unsigned) ipv4.protocol,
|
||||
(unsigned) ipv4.static_ip_address);
|
||||
(unsigned) ipv4->local_ip_address[0],
|
||||
(unsigned) ipv4->local_ip_address[1],
|
||||
(unsigned) ipv4->local_ip_address[2],
|
||||
(unsigned) ipv4->local_ip_address[3],
|
||||
(unsigned) ipv4->remote_ip_address[0],
|
||||
(unsigned) ipv4->remote_ip_address[1],
|
||||
(unsigned) ipv4->remote_ip_address[2],
|
||||
(unsigned) ipv4->remote_ip_address[3],
|
||||
(unsigned) ipv4->local_port,
|
||||
(unsigned) ipv4->remote_port,
|
||||
(unsigned) ipv4->protocol,
|
||||
(unsigned) ipv4->static_ip_address);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_ipv6_device_path_t ipv6;
|
||||
grub_memcpy (&ipv6, dp, len);
|
||||
grub_efi_ipv6_device_path_t *ipv6
|
||||
= (grub_efi_ipv6_device_path_t *) dp;
|
||||
grub_printf ("/IPv6(%x:%x:%x:%x:%x:%x:%x:%x,%x:%x:%x:%x:%x:%x:%x:%x,%u,%u,%x,%x)",
|
||||
(unsigned) ipv6.local_ip_address[0],
|
||||
(unsigned) ipv6.local_ip_address[1],
|
||||
(unsigned) ipv6.local_ip_address[2],
|
||||
(unsigned) ipv6.local_ip_address[3],
|
||||
(unsigned) ipv6.local_ip_address[4],
|
||||
(unsigned) ipv6.local_ip_address[5],
|
||||
(unsigned) ipv6.local_ip_address[6],
|
||||
(unsigned) ipv6.local_ip_address[7],
|
||||
(unsigned) ipv6.remote_ip_address[0],
|
||||
(unsigned) ipv6.remote_ip_address[1],
|
||||
(unsigned) ipv6.remote_ip_address[2],
|
||||
(unsigned) ipv6.remote_ip_address[3],
|
||||
(unsigned) ipv6.remote_ip_address[4],
|
||||
(unsigned) ipv6.remote_ip_address[5],
|
||||
(unsigned) ipv6.remote_ip_address[6],
|
||||
(unsigned) ipv6.remote_ip_address[7],
|
||||
(unsigned) ipv6.local_port,
|
||||
(unsigned) ipv6.remote_port,
|
||||
(unsigned) ipv6.protocol,
|
||||
(unsigned) ipv6.static_ip_address);
|
||||
(unsigned) ipv6->local_ip_address[0],
|
||||
(unsigned) ipv6->local_ip_address[1],
|
||||
(unsigned) ipv6->local_ip_address[2],
|
||||
(unsigned) ipv6->local_ip_address[3],
|
||||
(unsigned) ipv6->local_ip_address[4],
|
||||
(unsigned) ipv6->local_ip_address[5],
|
||||
(unsigned) ipv6->local_ip_address[6],
|
||||
(unsigned) ipv6->local_ip_address[7],
|
||||
(unsigned) ipv6->remote_ip_address[0],
|
||||
(unsigned) ipv6->remote_ip_address[1],
|
||||
(unsigned) ipv6->remote_ip_address[2],
|
||||
(unsigned) ipv6->remote_ip_address[3],
|
||||
(unsigned) ipv6->remote_ip_address[4],
|
||||
(unsigned) ipv6->remote_ip_address[5],
|
||||
(unsigned) ipv6->remote_ip_address[6],
|
||||
(unsigned) ipv6->remote_ip_address[7],
|
||||
(unsigned) ipv6->local_port,
|
||||
(unsigned) ipv6->remote_port,
|
||||
(unsigned) ipv6->protocol,
|
||||
(unsigned) ipv6->static_ip_address);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_infiniband_device_path_t ib;
|
||||
grub_memcpy (&ib, dp, len);
|
||||
grub_efi_infiniband_device_path_t *ib
|
||||
= (grub_efi_infiniband_device_path_t *) dp;
|
||||
grub_printf ("/InfiniBand(%x,%llx,%llx,%llx)",
|
||||
(unsigned) ib.port_gid[0], /* XXX */
|
||||
(unsigned long long) ib.remote_id,
|
||||
(unsigned long long) ib.target_port_id,
|
||||
(unsigned long long) ib.device_id);
|
||||
(unsigned) ib->port_gid[0], /* XXX */
|
||||
(unsigned long long) ib->remote_id,
|
||||
(unsigned long long) ib->target_port_id,
|
||||
(unsigned long long) ib->device_id);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_UART_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_uart_device_path_t uart;
|
||||
grub_memcpy (&uart, dp, len);
|
||||
grub_efi_uart_device_path_t *uart
|
||||
= (grub_efi_uart_device_path_t *) dp;
|
||||
grub_printf ("/UART(%llu,%u,%x,%x)",
|
||||
(unsigned long long) uart.baud_rate,
|
||||
uart.data_bits,
|
||||
uart.parity,
|
||||
uart.stop_bits);
|
||||
(unsigned long long) uart->baud_rate,
|
||||
uart->data_bits,
|
||||
uart->parity,
|
||||
uart->stop_bits);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE:
|
||||
case GRUB_EFI_SATA_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_vendor_messaging_device_path_t *vendor
|
||||
= (grub_efi_vendor_messaging_device_path_t *) dp;
|
||||
grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
|
||||
(unsigned) vendor->vendor_guid.data1,
|
||||
(unsigned) vendor->vendor_guid.data2,
|
||||
(unsigned) vendor->vendor_guid.data3,
|
||||
(unsigned) vendor->vendor_guid.data4[0],
|
||||
(unsigned) vendor->vendor_guid.data4[1],
|
||||
(unsigned) vendor->vendor_guid.data4[2],
|
||||
(unsigned) vendor->vendor_guid.data4[3],
|
||||
(unsigned) vendor->vendor_guid.data4[4],
|
||||
(unsigned) vendor->vendor_guid.data4[5],
|
||||
(unsigned) vendor->vendor_guid.data4[6],
|
||||
(unsigned) vendor->vendor_guid.data4[7]);
|
||||
grub_efi_sata_device_path_t *sata;
|
||||
sata = (grub_efi_sata_device_path_t *) dp;
|
||||
grub_printf ("/Sata(%x,%x,%x)",
|
||||
sata->hba_port,
|
||||
sata->multiplier_port,
|
||||
sata->lun);
|
||||
}
|
||||
break;
|
||||
|
||||
case GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE:
|
||||
dump_vendor_path ("Messaging",
|
||||
(grub_efi_vendor_device_path_t *) dp);
|
||||
break;
|
||||
default:
|
||||
grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype);
|
||||
break;
|
||||
@@ -710,31 +732,17 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
break;
|
||||
case GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_cdrom_device_path_t cd;
|
||||
grub_memcpy (&cd, dp, len);
|
||||
grub_efi_cdrom_device_path_t *cd
|
||||
= (grub_efi_cdrom_device_path_t *) dp;
|
||||
grub_printf ("/CD(%u,%llx,%llx)",
|
||||
cd.boot_entry,
|
||||
(unsigned long long) cd.partition_start,
|
||||
(unsigned long long) cd.partition_size);
|
||||
cd->boot_entry,
|
||||
(unsigned long long) cd->partition_start,
|
||||
(unsigned long long) cd->partition_size);
|
||||
}
|
||||
break;
|
||||
case GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_vendor_device_path_t *vendor = (grub_efi_vendor_device_path_t *) dp;
|
||||
|
||||
grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
|
||||
(unsigned) vendor->vendor_guid.data1,
|
||||
(unsigned) vendor->vendor_guid.data2,
|
||||
(unsigned) vendor->vendor_guid.data3,
|
||||
(unsigned) vendor->vendor_guid.data4[0],
|
||||
(unsigned) vendor->vendor_guid.data4[1],
|
||||
(unsigned) vendor->vendor_guid.data4[2],
|
||||
(unsigned) vendor->vendor_guid.data4[3],
|
||||
(unsigned) vendor->vendor_guid.data4[4],
|
||||
(unsigned) vendor->vendor_guid.data4[5],
|
||||
(unsigned) vendor->vendor_guid.data4[6],
|
||||
(unsigned) vendor->vendor_guid.data4[7]);
|
||||
}
|
||||
dump_vendor_path ("Media",
|
||||
(grub_efi_vendor_device_path_t *) dp);
|
||||
break;
|
||||
case GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
@@ -754,20 +762,20 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
break;
|
||||
case GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_protocol_device_path_t proto;
|
||||
grub_memcpy (&proto, dp, sizeof (proto));
|
||||
grub_efi_protocol_device_path_t *proto
|
||||
= (grub_efi_protocol_device_path_t *) dp;
|
||||
grub_printf ("/Protocol(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
|
||||
(unsigned) proto.guid.data1,
|
||||
(unsigned) proto.guid.data2,
|
||||
(unsigned) proto.guid.data3,
|
||||
(unsigned) proto.guid.data4[0],
|
||||
(unsigned) proto.guid.data4[1],
|
||||
(unsigned) proto.guid.data4[2],
|
||||
(unsigned) proto.guid.data4[3],
|
||||
(unsigned) proto.guid.data4[4],
|
||||
(unsigned) proto.guid.data4[5],
|
||||
(unsigned) proto.guid.data4[6],
|
||||
(unsigned) proto.guid.data4[7]);
|
||||
(unsigned) proto->guid.data1,
|
||||
(unsigned) proto->guid.data2,
|
||||
(unsigned) proto->guid.data3,
|
||||
(unsigned) proto->guid.data4[0],
|
||||
(unsigned) proto->guid.data4[1],
|
||||
(unsigned) proto->guid.data4[2],
|
||||
(unsigned) proto->guid.data4[3],
|
||||
(unsigned) proto->guid.data4[4],
|
||||
(unsigned) proto->guid.data4[5],
|
||||
(unsigned) proto->guid.data4[6],
|
||||
(unsigned) proto->guid.data4[7]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -781,11 +789,11 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
{
|
||||
case GRUB_EFI_BIOS_DEVICE_PATH_SUBTYPE:
|
||||
{
|
||||
grub_efi_bios_device_path_t bios;
|
||||
grub_memcpy (&bios, dp, sizeof (bios));
|
||||
grub_efi_bios_device_path_t *bios
|
||||
= (grub_efi_bios_device_path_t *) dp;
|
||||
grub_printf ("/BIOS(%x,%x,%s)",
|
||||
(unsigned) bios.device_type,
|
||||
(unsigned) bios.status_flags,
|
||||
(unsigned) bios->device_type,
|
||||
(unsigned) bios->status_flags,
|
||||
(char *) (dp + 1));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -63,10 +63,13 @@ grub_machine_get_bootlocation (char **device, char **path)
|
||||
if (!*device && grub_efi_net_config)
|
||||
grub_efi_net_config (image->device_handle, device, path);
|
||||
|
||||
/* Get the directory. */
|
||||
p = grub_strrchr (*path, '/');
|
||||
if (p)
|
||||
*p = '\0';
|
||||
if (*path)
|
||||
{
|
||||
/* Get the directory. */
|
||||
p = grub_strrchr (*path, '/');
|
||||
if (p)
|
||||
*p = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -230,6 +230,7 @@ grub_efi_get_memory_map (grub_efi_uintn_t *memory_map_size,
|
||||
grub_efi_boot_services_t *b;
|
||||
grub_efi_uintn_t key;
|
||||
grub_efi_uint32_t version;
|
||||
grub_efi_uintn_t size;
|
||||
|
||||
if (grub_efi_is_finished)
|
||||
{
|
||||
@@ -259,10 +260,14 @@ grub_efi_get_memory_map (grub_efi_uintn_t *memory_map_size,
|
||||
map_key = &key;
|
||||
if (! descriptor_version)
|
||||
descriptor_version = &version;
|
||||
if (! descriptor_size)
|
||||
descriptor_size = &size;
|
||||
|
||||
b = grub_efi_system_table->boot_services;
|
||||
status = efi_call_5 (b->get_memory_map, memory_map_size, memory_map, map_key,
|
||||
descriptor_size, descriptor_version);
|
||||
if (*descriptor_size == 0)
|
||||
*descriptor_size = sizeof (grub_efi_memory_descriptor_t);
|
||||
if (status == GRUB_EFI_SUCCESS)
|
||||
return 1;
|
||||
else if (status == GRUB_EFI_BUFFER_TOO_SMALL)
|
||||
|
||||
+58
-2
@@ -28,6 +28,11 @@
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
void grub_elf32_check_endianess (grub_elf_t elf);
|
||||
void grub_elf64_check_endianess (grub_elf_t elf);
|
||||
grub_err_t grub_elf32_check_version (grub_elf_t elf);
|
||||
grub_err_t grub_elf64_check_version (grub_elf_t elf);
|
||||
|
||||
/* Check if EHDR is a valid ELF header. */
|
||||
static grub_err_t
|
||||
grub_elf_check_header (grub_elf_t elf)
|
||||
@@ -38,10 +43,22 @@ grub_elf_check_header (grub_elf_t elf)
|
||||
|| e->e_ident[EI_MAG1] != ELFMAG1
|
||||
|| e->e_ident[EI_MAG2] != ELFMAG2
|
||||
|| e->e_ident[EI_MAG3] != ELFMAG3
|
||||
|| e->e_ident[EI_VERSION] != EV_CURRENT
|
||||
|| e->e_version != EV_CURRENT)
|
||||
|| e->e_ident[EI_VERSION] != EV_CURRENT)
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-independent ELF magic"));
|
||||
|
||||
if (grub_elf_is_elf32 (elf))
|
||||
{
|
||||
grub_elf32_check_endianess (elf);
|
||||
grub_elf32_check_version (elf);
|
||||
}
|
||||
else if (grub_elf_is_elf64 (elf))
|
||||
{
|
||||
grub_elf64_check_endianess (elf);
|
||||
grub_elf64_check_version (elf);
|
||||
}
|
||||
else
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-dependent ELF magic"));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
@@ -127,7 +144,20 @@ grub_elf_open (const char *name)
|
||||
#define grub_elf_is_elfXX grub_elf_is_elf32
|
||||
#define grub_elfXX_load_phdrs grub_elf32_load_phdrs
|
||||
#define ElfXX_Phdr Elf32_Phdr
|
||||
#define ElfXX_Ehdr Elf32_Ehdr
|
||||
#define grub_uintXX_t grub_uint32_t
|
||||
#define grub_be_to_halfXX grub_be_to_cpu16
|
||||
#define grub_be_to_wordXX grub_be_to_cpu32
|
||||
#define grub_be_to_addrXX grub_be_to_cpu32
|
||||
#define grub_be_to_offXX grub_be_to_cpu32
|
||||
#define grub_be_to_XwordXX grub_be_to_wordXX
|
||||
#define grub_le_to_halfXX grub_le_to_cpu16
|
||||
#define grub_le_to_wordXX grub_le_to_cpu32
|
||||
#define grub_le_to_addrXX grub_le_to_cpu32
|
||||
#define grub_le_to_offXX grub_le_to_cpu32
|
||||
#define grub_le_to_XwordXX grub_le_to_wordXX
|
||||
#define grub_elfXX_check_endianess grub_elf32_check_endianess
|
||||
#define grub_elfXX_check_version grub_elf32_check_version
|
||||
|
||||
#include "elfXX.c"
|
||||
|
||||
@@ -140,7 +170,20 @@ grub_elf_open (const char *name)
|
||||
#undef grub_elf_is_elfXX
|
||||
#undef grub_elfXX_load_phdrs
|
||||
#undef ElfXX_Phdr
|
||||
#undef ElfXX_Ehdr
|
||||
#undef grub_uintXX_t
|
||||
#undef grub_be_to_halfXX
|
||||
#undef grub_be_to_wordXX
|
||||
#undef grub_be_to_addrXX
|
||||
#undef grub_be_to_offXX
|
||||
#undef grub_be_to_XwordXX
|
||||
#undef grub_le_to_halfXX
|
||||
#undef grub_le_to_wordXX
|
||||
#undef grub_le_to_addrXX
|
||||
#undef grub_le_to_offXX
|
||||
#undef grub_le_to_XwordXX
|
||||
#undef grub_elfXX_check_endianess
|
||||
#undef grub_elfXX_check_version
|
||||
|
||||
|
||||
/* 64-bit */
|
||||
@@ -153,6 +196,19 @@ grub_elf_open (const char *name)
|
||||
#define grub_elf_is_elfXX grub_elf_is_elf64
|
||||
#define grub_elfXX_load_phdrs grub_elf64_load_phdrs
|
||||
#define ElfXX_Phdr Elf64_Phdr
|
||||
#define ElfXX_Ehdr Elf64_Ehdr
|
||||
#define grub_uintXX_t grub_uint64_t
|
||||
#define grub_be_to_halfXX grub_be_to_cpu16
|
||||
#define grub_be_to_wordXX grub_be_to_cpu32
|
||||
#define grub_be_to_addrXX grub_be_to_cpu64
|
||||
#define grub_be_to_offXX grub_be_to_cpu64
|
||||
#define grub_be_to_XwordXX grub_be_to_cpu64
|
||||
#define grub_le_to_halfXX grub_le_to_cpu16
|
||||
#define grub_le_to_wordXX grub_le_to_cpu32
|
||||
#define grub_le_to_addrXX grub_le_to_cpu64
|
||||
#define grub_le_to_offXX grub_le_to_cpu64
|
||||
#define grub_le_to_XwordXX grub_le_to_cpu64
|
||||
#define grub_elfXX_check_endianess grub_elf64_check_endianess
|
||||
#define grub_elfXX_check_version grub_elf64_check_version
|
||||
|
||||
#include "elfXX.c"
|
||||
@@ -154,3 +154,76 @@ grub_elfXX_load (grub_elf_t elf, const char *filename,
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
void
|
||||
grub_elfXX_check_endianess (grub_elf_t elf)
|
||||
{
|
||||
ElfXX_Ehdr *e = &(elf->ehdr.ehdrXX);
|
||||
ElfXX_Phdr *phdr;
|
||||
|
||||
if (e->e_ident[EI_DATA] == ELFDATA2MSB)
|
||||
{
|
||||
e->e_type = grub_be_to_halfXX (e->e_type);
|
||||
e->e_machine = grub_be_to_halfXX (e->e_machine);
|
||||
e->e_version = grub_be_to_wordXX (e->e_version);
|
||||
e->e_entry = grub_be_to_addrXX (e->e_entry);
|
||||
e->e_phoff = grub_be_to_offXX (e->e_phoff);
|
||||
e->e_shoff = grub_be_to_offXX (e->e_shoff);
|
||||
e->e_flags = grub_be_to_wordXX (e->e_flags);
|
||||
e->e_ehsize = grub_be_to_halfXX (e->e_ehsize);
|
||||
e->e_phentsize = grub_be_to_halfXX (e->e_phentsize);
|
||||
e->e_phnum = grub_be_to_halfXX (e->e_phnum);
|
||||
e->e_shentsize = grub_be_to_halfXX (e->e_shentsize);
|
||||
e->e_shnum = grub_be_to_halfXX (e->e_shnum);
|
||||
e->e_shstrndx = grub_be_to_halfXX (e->e_shstrndx);
|
||||
|
||||
FOR_ELFXX_PHDRS (elf,phdr)
|
||||
{
|
||||
phdr->p_type = grub_be_to_wordXX (phdr->p_type);
|
||||
phdr->p_flags = grub_be_to_wordXX (phdr->p_flags);
|
||||
phdr->p_offset = grub_be_to_offXX (phdr->p_offset);
|
||||
phdr->p_vaddr = grub_be_to_addrXX (phdr->p_vaddr);
|
||||
phdr->p_paddr = grub_be_to_addrXX (phdr->p_paddr);
|
||||
phdr->p_filesz = grub_be_to_XwordXX (phdr->p_filesz);
|
||||
phdr->p_memsz = grub_be_to_XwordXX (phdr->p_memsz);
|
||||
phdr->p_align = grub_be_to_XwordXX (phdr->p_align);
|
||||
}
|
||||
}
|
||||
else if (e->e_ident[EI_DATA] == ELFDATA2LSB)
|
||||
{
|
||||
e->e_type = grub_le_to_halfXX (e->e_type);
|
||||
e->e_machine = grub_le_to_halfXX (e->e_machine);
|
||||
e->e_version = grub_le_to_wordXX (e->e_version);
|
||||
e->e_entry = grub_le_to_addrXX (e->e_entry);
|
||||
e->e_phoff = grub_le_to_offXX (e->e_phoff);
|
||||
e->e_shoff = grub_le_to_offXX (e->e_shoff);
|
||||
e->e_flags = grub_le_to_wordXX (e->e_flags);
|
||||
e->e_ehsize = grub_le_to_halfXX (e->e_ehsize);
|
||||
e->e_phentsize = grub_le_to_halfXX (e->e_phentsize);
|
||||
e->e_phnum = grub_le_to_halfXX (e->e_phnum);
|
||||
e->e_shentsize = grub_le_to_halfXX (e->e_shentsize);
|
||||
e->e_shnum = grub_le_to_halfXX (e->e_shnum);
|
||||
e->e_shstrndx = grub_le_to_halfXX (e->e_shstrndx);
|
||||
|
||||
FOR_ELFXX_PHDRS (elf,phdr)
|
||||
{
|
||||
phdr->p_type = grub_le_to_wordXX (phdr->p_type);
|
||||
phdr->p_flags = grub_le_to_wordXX (phdr->p_flags);
|
||||
phdr->p_offset = grub_le_to_offXX (phdr->p_offset);
|
||||
phdr->p_vaddr = grub_le_to_addrXX (phdr->p_vaddr);
|
||||
phdr->p_paddr = grub_le_to_addrXX (phdr->p_paddr);
|
||||
phdr->p_filesz = grub_le_to_XwordXX (phdr->p_filesz);
|
||||
phdr->p_memsz = grub_le_to_XwordXX (phdr->p_memsz);
|
||||
phdr->p_align = grub_le_to_XwordXX (phdr->p_align);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_elfXX_check_version (grub_elf_t elf)
|
||||
{
|
||||
if (elf->ehdr.ehdrXX.e_version != EV_CURRENT)
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-independent ELF magic"));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ find_free_slot (void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (map) / sizeof (map[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE (map); i++)
|
||||
if (! map[i].drive)
|
||||
return i;
|
||||
|
||||
@@ -115,7 +115,7 @@ grub_util_biosdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data,
|
||||
if (pull != GRUB_DISK_PULL_NONE)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < sizeof (map) / sizeof (map[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE (map); i++)
|
||||
if (map[i].drive && hook (map[i].drive, hook_data))
|
||||
return 1;
|
||||
|
||||
@@ -581,7 +581,7 @@ grub_util_biosdisk_fini (void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sizeof (map) / sizeof (map[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(map); i++)
|
||||
{
|
||||
if (map[i].drive)
|
||||
free (map[i].drive);
|
||||
|
||||
@@ -19,7 +19,11 @@
|
||||
|
||||
#include <config-util.h>
|
||||
|
||||
/* Legacy feature macro.*/
|
||||
#define _BSD_SOURCE
|
||||
/* New feature macro that provides everything _BSD_SOURCE and
|
||||
* _SVID_SOURCE provided and possibly more. */
|
||||
#define _DEFAULT_SOURCE
|
||||
#include <grub/fs.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/disk.h>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -34,5 +34,5 @@ grub_rtc_get_time_ms (void)
|
||||
1 s 1 T rtc ticks
|
||||
*/
|
||||
grub_uint64_t ticks_ms_per_sec = ((grub_uint64_t) 1000) * grub_get_rtc ();
|
||||
return grub_divmod64 (ticks_ms_per_sec, GRUB_TICKS_PER_SECOND, 0);
|
||||
return grub_divmod64 (ticks_ms_per_sec, GRUB_TICKS_PER_SECOND ? : 1000, 0);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t,
|
||||
if (check_signature (table_header))
|
||||
goto signature_found;
|
||||
|
||||
grub_fatal ("Could not find coreboot table\n");
|
||||
return 0;
|
||||
|
||||
signature_found:
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ grub_exit (void)
|
||||
|
||||
grub_addr_t grub_modbase = GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR;
|
||||
static grub_uint64_t modend;
|
||||
static int have_memory = 0;
|
||||
|
||||
/* Helper for grub_machine_init. */
|
||||
static int
|
||||
@@ -82,6 +83,8 @@ heap_init (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type,
|
||||
|
||||
grub_mm_init_region ((void *) (grub_addr_t) begin, (grub_size_t) (end - begin));
|
||||
|
||||
have_memory = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -97,6 +100,8 @@ grub_machine_init (void)
|
||||
grub_vga_text_init ();
|
||||
|
||||
grub_machine_mmap_iterate (heap_init, NULL);
|
||||
if (!have_memory)
|
||||
grub_fatal ("No memory found");
|
||||
|
||||
grub_video_coreboot_fb_late_init ();
|
||||
|
||||
|
||||
@@ -44,18 +44,44 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data)
|
||||
mem_region =
|
||||
(mem_region_t) ((long) table_item +
|
||||
sizeof (struct grub_linuxbios_table_item));
|
||||
while ((long) mem_region < (long) table_item + (long) table_item->size)
|
||||
for (; (long) mem_region < (long) table_item + (long) table_item->size;
|
||||
mem_region++)
|
||||
{
|
||||
if (ctx->hook (mem_region->addr, mem_region->size,
|
||||
grub_uint64_t start = mem_region->addr;
|
||||
grub_uint64_t end = mem_region->addr + mem_region->size;
|
||||
/* Mark region 0xa0000 - 0x100000 as reserved. */
|
||||
if (start < 0x100000 && end >= 0xa0000
|
||||
&& mem_region->type == GRUB_MACHINE_MEMORY_AVAILABLE)
|
||||
{
|
||||
if (start < 0xa0000
|
||||
&& ctx->hook (start, 0xa0000 - start,
|
||||
/* Multiboot mmaps match with the coreboot mmap
|
||||
definition. Therefore, we can just pass type
|
||||
through. */
|
||||
mem_region->type,
|
||||
ctx->hook_data))
|
||||
return 1;
|
||||
if (start < 0xa0000)
|
||||
start = 0xa0000;
|
||||
if (start >= end)
|
||||
continue;
|
||||
|
||||
if (ctx->hook (start, (end > 0x100000 ? 0x100000 : end) - start,
|
||||
GRUB_MEMORY_RESERVED,
|
||||
ctx->hook_data))
|
||||
return 1;
|
||||
start = 0x100000;
|
||||
|
||||
if (end <= start)
|
||||
continue;
|
||||
}
|
||||
if (ctx->hook (start, end - start,
|
||||
/* Multiboot mmaps match with the coreboot mmap
|
||||
definition. Therefore, we can just pass type
|
||||
through. */
|
||||
(((mem_region->type <= GRUB_MACHINE_MEMORY_BADRAM) && (mem_region->type >= GRUB_MACHINE_MEMORY_AVAILABLE))
|
||||
|| mem_region->type == GRUB_MEMORY_COREBOOT_TABLES) ? mem_region->type : GRUB_MEMORY_RESERVED,
|
||||
mem_region->type,
|
||||
ctx->hook_data))
|
||||
return 1;
|
||||
|
||||
mem_region++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -141,33 +141,35 @@ grub_get_mmap_entry (struct grub_machine_mmap_entry *entry,
|
||||
grub_err_t
|
||||
grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
||||
{
|
||||
grub_uint32_t cont;
|
||||
grub_uint32_t cont = 0;
|
||||
struct grub_machine_mmap_entry *entry
|
||||
= (struct grub_machine_mmap_entry *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
|
||||
int e820_works = 0;
|
||||
|
||||
grub_memset (entry, 0, sizeof (entry));
|
||||
while (1)
|
||||
{
|
||||
grub_memset (entry, 0, sizeof (entry));
|
||||
|
||||
/* Check if grub_get_mmap_entry works. */
|
||||
cont = grub_get_mmap_entry (entry, 0);
|
||||
cont = grub_get_mmap_entry (entry, cont);
|
||||
|
||||
if (entry->size)
|
||||
do
|
||||
{
|
||||
if (hook (entry->addr, entry->len,
|
||||
/* GRUB mmaps have been defined to match with the E820 definition.
|
||||
Therefore, we can just pass type through. */
|
||||
entry->type, hook_data))
|
||||
break;
|
||||
if (!entry->size)
|
||||
break;
|
||||
|
||||
if (! cont)
|
||||
break;
|
||||
if (entry->len)
|
||||
e820_works = 1;
|
||||
if (entry->len
|
||||
&& hook (entry->addr, entry->len,
|
||||
/* GRUB mmaps have been defined to match with
|
||||
the E820 definition.
|
||||
Therefore, we can just pass type through. */
|
||||
entry->type, hook_data))
|
||||
break;
|
||||
|
||||
grub_memset (entry, 0, sizeof (entry));
|
||||
if (! cont)
|
||||
break;
|
||||
}
|
||||
|
||||
cont = grub_get_mmap_entry (entry, cont);
|
||||
}
|
||||
while (entry->size);
|
||||
else
|
||||
if (!e820_works)
|
||||
{
|
||||
grub_uint32_t eisa_mmap = grub_get_eisa_mmap ();
|
||||
|
||||
|
||||
@@ -122,7 +122,11 @@ calibrate_tsc (void)
|
||||
grub_pit_wait (0xffff);
|
||||
end_tsc = grub_get_tsc ();
|
||||
|
||||
grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_time, 0);
|
||||
grub_tsc_rate = 0;
|
||||
if (end_tsc > tsc_boot_time)
|
||||
grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_time, 0);
|
||||
if (grub_tsc_rate == 0)
|
||||
grub_tsc_rate = 5368;/* 800 MHz */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -84,8 +84,10 @@ grub_ieee1275_find_options (void)
|
||||
|
||||
rc = grub_ieee1275_get_property (root, "model",
|
||||
tmp, sizeof (tmp), 0);
|
||||
if (rc >= 0 && !grub_strcmp (tmp, "Emulated PC"))
|
||||
if (rc >= 0 && (!grub_strcmp (tmp, "Emulated PC")
|
||||
|| !grub_strcmp (tmp, "IBM pSeries (emulated by qemu)"))) {
|
||||
is_qemu = 1;
|
||||
}
|
||||
|
||||
if (rc >= 0 && grub_strncmp (tmp, "IBM", 3) == 0)
|
||||
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS);
|
||||
|
||||
@@ -80,9 +80,8 @@ grub_translate_ieee1275_path (char *filepath)
|
||||
}
|
||||
}
|
||||
|
||||
void (*grub_ieee1275_net_config) (const char *dev,
|
||||
char **device,
|
||||
char **path);
|
||||
void (*grub_ieee1275_net_config) (const char *dev, char **device, char **path,
|
||||
char *bootpath);
|
||||
void
|
||||
grub_machine_get_bootlocation (char **device, char **path)
|
||||
{
|
||||
@@ -126,7 +125,7 @@ grub_machine_get_bootlocation (char **device, char **path)
|
||||
*ptr = 0;
|
||||
|
||||
if (grub_ieee1275_net_config)
|
||||
grub_ieee1275_net_config (canon, device, path);
|
||||
grub_ieee1275_net_config (canon, device, path, bootpath);
|
||||
grub_free (dev);
|
||||
grub_free (canon);
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ grub_ieee1275_map (grub_addr_t phys, grub_addr_t virt, grub_size_t size,
|
||||
grub_ieee1275_cell_t mode;
|
||||
grub_ieee1275_cell_t size;
|
||||
grub_ieee1275_cell_t virt;
|
||||
#ifdef GRUB_MACHINE_SPARC64
|
||||
#ifdef __sparc__
|
||||
grub_ieee1275_cell_t phys_high;
|
||||
#endif
|
||||
grub_ieee1275_cell_t phys_low;
|
||||
@@ -279,7 +279,7 @@ grub_ieee1275_map (grub_addr_t phys, grub_addr_t virt, grub_size_t size,
|
||||
} args;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "call-method",
|
||||
#ifdef GRUB_MACHINE_SPARC64
|
||||
#ifdef __sparc__
|
||||
7,
|
||||
#else
|
||||
6,
|
||||
@@ -287,7 +287,7 @@ grub_ieee1275_map (grub_addr_t phys, grub_addr_t virt, grub_size_t size,
|
||||
1);
|
||||
args.method = (grub_ieee1275_cell_t) "map";
|
||||
args.ihandle = grub_ieee1275_mmu;
|
||||
#ifdef GRUB_MACHINE_SPARC64
|
||||
#ifdef __sparc__
|
||||
args.phys_high = 0;
|
||||
#endif
|
||||
args.phys_low = phys;
|
||||
|
||||
@@ -360,7 +360,7 @@ grub_machine_get_bootlocation (char **device, char **path)
|
||||
char *loaddev = boot_location;
|
||||
char *pptr, *partptr;
|
||||
char *dname;
|
||||
grub_disk_addr_t poff = -1, pend;
|
||||
grub_disk_addr_t poff = -1, pend = -1;
|
||||
struct get_device_name_ctx ctx;
|
||||
grub_disk_t parent = 0;
|
||||
unsigned i;
|
||||
|
||||
@@ -542,6 +542,9 @@ memset (void *s, int c, grub_size_t n)
|
||||
return grub_memset (s, c, n);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(GRUB_UTIL) && defined(__APPLE__)
|
||||
void GRUB_BUILTIN_ATTR
|
||||
__bzero (void *s, grub_size_t n)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Special support for eabi and SVR4
|
||||
*
|
||||
* Copyright (C) 1995-2014 Free Software Foundation, Inc.
|
||||
* Written By Michael Meissner
|
||||
* 64-bit support written by David Edelsohn
|
||||
*
|
||||
* This file 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, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This file 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.
|
||||
*
|
||||
* Under Section 7 of GPL version 3, you are granted additional
|
||||
* permissions described in the GCC Runtime Library Exception, version
|
||||
* 3.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* a copy of the GCC Runtime Library Exception along with this program;
|
||||
* see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Do any initializations needed for the eabi environment */
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
.section ".text"
|
||||
|
||||
#define CFI_RESTORE(reg) .cfi_restore reg
|
||||
#define CFI_OFFSET(reg, off) .cfi_offset reg, off
|
||||
#define CFI_DEF_CFA_REGISTER(reg) .cfi_def_cfa_register reg
|
||||
#define CFI_STARTPROC .cfi_startproc
|
||||
#define CFI_ENDPROC .cfi_endproc
|
||||
|
||||
/* Routines for restoring integer registers, called by the compiler. */
|
||||
/* Called with r11 pointing to the stack header word of the caller of the */
|
||||
/* function, just beyond the end of the integer restore area. */
|
||||
|
||||
CFI_STARTPROC
|
||||
CFI_DEF_CFA_REGISTER (11)
|
||||
CFI_OFFSET (65, 4)
|
||||
CFI_OFFSET (14, -72)
|
||||
CFI_OFFSET (15, -68)
|
||||
CFI_OFFSET (16, -64)
|
||||
CFI_OFFSET (17, -60)
|
||||
CFI_OFFSET (18, -56)
|
||||
CFI_OFFSET (19, -52)
|
||||
CFI_OFFSET (20, -48)
|
||||
CFI_OFFSET (21, -44)
|
||||
CFI_OFFSET (22, -40)
|
||||
CFI_OFFSET (23, -36)
|
||||
CFI_OFFSET (24, -32)
|
||||
CFI_OFFSET (25, -28)
|
||||
CFI_OFFSET (26, -24)
|
||||
CFI_OFFSET (27, -20)
|
||||
CFI_OFFSET (28, -16)
|
||||
CFI_OFFSET (29, -12)
|
||||
CFI_OFFSET (30, -8)
|
||||
CFI_OFFSET (31, -4)
|
||||
FUNCTION(_restgpr_14_x) lwz 14,-72(11) /* restore gp registers */
|
||||
CFI_RESTORE (14)
|
||||
FUNCTION(_restgpr_15_x) lwz 15,-68(11)
|
||||
CFI_RESTORE (15)
|
||||
FUNCTION(_restgpr_16_x) lwz 16,-64(11)
|
||||
CFI_RESTORE (16)
|
||||
FUNCTION(_restgpr_17_x) lwz 17,-60(11)
|
||||
CFI_RESTORE (17)
|
||||
FUNCTION(_restgpr_18_x) lwz 18,-56(11)
|
||||
CFI_RESTORE (18)
|
||||
FUNCTION(_restgpr_19_x) lwz 19,-52(11)
|
||||
CFI_RESTORE (19)
|
||||
FUNCTION(_restgpr_20_x) lwz 20,-48(11)
|
||||
CFI_RESTORE (20)
|
||||
FUNCTION(_restgpr_21_x) lwz 21,-44(11)
|
||||
CFI_RESTORE (21)
|
||||
FUNCTION(_restgpr_22_x) lwz 22,-40(11)
|
||||
CFI_RESTORE (22)
|
||||
FUNCTION(_restgpr_23_x) lwz 23,-36(11)
|
||||
CFI_RESTORE (23)
|
||||
FUNCTION(_restgpr_24_x) lwz 24,-32(11)
|
||||
CFI_RESTORE (24)
|
||||
FUNCTION(_restgpr_25_x) lwz 25,-28(11)
|
||||
CFI_RESTORE (25)
|
||||
FUNCTION(_restgpr_26_x) lwz 26,-24(11)
|
||||
CFI_RESTORE (26)
|
||||
FUNCTION(_restgpr_27_x) lwz 27,-20(11)
|
||||
CFI_RESTORE (27)
|
||||
FUNCTION(_restgpr_28_x) lwz 28,-16(11)
|
||||
CFI_RESTORE (28)
|
||||
FUNCTION(_restgpr_29_x) lwz 29,-12(11)
|
||||
CFI_RESTORE (29)
|
||||
FUNCTION(_restgpr_30_x) lwz 30,-8(11)
|
||||
CFI_RESTORE (30)
|
||||
FUNCTION(_restgpr_31_x) lwz 0,4(11)
|
||||
lwz 31,-4(11)
|
||||
CFI_RESTORE (31)
|
||||
mtlr 0
|
||||
CFI_RESTORE (65)
|
||||
mr 1,11
|
||||
CFI_DEF_CFA_REGISTER (1)
|
||||
blr
|
||||
CFI_ENDPROC
|
||||
|
||||
CFI_STARTPROC
|
||||
FUNCTION(_savegpr_14) stw 14,-72(11) /* save gp registers */
|
||||
FUNCTION(_savegpr_15) stw 15,-68(11)
|
||||
FUNCTION(_savegpr_16) stw 16,-64(11)
|
||||
FUNCTION(_savegpr_17) stw 17,-60(11)
|
||||
FUNCTION(_savegpr_18) stw 18,-56(11)
|
||||
FUNCTION(_savegpr_19) stw 19,-52(11)
|
||||
FUNCTION(_savegpr_20) stw 20,-48(11)
|
||||
FUNCTION(_savegpr_21) stw 21,-44(11)
|
||||
FUNCTION(_savegpr_22) stw 22,-40(11)
|
||||
FUNCTION(_savegpr_23) stw 23,-36(11)
|
||||
FUNCTION(_savegpr_24) stw 24,-32(11)
|
||||
FUNCTION(_savegpr_25) stw 25,-28(11)
|
||||
FUNCTION(_savegpr_26) stw 26,-24(11)
|
||||
FUNCTION(_savegpr_27) stw 27,-20(11)
|
||||
FUNCTION(_savegpr_28) stw 28,-16(11)
|
||||
FUNCTION(_savegpr_29) stw 29,-12(11)
|
||||
FUNCTION(_savegpr_30) stw 30,-8(11)
|
||||
FUNCTION(_savegpr_31) stw 31,-4(11)
|
||||
blr
|
||||
CFI_ENDPROC
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <grub/uboot/uboot.h>
|
||||
#include <grub/uboot/api_public.h>
|
||||
#include <grub/cpu/system.h>
|
||||
#include <grub/cache.h>
|
||||
|
||||
extern char __bss_start[];
|
||||
extern char _end[];
|
||||
@@ -107,6 +108,11 @@ grub_machine_init (void)
|
||||
/* Enumerate memory and initialize the memory management system. */
|
||||
grub_uboot_mm_init ();
|
||||
|
||||
/* Should be earlier but it needs memalign. */
|
||||
#ifdef __arm__
|
||||
grub_arm_enable_caches_mmu ();
|
||||
#endif
|
||||
|
||||
grub_dprintf ("init", "__bss_start: %p\n", __bss_start);
|
||||
grub_dprintf ("init", "_end: %p\n", _end);
|
||||
grub_dprintf ("init", "grub_modbase: %p\n", (void *) grub_modbase);
|
||||
|
||||
@@ -73,7 +73,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||
{
|
||||
grub_int64_t value;
|
||||
value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
|
||||
(Elf64_Xword) seg->addr - rel->r_offset;
|
||||
(Elf64_Xword) (grub_addr_t) seg->addr - rel->r_offset;
|
||||
if (value != (grub_int32_t) value)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
|
||||
*addr32 = value;
|
||||
@@ -83,7 +83,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||
case R_X86_64_PC64:
|
||||
{
|
||||
*addr64 += rel->r_addend + sym->st_value -
|
||||
(Elf64_Xword) seg->addr - rel->r_offset;
|
||||
(Elf64_Xword) (grub_addr_t) seg->addr - rel->r_offset;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
+34
-5
@@ -164,10 +164,10 @@ static int add_subnode (void *fdt, int parentoffset, const char *name)
|
||||
insert:
|
||||
grub_memmove (token + entry_size / sizeof(*token), token,
|
||||
(grub_addr_t) end - (grub_addr_t) token);
|
||||
*token = grub_cpu_to_be32(FDT_BEGIN_NODE);
|
||||
*token = grub_cpu_to_be32_compile_time(FDT_BEGIN_NODE);
|
||||
token[entry_size / sizeof(*token) - 2] = 0; /* padding bytes */
|
||||
grub_strcpy((char *) (token + 1), name);
|
||||
token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32(FDT_END_NODE);
|
||||
token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32_compile_time(FDT_END_NODE);
|
||||
grub_fdt_set_size_dt_struct (fdt, struct_size + entry_size);
|
||||
return ((grub_addr_t) token - (grub_addr_t) fdt
|
||||
- grub_fdt_get_off_dt_struct(fdt));
|
||||
@@ -377,7 +377,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
|
||||
|
||||
prop_name_present = 1;
|
||||
for (i = 0; i < prop_len / sizeof(grub_uint32_t); i++)
|
||||
*(prop + 3 + i) = grub_cpu_to_be32 (FDT_NOP);
|
||||
*(prop + 3 + i) = grub_cpu_to_be32_compile_time (FDT_NOP);
|
||||
if (len > ALIGN_UP(prop_len, sizeof(grub_uint32_t)))
|
||||
{
|
||||
/* Length of new property value is greater than the space allocated
|
||||
@@ -385,7 +385,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
|
||||
nameoff field of the current entry and replace the current entry
|
||||
with NOP tokens. */
|
||||
nameoff = grub_be_to_cpu32 (*(prop + 2));
|
||||
*prop = *(prop + 1) = *(prop + 2) = grub_cpu_to_be32 (FDT_NOP);
|
||||
*prop = *(prop + 1) = *(prop + 2) = grub_cpu_to_be32_compile_time (FDT_NOP);
|
||||
prop = NULL;
|
||||
}
|
||||
}
|
||||
@@ -419,7 +419,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
|
||||
struct_end(fdt) - (grub_addr_t) prop);
|
||||
grub_fdt_set_size_dt_struct (fdt, grub_fdt_get_size_dt_struct (fdt)
|
||||
+ prop_entry_size(len));
|
||||
*prop = grub_cpu_to_be32 (FDT_PROP);
|
||||
*prop = grub_cpu_to_be32_compile_time (FDT_PROP);
|
||||
*(prop + 2) = grub_cpu_to_be32 (nameoff);
|
||||
}
|
||||
*(prop + 1) = grub_cpu_to_be32 (len);
|
||||
@@ -431,3 +431,32 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
|
||||
grub_memcpy (prop + 3, val, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
grub_fdt_create_empty_tree (void *fdt, unsigned int size)
|
||||
{
|
||||
struct grub_fdt_empty_tree *et;
|
||||
|
||||
if (size < GRUB_FDT_EMPTY_TREE_SZ)
|
||||
return -1;
|
||||
|
||||
grub_memset (fdt, 0, size);
|
||||
et = fdt;
|
||||
|
||||
et->empty_node.tree_end = grub_cpu_to_be32_compile_time (FDT_END);
|
||||
et->empty_node.node_end = grub_cpu_to_be32_compile_time (FDT_END_NODE);
|
||||
et->empty_node.node_start = grub_cpu_to_be32_compile_time (FDT_BEGIN_NODE);
|
||||
((struct grub_fdt_empty_tree *) fdt)->header.off_mem_rsvmap =
|
||||
grub_cpu_to_be32_compile_time (ALIGN_UP (sizeof (grub_fdt_header_t), 8));
|
||||
|
||||
grub_fdt_set_off_dt_strings (fdt, sizeof (*et));
|
||||
grub_fdt_set_off_dt_struct (fdt,
|
||||
sizeof (et->header) + sizeof (et->empty_rsvmap));
|
||||
grub_fdt_set_version (fdt, FDT_SUPPORTED_VERSION);
|
||||
grub_fdt_set_last_comp_version (fdt, FDT_SUPPORTED_VERSION);
|
||||
grub_fdt_set_size_dt_struct (fdt, sizeof (et->empty_node));
|
||||
grub_fdt_set_totalsize (fdt, size);
|
||||
grub_fdt_set_magic (fdt, FDT_MAGIC);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -81,10 +81,13 @@ grub_relocator32_boot (struct grub_relocator *rel,
|
||||
void *relst;
|
||||
grub_relocator_chunk_t ch;
|
||||
|
||||
err = grub_relocator_alloc_chunk_align (rel, &ch, 0,
|
||||
(0xffffffff - RELOCATOR_SIZEOF (32))
|
||||
+ 1, RELOCATOR_SIZEOF (32), 16,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE,
|
||||
/* Specific memory range due to Global Descriptor Table for use by payload
|
||||
that we will store in returned chunk. The address range and preference
|
||||
are based on "THE LINUX/x86 BOOT PROTOCOL" specification. */
|
||||
err = grub_relocator_alloc_chunk_align (rel, &ch, 0x1000,
|
||||
0x9a000 - RELOCATOR_SIZEOF (32),
|
||||
RELOCATOR_SIZEOF (32), 16,
|
||||
GRUB_RELOCATOR_PREFERENCE_LOW,
|
||||
avoid_efi_bootservices);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -357,7 +357,7 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen)
|
||||
|
||||
for (j = KC-1; j >= 0; j--)
|
||||
{
|
||||
*((u32*)tk[j]) = *((u32*)k[j]);
|
||||
*((u32_a_t*)tk[j]) = *((u32_a_t*)k[j]);
|
||||
}
|
||||
r = 0;
|
||||
t = 0;
|
||||
@@ -366,7 +366,7 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen)
|
||||
{
|
||||
for (; (j < KC) && (t < 4); j++, t++)
|
||||
{
|
||||
*((u32*)W[r][t]) = *((u32*)tk[j]);
|
||||
*((u32_a_t*)W[r][t]) = *((u32_a_t*)tk[j]);
|
||||
}
|
||||
if (t == 4)
|
||||
{
|
||||
@@ -389,14 +389,14 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen)
|
||||
{
|
||||
for (j = 1; j < KC; j++)
|
||||
{
|
||||
*((u32*)tk[j]) ^= *((u32*)tk[j-1]);
|
||||
*((u32_a_t*)tk[j]) ^= *((u32_a_t*)tk[j-1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 1; j < KC/2; j++)
|
||||
{
|
||||
*((u32*)tk[j]) ^= *((u32*)tk[j-1]);
|
||||
*((u32_a_t*)tk[j]) ^= *((u32_a_t*)tk[j-1]);
|
||||
}
|
||||
tk[KC/2][0] ^= S[tk[KC/2 - 1][0]];
|
||||
tk[KC/2][1] ^= S[tk[KC/2 - 1][1]];
|
||||
@@ -404,7 +404,7 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen)
|
||||
tk[KC/2][3] ^= S[tk[KC/2 - 1][3]];
|
||||
for (j = KC/2 + 1; j < KC; j++)
|
||||
{
|
||||
*((u32*)tk[j]) ^= *((u32*)tk[j-1]);
|
||||
*((u32_a_t*)tk[j]) ^= *((u32_a_t*)tk[j-1]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen)
|
||||
{
|
||||
for (; (j < KC) && (t < 4); j++, t++)
|
||||
{
|
||||
*((u32*)W[r][t]) = *((u32*)tk[j]);
|
||||
*((u32_a_t*)W[r][t]) = *((u32_a_t*)tk[j]);
|
||||
}
|
||||
if (t == 4)
|
||||
{
|
||||
@@ -483,29 +483,29 @@ prepare_decryption( RIJNDAEL_context *ctx )
|
||||
|
||||
for (r=0; r < MAXROUNDS+1; r++ )
|
||||
{
|
||||
*((u32*)ctx->keyschdec[r][0]) = *((u32*)ctx->keyschenc[r][0]);
|
||||
*((u32*)ctx->keyschdec[r][1]) = *((u32*)ctx->keyschenc[r][1]);
|
||||
*((u32*)ctx->keyschdec[r][2]) = *((u32*)ctx->keyschenc[r][2]);
|
||||
*((u32*)ctx->keyschdec[r][3]) = *((u32*)ctx->keyschenc[r][3]);
|
||||
*((u32_a_t*)ctx->keyschdec[r][0]) = *((u32_a_t*)ctx->keyschenc[r][0]);
|
||||
*((u32_a_t*)ctx->keyschdec[r][1]) = *((u32_a_t*)ctx->keyschenc[r][1]);
|
||||
*((u32_a_t*)ctx->keyschdec[r][2]) = *((u32_a_t*)ctx->keyschenc[r][2]);
|
||||
*((u32_a_t*)ctx->keyschdec[r][3]) = *((u32_a_t*)ctx->keyschenc[r][3]);
|
||||
}
|
||||
#define W (ctx->keyschdec)
|
||||
for (r = 1; r < ctx->rounds; r++)
|
||||
{
|
||||
w = W[r][0];
|
||||
*((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]])
|
||||
^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]);
|
||||
*((u32_a_t*)w) = *((u32_a_t*)U1[w[0]]) ^ *((u32_a_t*)U2[w[1]])
|
||||
^ *((u32_a_t*)U3[w[2]]) ^ *((u32_a_t*)U4[w[3]]);
|
||||
|
||||
w = W[r][1];
|
||||
*((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]])
|
||||
^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]);
|
||||
*((u32_a_t*)w) = *((u32_a_t*)U1[w[0]]) ^ *((u32_a_t*)U2[w[1]])
|
||||
^ *((u32_a_t*)U3[w[2]]) ^ *((u32_a_t*)U4[w[3]]);
|
||||
|
||||
w = W[r][2];
|
||||
*((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]])
|
||||
^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]);
|
||||
*((u32_a_t*)w) = *((u32_a_t*)U1[w[0]]) ^ *((u32_a_t*)U2[w[1]])
|
||||
^ *((u32_a_t*)U3[w[2]]) ^ *((u32_a_t*)U4[w[3]]);
|
||||
|
||||
w = W[r][3];
|
||||
*((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]])
|
||||
^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]);
|
||||
*((u32_a_t*)w) = *((u32_a_t*)U1[w[0]]) ^ *((u32_a_t*)U2[w[1]])
|
||||
^ *((u32_a_t*)U3[w[2]]) ^ *((u32_a_t*)U4[w[3]]);
|
||||
}
|
||||
#undef W
|
||||
#undef w
|
||||
|
||||
@@ -52,7 +52,7 @@ grub_crypto_pbkdf2 (const struct gcry_md_spec *md,
|
||||
grub_uint8_t *tmp;
|
||||
grub_size_t tmplen = Slen + 4;
|
||||
|
||||
if (md->mdlen > GRUB_CRYPTO_MAX_MDLEN)
|
||||
if (md->mdlen > GRUB_CRYPTO_MAX_MDLEN || md->mdlen == 0)
|
||||
return GPG_ERR_INV_ARG;
|
||||
|
||||
if (c == 0)
|
||||
|
||||
Loaded 100 of 231 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user