mirror of
https://git.proxmox.com/git/grub2
synced 2025-07-15 13:47:10 +00:00
Import grub2_2.06.orig.tar.xz
This commit is contained in:
commit
21f954425f
69
INSTALL
69
INSTALL
@ -11,27 +11,9 @@ GRUB depends on some software packages installed into your system. If
|
||||
you don't have any of them, please obtain and install them before
|
||||
configuring the GRUB.
|
||||
|
||||
* GCC 4.1.3 or later
|
||||
Note: older versions may work but support is limited
|
||||
|
||||
Experimental support for clang 3.3 or later (results in much bigger binaries)
|
||||
* GCC 5.1.0 or later
|
||||
Experimental support for clang 3.8.0 or later (results in much bigger binaries)
|
||||
for i386, x86_64, arm (including thumb), arm64, mips(el), powerpc, sparc64
|
||||
Note: clang 3.2 or later works for i386 and x86_64 targets but results in
|
||||
much bigger binaries.
|
||||
earlier versions not tested
|
||||
Note: clang 3.2 or later works for arm
|
||||
earlier versions not tested
|
||||
Note: clang on arm64 is not supported due to
|
||||
https://llvm.org/bugs/show_bug.cgi?id=26030
|
||||
Note: clang 3.3 or later works for mips(el)
|
||||
earlier versions fail to generate .reginfo and hence gprel relocations
|
||||
fail.
|
||||
Note: clang 3.2 or later works for powerpc
|
||||
earlier versions not tested
|
||||
Note: clang 3.5 or later works for sparc64
|
||||
earlier versions return "error: unable to interface with target machine"
|
||||
Note: clang has no support for ia64 and hence you can't compile GRUB
|
||||
for ia64 with clang
|
||||
* GNU Make
|
||||
* GNU Bison 2.3 or later
|
||||
* GNU gettext 0.17 or later
|
||||
@ -160,12 +142,20 @@ 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 omitted):
|
||||
|
||||
./configure BUILD_CC=gcc BUILD_PKG_CONFIG=pkg-config --host=amd64-linux-gnu
|
||||
CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" PKG_CONFIG=amd64-linux-gnu-pkg-config
|
||||
--target=arm --with-platform=uboot TARGET_CC=arm-elf-gcc
|
||||
TARGET_CFLAGS="-Os -march=armv6" TARGET_CCASFLAGS="-march=armv6"
|
||||
TARGET_OBJCOPY="arm-elf-objcopy" TARGET_STRIP="arm-elf-strip"
|
||||
TARGET_NM=arm-elf-nm TARGET_RANLIB=arm-elf-ranlib LEX=gflex
|
||||
./configure --host=x86_64-linux-gnu --target=arm-linux-gnueabihf \
|
||||
--with-platform=efi BUILD_CC=gcc BUILD_PKG_CONFIG=pkg-config \
|
||||
HOST_CC=x86_64-linux-gnu-gcc HOST_CFLAGS='-g -O2' \
|
||||
PKG_CONFIG=x86_64-linux-gnu-pkg-config TARGET_CC=arm-linux-gnueabihf-gcc \
|
||||
TARGET_CFLAGS='-Os -march=armv8.3-a' TARGET_CCASFLAGS='-march=armv8.3-a' \
|
||||
TARGET_OBJCOPY=arm-linux-gnueabihf-objcopy \
|
||||
TARGET_STRIP=arm-linux-gnueabihf-strip TARGET_NM=arm-linux-gnueabihf-nm \
|
||||
TARGET_RANLIB=arm-linux-gnueabihf-ranlib LEX=flex
|
||||
|
||||
Normally, for building a GRUB on amd64 with tools to run on amd64 to
|
||||
generate images to run on ARM, using your Linux distribution's
|
||||
packaged cross compiler, the following would suffice:
|
||||
|
||||
./configure --target=arm-linux-gnueabihf --with-platform=efi
|
||||
|
||||
You need to use following options to specify tools and platforms. For minimum
|
||||
version look at prerequisites. All tools not mentioned in this section under
|
||||
@ -182,20 +172,23 @@ corresponding platform are not needed for the platform in question.
|
||||
|
||||
- For host
|
||||
1. --host= to autoconf name of host.
|
||||
2. CC= for gcc able to compile for host
|
||||
3. HOST_CFLAGS= for C options for host.
|
||||
4. HOST_CPPFLAGS= for C preprocessor options for host.
|
||||
5. HOST_LDFLAGS= for linker options for host.
|
||||
6. PKG_CONFIG= for pkg-config for host (optional).
|
||||
7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
|
||||
8. Libfuse if any must be in standard linker folders (-lfuse) (optional).
|
||||
9. Libzfs if any must be in standard linker folders (-lzfs) (optional).
|
||||
10. Liblzma if any must be in standard linker folders (-llzma) (optional).
|
||||
2. CC= for gcc able to compile for host.
|
||||
3. CFLAGS= for C options for host.
|
||||
4. HOST_CC= for gcc able to compile for host.
|
||||
5. HOST_CFLAGS= for C options for host.
|
||||
6. HOST_CPPFLAGS= for C preprocessor options for host.
|
||||
7. HOST_LDFLAGS= for linker options for host.
|
||||
8. PKG_CONFIG= for pkg-config for host (optional).
|
||||
9. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
|
||||
10. Libfuse if any must be in standard linker folders (-lfuse) (optional).
|
||||
11. Libzfs if any must be in standard linker folders (-lzfs) (optional).
|
||||
12. Liblzma if any must be in standard linker folders (-llzma) (optional).
|
||||
Note: The HOST_* variables override not prefixed variables.
|
||||
|
||||
- For target
|
||||
1. --target= to autoconf cpu name of target.
|
||||
2. --with-platform to choose firmware.
|
||||
3. TARGET_CC= for gcc able to compile for target
|
||||
3. TARGET_CC= for gcc able to compile for target.
|
||||
4. TARGET_CFLAGS= for C options for target.
|
||||
5. TARGET_CPPFLAGS= for C preprocessor options for target.
|
||||
6. TARGET_CCASFLAGS= for assembler options for target.
|
||||
@ -204,6 +197,10 @@ corresponding platform are not needed for the platform in question.
|
||||
9. TARGET_STRIP= for strip for target.
|
||||
10. TARGET_NM= for nm for target.
|
||||
11. TARGET_RANLIB= for ranlib for target.
|
||||
Note: If the TARGET_* variables are not specified then they will default
|
||||
to be the same as the host variables. If host variables are not
|
||||
specified then the TARGET_* variables will default to be the same
|
||||
as not prefixed variables.
|
||||
|
||||
- Additionally for emu, for host and target.
|
||||
1. SDL is looked for in standard linker directories (-lSDL) (optional)
|
||||
|
@ -37,7 +37,7 @@ grub_script.yy.c: grub_script.yy.h
|
||||
CLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||
|
||||
# For libgrub.a
|
||||
libgrub.pp: grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgrubkern_a_SOURCES)
|
||||
libgrub.pp: config-util.h grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgrubkern_a_SOURCES)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) \
|
||||
-D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1)
|
||||
CLEANFILES += libgrub.pp
|
||||
|
324
Makefile.in
324
Makefile.in
@ -247,8 +247,8 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
|
||||
$(top_srcdir)/m4/__inline.m4 \
|
||||
$(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
|
||||
$(top_srcdir)/m4/argp.m4 $(top_srcdir)/m4/btowc.m4 \
|
||||
$(top_srcdir)/m4/builtin-expect.m4 \
|
||||
$(top_srcdir)/m4/argp.m4 $(top_srcdir)/m4/base64.m4 \
|
||||
$(top_srcdir)/m4/btowc.m4 $(top_srcdir)/m4/builtin-expect.m4 \
|
||||
$(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/close.m4 \
|
||||
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/dirent_h.m4 \
|
||||
$(top_srcdir)/m4/dirfd.m4 $(top_srcdir)/m4/dirname.m4 \
|
||||
@ -391,7 +391,9 @@ am_libgrubkern_a_OBJECTS = util/libgrubkern_a-misc.$(OBJEXT) \
|
||||
grub-core/kern/libgrubkern_a-misc.$(OBJEXT) \
|
||||
grub-core/kern/libgrubkern_a-partition.$(OBJEXT) \
|
||||
grub-core/lib/libgrubkern_a-crypto.$(OBJEXT) \
|
||||
grub-core/lib/json/libgrubkern_a-json.$(OBJEXT) \
|
||||
grub-core/disk/libgrubkern_a-luks.$(OBJEXT) \
|
||||
grub-core/disk/libgrubkern_a-luks2.$(OBJEXT) \
|
||||
grub-core/disk/libgrubkern_a-geli.$(OBJEXT) \
|
||||
grub-core/disk/libgrubkern_a-cryptodisk.$(OBJEXT) \
|
||||
grub-core/disk/libgrubkern_a-AFSplitter.$(OBJEXT) \
|
||||
@ -487,7 +489,7 @@ am_libgrubmods_a_OBJECTS = \
|
||||
grub-core/lib/libgrubmods_a-crc.$(OBJEXT) \
|
||||
grub-core/lib/libgrubmods_a-adler32.$(OBJEXT) \
|
||||
grub-core/lib/libgrubmods_a-crc64.$(OBJEXT) \
|
||||
grub-core/normal/libgrubmods_a-datetime.$(OBJEXT) \
|
||||
grub-core/lib/libgrubmods_a-datetime.$(OBJEXT) \
|
||||
grub-core/normal/libgrubmods_a-misc.$(OBJEXT) \
|
||||
grub-core/partmap/libgrubmods_a-acorn.$(OBJEXT) \
|
||||
grub-core/partmap/libgrubmods_a-amiga.$(OBJEXT) \
|
||||
@ -604,14 +606,23 @@ grub_bios_setup_LINK = $(CCLD) $(grub_bios_setup_CFLAGS) $(CFLAGS) \
|
||||
$(grub_bios_setup_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_grub_editenv_OBJECTS = util/grub_editenv-grub-editenv.$(OBJEXT) \
|
||||
util/grub_editenv-editenv.$(OBJEXT) \
|
||||
grub-core/osdep/grub_editenv-init.$(OBJEXT)
|
||||
util/grub_editenv-grub-install-common.$(OBJEXT) \
|
||||
grub-core/osdep/grub_editenv-init.$(OBJEXT) \
|
||||
grub-core/osdep/grub_editenv-compress.$(OBJEXT) \
|
||||
util/grub_editenv-mkimage.$(OBJEXT) \
|
||||
util/grub_editenv-grub-mkimage32.$(OBJEXT) \
|
||||
util/grub_editenv-grub-mkimage64.$(OBJEXT) \
|
||||
grub-core/osdep/grub_editenv-config.$(OBJEXT) \
|
||||
util/grub_editenv-config.$(OBJEXT) \
|
||||
util/grub_editenv-resolve.$(OBJEXT)
|
||||
nodist_grub_editenv_OBJECTS =
|
||||
grub_editenv_OBJECTS = $(am_grub_editenv_OBJECTS) \
|
||||
$(nodist_grub_editenv_OBJECTS)
|
||||
grub_editenv_DEPENDENCIES = libgrubmods.a libgrubgcry.a libgrubkern.a \
|
||||
grub-core/lib/gnulib/libgnu.a $(am__DEPENDENCIES_1) \
|
||||
grub_editenv_DEPENDENCIES = $(am__DEPENDENCIES_1) libgrubmods.a \
|
||||
libgrubgcry.a libgrubkern.a grub-core/lib/gnulib/libgnu.a \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1)
|
||||
grub_editenv_LINK = $(CCLD) $(grub_editenv_CFLAGS) $(CFLAGS) \
|
||||
$(grub_editenv_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_grub_file_OBJECTS = util/grub_file-grub-file.$(OBJEXT) \
|
||||
@ -1241,11 +1252,11 @@ am__dist_noinst_DATA_DIST = grub-core/kern/disk_common.c \
|
||||
grub-core/lib/libgcrypt-grub/cipher/ChangeLog \
|
||||
grub-core/osdep/aros/config.c grub-core/osdep/windows/config.c \
|
||||
grub-core/osdep/unix/config.c util/grub-mkimagexx.c \
|
||||
util/setup.c grub-core/osdep/generic/blocklist.c \
|
||||
grub-core/osdep/unix/compress.c \
|
||||
grub-core/osdep/basic/compress.c util/setup.c \
|
||||
grub-core/osdep/generic/blocklist.c \
|
||||
grub-core/osdep/linux/blocklist.c \
|
||||
grub-core/osdep/windows/blocklist.c \
|
||||
grub-core/osdep/unix/compress.c \
|
||||
grub-core/osdep/basic/compress.c \
|
||||
grub-core/osdep/linux/platform.c \
|
||||
grub-core/osdep/windows/platform.c \
|
||||
grub-core/osdep/basic/platform.c \
|
||||
@ -1255,14 +1266,14 @@ am__dist_noinst_DATA_DIST = grub-core/kern/disk_common.c \
|
||||
util/grub.d/10_kfreebsd.in util/grub.d/10_illumos.in \
|
||||
util/grub.d/10_netbsd.in util/grub.d/10_linux.in \
|
||||
util/grub.d/10_xnu.in util/grub.d/20_linux_xen.in \
|
||||
util/grub.d/30_os-prober.in util/grub.d/40_custom.in \
|
||||
util/grub.d/41_custom.in util/grub-mkconfig.in \
|
||||
util/grub-set-default.in util/grub-reboot.in \
|
||||
util/grub-mkconfig_lib.in util/grub-kbdcomp.in \
|
||||
tests/util/grub-shell.in tests/util/grub-shell-tester.in \
|
||||
tests/util/grub-fs-tester.in tests/ext234_test.in \
|
||||
tests/squashfs_test.in tests/iso9660_test.in \
|
||||
tests/hfsplus_test.in tests/ntfs_test.in \
|
||||
util/grub.d/30_os-prober.in util/grub.d/30_uefi-firmware.in \
|
||||
util/grub.d/40_custom.in util/grub.d/41_custom.in \
|
||||
util/grub-mkconfig.in util/grub-set-default.in \
|
||||
util/grub-reboot.in util/grub-mkconfig_lib.in \
|
||||
util/grub-kbdcomp.in tests/util/grub-shell.in \
|
||||
tests/util/grub-shell-tester.in tests/util/grub-fs-tester.in \
|
||||
tests/ext234_test.in tests/squashfs_test.in \
|
||||
tests/iso9660_test.in tests/hfsplus_test.in tests/ntfs_test.in \
|
||||
tests/reiserfs_test.in tests/fat_test.in tests/minixfs_test.in \
|
||||
tests/xfs_test.in tests/f2fs_test.in tests/nilfs2_test.in \
|
||||
tests/romfs_test.in tests/exfat_test.in tests/tar_test.in \
|
||||
@ -2617,7 +2628,9 @@ CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
|
||||
CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)' \
|
||||
'-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)' \
|
||||
'-Dgrub_register_command_lockdown(...)=COMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)' \
|
||||
'-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)' \
|
||||
'-Dgrub_register_extcmd_lockdown(...)=EXTCOMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)' \
|
||||
'-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_FDT_LIST := '-Dgrub_fdtbus_register(...)=FDT_DRIVER_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
|
||||
@ -2668,7 +2681,7 @@ noinst_SCRIPTS = grub-mkconfig_lib grub-shell grub-shell-tester \
|
||||
grubconf_SCRIPTS = 00_header $(am__append_57) $(am__append_61) \
|
||||
$(am__append_65) $(am__append_69) $(am__append_73) \
|
||||
$(am__append_77) $(am__append_81) $(am__append_85) \
|
||||
30_os-prober 40_custom 41_custom
|
||||
30_os-prober 30_uefi-firmware 40_custom 41_custom
|
||||
noinst_LIBRARIES = libgrubkern.a libgrubmods.a libgrubgcry.a
|
||||
dist_noinst_DATA = grub-core/kern/disk_common.c \
|
||||
grub-core/osdep/unix/relpath.c grub-core/osdep/aros/relpath.c \
|
||||
@ -2676,8 +2689,10 @@ dist_noinst_DATA = grub-core/kern/disk_common.c \
|
||||
grub-core/lib/libgcrypt-grub/cipher/ChangeLog \
|
||||
grub-core/osdep/aros/config.c grub-core/osdep/windows/config.c \
|
||||
grub-core/osdep/unix/config.c util/grub-mkimagexx.c \
|
||||
$(am__append_13) $(am__append_21) $(am__append_27) \
|
||||
util/setup.c grub-core/osdep/generic/blocklist.c \
|
||||
grub-core/osdep/unix/compress.c \
|
||||
grub-core/osdep/basic/compress.c $(am__append_13) \
|
||||
$(am__append_21) $(am__append_27) util/setup.c \
|
||||
grub-core/osdep/generic/blocklist.c \
|
||||
grub-core/osdep/linux/blocklist.c \
|
||||
grub-core/osdep/windows/blocklist.c $(am__append_40) \
|
||||
grub-core/osdep/linux/platform.c \
|
||||
@ -2688,14 +2703,14 @@ dist_noinst_DATA = grub-core/kern/disk_common.c \
|
||||
util/grub.d/00_header.in $(am__append_60) $(am__append_64) \
|
||||
$(am__append_68) $(am__append_72) $(am__append_76) \
|
||||
$(am__append_80) $(am__append_84) $(am__append_88) \
|
||||
util/grub.d/30_os-prober.in util/grub.d/40_custom.in \
|
||||
util/grub.d/41_custom.in util/grub-mkconfig.in \
|
||||
util/grub-set-default.in util/grub-reboot.in \
|
||||
util/grub-mkconfig_lib.in util/grub-kbdcomp.in \
|
||||
tests/util/grub-shell.in tests/util/grub-shell-tester.in \
|
||||
tests/util/grub-fs-tester.in tests/ext234_test.in \
|
||||
tests/squashfs_test.in tests/iso9660_test.in \
|
||||
tests/hfsplus_test.in tests/ntfs_test.in \
|
||||
util/grub.d/30_os-prober.in util/grub.d/30_uefi-firmware.in \
|
||||
util/grub.d/40_custom.in util/grub.d/41_custom.in \
|
||||
util/grub-mkconfig.in util/grub-set-default.in \
|
||||
util/grub-reboot.in util/grub-mkconfig_lib.in \
|
||||
util/grub-kbdcomp.in tests/util/grub-shell.in \
|
||||
tests/util/grub-shell-tester.in tests/util/grub-fs-tester.in \
|
||||
tests/ext234_test.in tests/squashfs_test.in \
|
||||
tests/iso9660_test.in tests/hfsplus_test.in tests/ntfs_test.in \
|
||||
tests/reiserfs_test.in tests/fat_test.in tests/minixfs_test.in \
|
||||
tests/xfs_test.in tests/f2fs_test.in tests/nilfs2_test.in \
|
||||
tests/romfs_test.in tests/exfat_test.in tests/tar_test.in \
|
||||
@ -2739,7 +2754,13 @@ EXTRA_DIST = autogen.sh geninit.sh gentpl.py Makefile.util.def \
|
||||
grub-core/genmoddep.awk grub-core/genmod.sh.in \
|
||||
grub-core/gensyminfo.sh.in grub-core/gensymlist.sh \
|
||||
grub-core/genemuinit.sh grub-core/genemuinitheader.sh \
|
||||
grub-core/lib/gnulib-patches/fix-base64.patch \
|
||||
grub-core/lib/gnulib-patches/fix-null-deref.patch \
|
||||
grub-core/lib/gnulib-patches/fix-null-state-deref.patch \
|
||||
grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch \
|
||||
grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch \
|
||||
grub-core/lib/gnulib-patches/fix-uninit-structure.patch \
|
||||
grub-core/lib/gnulib-patches/fix-unused-value.patch \
|
||||
grub-core/lib/gnulib-patches/fix-width.patch \
|
||||
grub-core/lib/gnulib-patches/no-abort.patch \
|
||||
grub-core/lib/libgcrypt \
|
||||
@ -2779,6 +2800,13 @@ EXTRA_DIST = autogen.sh geninit.sh gentpl.py Makefile.util.def \
|
||||
grub-core/osdep/windows/password.c \
|
||||
grub-core/osdep/windows/random.c \
|
||||
grub-core/osdep/windows/sleep.c \
|
||||
po/gettext-patches/0001-Support-POTFILES-shell.patch \
|
||||
po/gettext-patches/0002-Handle-gettext_printf-shell-function.patch \
|
||||
po/gettext-patches/0003-Make-msgfmt-output-in-little-endian.patch \
|
||||
po/gettext-patches/0004-Use-SHELL-rather-than-bin-sh.patch \
|
||||
po/POTFILES-shell.in po/README po/Rules-translit \
|
||||
po/Rules-windowsdir po/arabic.sed po/cyrillic.sed po/greek.sed \
|
||||
po/grub.d.sed po/hebrew.sed \
|
||||
tests/dfly-mbr-mbexample.mbr.img.gz \
|
||||
tests/dfly-mbr-mbexample.dfly.img.gz coreboot.cfg \
|
||||
tests/file_filter/file tests/file_filter/file.gz \
|
||||
@ -2868,8 +2896,8 @@ CLEANFILES = $(nodist_libgrubkern_a_SOURCES) \
|
||||
$(nodist_grub_file_SOURCES) 00_header $(am__append_58) \
|
||||
$(am__append_62) $(am__append_66) $(am__append_70) \
|
||||
$(am__append_74) $(am__append_78) $(am__append_82) \
|
||||
$(am__append_86) 30_os-prober 40_custom 41_custom \
|
||||
$(am__append_89) grub-mkconfig $(am__append_90) \
|
||||
$(am__append_86) 30_os-prober 30_uefi-firmware 40_custom \
|
||||
41_custom $(am__append_89) grub-mkconfig $(am__append_90) \
|
||||
grub-set-default $(am__append_91) grub-reboot \
|
||||
grub-mkconfig_lib $(am__append_92) grub-kbdcomp grub-shell \
|
||||
grub-shell-tester grub-fs-tester ext234_test squashfs_test \
|
||||
@ -2946,7 +2974,8 @@ libgrubkern_a_SOURCES = util/misc.c grub-core/kern/command.c \
|
||||
grub-core/kern/err.c grub-core/kern/file.c grub-core/kern/fs.c \
|
||||
grub-core/kern/list.c grub-core/kern/misc.c \
|
||||
grub-core/kern/partition.c grub-core/lib/crypto.c \
|
||||
grub-core/disk/luks.c grub-core/disk/geli.c \
|
||||
grub-core/lib/json/json.c grub-core/disk/luks.c \
|
||||
grub-core/disk/luks2.c grub-core/disk/geli.c \
|
||||
grub-core/disk/cryptodisk.c grub-core/disk/AFSplitter.c \
|
||||
grub-core/lib/pbkdf2.c grub-core/commands/extcmd.c \
|
||||
grub-core/lib/arg.c grub-core/disk/ldm.c \
|
||||
@ -2956,7 +2985,7 @@ libgrubkern_a_SOURCES = util/misc.c grub-core/kern/command.c \
|
||||
nodist_libgrubkern_a_SOURCES =
|
||||
libgrubkern_a_CFLAGS = $(AM_CFLAGS) $(CFLAGS_LIBRARY) $(CFLAGS_GNULIB)
|
||||
libgrubkern_a_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) \
|
||||
$(CPPFLAGS_GNULIB)
|
||||
$(CPPFLAGS_GNULIB) -I$(srcdir)/grub-core/lib/json
|
||||
libgrubkern_a_CCASFLAGS = $(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY)
|
||||
libgrubmods_a_SOURCES = grub-core/commands/blocklist.c \
|
||||
grub-core/commands/macbless.c grub-core/commands/xnu_uuid.c \
|
||||
@ -2993,7 +3022,7 @@ libgrubmods_a_SOURCES = grub-core/commands/blocklist.c \
|
||||
grub-core/lib/hexdump.c grub-core/lib/LzFind.c \
|
||||
grub-core/lib/LzmaEnc.c grub-core/lib/crc.c \
|
||||
grub-core/lib/adler32.c grub-core/lib/crc64.c \
|
||||
grub-core/normal/datetime.c grub-core/normal/misc.c \
|
||||
grub-core/lib/datetime.c grub-core/normal/misc.c \
|
||||
grub-core/partmap/acorn.c grub-core/partmap/amiga.c \
|
||||
grub-core/partmap/apple.c grub-core/partmap/sun.c \
|
||||
grub-core/partmap/plan.c grub-core/partmap/dvh.c \
|
||||
@ -3056,7 +3085,7 @@ nodist_grub_mkimage_SOURCES =
|
||||
grub_mkimage_LDADD = libgrubmods.a libgrubgcry.a libgrubkern.a grub-core/lib/gnulib/libgnu.a $(LIBLZMA) $(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)
|
||||
grub_mkimage_CFLAGS = $(AM_CFLAGS) $(CFLAGS_PROGRAM)
|
||||
grub_mkimage_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_PROGRAM)
|
||||
grub_mkimage_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM) -DGRUB_PKGLIBDIR=\"$(pkglibdir)\"
|
||||
grub_mkimage_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM)
|
||||
grub_mkimage_CCASFLAGS = $(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM)
|
||||
grub_mkrelpath_SOURCES = util/grub-mkrelpath.c grub-core/kern/emu/argp_common.c grub-core/osdep/init.c
|
||||
nodist_grub_mkrelpath_SOURCES =
|
||||
@ -3072,9 +3101,9 @@ grub_script_check_CFLAGS = $(AM_CFLAGS) $(CFLAGS_PROGRAM)
|
||||
grub_script_check_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_PROGRAM)
|
||||
grub_script_check_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM)
|
||||
grub_script_check_CCASFLAGS = $(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM)
|
||||
grub_editenv_SOURCES = util/grub-editenv.c util/editenv.c grub-core/osdep/init.c
|
||||
grub_editenv_SOURCES = util/grub-editenv.c util/editenv.c util/grub-install-common.c grub-core/osdep/init.c grub-core/osdep/compress.c util/mkimage.c util/grub-mkimage32.c util/grub-mkimage64.c grub-core/osdep/config.c util/config.c util/resolve.c
|
||||
nodist_grub_editenv_SOURCES =
|
||||
grub_editenv_LDADD = libgrubmods.a libgrubgcry.a libgrubkern.a grub-core/lib/gnulib/libgnu.a $(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)
|
||||
grub_editenv_LDADD = $(LIBLZMA) libgrubmods.a libgrubgcry.a libgrubkern.a grub-core/lib/gnulib/libgnu.a $(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)
|
||||
grub_editenv_CFLAGS = $(AM_CFLAGS) $(CFLAGS_PROGRAM)
|
||||
grub_editenv_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_PROGRAM)
|
||||
grub_editenv_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM)
|
||||
@ -3598,6 +3627,15 @@ grub-core/kern/libgrubkern_a-partition.$(OBJEXT): \
|
||||
grub-core/lib/libgrubkern_a-crypto.$(OBJEXT): \
|
||||
grub-core/lib/$(am__dirstamp) \
|
||||
grub-core/lib/$(DEPDIR)/$(am__dirstamp)
|
||||
grub-core/lib/json/$(am__dirstamp):
|
||||
@$(MKDIR_P) grub-core/lib/json
|
||||
@: > grub-core/lib/json/$(am__dirstamp)
|
||||
grub-core/lib/json/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) grub-core/lib/json/$(DEPDIR)
|
||||
@: > grub-core/lib/json/$(DEPDIR)/$(am__dirstamp)
|
||||
grub-core/lib/json/libgrubkern_a-json.$(OBJEXT): \
|
||||
grub-core/lib/json/$(am__dirstamp) \
|
||||
grub-core/lib/json/$(DEPDIR)/$(am__dirstamp)
|
||||
grub-core/disk/$(am__dirstamp):
|
||||
@$(MKDIR_P) grub-core/disk
|
||||
@: > grub-core/disk/$(am__dirstamp)
|
||||
@ -3607,6 +3645,9 @@ grub-core/disk/$(DEPDIR)/$(am__dirstamp):
|
||||
grub-core/disk/libgrubkern_a-luks.$(OBJEXT): \
|
||||
grub-core/disk/$(am__dirstamp) \
|
||||
grub-core/disk/$(DEPDIR)/$(am__dirstamp)
|
||||
grub-core/disk/libgrubkern_a-luks2.$(OBJEXT): \
|
||||
grub-core/disk/$(am__dirstamp) \
|
||||
grub-core/disk/$(DEPDIR)/$(am__dirstamp)
|
||||
grub-core/disk/libgrubkern_a-geli.$(OBJEXT): \
|
||||
grub-core/disk/$(am__dirstamp) \
|
||||
grub-core/disk/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -3944,9 +3985,9 @@ grub-core/lib/libgrubmods_a-adler32.$(OBJEXT): \
|
||||
grub-core/lib/libgrubmods_a-crc64.$(OBJEXT): \
|
||||
grub-core/lib/$(am__dirstamp) \
|
||||
grub-core/lib/$(DEPDIR)/$(am__dirstamp)
|
||||
grub-core/normal/libgrubmods_a-datetime.$(OBJEXT): \
|
||||
grub-core/normal/$(am__dirstamp) \
|
||||
grub-core/normal/$(DEPDIR)/$(am__dirstamp)
|
||||
grub-core/lib/libgrubmods_a-datetime.$(OBJEXT): \
|
||||
grub-core/lib/$(am__dirstamp) \
|
||||
grub-core/lib/$(DEPDIR)/$(am__dirstamp)
|
||||
grub-core/normal/libgrubmods_a-misc.$(OBJEXT): \
|
||||
grub-core/normal/$(am__dirstamp) \
|
||||
grub-core/normal/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -4321,9 +4362,27 @@ util/grub_editenv-grub-editenv.$(OBJEXT): util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
util/grub_editenv-editenv.$(OBJEXT): util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
util/grub_editenv-grub-install-common.$(OBJEXT): util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
grub-core/osdep/grub_editenv-init.$(OBJEXT): \
|
||||
grub-core/osdep/$(am__dirstamp) \
|
||||
grub-core/osdep/$(DEPDIR)/$(am__dirstamp)
|
||||
grub-core/osdep/grub_editenv-compress.$(OBJEXT): \
|
||||
grub-core/osdep/$(am__dirstamp) \
|
||||
grub-core/osdep/$(DEPDIR)/$(am__dirstamp)
|
||||
util/grub_editenv-mkimage.$(OBJEXT): util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
util/grub_editenv-grub-mkimage32.$(OBJEXT): util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
util/grub_editenv-grub-mkimage64.$(OBJEXT): util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
grub-core/osdep/grub_editenv-config.$(OBJEXT): \
|
||||
grub-core/osdep/$(am__dirstamp) \
|
||||
grub-core/osdep/$(DEPDIR)/$(am__dirstamp)
|
||||
util/grub_editenv-config.$(OBJEXT): util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
util/grub_editenv-resolve.$(OBJEXT): util/$(am__dirstamp) \
|
||||
util/$(DEPDIR)/$(am__dirstamp)
|
||||
|
||||
grub-editenv$(EXEEXT): $(grub_editenv_OBJECTS) $(grub_editenv_DEPENDENCIES) $(EXTRA_grub_editenv_DEPENDENCIES)
|
||||
@rm -f grub-editenv$(EXEEXT)
|
||||
@ -5107,6 +5166,7 @@ mostlyclean-compile:
|
||||
-rm -f grub-core/kern/ia64/*.$(OBJEXT)
|
||||
-rm -f grub-core/lib/*.$(OBJEXT)
|
||||
-rm -f grub-core/lib/i386/pc/*.$(OBJEXT)
|
||||
-rm -f grub-core/lib/json/*.$(OBJEXT)
|
||||
-rm -f grub-core/lib/libgcrypt-grub/cipher/*.$(OBJEXT)
|
||||
-rm -f grub-core/lib/minilzo/*.$(OBJEXT)
|
||||
-rm -f grub-core/lib/xzembed/*.$(OBJEXT)
|
||||
@ -5159,6 +5219,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/disk/$(DEPDIR)/libgrubkern_a-geli.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/disk/$(DEPDIR)/libgrubkern_a-ldm.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/disk/$(DEPDIR)/libgrubkern_a-luks.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/disk/$(DEPDIR)/libgrubkern_a-luks2.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/disk/$(DEPDIR)/libgrubmods_a-dmraid_nvidia.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/disk/$(DEPDIR)/libgrubmods_a-loopback.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/disk/$(DEPDIR)/libgrubmods_a-lvm.Po@am__quote@
|
||||
@ -5291,10 +5352,12 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/$(DEPDIR)/libgrubmods_a-adler32.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/$(DEPDIR)/libgrubmods_a-crc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/$(DEPDIR)/libgrubmods_a-crc64.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/$(DEPDIR)/libgrubmods_a-datetime.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/$(DEPDIR)/libgrubmods_a-envblk.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/$(DEPDIR)/libgrubmods_a-hexdump.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/$(DEPDIR)/priority_queue_unit_test-priority_queue.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/i386/pc/$(DEPDIR)/grub_menulst2cfg-vesa_modes_table.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/json/$(DEPDIR)/libgrubkern_a-json.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/libgcrypt-grub/cipher/$(DEPDIR)/libgrubgcry_a-arcfour.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/libgcrypt-grub/cipher/$(DEPDIR)/libgrubgcry_a-blowfish.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/lib/libgcrypt-grub/cipher/$(DEPDIR)/libgrubgcry_a-camellia-glue.Po@am__quote@
|
||||
@ -5338,10 +5401,11 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/loader/i386/$(DEPDIR)/grub_file-xen_file32.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/loader/i386/$(DEPDIR)/grub_file-xen_file64.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/normal/$(DEPDIR)/libgrubmods_a-charset.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/normal/$(DEPDIR)/libgrubmods_a-datetime.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/normal/$(DEPDIR)/libgrubmods_a-misc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/osdep/$(DEPDIR)/grub_bios_setup-blocklist.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/osdep/$(DEPDIR)/grub_bios_setup-init.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/osdep/$(DEPDIR)/grub_editenv-compress.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/osdep/$(DEPDIR)/grub_editenv-config.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/osdep/$(DEPDIR)/grub_editenv-init.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/osdep/$(DEPDIR)/grub_file-init.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@grub-core/osdep/$(DEPDIR)/grub_fstest-init.Po@am__quote@
|
||||
@ -5448,8 +5512,14 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/lib/$(DEPDIR)/priority_queue_unit_test-unit_test.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_bios_setup-grub-setup.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_bios_setup-setup_bios.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_editenv-config.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_editenv-editenv.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_editenv-grub-editenv.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_editenv-grub-install-common.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_editenv-grub-mkimage32.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_editenv-grub-mkimage64.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_editenv-mkimage.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_editenv-resolve.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_file-grub-file.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_file-render-label.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/grub_fstest-grub-fstest.Po@am__quote@
|
||||
@ -6229,6 +6299,20 @@ grub-core/lib/libgrubkern_a-crypto.obj: grub-core/lib/crypto.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -c -o grub-core/lib/libgrubkern_a-crypto.obj `if test -f 'grub-core/lib/crypto.c'; then $(CYGPATH_W) 'grub-core/lib/crypto.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/lib/crypto.c'; fi`
|
||||
|
||||
grub-core/lib/json/libgrubkern_a-json.o: grub-core/lib/json/json.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -MT grub-core/lib/json/libgrubkern_a-json.o -MD -MP -MF grub-core/lib/json/$(DEPDIR)/libgrubkern_a-json.Tpo -c -o grub-core/lib/json/libgrubkern_a-json.o `test -f 'grub-core/lib/json/json.c' || echo '$(srcdir)/'`grub-core/lib/json/json.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/lib/json/$(DEPDIR)/libgrubkern_a-json.Tpo grub-core/lib/json/$(DEPDIR)/libgrubkern_a-json.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/lib/json/json.c' object='grub-core/lib/json/libgrubkern_a-json.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -c -o grub-core/lib/json/libgrubkern_a-json.o `test -f 'grub-core/lib/json/json.c' || echo '$(srcdir)/'`grub-core/lib/json/json.c
|
||||
|
||||
grub-core/lib/json/libgrubkern_a-json.obj: grub-core/lib/json/json.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -MT grub-core/lib/json/libgrubkern_a-json.obj -MD -MP -MF grub-core/lib/json/$(DEPDIR)/libgrubkern_a-json.Tpo -c -o grub-core/lib/json/libgrubkern_a-json.obj `if test -f 'grub-core/lib/json/json.c'; then $(CYGPATH_W) 'grub-core/lib/json/json.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/lib/json/json.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/lib/json/$(DEPDIR)/libgrubkern_a-json.Tpo grub-core/lib/json/$(DEPDIR)/libgrubkern_a-json.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/lib/json/json.c' object='grub-core/lib/json/libgrubkern_a-json.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -c -o grub-core/lib/json/libgrubkern_a-json.obj `if test -f 'grub-core/lib/json/json.c'; then $(CYGPATH_W) 'grub-core/lib/json/json.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/lib/json/json.c'; fi`
|
||||
|
||||
grub-core/disk/libgrubkern_a-luks.o: grub-core/disk/luks.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -MT grub-core/disk/libgrubkern_a-luks.o -MD -MP -MF grub-core/disk/$(DEPDIR)/libgrubkern_a-luks.Tpo -c -o grub-core/disk/libgrubkern_a-luks.o `test -f 'grub-core/disk/luks.c' || echo '$(srcdir)/'`grub-core/disk/luks.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/disk/$(DEPDIR)/libgrubkern_a-luks.Tpo grub-core/disk/$(DEPDIR)/libgrubkern_a-luks.Po
|
||||
@ -6243,6 +6327,20 @@ grub-core/disk/libgrubkern_a-luks.obj: grub-core/disk/luks.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -c -o grub-core/disk/libgrubkern_a-luks.obj `if test -f 'grub-core/disk/luks.c'; then $(CYGPATH_W) 'grub-core/disk/luks.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/disk/luks.c'; fi`
|
||||
|
||||
grub-core/disk/libgrubkern_a-luks2.o: grub-core/disk/luks2.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -MT grub-core/disk/libgrubkern_a-luks2.o -MD -MP -MF grub-core/disk/$(DEPDIR)/libgrubkern_a-luks2.Tpo -c -o grub-core/disk/libgrubkern_a-luks2.o `test -f 'grub-core/disk/luks2.c' || echo '$(srcdir)/'`grub-core/disk/luks2.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/disk/$(DEPDIR)/libgrubkern_a-luks2.Tpo grub-core/disk/$(DEPDIR)/libgrubkern_a-luks2.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/disk/luks2.c' object='grub-core/disk/libgrubkern_a-luks2.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -c -o grub-core/disk/libgrubkern_a-luks2.o `test -f 'grub-core/disk/luks2.c' || echo '$(srcdir)/'`grub-core/disk/luks2.c
|
||||
|
||||
grub-core/disk/libgrubkern_a-luks2.obj: grub-core/disk/luks2.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -MT grub-core/disk/libgrubkern_a-luks2.obj -MD -MP -MF grub-core/disk/$(DEPDIR)/libgrubkern_a-luks2.Tpo -c -o grub-core/disk/libgrubkern_a-luks2.obj `if test -f 'grub-core/disk/luks2.c'; then $(CYGPATH_W) 'grub-core/disk/luks2.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/disk/luks2.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/disk/$(DEPDIR)/libgrubkern_a-luks2.Tpo grub-core/disk/$(DEPDIR)/libgrubkern_a-luks2.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/disk/luks2.c' object='grub-core/disk/libgrubkern_a-luks2.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -c -o grub-core/disk/libgrubkern_a-luks2.obj `if test -f 'grub-core/disk/luks2.c'; then $(CYGPATH_W) 'grub-core/disk/luks2.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/disk/luks2.c'; fi`
|
||||
|
||||
grub-core/disk/libgrubkern_a-geli.o: grub-core/disk/geli.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) $(libgrubkern_a_CFLAGS) $(CFLAGS) -MT grub-core/disk/libgrubkern_a-geli.o -MD -MP -MF grub-core/disk/$(DEPDIR)/libgrubkern_a-geli.Tpo -c -o grub-core/disk/libgrubkern_a-geli.o `test -f 'grub-core/disk/geli.c' || echo '$(srcdir)/'`grub-core/disk/geli.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/disk/$(DEPDIR)/libgrubkern_a-geli.Tpo grub-core/disk/$(DEPDIR)/libgrubkern_a-geli.Po
|
||||
@ -7489,19 +7587,19 @@ grub-core/lib/libgrubmods_a-crc64.obj: grub-core/lib/crc64.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(CPPFLAGS) $(libgrubmods_a_CFLAGS) $(CFLAGS) -c -o grub-core/lib/libgrubmods_a-crc64.obj `if test -f 'grub-core/lib/crc64.c'; then $(CYGPATH_W) 'grub-core/lib/crc64.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/lib/crc64.c'; fi`
|
||||
|
||||
grub-core/normal/libgrubmods_a-datetime.o: grub-core/normal/datetime.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(CPPFLAGS) $(libgrubmods_a_CFLAGS) $(CFLAGS) -MT grub-core/normal/libgrubmods_a-datetime.o -MD -MP -MF grub-core/normal/$(DEPDIR)/libgrubmods_a-datetime.Tpo -c -o grub-core/normal/libgrubmods_a-datetime.o `test -f 'grub-core/normal/datetime.c' || echo '$(srcdir)/'`grub-core/normal/datetime.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/normal/$(DEPDIR)/libgrubmods_a-datetime.Tpo grub-core/normal/$(DEPDIR)/libgrubmods_a-datetime.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/normal/datetime.c' object='grub-core/normal/libgrubmods_a-datetime.o' libtool=no @AMDEPBACKSLASH@
|
||||
grub-core/lib/libgrubmods_a-datetime.o: grub-core/lib/datetime.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(CPPFLAGS) $(libgrubmods_a_CFLAGS) $(CFLAGS) -MT grub-core/lib/libgrubmods_a-datetime.o -MD -MP -MF grub-core/lib/$(DEPDIR)/libgrubmods_a-datetime.Tpo -c -o grub-core/lib/libgrubmods_a-datetime.o `test -f 'grub-core/lib/datetime.c' || echo '$(srcdir)/'`grub-core/lib/datetime.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/lib/$(DEPDIR)/libgrubmods_a-datetime.Tpo grub-core/lib/$(DEPDIR)/libgrubmods_a-datetime.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/lib/datetime.c' object='grub-core/lib/libgrubmods_a-datetime.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(CPPFLAGS) $(libgrubmods_a_CFLAGS) $(CFLAGS) -c -o grub-core/normal/libgrubmods_a-datetime.o `test -f 'grub-core/normal/datetime.c' || echo '$(srcdir)/'`grub-core/normal/datetime.c
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(CPPFLAGS) $(libgrubmods_a_CFLAGS) $(CFLAGS) -c -o grub-core/lib/libgrubmods_a-datetime.o `test -f 'grub-core/lib/datetime.c' || echo '$(srcdir)/'`grub-core/lib/datetime.c
|
||||
|
||||
grub-core/normal/libgrubmods_a-datetime.obj: grub-core/normal/datetime.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(CPPFLAGS) $(libgrubmods_a_CFLAGS) $(CFLAGS) -MT grub-core/normal/libgrubmods_a-datetime.obj -MD -MP -MF grub-core/normal/$(DEPDIR)/libgrubmods_a-datetime.Tpo -c -o grub-core/normal/libgrubmods_a-datetime.obj `if test -f 'grub-core/normal/datetime.c'; then $(CYGPATH_W) 'grub-core/normal/datetime.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/normal/datetime.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/normal/$(DEPDIR)/libgrubmods_a-datetime.Tpo grub-core/normal/$(DEPDIR)/libgrubmods_a-datetime.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/normal/datetime.c' object='grub-core/normal/libgrubmods_a-datetime.obj' libtool=no @AMDEPBACKSLASH@
|
||||
grub-core/lib/libgrubmods_a-datetime.obj: grub-core/lib/datetime.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(CPPFLAGS) $(libgrubmods_a_CFLAGS) $(CFLAGS) -MT grub-core/lib/libgrubmods_a-datetime.obj -MD -MP -MF grub-core/lib/$(DEPDIR)/libgrubmods_a-datetime.Tpo -c -o grub-core/lib/libgrubmods_a-datetime.obj `if test -f 'grub-core/lib/datetime.c'; then $(CYGPATH_W) 'grub-core/lib/datetime.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/lib/datetime.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/lib/$(DEPDIR)/libgrubmods_a-datetime.Tpo grub-core/lib/$(DEPDIR)/libgrubmods_a-datetime.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/lib/datetime.c' object='grub-core/lib/libgrubmods_a-datetime.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(CPPFLAGS) $(libgrubmods_a_CFLAGS) $(CFLAGS) -c -o grub-core/normal/libgrubmods_a-datetime.obj `if test -f 'grub-core/normal/datetime.c'; then $(CYGPATH_W) 'grub-core/normal/datetime.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/normal/datetime.c'; fi`
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(CPPFLAGS) $(libgrubmods_a_CFLAGS) $(CFLAGS) -c -o grub-core/lib/libgrubmods_a-datetime.obj `if test -f 'grub-core/lib/datetime.c'; then $(CYGPATH_W) 'grub-core/lib/datetime.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/lib/datetime.c'; fi`
|
||||
|
||||
grub-core/normal/libgrubmods_a-misc.o: grub-core/normal/misc.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(CPPFLAGS) $(libgrubmods_a_CFLAGS) $(CFLAGS) -MT grub-core/normal/libgrubmods_a-misc.o -MD -MP -MF grub-core/normal/$(DEPDIR)/libgrubmods_a-misc.Tpo -c -o grub-core/normal/libgrubmods_a-misc.o `test -f 'grub-core/normal/misc.c' || echo '$(srcdir)/'`grub-core/normal/misc.c
|
||||
@ -8343,6 +8441,20 @@ util/grub_editenv-editenv.obj: util/editenv.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-editenv.obj `if test -f 'util/editenv.c'; then $(CYGPATH_W) 'util/editenv.c'; else $(CYGPATH_W) '$(srcdir)/util/editenv.c'; fi`
|
||||
|
||||
util/grub_editenv-grub-install-common.o: util/grub-install-common.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-grub-install-common.o -MD -MP -MF util/$(DEPDIR)/grub_editenv-grub-install-common.Tpo -c -o util/grub_editenv-grub-install-common.o `test -f 'util/grub-install-common.c' || echo '$(srcdir)/'`util/grub-install-common.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-grub-install-common.Tpo util/$(DEPDIR)/grub_editenv-grub-install-common.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/grub-install-common.c' object='util/grub_editenv-grub-install-common.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-grub-install-common.o `test -f 'util/grub-install-common.c' || echo '$(srcdir)/'`util/grub-install-common.c
|
||||
|
||||
util/grub_editenv-grub-install-common.obj: util/grub-install-common.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-grub-install-common.obj -MD -MP -MF util/$(DEPDIR)/grub_editenv-grub-install-common.Tpo -c -o util/grub_editenv-grub-install-common.obj `if test -f 'util/grub-install-common.c'; then $(CYGPATH_W) 'util/grub-install-common.c'; else $(CYGPATH_W) '$(srcdir)/util/grub-install-common.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-grub-install-common.Tpo util/$(DEPDIR)/grub_editenv-grub-install-common.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/grub-install-common.c' object='util/grub_editenv-grub-install-common.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-grub-install-common.obj `if test -f 'util/grub-install-common.c'; then $(CYGPATH_W) 'util/grub-install-common.c'; else $(CYGPATH_W) '$(srcdir)/util/grub-install-common.c'; fi`
|
||||
|
||||
grub-core/osdep/grub_editenv-init.o: grub-core/osdep/init.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT grub-core/osdep/grub_editenv-init.o -MD -MP -MF grub-core/osdep/$(DEPDIR)/grub_editenv-init.Tpo -c -o grub-core/osdep/grub_editenv-init.o `test -f 'grub-core/osdep/init.c' || echo '$(srcdir)/'`grub-core/osdep/init.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/osdep/$(DEPDIR)/grub_editenv-init.Tpo grub-core/osdep/$(DEPDIR)/grub_editenv-init.Po
|
||||
@ -8357,6 +8469,104 @@ grub-core/osdep/grub_editenv-init.obj: grub-core/osdep/init.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o grub-core/osdep/grub_editenv-init.obj `if test -f 'grub-core/osdep/init.c'; then $(CYGPATH_W) 'grub-core/osdep/init.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/osdep/init.c'; fi`
|
||||
|
||||
grub-core/osdep/grub_editenv-compress.o: grub-core/osdep/compress.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT grub-core/osdep/grub_editenv-compress.o -MD -MP -MF grub-core/osdep/$(DEPDIR)/grub_editenv-compress.Tpo -c -o grub-core/osdep/grub_editenv-compress.o `test -f 'grub-core/osdep/compress.c' || echo '$(srcdir)/'`grub-core/osdep/compress.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/osdep/$(DEPDIR)/grub_editenv-compress.Tpo grub-core/osdep/$(DEPDIR)/grub_editenv-compress.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/osdep/compress.c' object='grub-core/osdep/grub_editenv-compress.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o grub-core/osdep/grub_editenv-compress.o `test -f 'grub-core/osdep/compress.c' || echo '$(srcdir)/'`grub-core/osdep/compress.c
|
||||
|
||||
grub-core/osdep/grub_editenv-compress.obj: grub-core/osdep/compress.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT grub-core/osdep/grub_editenv-compress.obj -MD -MP -MF grub-core/osdep/$(DEPDIR)/grub_editenv-compress.Tpo -c -o grub-core/osdep/grub_editenv-compress.obj `if test -f 'grub-core/osdep/compress.c'; then $(CYGPATH_W) 'grub-core/osdep/compress.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/osdep/compress.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/osdep/$(DEPDIR)/grub_editenv-compress.Tpo grub-core/osdep/$(DEPDIR)/grub_editenv-compress.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/osdep/compress.c' object='grub-core/osdep/grub_editenv-compress.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o grub-core/osdep/grub_editenv-compress.obj `if test -f 'grub-core/osdep/compress.c'; then $(CYGPATH_W) 'grub-core/osdep/compress.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/osdep/compress.c'; fi`
|
||||
|
||||
util/grub_editenv-mkimage.o: util/mkimage.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-mkimage.o -MD -MP -MF util/$(DEPDIR)/grub_editenv-mkimage.Tpo -c -o util/grub_editenv-mkimage.o `test -f 'util/mkimage.c' || echo '$(srcdir)/'`util/mkimage.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-mkimage.Tpo util/$(DEPDIR)/grub_editenv-mkimage.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/mkimage.c' object='util/grub_editenv-mkimage.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-mkimage.o `test -f 'util/mkimage.c' || echo '$(srcdir)/'`util/mkimage.c
|
||||
|
||||
util/grub_editenv-mkimage.obj: util/mkimage.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-mkimage.obj -MD -MP -MF util/$(DEPDIR)/grub_editenv-mkimage.Tpo -c -o util/grub_editenv-mkimage.obj `if test -f 'util/mkimage.c'; then $(CYGPATH_W) 'util/mkimage.c'; else $(CYGPATH_W) '$(srcdir)/util/mkimage.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-mkimage.Tpo util/$(DEPDIR)/grub_editenv-mkimage.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/mkimage.c' object='util/grub_editenv-mkimage.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-mkimage.obj `if test -f 'util/mkimage.c'; then $(CYGPATH_W) 'util/mkimage.c'; else $(CYGPATH_W) '$(srcdir)/util/mkimage.c'; fi`
|
||||
|
||||
util/grub_editenv-grub-mkimage32.o: util/grub-mkimage32.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-grub-mkimage32.o -MD -MP -MF util/$(DEPDIR)/grub_editenv-grub-mkimage32.Tpo -c -o util/grub_editenv-grub-mkimage32.o `test -f 'util/grub-mkimage32.c' || echo '$(srcdir)/'`util/grub-mkimage32.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-grub-mkimage32.Tpo util/$(DEPDIR)/grub_editenv-grub-mkimage32.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/grub-mkimage32.c' object='util/grub_editenv-grub-mkimage32.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-grub-mkimage32.o `test -f 'util/grub-mkimage32.c' || echo '$(srcdir)/'`util/grub-mkimage32.c
|
||||
|
||||
util/grub_editenv-grub-mkimage32.obj: util/grub-mkimage32.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-grub-mkimage32.obj -MD -MP -MF util/$(DEPDIR)/grub_editenv-grub-mkimage32.Tpo -c -o util/grub_editenv-grub-mkimage32.obj `if test -f 'util/grub-mkimage32.c'; then $(CYGPATH_W) 'util/grub-mkimage32.c'; else $(CYGPATH_W) '$(srcdir)/util/grub-mkimage32.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-grub-mkimage32.Tpo util/$(DEPDIR)/grub_editenv-grub-mkimage32.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/grub-mkimage32.c' object='util/grub_editenv-grub-mkimage32.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-grub-mkimage32.obj `if test -f 'util/grub-mkimage32.c'; then $(CYGPATH_W) 'util/grub-mkimage32.c'; else $(CYGPATH_W) '$(srcdir)/util/grub-mkimage32.c'; fi`
|
||||
|
||||
util/grub_editenv-grub-mkimage64.o: util/grub-mkimage64.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-grub-mkimage64.o -MD -MP -MF util/$(DEPDIR)/grub_editenv-grub-mkimage64.Tpo -c -o util/grub_editenv-grub-mkimage64.o `test -f 'util/grub-mkimage64.c' || echo '$(srcdir)/'`util/grub-mkimage64.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-grub-mkimage64.Tpo util/$(DEPDIR)/grub_editenv-grub-mkimage64.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/grub-mkimage64.c' object='util/grub_editenv-grub-mkimage64.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-grub-mkimage64.o `test -f 'util/grub-mkimage64.c' || echo '$(srcdir)/'`util/grub-mkimage64.c
|
||||
|
||||
util/grub_editenv-grub-mkimage64.obj: util/grub-mkimage64.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-grub-mkimage64.obj -MD -MP -MF util/$(DEPDIR)/grub_editenv-grub-mkimage64.Tpo -c -o util/grub_editenv-grub-mkimage64.obj `if test -f 'util/grub-mkimage64.c'; then $(CYGPATH_W) 'util/grub-mkimage64.c'; else $(CYGPATH_W) '$(srcdir)/util/grub-mkimage64.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-grub-mkimage64.Tpo util/$(DEPDIR)/grub_editenv-grub-mkimage64.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/grub-mkimage64.c' object='util/grub_editenv-grub-mkimage64.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-grub-mkimage64.obj `if test -f 'util/grub-mkimage64.c'; then $(CYGPATH_W) 'util/grub-mkimage64.c'; else $(CYGPATH_W) '$(srcdir)/util/grub-mkimage64.c'; fi`
|
||||
|
||||
grub-core/osdep/grub_editenv-config.o: grub-core/osdep/config.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT grub-core/osdep/grub_editenv-config.o -MD -MP -MF grub-core/osdep/$(DEPDIR)/grub_editenv-config.Tpo -c -o grub-core/osdep/grub_editenv-config.o `test -f 'grub-core/osdep/config.c' || echo '$(srcdir)/'`grub-core/osdep/config.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/osdep/$(DEPDIR)/grub_editenv-config.Tpo grub-core/osdep/$(DEPDIR)/grub_editenv-config.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/osdep/config.c' object='grub-core/osdep/grub_editenv-config.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o grub-core/osdep/grub_editenv-config.o `test -f 'grub-core/osdep/config.c' || echo '$(srcdir)/'`grub-core/osdep/config.c
|
||||
|
||||
grub-core/osdep/grub_editenv-config.obj: grub-core/osdep/config.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT grub-core/osdep/grub_editenv-config.obj -MD -MP -MF grub-core/osdep/$(DEPDIR)/grub_editenv-config.Tpo -c -o grub-core/osdep/grub_editenv-config.obj `if test -f 'grub-core/osdep/config.c'; then $(CYGPATH_W) 'grub-core/osdep/config.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/osdep/config.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) grub-core/osdep/$(DEPDIR)/grub_editenv-config.Tpo grub-core/osdep/$(DEPDIR)/grub_editenv-config.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='grub-core/osdep/config.c' object='grub-core/osdep/grub_editenv-config.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o grub-core/osdep/grub_editenv-config.obj `if test -f 'grub-core/osdep/config.c'; then $(CYGPATH_W) 'grub-core/osdep/config.c'; else $(CYGPATH_W) '$(srcdir)/grub-core/osdep/config.c'; fi`
|
||||
|
||||
util/grub_editenv-config.o: util/config.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-config.o -MD -MP -MF util/$(DEPDIR)/grub_editenv-config.Tpo -c -o util/grub_editenv-config.o `test -f 'util/config.c' || echo '$(srcdir)/'`util/config.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-config.Tpo util/$(DEPDIR)/grub_editenv-config.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/config.c' object='util/grub_editenv-config.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-config.o `test -f 'util/config.c' || echo '$(srcdir)/'`util/config.c
|
||||
|
||||
util/grub_editenv-config.obj: util/config.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-config.obj -MD -MP -MF util/$(DEPDIR)/grub_editenv-config.Tpo -c -o util/grub_editenv-config.obj `if test -f 'util/config.c'; then $(CYGPATH_W) 'util/config.c'; else $(CYGPATH_W) '$(srcdir)/util/config.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-config.Tpo util/$(DEPDIR)/grub_editenv-config.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/config.c' object='util/grub_editenv-config.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-config.obj `if test -f 'util/config.c'; then $(CYGPATH_W) 'util/config.c'; else $(CYGPATH_W) '$(srcdir)/util/config.c'; fi`
|
||||
|
||||
util/grub_editenv-resolve.o: util/resolve.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-resolve.o -MD -MP -MF util/$(DEPDIR)/grub_editenv-resolve.Tpo -c -o util/grub_editenv-resolve.o `test -f 'util/resolve.c' || echo '$(srcdir)/'`util/resolve.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-resolve.Tpo util/$(DEPDIR)/grub_editenv-resolve.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/resolve.c' object='util/grub_editenv-resolve.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-resolve.o `test -f 'util/resolve.c' || echo '$(srcdir)/'`util/resolve.c
|
||||
|
||||
util/grub_editenv-resolve.obj: util/resolve.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -MT util/grub_editenv-resolve.obj -MD -MP -MF util/$(DEPDIR)/grub_editenv-resolve.Tpo -c -o util/grub_editenv-resolve.obj `if test -f 'util/resolve.c'; then $(CYGPATH_W) 'util/resolve.c'; else $(CYGPATH_W) '$(srcdir)/util/resolve.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_editenv-resolve.Tpo util/$(DEPDIR)/grub_editenv-resolve.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util/resolve.c' object='util/grub_editenv-resolve.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_editenv_CPPFLAGS) $(CPPFLAGS) $(grub_editenv_CFLAGS) $(CFLAGS) -c -o util/grub_editenv-resolve.obj `if test -f 'util/resolve.c'; then $(CYGPATH_W) 'util/resolve.c'; else $(CYGPATH_W) '$(srcdir)/util/resolve.c'; fi`
|
||||
|
||||
util/grub_file-grub-file.o: util/grub-file.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_file_CPPFLAGS) $(CPPFLAGS) $(grub_file_CFLAGS) $(CFLAGS) -MT util/grub_file-grub-file.o -MD -MP -MF util/$(DEPDIR)/grub_file-grub-file.Tpo -c -o util/grub_file-grub-file.o `test -f 'util/grub-file.c' || echo '$(srcdir)/'`util/grub-file.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) util/$(DEPDIR)/grub_file-grub-file.Tpo util/$(DEPDIR)/grub_file-grub-file.Po
|
||||
@ -12391,6 +12601,8 @@ distclean-generic:
|
||||
-rm -f grub-core/lib/$(am__dirstamp)
|
||||
-rm -f grub-core/lib/i386/pc/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f grub-core/lib/i386/pc/$(am__dirstamp)
|
||||
-rm -f grub-core/lib/json/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f grub-core/lib/json/$(am__dirstamp)
|
||||
-rm -f grub-core/lib/libgcrypt-grub/cipher/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f grub-core/lib/libgcrypt-grub/cipher/$(am__dirstamp)
|
||||
-rm -f grub-core/lib/minilzo/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -12442,7 +12654,7 @@ clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf ./$(DEPDIR) grub-core/$(DEPDIR) grub-core/commands/$(DEPDIR) grub-core/disk/$(DEPDIR) grub-core/font/$(DEPDIR) grub-core/fs/$(DEPDIR) grub-core/fs/zfs/$(DEPDIR) grub-core/gfxmenu/$(DEPDIR) grub-core/io/$(DEPDIR) grub-core/kern/$(DEPDIR) grub-core/kern/arm/$(DEPDIR) grub-core/kern/arm64/$(DEPDIR) grub-core/kern/emu/$(DEPDIR) grub-core/kern/ia64/$(DEPDIR) grub-core/lib/$(DEPDIR) grub-core/lib/i386/pc/$(DEPDIR) grub-core/lib/libgcrypt-grub/cipher/$(DEPDIR) grub-core/lib/minilzo/$(DEPDIR) grub-core/lib/xzembed/$(DEPDIR) grub-core/lib/zstd/$(DEPDIR) grub-core/loader/$(DEPDIR) grub-core/loader/i386/$(DEPDIR) grub-core/normal/$(DEPDIR) grub-core/osdep/$(DEPDIR) grub-core/osdep/devmapper/$(DEPDIR) grub-core/osdep/unix/$(DEPDIR) grub-core/partmap/$(DEPDIR) grub-core/script/$(DEPDIR) grub-core/tests/lib/$(DEPDIR) grub-core/video/$(DEPDIR) grub-core/video/fb/$(DEPDIR) tests/$(DEPDIR) tests/lib/$(DEPDIR) util/$(DEPDIR) util/ieee1275/$(DEPDIR)
|
||||
-rm -rf ./$(DEPDIR) grub-core/$(DEPDIR) grub-core/commands/$(DEPDIR) grub-core/disk/$(DEPDIR) grub-core/font/$(DEPDIR) grub-core/fs/$(DEPDIR) grub-core/fs/zfs/$(DEPDIR) grub-core/gfxmenu/$(DEPDIR) grub-core/io/$(DEPDIR) grub-core/kern/$(DEPDIR) grub-core/kern/arm/$(DEPDIR) grub-core/kern/arm64/$(DEPDIR) grub-core/kern/emu/$(DEPDIR) grub-core/kern/ia64/$(DEPDIR) grub-core/lib/$(DEPDIR) grub-core/lib/i386/pc/$(DEPDIR) grub-core/lib/json/$(DEPDIR) grub-core/lib/libgcrypt-grub/cipher/$(DEPDIR) grub-core/lib/minilzo/$(DEPDIR) grub-core/lib/xzembed/$(DEPDIR) grub-core/lib/zstd/$(DEPDIR) grub-core/loader/$(DEPDIR) grub-core/loader/i386/$(DEPDIR) grub-core/normal/$(DEPDIR) grub-core/osdep/$(DEPDIR) grub-core/osdep/devmapper/$(DEPDIR) grub-core/osdep/unix/$(DEPDIR) grub-core/partmap/$(DEPDIR) grub-core/script/$(DEPDIR) grub-core/tests/lib/$(DEPDIR) grub-core/video/$(DEPDIR) grub-core/video/fb/$(DEPDIR) tests/$(DEPDIR) tests/lib/$(DEPDIR) util/$(DEPDIR) util/ieee1275/$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-hdr distclean-tags
|
||||
@ -12494,7 +12706,7 @@ installcheck-am:
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -rf ./$(DEPDIR) grub-core/$(DEPDIR) grub-core/commands/$(DEPDIR) grub-core/disk/$(DEPDIR) grub-core/font/$(DEPDIR) grub-core/fs/$(DEPDIR) grub-core/fs/zfs/$(DEPDIR) grub-core/gfxmenu/$(DEPDIR) grub-core/io/$(DEPDIR) grub-core/kern/$(DEPDIR) grub-core/kern/arm/$(DEPDIR) grub-core/kern/arm64/$(DEPDIR) grub-core/kern/emu/$(DEPDIR) grub-core/kern/ia64/$(DEPDIR) grub-core/lib/$(DEPDIR) grub-core/lib/i386/pc/$(DEPDIR) grub-core/lib/libgcrypt-grub/cipher/$(DEPDIR) grub-core/lib/minilzo/$(DEPDIR) grub-core/lib/xzembed/$(DEPDIR) grub-core/lib/zstd/$(DEPDIR) grub-core/loader/$(DEPDIR) grub-core/loader/i386/$(DEPDIR) grub-core/normal/$(DEPDIR) grub-core/osdep/$(DEPDIR) grub-core/osdep/devmapper/$(DEPDIR) grub-core/osdep/unix/$(DEPDIR) grub-core/partmap/$(DEPDIR) grub-core/script/$(DEPDIR) grub-core/tests/lib/$(DEPDIR) grub-core/video/$(DEPDIR) grub-core/video/fb/$(DEPDIR) tests/$(DEPDIR) tests/lib/$(DEPDIR) util/$(DEPDIR) util/ieee1275/$(DEPDIR)
|
||||
-rm -rf ./$(DEPDIR) grub-core/$(DEPDIR) grub-core/commands/$(DEPDIR) grub-core/disk/$(DEPDIR) grub-core/font/$(DEPDIR) grub-core/fs/$(DEPDIR) grub-core/fs/zfs/$(DEPDIR) grub-core/gfxmenu/$(DEPDIR) grub-core/io/$(DEPDIR) grub-core/kern/$(DEPDIR) grub-core/kern/arm/$(DEPDIR) grub-core/kern/arm64/$(DEPDIR) grub-core/kern/emu/$(DEPDIR) grub-core/kern/ia64/$(DEPDIR) grub-core/lib/$(DEPDIR) grub-core/lib/i386/pc/$(DEPDIR) grub-core/lib/json/$(DEPDIR) grub-core/lib/libgcrypt-grub/cipher/$(DEPDIR) grub-core/lib/minilzo/$(DEPDIR) grub-core/lib/xzembed/$(DEPDIR) grub-core/lib/zstd/$(DEPDIR) grub-core/loader/$(DEPDIR) grub-core/loader/i386/$(DEPDIR) grub-core/normal/$(DEPDIR) grub-core/osdep/$(DEPDIR) grub-core/osdep/devmapper/$(DEPDIR) grub-core/osdep/unix/$(DEPDIR) grub-core/partmap/$(DEPDIR) grub-core/script/$(DEPDIR) grub-core/tests/lib/$(DEPDIR) grub-core/video/$(DEPDIR) grub-core/video/fb/$(DEPDIR) tests/$(DEPDIR) tests/lib/$(DEPDIR) util/$(DEPDIR) util/ieee1275/$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
@ -12710,6 +12922,10 @@ $(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/gentpl.py $(top_srcdir)/
|
||||
(for x in util/grub.d/30_os-prober.in ; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:-
|
||||
chmod a+x 30_os-prober
|
||||
|
||||
30_uefi-firmware: $(top_builddir)/config.status util/grub.d/30_uefi-firmware.in
|
||||
(for x in util/grub.d/30_uefi-firmware.in ; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:-
|
||||
chmod a+x 30_uefi-firmware
|
||||
|
||||
40_custom: $(top_builddir)/config.status util/grub.d/40_custom.in
|
||||
(for x in util/grub.d/40_custom.in ; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:-
|
||||
chmod a+x 40_custom
|
||||
@ -13085,7 +13301,7 @@ grub_script.yy.h: $(top_srcdir)/grub-core/script/yylex.l
|
||||
grub_script.yy.c: grub_script.yy.h
|
||||
|
||||
# For libgrub.a
|
||||
libgrub.pp: grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgrubkern_a_SOURCES)
|
||||
libgrub.pp: config-util.h grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgrubkern_a_SOURCES)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) \
|
||||
-D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
@ -14,16 +14,16 @@ libgrubgcry_a_CFLAGS =
|
||||
libgrubgcry_a_CPPFLAGS =
|
||||
libgrubgcry_a_CCASFLAGS =
|
||||
noinst_LIBRARIES += libgrubkern.a
|
||||
libgrubkern_a_SOURCES += util/misc.c grub-core/kern/command.c grub-core/kern/device.c grub-core/kern/disk.c grub-core/lib/disk.c util/getroot.c grub-core/osdep/unix/getroot.c grub-core/osdep/getroot.c grub-core/osdep/devmapper/getroot.c grub-core/osdep/relpath.c grub-core/kern/emu/hostdisk.c grub-core/osdep/devmapper/hostdisk.c grub-core/osdep/hostdisk.c grub-core/osdep/unix/hostdisk.c grub-core/osdep/exec.c grub-core/osdep/sleep.c grub-core/osdep/password.c grub-core/kern/emu/misc.c grub-core/kern/emu/mm.c grub-core/kern/env.c grub-core/kern/err.c grub-core/kern/file.c grub-core/kern/fs.c grub-core/kern/list.c grub-core/kern/misc.c grub-core/kern/partition.c grub-core/lib/crypto.c grub-core/disk/luks.c grub-core/disk/geli.c grub-core/disk/cryptodisk.c grub-core/disk/AFSplitter.c grub-core/lib/pbkdf2.c grub-core/commands/extcmd.c grub-core/lib/arg.c grub-core/disk/ldm.c grub-core/disk/diskfilter.c grub-core/partmap/gpt.c grub-core/partmap/msdos.c grub-core/fs/proc.c grub-core/fs/archelp.c
|
||||
libgrubkern_a_SOURCES += util/misc.c grub-core/kern/command.c grub-core/kern/device.c grub-core/kern/disk.c grub-core/lib/disk.c util/getroot.c grub-core/osdep/unix/getroot.c grub-core/osdep/getroot.c grub-core/osdep/devmapper/getroot.c grub-core/osdep/relpath.c grub-core/kern/emu/hostdisk.c grub-core/osdep/devmapper/hostdisk.c grub-core/osdep/hostdisk.c grub-core/osdep/unix/hostdisk.c grub-core/osdep/exec.c grub-core/osdep/sleep.c grub-core/osdep/password.c grub-core/kern/emu/misc.c grub-core/kern/emu/mm.c grub-core/kern/env.c grub-core/kern/err.c grub-core/kern/file.c grub-core/kern/fs.c grub-core/kern/list.c grub-core/kern/misc.c grub-core/kern/partition.c grub-core/lib/crypto.c grub-core/lib/json/json.c grub-core/disk/luks.c grub-core/disk/luks2.c grub-core/disk/geli.c grub-core/disk/cryptodisk.c grub-core/disk/AFSplitter.c grub-core/lib/pbkdf2.c grub-core/commands/extcmd.c grub-core/lib/arg.c grub-core/disk/ldm.c grub-core/disk/diskfilter.c grub-core/partmap/gpt.c grub-core/partmap/msdos.c grub-core/fs/proc.c grub-core/fs/archelp.c
|
||||
nodist_libgrubkern_a_SOURCES +=
|
||||
libgrubkern_a_CFLAGS += $(AM_CFLAGS) $(CFLAGS_LIBRARY) $(CFLAGS_GNULIB)
|
||||
libgrubkern_a_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) $(CPPFLAGS_GNULIB)
|
||||
libgrubkern_a_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) $(CPPFLAGS_GNULIB) -I$(srcdir)/grub-core/lib/json
|
||||
libgrubkern_a_CCASFLAGS += $(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY)
|
||||
dist_noinst_DATA += grub-core/kern/disk_common.c grub-core/osdep/unix/relpath.c grub-core/osdep/aros/relpath.c grub-core/osdep/windows/relpath.c
|
||||
BUILT_SOURCES += $(nodist_libgrubkern_a_SOURCES)
|
||||
CLEANFILES += $(nodist_libgrubkern_a_SOURCES)
|
||||
noinst_LIBRARIES += libgrubmods.a
|
||||
libgrubmods_a_SOURCES += grub-core/commands/blocklist.c grub-core/commands/macbless.c grub-core/commands/xnu_uuid.c grub-core/commands/testload.c grub-core/commands/ls.c grub-core/disk/dmraid_nvidia.c grub-core/disk/loopback.c grub-core/disk/lvm.c grub-core/disk/mdraid_linux.c grub-core/disk/mdraid_linux_be.c grub-core/disk/mdraid1x_linux.c grub-core/disk/raid5_recover.c grub-core/disk/raid6_recover.c grub-core/font/font.c grub-core/gfxmenu/font.c grub-core/normal/charset.c grub-core/video/fb/fbblit.c grub-core/video/fb/fbutil.c grub-core/video/fb/fbfill.c grub-core/video/fb/video_fb.c grub-core/video/video.c grub-core/video/capture.c grub-core/video/colors.c grub-core/unidata.c grub-core/io/bufio.c grub-core/fs/affs.c grub-core/fs/afs.c grub-core/fs/bfs.c grub-core/fs/btrfs.c grub-core/fs/cbfs.c grub-core/fs/cpio.c grub-core/fs/cpio_be.c grub-core/fs/odc.c grub-core/fs/newc.c grub-core/fs/ext2.c grub-core/fs/fat.c grub-core/fs/exfat.c grub-core/fs/f2fs.c grub-core/fs/fshelp.c grub-core/fs/hfs.c grub-core/fs/hfsplus.c grub-core/fs/hfspluscomp.c grub-core/fs/iso9660.c grub-core/fs/jfs.c grub-core/fs/minix.c grub-core/fs/minix2.c grub-core/fs/minix3.c grub-core/fs/minix_be.c grub-core/fs/minix2_be.c grub-core/fs/minix3_be.c grub-core/fs/nilfs2.c grub-core/fs/ntfs.c grub-core/fs/ntfscomp.c grub-core/fs/reiserfs.c grub-core/fs/romfs.c grub-core/fs/sfs.c grub-core/fs/squash4.c grub-core/fs/tar.c grub-core/fs/udf.c grub-core/fs/ufs2.c grub-core/fs/ufs.c grub-core/fs/ufs_be.c grub-core/fs/xfs.c grub-core/fs/zfs/zfscrypt.c grub-core/fs/zfs/zfs.c grub-core/fs/zfs/zfsinfo.c grub-core/fs/zfs/zfs_lzjb.c grub-core/fs/zfs/zfs_lz4.c grub-core/fs/zfs/zfs_sha256.c grub-core/fs/zfs/zfs_fletcher.c grub-core/lib/envblk.c grub-core/lib/hexdump.c grub-core/lib/LzFind.c grub-core/lib/LzmaEnc.c grub-core/lib/crc.c grub-core/lib/adler32.c grub-core/lib/crc64.c grub-core/normal/datetime.c grub-core/normal/misc.c grub-core/partmap/acorn.c grub-core/partmap/amiga.c grub-core/partmap/apple.c grub-core/partmap/sun.c grub-core/partmap/plan.c grub-core/partmap/dvh.c grub-core/partmap/sunpc.c grub-core/partmap/bsdlabel.c grub-core/partmap/dfly.c grub-core/script/function.c grub-core/script/lexer.c grub-core/script/main.c grub-core/script/script.c grub-core/script/argv.c grub-core/io/gzio.c grub-core/io/xzio.c grub-core/io/lzopio.c grub-core/kern/ia64/dl_helper.c grub-core/kern/arm/dl_helper.c grub-core/kern/arm64/dl_helper.c grub-core/lib/minilzo/minilzo.c grub-core/lib/xzembed/xz_dec_bcj.c grub-core/lib/xzembed/xz_dec_lzma2.c grub-core/lib/xzembed/xz_dec_stream.c grub-core/lib/zstd/debug.c grub-core/lib/zstd/entropy_common.c grub-core/lib/zstd/error_private.c grub-core/lib/zstd/fse_decompress.c grub-core/lib/zstd/huf_decompress.c grub-core/lib/zstd/module.c grub-core/lib/zstd/xxhash.c grub-core/lib/zstd/zstd_common.c grub-core/lib/zstd/zstd_decompress.c
|
||||
libgrubmods_a_SOURCES += grub-core/commands/blocklist.c grub-core/commands/macbless.c grub-core/commands/xnu_uuid.c grub-core/commands/testload.c grub-core/commands/ls.c grub-core/disk/dmraid_nvidia.c grub-core/disk/loopback.c grub-core/disk/lvm.c grub-core/disk/mdraid_linux.c grub-core/disk/mdraid_linux_be.c grub-core/disk/mdraid1x_linux.c grub-core/disk/raid5_recover.c grub-core/disk/raid6_recover.c grub-core/font/font.c grub-core/gfxmenu/font.c grub-core/normal/charset.c grub-core/video/fb/fbblit.c grub-core/video/fb/fbutil.c grub-core/video/fb/fbfill.c grub-core/video/fb/video_fb.c grub-core/video/video.c grub-core/video/capture.c grub-core/video/colors.c grub-core/unidata.c grub-core/io/bufio.c grub-core/fs/affs.c grub-core/fs/afs.c grub-core/fs/bfs.c grub-core/fs/btrfs.c grub-core/fs/cbfs.c grub-core/fs/cpio.c grub-core/fs/cpio_be.c grub-core/fs/odc.c grub-core/fs/newc.c grub-core/fs/ext2.c grub-core/fs/fat.c grub-core/fs/exfat.c grub-core/fs/f2fs.c grub-core/fs/fshelp.c grub-core/fs/hfs.c grub-core/fs/hfsplus.c grub-core/fs/hfspluscomp.c grub-core/fs/iso9660.c grub-core/fs/jfs.c grub-core/fs/minix.c grub-core/fs/minix2.c grub-core/fs/minix3.c grub-core/fs/minix_be.c grub-core/fs/minix2_be.c grub-core/fs/minix3_be.c grub-core/fs/nilfs2.c grub-core/fs/ntfs.c grub-core/fs/ntfscomp.c grub-core/fs/reiserfs.c grub-core/fs/romfs.c grub-core/fs/sfs.c grub-core/fs/squash4.c grub-core/fs/tar.c grub-core/fs/udf.c grub-core/fs/ufs2.c grub-core/fs/ufs.c grub-core/fs/ufs_be.c grub-core/fs/xfs.c grub-core/fs/zfs/zfscrypt.c grub-core/fs/zfs/zfs.c grub-core/fs/zfs/zfsinfo.c grub-core/fs/zfs/zfs_lzjb.c grub-core/fs/zfs/zfs_lz4.c grub-core/fs/zfs/zfs_sha256.c grub-core/fs/zfs/zfs_fletcher.c grub-core/lib/envblk.c grub-core/lib/hexdump.c grub-core/lib/LzFind.c grub-core/lib/LzmaEnc.c grub-core/lib/crc.c grub-core/lib/adler32.c grub-core/lib/crc64.c grub-core/lib/datetime.c grub-core/normal/misc.c grub-core/partmap/acorn.c grub-core/partmap/amiga.c grub-core/partmap/apple.c grub-core/partmap/sun.c grub-core/partmap/plan.c grub-core/partmap/dvh.c grub-core/partmap/sunpc.c grub-core/partmap/bsdlabel.c grub-core/partmap/dfly.c grub-core/script/function.c grub-core/script/lexer.c grub-core/script/main.c grub-core/script/script.c grub-core/script/argv.c grub-core/io/gzio.c grub-core/io/xzio.c grub-core/io/lzopio.c grub-core/kern/ia64/dl_helper.c grub-core/kern/arm/dl_helper.c grub-core/kern/arm64/dl_helper.c grub-core/lib/minilzo/minilzo.c grub-core/lib/xzembed/xz_dec_bcj.c grub-core/lib/xzembed/xz_dec_lzma2.c grub-core/lib/xzembed/xz_dec_stream.c grub-core/lib/zstd/debug.c grub-core/lib/zstd/entropy_common.c grub-core/lib/zstd/error_private.c grub-core/lib/zstd/fse_decompress.c grub-core/lib/zstd/huf_decompress.c grub-core/lib/zstd/module.c grub-core/lib/zstd/xxhash.c grub-core/lib/zstd/zstd_common.c grub-core/lib/zstd/zstd_decompress.c
|
||||
nodist_libgrubmods_a_SOURCES += grub_script.tab.c grub_script.yy.c libgrub_a_init.c grub_script.yy.h grub_script.tab.h
|
||||
libgrubmods_a_CFLAGS += $(AM_CFLAGS) $(CFLAGS_LIBRARY) -fno-builtin -Wno-undef
|
||||
libgrubmods_a_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) -I$(srcdir)/grub-core/lib/minilzo -I$(srcdir)/grub-core/lib/xzembed -I$(srcdir)/grub-core/lib/zstd -DMINILZO_HAVE_CONFIG_H
|
||||
@ -55,7 +55,7 @@ nodist_grub_mkimage_SOURCES =
|
||||
grub_mkimage_LDADD = libgrubmods.a libgrubgcry.a libgrubkern.a grub-core/lib/gnulib/libgnu.a $(LIBLZMA) $(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)
|
||||
grub_mkimage_CFLAGS = $(AM_CFLAGS) $(CFLAGS_PROGRAM)
|
||||
grub_mkimage_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_PROGRAM)
|
||||
grub_mkimage_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM) -DGRUB_PKGLIBDIR=\"$(pkglibdir)\"
|
||||
grub_mkimage_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM)
|
||||
grub_mkimage_CCASFLAGS = $(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM)
|
||||
dist_noinst_DATA += grub-core/osdep/aros/config.c grub-core/osdep/windows/config.c grub-core/osdep/unix/config.c util/grub-mkimagexx.c
|
||||
BUILT_SOURCES += $(nodist_grub_mkimage_SOURCES)
|
||||
@ -110,14 +110,14 @@ grub-editenv.1: grub-editenv
|
||||
|
||||
CLEANFILES += grub-editenv.1
|
||||
endif
|
||||
grub_editenv_SOURCES = util/grub-editenv.c util/editenv.c grub-core/osdep/init.c
|
||||
grub_editenv_SOURCES = util/grub-editenv.c util/editenv.c util/grub-install-common.c grub-core/osdep/init.c grub-core/osdep/compress.c util/mkimage.c util/grub-mkimage32.c util/grub-mkimage64.c grub-core/osdep/config.c util/config.c util/resolve.c
|
||||
nodist_grub_editenv_SOURCES =
|
||||
grub_editenv_LDADD = libgrubmods.a libgrubgcry.a libgrubkern.a grub-core/lib/gnulib/libgnu.a $(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)
|
||||
grub_editenv_LDADD = $(LIBLZMA) libgrubmods.a libgrubgcry.a libgrubkern.a grub-core/lib/gnulib/libgnu.a $(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)
|
||||
grub_editenv_CFLAGS = $(AM_CFLAGS) $(CFLAGS_PROGRAM)
|
||||
grub_editenv_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_PROGRAM)
|
||||
grub_editenv_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM)
|
||||
grub_editenv_CCASFLAGS = $(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM)
|
||||
dist_noinst_DATA +=
|
||||
dist_noinst_DATA += grub-core/osdep/unix/compress.c grub-core/osdep/basic/compress.c
|
||||
BUILT_SOURCES += $(nodist_grub_editenv_SOURCES)
|
||||
CLEANFILES += $(nodist_grub_editenv_SOURCES)
|
||||
bin_PROGRAMS += grub-mkpasswd-pbkdf2
|
||||
@ -696,6 +696,15 @@ grubconf_SCRIPTS += 30_os-prober
|
||||
CLEANFILES += 30_os-prober
|
||||
EXTRA_DIST +=
|
||||
dist_noinst_DATA += util/grub.d/30_os-prober.in
|
||||
grubconf_SCRIPTS += 30_uefi-firmware
|
||||
|
||||
30_uefi-firmware: $(top_builddir)/config.status util/grub.d/30_uefi-firmware.in
|
||||
(for x in util/grub.d/30_uefi-firmware.in ; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:-
|
||||
chmod a+x 30_uefi-firmware
|
||||
|
||||
CLEANFILES += 30_uefi-firmware
|
||||
EXTRA_DIST +=
|
||||
dist_noinst_DATA += util/grub.d/30_uefi-firmware.in
|
||||
grubconf_SCRIPTS += 40_custom
|
||||
|
||||
40_custom: $(top_builddir)/config.status util/grub.d/40_custom.in
|
||||
|
@ -3,7 +3,7 @@ AutoGen definitions Makefile.tpl;
|
||||
library = {
|
||||
name = libgrubkern.a;
|
||||
cflags = '$(CFLAGS_GNULIB)';
|
||||
cppflags = '$(CPPFLAGS_GNULIB)';
|
||||
cppflags = '$(CPPFLAGS_GNULIB) -I$(srcdir)/grub-core/lib/json';
|
||||
|
||||
common = util/misc.c;
|
||||
common = grub-core/kern/command.c;
|
||||
@ -36,7 +36,9 @@ library = {
|
||||
common = grub-core/kern/misc.c;
|
||||
common = grub-core/kern/partition.c;
|
||||
common = grub-core/lib/crypto.c;
|
||||
common = grub-core/lib/json/json.c;
|
||||
common = grub-core/disk/luks.c;
|
||||
common = grub-core/disk/luks2.c;
|
||||
common = grub-core/disk/geli.c;
|
||||
common = grub-core/disk/cryptodisk.c;
|
||||
common = grub-core/disk/AFSplitter.c;
|
||||
@ -139,7 +141,7 @@ library = {
|
||||
common = grub-core/lib/crc.c;
|
||||
common = grub-core/lib/adler32.c;
|
||||
common = grub-core/lib/crc64.c;
|
||||
common = grub-core/normal/datetime.c;
|
||||
common = grub-core/lib/datetime.c;
|
||||
common = grub-core/normal/misc.c;
|
||||
common = grub-core/partmap/acorn.c;
|
||||
common = grub-core/partmap/amiga.c;
|
||||
@ -201,7 +203,6 @@ program = {
|
||||
ldadd = grub-core/lib/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBLZMA)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
cppflags = '-DGRUB_PKGLIBDIR=\"$(pkglibdir)\"';
|
||||
};
|
||||
|
||||
program = {
|
||||
@ -240,8 +241,19 @@ program = {
|
||||
|
||||
common = util/grub-editenv.c;
|
||||
common = util/editenv.c;
|
||||
common = util/grub-install-common.c;
|
||||
common = grub-core/osdep/init.c;
|
||||
common = grub-core/osdep/compress.c;
|
||||
extra_dist = grub-core/osdep/unix/compress.c;
|
||||
extra_dist = grub-core/osdep/basic/compress.c;
|
||||
common = util/mkimage.c;
|
||||
common = util/grub-mkimage32.c;
|
||||
common = util/grub-mkimage64.c;
|
||||
common = grub-core/osdep/config.c;
|
||||
common = util/config.c;
|
||||
common = util/resolve.c;
|
||||
|
||||
ldadd = '$(LIBLZMA)';
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
@ -502,6 +514,12 @@ script = {
|
||||
installdir = grubconf;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '30_uefi-firmware';
|
||||
common = util/grub.d/30_uefi-firmware.in;
|
||||
installdir = grubconf;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '40_custom';
|
||||
common = util/grub.d/40_custom.in;
|
||||
|
14
NEWS
14
NEWS
@ -1,3 +1,17 @@
|
||||
New in 2.06:
|
||||
|
||||
* GCC 10 support.
|
||||
* clang 10 support.
|
||||
* SBAT support.
|
||||
* LUKS2 support.
|
||||
* Drop small MBR gap support.
|
||||
* Xen Security Modules (XSM/FLASK) support.
|
||||
* The lockdown mechanism similar to the Linux kernel one.
|
||||
* Disable the os-prober by default.
|
||||
* Many backports of GRUB distros specific patches.
|
||||
* BootHole and BootHole2 fixes.
|
||||
* ...and tons of other fixes and cleanups...
|
||||
|
||||
New in 2.04:
|
||||
|
||||
* GCC 8 and 9 support.
|
||||
|
6
README
6
README
@ -7,6 +7,12 @@ See the file NEWS for a description of recent changes to GRUB 2.
|
||||
See the file INSTALL for instructions on how to build and install the
|
||||
GRUB 2 data and program files.
|
||||
|
||||
See the file MAINTAINERS for information about the GRUB maintainers, etc.
|
||||
|
||||
If you found a security vulnerability in the GRUB please check the SECURITY
|
||||
file to get more information how to properly report this kind of bugs to
|
||||
the maintainers.
|
||||
|
||||
Please visit the official web page of GRUB 2, for more information.
|
||||
The URL is <http://www.gnu.org/software/grub/grub.html>.
|
||||
|
||||
|
38
acinclude.m4
38
acinclude.m4
@ -305,9 +305,9 @@ fi
|
||||
])
|
||||
|
||||
|
||||
dnl Check if the C compiler supports `-fstack-protector'.
|
||||
dnl Check if the C compiler supports the stack protector
|
||||
AC_DEFUN([grub_CHECK_STACK_PROTECTOR],[
|
||||
[# Smashing stack protector.
|
||||
[# Stack smashing protector.
|
||||
ssp_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector'])
|
||||
# Is this a reliable test case?
|
||||
@ -324,6 +324,40 @@ else
|
||||
ssp_possible=no]
|
||||
AC_MSG_RESULT([no])
|
||||
[fi]
|
||||
[# Strong stack smashing protector.
|
||||
ssp_strong_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector-strong'])
|
||||
# Is this a reliable test case?
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||
void foo (void) { volatile char a[8]; a[3]; }
|
||||
]])])
|
||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||
# `ac_compile' like this correct, after all?
|
||||
if eval "$ac_compile -S -fstack-protector-strong -o conftest.s" 2> /dev/null; then]
|
||||
AC_MSG_RESULT([yes])
|
||||
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
||||
rm -f conftest.s
|
||||
else
|
||||
ssp_strong_possible=no]
|
||||
AC_MSG_RESULT([no])
|
||||
[fi]
|
||||
[# Global stack smashing protector.
|
||||
ssp_global_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' accepts `-mstack-protector-guard=global'])
|
||||
# Is this a reliable test case?
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||
void foo (void) { volatile char a[8]; a[3]; }
|
||||
]])])
|
||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||
# `ac_compile' like this correct, after all?
|
||||
if eval "$ac_compile -S -fstack-protector -mstack-protector-guard=global -o conftest.s" 2> /dev/null; then]
|
||||
AC_MSG_RESULT([yes])
|
||||
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
||||
rm -f conftest.s
|
||||
else
|
||||
ssp_global_possible=no]
|
||||
AC_MSG_RESULT([no])
|
||||
[fi]
|
||||
])
|
||||
|
||||
dnl Check if the C compiler supports `-mstack-arg-probe' (Cygwin).
|
||||
|
1
aclocal.m4
vendored
1
aclocal.m4
vendored
@ -1686,6 +1686,7 @@ m4_include([m4/__inline.m4])
|
||||
m4_include([m4/absolute-header.m4])
|
||||
m4_include([m4/alloca.m4])
|
||||
m4_include([m4/argp.m4])
|
||||
m4_include([m4/base64.m4])
|
||||
m4_include([m4/btowc.m4])
|
||||
m4_include([m4/builtin-expect.m4])
|
||||
m4_include([m4/chdir-long.m4])
|
||||
|
@ -13,7 +13,7 @@ fi
|
||||
export LC_COLLATE=C
|
||||
unset LC_ALL
|
||||
|
||||
find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' ! -ipath './gnulib/*' ! -iname './grub-core/lib/gnulib/*' |sort > po/POTFILES.in
|
||||
find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' ! -ipath './gnulib/*' ! -ipath './grub-core/lib/gnulib/*' |sort > po/POTFILES.in
|
||||
find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in
|
||||
|
||||
echo "Importing unicode..."
|
||||
|
@ -84,7 +84,9 @@ CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
|
||||
CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_TERMINAL_LIST += '-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_lockdown(...)=COMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd_lockdown(...)=EXTCOMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_FDT_LIST := '-Dgrub_fdtbus_register(...)=FDT_DRIVER_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
|
||||
|
@ -28,7 +28,13 @@ EXTRA_DIST += grub-core/gensymlist.sh
|
||||
EXTRA_DIST += grub-core/genemuinit.sh
|
||||
EXTRA_DIST += grub-core/genemuinitheader.sh
|
||||
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-base64.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch
|
||||
|
||||
@ -110,6 +116,21 @@ EXTRA_DIST += grub-core/osdep/windows/password.c
|
||||
EXTRA_DIST += grub-core/osdep/windows/random.c
|
||||
EXTRA_DIST += grub-core/osdep/windows/sleep.c
|
||||
|
||||
EXTRA_DIST += po/gettext-patches/0001-Support-POTFILES-shell.patch
|
||||
EXTRA_DIST += po/gettext-patches/0002-Handle-gettext_printf-shell-function.patch
|
||||
EXTRA_DIST += po/gettext-patches/0003-Make-msgfmt-output-in-little-endian.patch
|
||||
EXTRA_DIST += po/gettext-patches/0004-Use-SHELL-rather-than-bin-sh.patch
|
||||
|
||||
EXTRA_DIST += po/POTFILES-shell.in
|
||||
EXTRA_DIST += po/README
|
||||
EXTRA_DIST += po/Rules-translit
|
||||
EXTRA_DIST += po/Rules-windowsdir
|
||||
EXTRA_DIST += po/arabic.sed
|
||||
EXTRA_DIST += po/cyrillic.sed
|
||||
EXTRA_DIST += po/greek.sed
|
||||
EXTRA_DIST += po/grub.d.sed
|
||||
EXTRA_DIST += po/hebrew.sed
|
||||
|
||||
EXTRA_DIST += tests/dfly-mbr-mbexample.mbr.img.gz
|
||||
EXTRA_DIST += tests/dfly-mbr-mbexample.dfly.img.gz
|
||||
|
||||
|
@ -253,6 +253,9 @@
|
||||
*/
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define to 1 if you have the `atexit' function. */
|
||||
#undef HAVE_ATEXIT
|
||||
|
||||
/* Define to 1 if you have the <bp-sym.h> header file. */
|
||||
#undef HAVE_BP_SYM_H
|
||||
|
||||
@ -935,6 +938,9 @@
|
||||
/* Define to 1 if you have the `__chkstk_ms' function. */
|
||||
#undef HAVE___CHKSTK_MS
|
||||
|
||||
/* Define to 1 if you have the `__clzdi2' function. */
|
||||
#undef HAVE___CLZDI2
|
||||
|
||||
/* Define to 1 if you have the `__ctzdi2' function. */
|
||||
#undef HAVE___CTZDI2
|
||||
|
||||
|
229
configure
vendored
229
configure
vendored
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for GRUB 2.04.
|
||||
# Generated by GNU Autoconf 2.69 for GRUB 2.06.
|
||||
#
|
||||
# Report bugs to <bug-grub@gnu.org>.
|
||||
#
|
||||
@ -580,8 +580,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='GRUB'
|
||||
PACKAGE_TARNAME='grub'
|
||||
PACKAGE_VERSION='2.04'
|
||||
PACKAGE_STRING='GRUB 2.04'
|
||||
PACKAGE_VERSION='2.06'
|
||||
PACKAGE_STRING='GRUB 2.06'
|
||||
PACKAGE_BUGREPORT='bug-grub@gnu.org'
|
||||
PACKAGE_URL=''
|
||||
|
||||
@ -1778,6 +1778,7 @@ with_libintl_prefix
|
||||
with_libpth_prefix
|
||||
with_included_regex
|
||||
enable_efiemu
|
||||
enable_stack_protector
|
||||
enable_mm_debug
|
||||
enable_cache_stats
|
||||
enable_boot_time
|
||||
@ -2365,7 +2366,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures GRUB 2.04 to adapt to many kinds of systems.
|
||||
\`configure' configures GRUB 2.06 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@ -2437,7 +2438,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of GRUB 2.04:";;
|
||||
short | recursive ) echo "Configuration of GRUB 2.06:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@ -2459,6 +2460,8 @@ Optional Features:
|
||||
--disable-rpath do not hardcode runtime library paths
|
||||
--enable-efiemu build and install the efiemu runtimes
|
||||
(default=guessed)
|
||||
--enable-stack-protector
|
||||
enable the stack protector
|
||||
--enable-mm-debug include memory manager debugging
|
||||
--enable-cache-stats enable disk cache statistics collection
|
||||
--enable-boot-time enable boot time statistics collection
|
||||
@ -2596,7 +2599,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
GRUB configure 2.04
|
||||
GRUB configure 2.06
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
@ -3343,7 +3346,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by GRUB $as_me 2.04, which was
|
||||
It was created by GRUB $as_me 2.06, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@ -4385,7 +4388,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='grub'
|
||||
VERSION='2.04'
|
||||
VERSION='2.06'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@ -4647,9 +4650,15 @@ grub_file=`$as_echo grub-file | sed "$program_transform_name"`
|
||||
|
||||
# Optimization flag. Allow user to override.
|
||||
if test "x$TARGET_CFLAGS" = x; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -Os"
|
||||
TARGET_CFLAGS=-Os
|
||||
fi
|
||||
|
||||
# Enable support for "restrict" keyword and other
|
||||
# features from gnu99 C language standard.
|
||||
BUILD_CFLAGS="-std=gnu99 $BUILD_CFLAGS"
|
||||
HOST_CFLAGS="-std=gnu99 $HOST_CFLAGS"
|
||||
TARGET_CFLAGS="-std=gnu99 $TARGET_CFLAGS"
|
||||
|
||||
# Default HOST_CPPFLAGS
|
||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
|
||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
|
||||
@ -8238,6 +8247,7 @@ fi
|
||||
# Code from module argp:
|
||||
# Code from module assure:
|
||||
# Code from module at-internal:
|
||||
# Code from module base64:
|
||||
# Code from module btowc:
|
||||
# Code from module builtin-expect:
|
||||
# Code from module chdir:
|
||||
@ -12307,7 +12317,7 @@ fi
|
||||
fi
|
||||
|
||||
# Check for functions and headers.
|
||||
for ac_func in posix_memalign memalign getextmntent
|
||||
for ac_func in posix_memalign memalign getextmntent atexit
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
@ -20950,6 +20960,11 @@ rm -f core conftest.err conftest.$ac_objext \
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if test $ac_cv_func_btowc = no; then
|
||||
HAVE_BTOWC=0
|
||||
else
|
||||
@ -30783,6 +30798,24 @@ CPPFLAGS="$TARGET_CPPFLAGS"
|
||||
LDFLAGS="$TARGET_LDFLAGS"
|
||||
LIBS=""
|
||||
|
||||
if test "x$target_m32" = x1; then
|
||||
# Force 32-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
||||
TARGET_MODULE_FORMAT="elf32"
|
||||
fi
|
||||
|
||||
if test "x$target_m64" = x1; then
|
||||
# Force 64-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
||||
TARGET_MODULE_FORMAT="elf64"
|
||||
fi
|
||||
|
||||
# debug flags.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
|
||||
@ -31091,24 +31124,6 @@ if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
|
||||
fi
|
||||
|
||||
if test "x$target_m32" = x1; then
|
||||
# Force 32-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
||||
TARGET_MODULE_FORMAT="elf32"
|
||||
fi
|
||||
|
||||
if test "x$target_m64" = x1; then
|
||||
# Force 64-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
||||
TARGET_MODULE_FORMAT="elf64"
|
||||
fi
|
||||
|
||||
if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3"
|
||||
fi
|
||||
@ -31338,6 +31353,24 @@ _ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
grub_cv_target_cc_soft_float="-mno-inline-float-divide -mno-inline-sqrt"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
if test "x$target_cpu" = xsh4; then
|
||||
CFLAGS="$TARGET_CFLAGS -m4-nofpu -Werror"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
grub_cv_target_cc_soft_float="-m4-nofpu"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
for cand in "-msoft-float -Xclang -msoft-float -Xclang -no-implicit-float" \
|
||||
@ -31655,6 +31688,39 @@ if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
|
||||
fi
|
||||
|
||||
# Do not generate .ident sections.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fno-ident works" >&5
|
||||
$as_echo_n "checking whether -fno-ident works... " >&6; }
|
||||
if ${grub_cv_cc_fno_ident+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
CFLAGS="$TARGET_CFLAGS -fno-ident"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
grub_cv_cc_fno_ident=yes
|
||||
else
|
||||
grub_cv_cc_fno_ident=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $grub_cv_cc_fno_ident" >&5
|
||||
$as_echo "$grub_cv_cc_fno_ident" >&6; }
|
||||
|
||||
if test "x$grub_cv_cc_fno_ident" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-ident"
|
||||
fi
|
||||
|
||||
CFLAGS="$TARGET_CFLAGS"
|
||||
|
||||
@ -32049,7 +32115,8 @@ else
|
||||
|
||||
grub_cv_target_cc_mno_movt=no
|
||||
for cand in "-mno-movt" \
|
||||
"-mllvm -arm-use-movt=0"; do
|
||||
"-mllvm -arm-use-movt=0" \
|
||||
"-mword-relocations"; do
|
||||
if test x"$grub_cv_target_cc_mno_movt" != xno ; then
|
||||
break
|
||||
fi
|
||||
@ -32283,6 +32350,7 @@ fi
|
||||
# `-fPIE' or '-fpie' and '-pie' in the default specs.
|
||||
if [ x"$pie_possible" = xyes ]; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE -fno-pie"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -fno-PIE -fno-pie"
|
||||
fi
|
||||
|
||||
if [ x"$link_nopie_needed" = xyes ] || [ x"$pie_possible" = xyes ]; then
|
||||
@ -32348,9 +32416,9 @@ fi
|
||||
|
||||
CFLAGS="$TARGET_CFLAGS"
|
||||
|
||||
# Smashing stack protector.
|
||||
# Stack smashing protector.
|
||||
|
||||
# Smashing stack protector.
|
||||
# Stack smashing protector.
|
||||
ssp_possible=yes
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`$CC' accepts \`-fstack-protector'" >&5
|
||||
$as_echo_n "checking whether \`$CC' accepts \`-fstack-protector'... " >&6; }
|
||||
@ -32373,11 +32441,88 @@ else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
# Strong stack smashing protector.
|
||||
ssp_strong_possible=yes
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`$CC' accepts \`-fstack-protector-strong'" >&5
|
||||
$as_echo_n "checking whether \`$CC' accepts \`-fstack-protector-strong'... " >&6; }
|
||||
# Is this a reliable test case?
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
# Need that, because some distributions ship compilers that include
|
||||
# `-fstack-protector' in the default specs.
|
||||
if test "x$ssp_possible" = xyes; then
|
||||
void foo (void) { volatile char a[8]; a[3]; }
|
||||
|
||||
_ACEOF
|
||||
# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||
# `ac_compile' like this correct, after all?
|
||||
if eval "$ac_compile -S -fstack-protector-strong -o conftest.s" 2> /dev/null; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
||||
rm -f conftest.s
|
||||
else
|
||||
ssp_strong_possible=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
# Global stack smashing protector.
|
||||
ssp_global_possible=yes
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`$CC' accepts \`-mstack-protector-guard=global'" >&5
|
||||
$as_echo_n "checking whether \`$CC' accepts \`-mstack-protector-guard=global'... " >&6; }
|
||||
# Is this a reliable test case?
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
void foo (void) { volatile char a[8]; a[3]; }
|
||||
|
||||
_ACEOF
|
||||
# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||
# `ac_compile' like this correct, after all?
|
||||
if eval "$ac_compile -S -fstack-protector -mstack-protector-guard=global -o conftest.s" 2> /dev/null; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
||||
rm -f conftest.s
|
||||
else
|
||||
ssp_global_possible=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
# Check whether --enable-stack-protector was given.
|
||||
if test "${enable_stack_protector+set}" = set; then :
|
||||
enableval=$enable_stack_protector;
|
||||
else
|
||||
enable_stack_protector=no
|
||||
fi
|
||||
|
||||
if test "x$enable_stack_protector" = xno; then
|
||||
if test "x$ssp_possible" = xyes; then
|
||||
# Need that, because some distributions ship compilers that include
|
||||
# `-fstack-protector' in the default specs.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
|
||||
fi
|
||||
elif test "x$platform" != xefi; then
|
||||
as_fn_error $? "--enable-stack-protector is only supported on EFI platforms" "$LINENO" 5
|
||||
elif test "x$ssp_global_possible" != xyes; then
|
||||
as_fn_error $? "--enable-stack-protector is not supported (compiler doesn't support -mstack-protector-guard=global)" "$LINENO" 5
|
||||
else
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -mstack-protector-guard=global"
|
||||
if test "x$enable_stack_protector" = xyes; then
|
||||
if test "x$ssp_possible" != xyes; then
|
||||
as_fn_error $? "--enable-stack-protector is not supported (compiler doesn't support -fstack-protector)" "$LINENO" 5
|
||||
fi
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fstack-protector"
|
||||
elif test "x$enable_stack_protector" = xstrong; then
|
||||
if test "x$ssp_strong_possible" != xyes; then
|
||||
as_fn_error $? "--enable-stack-protector=strong is not supported (compiler doesn't support -fstack-protector-strong)" "$LINENO" 5
|
||||
fi
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fstack-protector-strong"
|
||||
else
|
||||
# Note, -fstack-protector-all requires that the protector is disabled for
|
||||
# functions that appear in the call stack when the canary is initialized.
|
||||
as_fn_error $? "invalid value $enable_stack_protector for --enable-stack-protector" "$LINENO" 5
|
||||
fi
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_STACK_PROTECTOR=1"
|
||||
fi
|
||||
|
||||
CFLAGS="$TARGET_CFLAGS"
|
||||
@ -32554,7 +32699,7 @@ fi
|
||||
|
||||
# Check for libgcc symbols
|
||||
if test x"$platform" = xemu; then
|
||||
for ac_func in __udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms
|
||||
for ac_func in __udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __clzdi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
@ -33115,11 +33260,14 @@ LIBS="$tmp_LIBS"
|
||||
# Check whether --enable-mm-debug was given.
|
||||
if test "${enable_mm_debug+set}" = set; then :
|
||||
enableval=$enable_mm_debug;
|
||||
fi
|
||||
|
||||
if test x$enable_mm_debug = xyes; then
|
||||
|
||||
$as_echo "#define MM_DEBUG 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-cache-stats was given.
|
||||
if test "${enable_cache_stats+set}" = set; then :
|
||||
enableval=$enable_cache_stats;
|
||||
@ -35882,7 +36030,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by GRUB $as_me 2.04, which was
|
||||
This file was extended by GRUB $as_me 2.06, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@ -35952,7 +36100,7 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
GRUB config.status 2.04
|
||||
GRUB config.status 2.06
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
@ -37054,5 +37202,10 @@ echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excus
|
||||
else
|
||||
echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
|
||||
fi
|
||||
if test "x$enable_stack_protector" != xno; then
|
||||
echo "With stack smashing protector: Yes"
|
||||
else
|
||||
echo "With stack smashing protector: No"
|
||||
fi
|
||||
echo "*******************************************************"
|
||||
|
||||
|
131
configure.ac
131
configure.ac
@ -26,12 +26,15 @@ 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, 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.
|
||||
dnl CC, CFLAGS, etc.) for the host and target type, variables with
|
||||
dnl prefix "BUILD_" (such as BUILD_CC, BUILD_CFLAGS, etc.) for the
|
||||
dnl build type, variables with prefix "HOST_" (such as HOST_CC,
|
||||
dnl HOST_CFLAGS, etc.) for the host type and variables with the prefix
|
||||
dnl "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for
|
||||
dnl the target type. See INSTALL for full list of variables and
|
||||
dnl description of the relationships between them.
|
||||
|
||||
AC_INIT([GRUB],[2.04],[bug-grub@gnu.org])
|
||||
AC_INIT([GRUB],[2.06],[bug-grub@gnu.org])
|
||||
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
|
||||
@ -77,9 +80,15 @@ grub_TRANSFORM([grub-file])
|
||||
|
||||
# Optimization flag. Allow user to override.
|
||||
if test "x$TARGET_CFLAGS" = x; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -Os"
|
||||
TARGET_CFLAGS=-Os
|
||||
fi
|
||||
|
||||
# Enable support for "restrict" keyword and other
|
||||
# features from gnu99 C language standard.
|
||||
BUILD_CFLAGS="-std=gnu99 $BUILD_CFLAGS"
|
||||
HOST_CFLAGS="-std=gnu99 $HOST_CFLAGS"
|
||||
TARGET_CFLAGS="-std=gnu99 $TARGET_CFLAGS"
|
||||
|
||||
# Default HOST_CPPFLAGS
|
||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
|
||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
|
||||
@ -410,7 +419,7 @@ else
|
||||
fi
|
||||
|
||||
# Check for functions and headers.
|
||||
AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
|
||||
AC_CHECK_FUNCS(posix_memalign memalign getextmntent atexit)
|
||||
AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h)
|
||||
|
||||
# glibc 2.25 still includes sys/sysmacros.h in sys/types.h but emits deprecation
|
||||
@ -562,6 +571,24 @@ CPPFLAGS="$TARGET_CPPFLAGS"
|
||||
LDFLAGS="$TARGET_LDFLAGS"
|
||||
LIBS=""
|
||||
|
||||
if test "x$target_m32" = x1; then
|
||||
# Force 32-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
||||
TARGET_MODULE_FORMAT="elf32"
|
||||
fi
|
||||
|
||||
if test "x$target_m64" = x1; then
|
||||
# Force 64-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
||||
TARGET_MODULE_FORMAT="elf64"
|
||||
fi
|
||||
|
||||
# debug flags.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
|
||||
@ -750,24 +777,6 @@ if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
|
||||
fi
|
||||
|
||||
if test "x$target_m32" = x1; then
|
||||
# Force 32-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
||||
TARGET_MODULE_FORMAT="elf32"
|
||||
fi
|
||||
|
||||
if test "x$target_m64" = x1; then
|
||||
# Force 64-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
||||
TARGET_MODULE_FORMAT="elf64"
|
||||
fi
|
||||
|
||||
if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3"
|
||||
fi
|
||||
@ -854,6 +863,11 @@ if test x"$platform" != xemu ; then
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_target_cc_soft_float="-mno-inline-float-divide -mno-inline-sqrt"], [])
|
||||
fi
|
||||
if test "x$target_cpu" = xsh4; then
|
||||
CFLAGS="$TARGET_CFLAGS -m4-nofpu -Werror"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_target_cc_soft_float="-m4-nofpu"], [])
|
||||
fi
|
||||
for cand in "-msoft-float -Xclang -msoft-float -Xclang -no-implicit-float" \
|
||||
"-Xclang -msoft-float -Xclang -no-implicit-float" \
|
||||
"-Xclang -msoft-float" "-msoft-float"; do
|
||||
@ -999,6 +1013,17 @@ if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
|
||||
fi
|
||||
|
||||
# Do not generate .ident sections.
|
||||
AC_CACHE_CHECK([whether -fno-ident works], [grub_cv_cc_fno_ident], [
|
||||
CFLAGS="$TARGET_CFLAGS -fno-ident"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_fno_ident=yes],
|
||||
[grub_cv_cc_fno_ident=no])
|
||||
])
|
||||
|
||||
if test "x$grub_cv_cc_fno_ident" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-ident"
|
||||
fi
|
||||
|
||||
CFLAGS="$TARGET_CFLAGS"
|
||||
|
||||
@ -1198,7 +1223,8 @@ if test "x$target_cpu" = xarm; then
|
||||
AC_CACHE_CHECK([for options to disable movt and movw], grub_cv_target_cc_mno_movt, [
|
||||
grub_cv_target_cc_mno_movt=no
|
||||
for cand in "-mno-movt" \
|
||||
"-mllvm -arm-use-movt=0"; do
|
||||
"-mllvm -arm-use-movt=0" \
|
||||
"-mword-relocations"; do
|
||||
if test x"$grub_cv_target_cc_mno_movt" != xno ; then
|
||||
break
|
||||
fi
|
||||
@ -1251,6 +1277,7 @@ grub_CHECK_LINK_PIE
|
||||
# `-fPIE' or '-fpie' and '-pie' in the default specs.
|
||||
if [ x"$pie_possible" = xyes ]; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE -fno-pie"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -fno-PIE -fno-pie"
|
||||
fi
|
||||
|
||||
if [ x"$link_nopie_needed" = xyes ] || [ x"$pie_possible" = xyes ]; then
|
||||
@ -1285,12 +1312,41 @@ fi]
|
||||
|
||||
CFLAGS="$TARGET_CFLAGS"
|
||||
|
||||
# Smashing stack protector.
|
||||
# Stack smashing protector.
|
||||
grub_CHECK_STACK_PROTECTOR
|
||||
# Need that, because some distributions ship compilers that include
|
||||
# `-fstack-protector' in the default specs.
|
||||
if test "x$ssp_possible" = xyes; then
|
||||
AC_ARG_ENABLE([stack-protector],
|
||||
AS_HELP_STRING([--enable-stack-protector],
|
||||
[enable the stack protector]),
|
||||
[],
|
||||
[enable_stack_protector=no])
|
||||
if test "x$enable_stack_protector" = xno; then
|
||||
if test "x$ssp_possible" = xyes; then
|
||||
# Need that, because some distributions ship compilers that include
|
||||
# `-fstack-protector' in the default specs.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
|
||||
fi
|
||||
elif test "x$platform" != xefi; then
|
||||
AC_MSG_ERROR([--enable-stack-protector is only supported on EFI platforms])
|
||||
elif test "x$ssp_global_possible" != xyes; then
|
||||
AC_MSG_ERROR([--enable-stack-protector is not supported (compiler doesn't support -mstack-protector-guard=global)])
|
||||
else
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -mstack-protector-guard=global"
|
||||
if test "x$enable_stack_protector" = xyes; then
|
||||
if test "x$ssp_possible" != xyes; then
|
||||
AC_MSG_ERROR([--enable-stack-protector is not supported (compiler doesn't support -fstack-protector)])
|
||||
fi
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fstack-protector"
|
||||
elif test "x$enable_stack_protector" = xstrong; then
|
||||
if test "x$ssp_strong_possible" != xyes; then
|
||||
AC_MSG_ERROR([--enable-stack-protector=strong is not supported (compiler doesn't support -fstack-protector-strong)])
|
||||
fi
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fstack-protector-strong"
|
||||
else
|
||||
# Note, -fstack-protector-all requires that the protector is disabled for
|
||||
# functions that appear in the call stack when the canary is initialized.
|
||||
AC_MSG_ERROR([invalid value $enable_stack_protector for --enable-stack-protector])
|
||||
fi
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_STACK_PROTECTOR=1"
|
||||
fi
|
||||
|
||||
CFLAGS="$TARGET_CFLAGS"
|
||||
@ -1358,7 +1414,7 @@ fi
|
||||
|
||||
# Check for libgcc symbols
|
||||
if test x"$platform" = xemu; then
|
||||
AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms)
|
||||
AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __clzdi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms)
|
||||
fi
|
||||
|
||||
if test "x$TARGET_APPLE_LINKER" = x1 ; then
|
||||
@ -1435,9 +1491,11 @@ LIBS="$tmp_LIBS"
|
||||
# Memory manager debugging.
|
||||
AC_ARG_ENABLE([mm-debug],
|
||||
AS_HELP_STRING([--enable-mm-debug],
|
||||
[include memory manager debugging]),
|
||||
[AC_DEFINE([MM_DEBUG], [1],
|
||||
[Define to 1 if you enable memory manager debugging.])])
|
||||
[include memory manager debugging]))
|
||||
if test x$enable_mm_debug = xyes; then
|
||||
AC_DEFINE([MM_DEBUG], [1],
|
||||
[Define to 1 if you enable memory manager debugging.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([cache-stats],
|
||||
AS_HELP_STRING([--enable-cache-stats],
|
||||
@ -2103,5 +2161,10 @@ echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excus
|
||||
else
|
||||
echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
|
||||
fi
|
||||
if test "x$enable_stack_protector" != xno; then
|
||||
echo "With stack smashing protector: Yes"
|
||||
else
|
||||
echo "With stack smashing protector: No"
|
||||
fi
|
||||
echo "*******************************************************"
|
||||
]
|
||||
|
@ -93,8 +93,8 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
|
||||
$(top_srcdir)/m4/__inline.m4 \
|
||||
$(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
|
||||
$(top_srcdir)/m4/argp.m4 $(top_srcdir)/m4/btowc.m4 \
|
||||
$(top_srcdir)/m4/builtin-expect.m4 \
|
||||
$(top_srcdir)/m4/argp.m4 $(top_srcdir)/m4/base64.m4 \
|
||||
$(top_srcdir)/m4/btowc.m4 $(top_srcdir)/m4/builtin-expect.m4 \
|
||||
$(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/close.m4 \
|
||||
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/dirent_h.m4 \
|
||||
$(top_srcdir)/m4/dirfd.m4 $(top_srcdir)/m4/dirname.m4 \
|
||||
|
@ -1,7 +1,7 @@
|
||||
This is grub-dev.info, produced by makeinfo version 6.3 from
|
||||
grub-dev.texi.
|
||||
|
||||
This developer manual is for GNU GRUB (version 2.04, 24 June 2019).
|
||||
This developer manual is for GNU GRUB (version 2.06, 10 May 2021).
|
||||
|
||||
Copyright (C) 1999,2000,2001,2002,2004,2005,2006,2008,2009,2010,2011
|
||||
Free Software Foundation, Inc.
|
||||
@ -25,9 +25,9 @@ This is the developer documentation of GNU GRUB, the GRand Unified
|
||||
Bootloader, a flexible and powerful boot loader program for a wide range
|
||||
of architectures.
|
||||
|
||||
This edition documents version 2.04.
|
||||
This edition documents version 2.06.
|
||||
|
||||
This developer manual is for GNU GRUB (version 2.04, 24 June 2019).
|
||||
This developer manual is for GNU GRUB (version 2.06, 10 May 2021).
|
||||
|
||||
Copyright (C) 1999,2000,2001,2002,2004,2005,2006,2008,2009,2010,2011
|
||||
Free Software Foundation, Inc.
|
||||
@ -52,6 +52,7 @@ Free Software Foundation, Inc.
|
||||
* PFF2 Font File Format::
|
||||
* Graphical Menu Software Design::
|
||||
* Verifiers framework::
|
||||
* Lockdown framework::
|
||||
* Copying This Manual:: Copying This Manual
|
||||
* Index::
|
||||
|
||||
@ -515,9 +516,11 @@ necessary to update it.
|
||||
* Menu:
|
||||
|
||||
* Gnulib::
|
||||
* jsmn::
|
||||
* minilzo::
|
||||
|
||||
|
||||
File: grub-dev.info, Node: Gnulib, Up: Updating External Code
|
||||
File: grub-dev.info, Node: Gnulib, Next: jsmn, Up: Updating External Code
|
||||
|
||||
5.1 Gnulib
|
||||
==========
|
||||
@ -571,6 +574,43 @@ running the './bootstrap' utility:
|
||||
# Identify characteristics of the host architecture.
|
||||
|
||||
|
||||
It will also be necessary to adjust the patches in
|
||||
'po/gettext-patches/' to apply to an older version of gettext.
|
||||
|
||||
|
||||
File: grub-dev.info, Node: jsmn, Next: minilzo, Prev: Gnulib, Up: Updating External Code
|
||||
|
||||
5.2 jsmn
|
||||
========
|
||||
|
||||
jsmn is a minimalistic JSON parser which is implemented in a single
|
||||
header file 'jsmn.h'. To import a different version of the jsmn parser,
|
||||
you may simply download the 'jsmn.h' header from the desired tag or
|
||||
commit to the target directory:
|
||||
|
||||
curl -L https://raw.githubusercontent.com/zserge/jsmn/v1.1.0/jsmn.h \
|
||||
-o grub-core/lib/json/jsmn.h
|
||||
|
||||
|
||||
File: grub-dev.info, Node: minilzo, Prev: jsmn, Up: Updating External Code
|
||||
|
||||
5.3 minilzo
|
||||
===========
|
||||
|
||||
miniLZO is a very lightweight subset of the LZO library intended for
|
||||
easy inclusion in other projects. It is generated automatically from
|
||||
the LZO source code and contains the most important LZO functions.
|
||||
|
||||
To upgrade to a new version of the miniLZO library, download the
|
||||
release tarball and copy the files into the target directory:
|
||||
|
||||
curl -L -O http://www.oberhumer.com/opensource/lzo/download/minilzo-2.08.tar.gz
|
||||
tar -zxf minilzo-2.08.tar.gz
|
||||
rm minilzo-2.08/testmini.c
|
||||
rm -r grub-core/lib/minilzo/*
|
||||
cp minilzo-2.08/*.[hc] grub-core/lib/minilzo
|
||||
rm -r minilzo-2.08*
|
||||
|
||||
|
||||
File: grub-dev.info, Node: Porting, Next: Error Handling, Prev: Updating External Code, Up: Top
|
||||
|
||||
@ -796,7 +836,7 @@ to be inited in 2 stages: one before (to get at least rudimentary
|
||||
console as early as possible) and another after the heap (to get
|
||||
full-featured console). For the input there are string of keys,
|
||||
terminfo and direct hardware. For string of keys look at i386-pc (same
|
||||
files), for termino ieee1275 (same files) and for hardware loongson
|
||||
files), for terminfo ieee1275 (same files) and for hardware loongson
|
||||
(kern/mips/loongson/init.c and term/at_keyboard.c).
|
||||
|
||||
For the timer you'll need to call grub_install_get_time_ms (...)
|
||||
@ -2097,7 +2137,7 @@ mode that was in use before 'grub_video_setup()' was called might fix
|
||||
some of the problems.
|
||||
|
||||
|
||||
File: grub-dev.info, Node: Verifiers framework, Next: Copying This Manual, Prev: Graphical Menu Software Design, Up: Top
|
||||
File: grub-dev.info, Node: Verifiers framework, Next: Lockdown framework, Prev: Graphical Menu Software Design, Up: Top
|
||||
|
||||
13 Verifiers framework
|
||||
**********************
|
||||
@ -2161,7 +2201,32 @@ with just the context. If you return no error during any of 'init',
|
||||
verification.
|
||||
|
||||
|
||||
File: grub-dev.info, Node: Copying This Manual, Next: Index, Prev: Verifiers framework, Up: Top
|
||||
File: grub-dev.info, Node: Lockdown framework, Next: Copying This Manual, Prev: Verifiers framework, Up: Top
|
||||
|
||||
14 Lockdown framework
|
||||
*********************
|
||||
|
||||
The GRUB can be locked down, which is a restricted mode where some
|
||||
operations are not allowed. For instance, some commands cannot be used
|
||||
when the GRUB is locked down.
|
||||
|
||||
The function 'grub_lockdown()' is used to lockdown GRUB and the
|
||||
function 'grub_is_lockdown()' function can be used to check whether
|
||||
lockdown is enabled or not. When enabled, the function returns
|
||||
'GRUB_LOCKDOWN_ENABLED' and 'GRUB_LOCKDOWN_DISABLED' when is not
|
||||
enabled.
|
||||
|
||||
The following functions can be used to register the commands that can
|
||||
only be used when lockdown is disabled:
|
||||
|
||||
* 'grub_cmd_lockdown()' registers command which should not run when
|
||||
the GRUB is in lockdown mode.
|
||||
|
||||
* 'grub_cmd_lockdown()' registers extended command which should not
|
||||
run when the GRUB is in lockdown mode.
|
||||
|
||||
|
||||
File: grub-dev.info, Node: Copying This Manual, Next: Index, Prev: Lockdown framework, Up: Top
|
||||
|
||||
Appendix A Copying This Manual
|
||||
******************************
|
||||
@ -2614,43 +2679,46 @@ Index
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Top637
|
||||
Node: Getting the source code1777
|
||||
Node: Coding style2738
|
||||
Node: Naming Conventions3147
|
||||
Node: Functions3432
|
||||
Node: Variables4306
|
||||
Node: Types5421
|
||||
Node: Macros6022
|
||||
Node: Comments6354
|
||||
Node: Multi-Line Comments6963
|
||||
Node: Finding your way around7888
|
||||
Node: Contributing Changes11204
|
||||
Node: Getting started12309
|
||||
Node: Typical Developer Experience16361
|
||||
Node: When you are approved for write access to project's files17403
|
||||
Node: Updating External Code18836
|
||||
Node: Gnulib19107
|
||||
Node: Porting20969
|
||||
Node: Error Handling32733
|
||||
Node: Stack and heap size37825
|
||||
Node: BIOS port memory map40458
|
||||
Node: Video Subsystem41307
|
||||
Node: Video API41781
|
||||
Node: Example usage of Video API62230
|
||||
Node: Bitmap API63810
|
||||
Node: PFF2 Font File Format66343
|
||||
Node: Introduction66583
|
||||
Node: File Structure68086
|
||||
Node: Font Metrics73004
|
||||
Node: Graphical Menu Software Design74152
|
||||
Node: Introduction_274444
|
||||
Node: Startup Sequence75178
|
||||
Node: GUI Components76029
|
||||
Node: Command Line Window78629
|
||||
Node: Verifiers framework79581
|
||||
Node: Copying This Manual82189
|
||||
Node: GNU Free Documentation License82434
|
||||
Node: Index104827
|
||||
Node: Top636
|
||||
Node: Getting the source code1798
|
||||
Node: Coding style2759
|
||||
Node: Naming Conventions3168
|
||||
Node: Functions3453
|
||||
Node: Variables4327
|
||||
Node: Types5442
|
||||
Node: Macros6043
|
||||
Node: Comments6375
|
||||
Node: Multi-Line Comments6984
|
||||
Node: Finding your way around7909
|
||||
Node: Contributing Changes11225
|
||||
Node: Getting started12330
|
||||
Node: Typical Developer Experience16382
|
||||
Node: When you are approved for write access to project's files17424
|
||||
Node: Updating External Code18857
|
||||
Node: Gnulib19149
|
||||
Node: jsmn21142
|
||||
Node: minilzo21613
|
||||
Node: Porting22319
|
||||
Node: Error Handling34084
|
||||
Node: Stack and heap size39176
|
||||
Node: BIOS port memory map41809
|
||||
Node: Video Subsystem42658
|
||||
Node: Video API43132
|
||||
Node: Example usage of Video API63581
|
||||
Node: Bitmap API65161
|
||||
Node: PFF2 Font File Format67694
|
||||
Node: Introduction67934
|
||||
Node: File Structure69437
|
||||
Node: Font Metrics74355
|
||||
Node: Graphical Menu Software Design75503
|
||||
Node: Introduction_275795
|
||||
Node: Startup Sequence76529
|
||||
Node: GUI Components77380
|
||||
Node: Command Line Window79980
|
||||
Node: Verifiers framework80932
|
||||
Node: Lockdown framework83539
|
||||
Node: Copying This Manual84481
|
||||
Node: GNU Free Documentation License84725
|
||||
Node: Index107118
|
||||
|
||||
End Tag Table
|
||||
|
@ -86,6 +86,7 @@ This edition documents version @value{VERSION}.
|
||||
* PFF2 Font File Format::
|
||||
* Graphical Menu Software Design::
|
||||
* Verifiers framework::
|
||||
* Lockdown framework::
|
||||
* Copying This Manual:: Copying This Manual
|
||||
* Index::
|
||||
@end menu
|
||||
@ -490,6 +491,8 @@ to update it.
|
||||
|
||||
@menu
|
||||
* Gnulib::
|
||||
* jsmn::
|
||||
* minilzo::
|
||||
@end menu
|
||||
|
||||
@node Gnulib
|
||||
@ -545,6 +548,41 @@ AC_SYS_LARGEFILE
|
||||
|
||||
@end example
|
||||
|
||||
It will also be necessary to adjust the patches in
|
||||
@file{po/gettext-patches/} to apply to an older version of gettext.
|
||||
|
||||
@node jsmn
|
||||
@section jsmn
|
||||
|
||||
jsmn is a minimalistic JSON parser which is implemented in a single header file
|
||||
@file{jsmn.h}. To import a different version of the jsmn parser, you may simply
|
||||
download the @file{jsmn.h} header from the desired tag or commit to the target
|
||||
directory:
|
||||
|
||||
@example
|
||||
curl -L https://raw.githubusercontent.com/zserge/jsmn/v1.1.0/jsmn.h \
|
||||
-o grub-core/lib/json/jsmn.h
|
||||
@end example
|
||||
|
||||
@node minilzo
|
||||
@section minilzo
|
||||
|
||||
miniLZO is a very lightweight subset of the LZO library intended for easy
|
||||
inclusion in other projects. It is generated automatically from the LZO
|
||||
source code and contains the most important LZO functions.
|
||||
|
||||
To upgrade to a new version of the miniLZO library, download the release
|
||||
tarball and copy the files into the target directory:
|
||||
|
||||
@example
|
||||
curl -L -O http://www.oberhumer.com/opensource/lzo/download/minilzo-2.08.tar.gz
|
||||
tar -zxf minilzo-2.08.tar.gz
|
||||
rm minilzo-2.08/testmini.c
|
||||
rm -r grub-core/lib/minilzo/*
|
||||
cp minilzo-2.08/*.[hc] grub-core/lib/minilzo
|
||||
rm -r minilzo-2.08*
|
||||
@end example
|
||||
|
||||
@node Porting
|
||||
@chapter Porting
|
||||
|
||||
@ -782,7 +820,7 @@ Of video is loongson (kern/mips/loongson/init.c). Note that terminfo has
|
||||
to be inited in 2 stages: one before (to get at least rudimentary console
|
||||
as early as possible) and another after the heap (to get full-featured console).
|
||||
For the input there are string of keys, terminfo and direct hardware. For string
|
||||
of keys look at i386-pc (same files), for termino ieee1275 (same files) and for
|
||||
of keys look at i386-pc (same files), for terminfo ieee1275 (same files) and for
|
||||
hardware loongson (kern/mips/loongson/init.c and term/at_keyboard.c).
|
||||
|
||||
For the timer you'll need to call grub_install_get_time_ms (...) with as sole
|
||||
@ -2086,6 +2124,32 @@ Optionally at the end of the file @samp{fini}, if it exists, is called with just
|
||||
the context. If you return no error during any of @samp{init}, @samp{write} and
|
||||
@samp{fini} then the file is considered as having succeded verification.
|
||||
|
||||
@node Lockdown framework
|
||||
@chapter Lockdown framework
|
||||
|
||||
The GRUB can be locked down, which is a restricted mode where some operations
|
||||
are not allowed. For instance, some commands cannot be used when the GRUB is
|
||||
locked down.
|
||||
|
||||
The function
|
||||
@code{grub_lockdown()} is used to lockdown GRUB and the function
|
||||
@code{grub_is_lockdown()} function can be used to check whether lockdown is
|
||||
enabled or not. When enabled, the function returns @samp{GRUB_LOCKDOWN_ENABLED}
|
||||
and @samp{GRUB_LOCKDOWN_DISABLED} when is not enabled.
|
||||
|
||||
The following functions can be used to register the commands that can only be
|
||||
used when lockdown is disabled:
|
||||
|
||||
@itemize
|
||||
|
||||
@item @code{grub_cmd_lockdown()} registers command which should not run when the
|
||||
GRUB is in lockdown mode.
|
||||
|
||||
@item @code{grub_cmd_lockdown()} registers extended command which should not run
|
||||
when the GRUB is in lockdown mode.
|
||||
|
||||
@end itemize
|
||||
|
||||
@node Copying This Manual
|
||||
@appendix Copying This Manual
|
||||
|
||||
|
7872
docs/grub.info
7872
docs/grub.info
File diff suppressed because it is too large
Load Diff
7554
docs/grub.info-1
Normal file
7554
docs/grub.info-1
Normal file
File diff suppressed because it is too large
Load Diff
BIN
docs/grub.info-2
Normal file
BIN
docs/grub.info-2
Normal file
Binary file not shown.
514
docs/grub.texi
514
docs/grub.texi
@ -695,13 +695,6 @@ floppy instead of exposing the USB drive as a hard disk (they call it
|
||||
This install doesn't conflict with standard install as long as they are in
|
||||
separate directories.
|
||||
|
||||
Note that @command{grub-install} is actually just a shell script and the
|
||||
real task is done by other tools such as @command{grub-mkimage}. Therefore,
|
||||
you may run those commands directly to install GRUB, without using
|
||||
@command{grub-install}. Don't do that, however, unless you are very familiar
|
||||
with the internals of GRUB. Installing a boot loader on a running OS may be
|
||||
extremely dangerous.
|
||||
|
||||
On EFI systems for fixed disk install you have to mount EFI System Partition.
|
||||
If you mount it at @file{/boot/efi} then you don't need any special arguments:
|
||||
|
||||
@ -829,25 +822,46 @@ four primary partitions and additional logical partitions. With this
|
||||
partition table format, there are two ways to install GRUB: it can be
|
||||
embedded in the area between the MBR and the first partition (called by
|
||||
various names, such as the "boot track", "MBR gap", or "embedding area", and
|
||||
which is usually at least 31 KiB), or the core image can be installed in a
|
||||
which is usually at least 1000 KiB), or the core image can be installed in a
|
||||
file system and a list of the blocks that make it up can be stored in the
|
||||
first sector of that partition.
|
||||
|
||||
Each of these has different problems. There is no way to reserve space in
|
||||
Modern tools usually leave MBR gap of at least 1023 KiB. This amount is
|
||||
sufficient to cover most configurations. Hence this value is recommended
|
||||
by the GRUB team.
|
||||
|
||||
Historically many tools left only 31 KiB of space. This is not enough to
|
||||
parse reliably difficult structures like Btrfs, ZFS, RAID or LVM, or to
|
||||
use difficult disk access methods like ahci. Hence GRUB will warn if attempted
|
||||
to install into small MBR gap except in a small number of configurations
|
||||
that were grandfathered. The grandfathered config must:
|
||||
|
||||
* use biosdisk as disk access module for @file{/boot}
|
||||
* not use any additional partition maps to access @file{/boot}
|
||||
* @file{/boot} must be on one of following filesystems:
|
||||
* AFFS, AFS, BFS, cpio, newc, odc, ext2/3/4, FAT, exFAT,
|
||||
F2FS, HFS, uncompressed HFS+, ISO9660, JFS, Minix, Minix2, Minix3, NILFS2,
|
||||
NTFS, ReiserFS, ROMFS, SFS, tar, UDF, UFS1, UFS2, XFS
|
||||
|
||||
MBR gap has few technical problems. There is no way to reserve space in
|
||||
the embedding area with complete safety, and some proprietary software is
|
||||
known to use it to make it difficult for users to work around licensing
|
||||
restrictions; and systems are sometimes partitioned without leaving enough
|
||||
space before the first partition. On the other hand, installing to a
|
||||
filesystem means that GRUB is vulnerable to its blocks being moved around by
|
||||
filesystem features such as tail packing, or even by aggressive fsck
|
||||
implementations, so this approach is quite fragile; and this approach can
|
||||
only be used if the @file{/boot} filesystem is on the same disk that the
|
||||
BIOS boots from, so that GRUB does not have to rely on guessing BIOS drive
|
||||
numbers.
|
||||
restrictions. GRUB works it around by detecting sectors by other software and
|
||||
avoiding them and protecting its own sectors using Reed-Solomon encoding.
|
||||
|
||||
GRUB team recommends having MBR gap of at least 1000 KiB
|
||||
|
||||
Should it be not possible GRUB has support for a fallback solution which is
|
||||
heavily recommended against. Installing to a filesystem means that GRUB is
|
||||
vulnerable to its blocks being moved around by filesystem features such as
|
||||
tail packing, or even by aggressive fsck implementations, so this approach
|
||||
is quite fragile; and this approach can only be used if the @file{/boot}
|
||||
filesystem is on the same disk that the BIOS boots from, so that GRUB does
|
||||
not have to rely on guessing BIOS drive numbers.
|
||||
|
||||
The GRUB development team generally recommends embedding GRUB before the
|
||||
first partition, unless you have special requirements. You must ensure that
|
||||
the first partition starts at least 31 KiB (63 sectors) from the start of
|
||||
the first partition starts at least 1000 KiB (2000 sectors) from the start of
|
||||
the disk; on modern disks, it is often a performance advantage to align
|
||||
partitions on larger boundaries anyway, so the first partition might start 1
|
||||
MiB from the start of the disk.
|
||||
@ -894,6 +908,7 @@ magic.
|
||||
@menu
|
||||
* General boot methods:: How to boot OSes with GRUB generally
|
||||
* Loopback booting:: Notes on booting from loopbacks
|
||||
* LVM cache booting:: Notes on booting from LVM cache logical volume
|
||||
* OS-specific notes:: Notes on some operating systems
|
||||
@end menu
|
||||
|
||||
@ -991,6 +1006,26 @@ way. Please consider alternative boot methods like copying all files
|
||||
from the image to actual partition. Consult your OS documentation for
|
||||
more details
|
||||
|
||||
@node LVM cache booting
|
||||
@section Booting from LVM cache logical volume
|
||||
|
||||
The LVM cache logical volume is the logical volume consisting of the original
|
||||
and the cache pool logical volume. The original is usually on a larger and
|
||||
slower storage device while the cache pool is on a smaller and faster one. The
|
||||
performance of the original volume can be improved by storing the frequently
|
||||
used data on the cache pool to utilize the greater performance of faster
|
||||
device.
|
||||
|
||||
GRUB boots from LVM cache logical volume merely by reading it's original
|
||||
logical volume so that dirty data in cache pool volume is disregarded. This is
|
||||
not a problem for "writethrough" cache mode as it ensures that any data written
|
||||
will be stored both on the cache and the origin LV. For the other cache mode
|
||||
"writeback", which delays writing from the cache pool back to the origin LV to
|
||||
boost performance, GRUB may fail to boot in the wake of accidental power outage
|
||||
due to it's inability to assemble the cache device for reading the required
|
||||
dirty data left behind. The situation will be improved after adding full
|
||||
support to the LVM cache logical volume in the future.
|
||||
|
||||
@node OS-specific notes
|
||||
@section Some caveats on OS-specific issues
|
||||
|
||||
@ -1093,12 +1128,6 @@ grub> @kbd{initrd16 /initrd}
|
||||
Finally, run the command @command{boot} (@pxref{boot}).
|
||||
@end enumerate
|
||||
|
||||
@strong{Caution:} If you use an initrd and specify the @samp{mem=}
|
||||
option to the kernel to let it use less than actual memory size, you
|
||||
will also have to specify the same memory size to GRUB. To let GRUB know
|
||||
the size, run the command @command{uppermem} @emph{before} loading the
|
||||
kernel. @xref{uppermem}, for more information.
|
||||
|
||||
|
||||
@node NetBSD
|
||||
@subsection NetBSD
|
||||
@ -1309,12 +1338,12 @@ menu and then wait for the timeout set by @samp{GRUB_TIMEOUT} to expire
|
||||
before booting the default entry. Pressing a key interrupts the timeout.
|
||||
|
||||
If this option is set to @samp{countdown} or @samp{hidden}, then, before
|
||||
displaying the menu, GRUB will wait for the timeout set by
|
||||
@samp{GRUB_TIMEOUT} to expire. If @key{ESC} is pressed during that time, it
|
||||
will display the menu and wait for input. If a hotkey associated with a
|
||||
menu entry is pressed, it will boot the associated menu entry immediately.
|
||||
If the timeout expires before either of these happens, it will boot the
|
||||
default entry. In the @samp{countdown} case, it will show a one-line
|
||||
displaying the menu, GRUB will wait for the timeout set by @samp{GRUB_TIMEOUT}
|
||||
to expire. If @key{ESC} or @key{F4} are pressed, or @key{SHIFT} is held down
|
||||
during that time, it will display the menu and wait for input. If a hotkey
|
||||
associated with a menu entry is pressed, it will boot the associated menu entry
|
||||
immediately. If the timeout expires before either of these happens, it will
|
||||
boot the default entry. In the @samp{countdown} case, it will show a one-line
|
||||
indication of the remaining time.
|
||||
|
||||
@item GRUB_DEFAULT_BUTTON
|
||||
@ -1441,6 +1470,15 @@ enable the use of partition UUIDs, set this option to @samp{false}.
|
||||
If this option is set to @samp{true}, disable the generation of recovery
|
||||
mode menu entries.
|
||||
|
||||
@item GRUB_DISABLE_UUID
|
||||
Normally, @command{grub-mkconfig} will generate menu entries that use
|
||||
universally-unique identifiers (UUIDs) to identify various filesystems to
|
||||
search for files. This is usually more reliable, but in some cases it may
|
||||
not be appropriate. To disable this use of UUIDs, set this option to
|
||||
@samp{true}. Setting this option to @samp{true}, will also set the options
|
||||
@samp{GRUB_DISABLE_LINUX_UUID} and @samp{GRUB_DISABLE_LINUX_PARTUUID} to
|
||||
@samp{true}, unless they have been explicilty set to @samp{false}.
|
||||
|
||||
@item GRUB_VIDEO_BACKEND
|
||||
If graphical video support is required, either because the @samp{gfxterm}
|
||||
graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
|
||||
@ -1481,10 +1519,13 @@ boot sequence. If you have problems, set this option to @samp{text} and
|
||||
GRUB will tell Linux to boot in normal text mode.
|
||||
|
||||
@item GRUB_DISABLE_OS_PROBER
|
||||
Normally, @command{grub-mkconfig} will try to use the external
|
||||
@command{os-prober} program, if installed, to discover other operating
|
||||
systems installed on the same system and generate appropriate menu entries
|
||||
for them. Set this option to @samp{true} to disable this.
|
||||
The @command{grub-mkconfig} has a feature to use the external
|
||||
@command{os-prober} program to discover other operating systems installed on
|
||||
the same machine and generate appropriate menu entries for them. It is disabled
|
||||
by default since automatic and silent execution of @command{os-prober}, and
|
||||
creating boot entries based on that data, is a potential attack vector. Set
|
||||
this option to @samp{false} to enable this feature in the
|
||||
@command{grub-mkconfig} command.
|
||||
|
||||
@item GRUB_OS_PROBER_SKIP_LIST
|
||||
List of space-separated FS UUIDs of filesystems to be ignored from os-prober
|
||||
@ -1495,7 +1536,7 @@ Normally, @command{grub-mkconfig} will generate top level menu entry for
|
||||
the kernel with highest version number and put all other found kernels
|
||||
or alternative menu entries for recovery mode in submenu. For entries returned
|
||||
by @command{os-prober} first entry will be put on top level and all others
|
||||
in submenu. If this option is set to @samp{y}, flat menu with all entries
|
||||
in submenu. If this option is set to @samp{true}, flat menu with all entries
|
||||
on top level will be generated instead. Changing this option will require
|
||||
changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback})
|
||||
and @samp{default} (@pxref{default}) environment variables as well as saved
|
||||
@ -1529,16 +1570,16 @@ configurations, but have better replacements:
|
||||
|
||||
@table @samp
|
||||
@item GRUB_HIDDEN_TIMEOUT
|
||||
Wait this many seconds before displaying the menu. If @key{ESC} is pressed
|
||||
during that time, display the menu and wait for input according to
|
||||
@samp{GRUB_TIMEOUT}. If a hotkey associated with a menu entry is pressed,
|
||||
boot the associated menu entry immediately. If the timeout expires before
|
||||
either of these happens, display the menu for the number of seconds
|
||||
specified in @samp{GRUB_TIMEOUT} before booting the default entry.
|
||||
Wait this many seconds before displaying the menu. If @key{ESC} or @key{F4} are
|
||||
pressed, or @key{SHIFT} is held down during that time, display the menu and wait
|
||||
for input according to @samp{GRUB_TIMEOUT}. If a hotkey associated with a menu
|
||||
entry is pressed, boot the associated menu entry immediately. If the timeout
|
||||
expires before either of these happens, display the menu for the number of
|
||||
seconds specified in @samp{GRUB_TIMEOUT} before booting the default entry.
|
||||
|
||||
If you set @samp{GRUB_HIDDEN_TIMEOUT}, you should also set
|
||||
@samp{GRUB_TIMEOUT=0} so that the menu is not displayed at all unless
|
||||
@key{ESC} is pressed.
|
||||
@key{ESC} or @key{F4} are pressed, or @key{SHIFT} is held down.
|
||||
|
||||
This option is unset by default, and is deprecated in favour of the less
|
||||
confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
|
||||
@ -1812,10 +1853,9 @@ than zero; otherwise 0.
|
||||
@section Multi-boot manual config
|
||||
|
||||
Currently autogenerating config files for multi-boot environments depends on
|
||||
os-prober and has several shortcomings. While fixing it is scheduled for the
|
||||
next release, meanwhile you can make use of the power of GRUB syntax and do it
|
||||
yourself. A possible configuration is detailed here, feel free to adjust to your
|
||||
needs.
|
||||
os-prober and has several shortcomings. Due to that it is disabled by default.
|
||||
It is advised to use the power of GRUB syntax and do it yourself. A possible
|
||||
configuration is detailed here, feel free to adjust to your needs.
|
||||
|
||||
First create a separate GRUB partition, big enough to hold GRUB. Some of the
|
||||
following entries show how to load OS installer images from this same partition,
|
||||
@ -2486,6 +2526,57 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38
|
||||
Then follow instructions printed out by grub-mknetdir on configuring your DHCP
|
||||
server.
|
||||
|
||||
The grub.cfg file is placed in the same directory as the path output by
|
||||
grub-mknetdir hereafter referred to as FWPATH. GRUB will search for its
|
||||
configuration files in order using the following rules where the appended
|
||||
value corresponds to a value on the client machine.
|
||||
|
||||
@example
|
||||
@group
|
||||
@samp{(FWPATH)}/grub.cfg-@samp{(UUID OF MACHINE)}
|
||||
@samp{(FWPATH)}/grub.cfg-@samp{(MAC ADDRESS OF NIC)}
|
||||
@samp{(FWPATH)}/grub.cfg-@samp{(IPv4 OR IPv6 ADDRESS)}
|
||||
@samp{(FWPATH)}/grub.cfg
|
||||
@end group
|
||||
@end example
|
||||
|
||||
The UUID is the Client Machine Identifier Option Definition as specified in
|
||||
RFC 4578. The client will only attempt to loouk up a UUID config file if it
|
||||
was provided by the DHCP server.
|
||||
|
||||
The client will only attempt to look up an IPv6 address config once, however,
|
||||
it will try the IPv4 multiple times. The concrete example below shows what
|
||||
would happen under the IPv4 case.
|
||||
|
||||
@example
|
||||
@group
|
||||
UUID: 7726a678-7fc0-4853-a4f6-c85ac36a120a
|
||||
MAC: 52:54:00:ec:33:81
|
||||
IPV4: 10.0.0.130 (0A000082)
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@example
|
||||
@group
|
||||
@samp{(FWPATH)}/grub.cfg-7726a678-7fc0-4853-a4f6-c85ac36a120a
|
||||
@samp{(FWPATH)}/grub.cfg-52-54-00-ec-33-81
|
||||
@samp{(FWPATH)}/grub.cfg-0A000082
|
||||
@samp{(FWPATH)}/grub.cfg-0A00008
|
||||
@samp{(FWPATH)}/grub.cfg-0A0000
|
||||
@samp{(FWPATH)}/grub.cfg-0A000
|
||||
@samp{(FWPATH)}/grub.cfg-0A00
|
||||
@samp{(FWPATH)}/grub.cfg-0A0
|
||||
@samp{(FWPATH)}/grub.cfg-0A
|
||||
@samp{(FWPATH)}/grub.cfg-0
|
||||
@samp{(FWPATH)}/grub.cfg
|
||||
@end group
|
||||
@end example
|
||||
|
||||
This feature is enabled by default but it can be disabled by setting the
|
||||
@samp{feature_net_search_cfg} to @samp{n}. Since this happens before the
|
||||
configuration file is read by GRUB, this option has to be disabled in an
|
||||
embedded configuration file (@pxref{Embedded configuration}).
|
||||
|
||||
After GRUB has started, files on the TFTP server will be accessible via the
|
||||
@samp{(tftp)} device.
|
||||
|
||||
@ -3843,7 +3934,7 @@ names active.
|
||||
@node terminfo
|
||||
@subsection terminfo
|
||||
|
||||
@deffn Command terminfo [-a|-u|-v] [term]
|
||||
@deffn Command terminfo [@option{-a}|@option{-u}|@option{-v}] [@option{-g WxH}] [term] [type]
|
||||
Define the capabilities of your terminal by giving the name of an entry in
|
||||
the terminfo database, which should correspond roughly to a @samp{TERM}
|
||||
environment variable in Unix.
|
||||
@ -3860,6 +3951,8 @@ specifies logically-ordered UTF-8; and @option{-v} specifies
|
||||
emulator without bidirectional text support will display right-to-left text
|
||||
in the proper order; this is not really proper UTF-8, but a workaround).
|
||||
|
||||
The @option{-g} (@option{--geometry}) can be used to specify terminal geometry.
|
||||
|
||||
If no option or terminal type is specified, the current terminal type is
|
||||
printed.
|
||||
@end deffn
|
||||
@ -3892,6 +3985,7 @@ you forget a command, you can run the command @command{help}
|
||||
* cpuid:: Check for CPU features
|
||||
* crc:: Compute or check CRC32 checksums
|
||||
* cryptomount:: Mount a crypto device
|
||||
* cutmem:: Remove memory regions
|
||||
* date:: Display or set current date and time
|
||||
* devicetree:: Load a device tree blob
|
||||
* distrust:: Remove a pubkey from trusted keys
|
||||
@ -3930,7 +4024,6 @@ you forget a command, you can run the command @command{help}
|
||||
* password_pbkdf2:: Set a hashed password
|
||||
* play:: Play a tune
|
||||
* probe:: Retrieve device info
|
||||
* pxe_unload:: Unload the PXE environment
|
||||
* rdmsr:: Read values from model-specific registers
|
||||
* read:: Read user input
|
||||
* reboot:: Reboot your computer
|
||||
@ -3944,12 +4037,12 @@ you forget a command, you can run the command @command{help}
|
||||
* sha256sum:: Compute or check SHA256 hash
|
||||
* sha512sum:: Compute or check SHA512 hash
|
||||
* sleep:: Wait for a specified number of seconds
|
||||
* smbios:: Retrieve SMBIOS information
|
||||
* source:: Read a configuration file in same context
|
||||
* test:: Check file types and compare values
|
||||
* true:: Do nothing, successfully
|
||||
* trust:: Add public key to list of trusted keys
|
||||
* unset:: Unset an environment variable
|
||||
* uppermem:: Set the upper memory size
|
||||
@comment * vbeinfo:: List available video modes
|
||||
* verify_detached:: Verify detached digital signature
|
||||
* videoinfo:: List available video modes
|
||||
@ -3986,6 +4079,11 @@ Normally, this command will replace the Root System Description Pointer
|
||||
(RSDP) in the Extended BIOS Data Area to point to the new tables. If the
|
||||
@option{--no-ebda} option is used, the new tables will be known only to
|
||||
GRUB, but may be used by GRUB's EFI emulation.
|
||||
|
||||
Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
Otherwise an attacker can instruct the GRUB to load an SSDT table to
|
||||
overwrite the kernel lockdown configuration and later load and execute
|
||||
unsigned code.
|
||||
@end deffn
|
||||
|
||||
|
||||
@ -4029,7 +4127,6 @@ can be changed only when using @samp{gfxterm} for terminal output.
|
||||
|
||||
@deffn Command badram addr,mask[,addr,mask...]
|
||||
Filter out bad RAM.
|
||||
@end deffn
|
||||
|
||||
This command notifies the memory manager that specified regions of
|
||||
RAM ought to be filtered out (usually, because they're damaged). This
|
||||
@ -4046,6 +4143,13 @@ this page is to be filtered. This syntax makes it easy to represent patterns
|
||||
that are often result of memory damage, due to physical distribution of memory
|
||||
cells.
|
||||
|
||||
The command is similar to @command{cutmem} command.
|
||||
|
||||
Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
This prevents removing EFI memory regions to potentially subvert the
|
||||
security mechanisms provided by the UEFI secure boot.
|
||||
@end deffn
|
||||
|
||||
@node blocklist
|
||||
@subsection blocklist
|
||||
|
||||
@ -4201,10 +4305,33 @@ is requested interactively. Option @var{device} configures specific grub device
|
||||
with specified @var{uuid}; option @option{-a} configures all detected encrypted
|
||||
devices; option @option{-b} configures all geli containers that have boot flag set.
|
||||
|
||||
GRUB suports devices encrypted using LUKS and geli. Note that necessary modules (@var{luks} and @var{geli}) have to be loaded manually before this command can
|
||||
be used.
|
||||
GRUB suports devices encrypted using LUKS, LUKS2 and geli. Note that necessary
|
||||
modules (@var{luks}, @var{luks2} and @var{geli}) have to be loaded manually
|
||||
before this command can be used. For LUKS2 only the PBKDF2 key derivation
|
||||
function is supported, as Argon2 is not yet supported.
|
||||
|
||||
Also, note that, unlike filesystem UUIDs, UUIDs for encrypted devices must be
|
||||
specified without dash separators.
|
||||
@end deffn
|
||||
|
||||
@node cutmem
|
||||
@subsection cutmem
|
||||
|
||||
@deffn Command cutmem from[K|M|G] to[K|M|G]
|
||||
Remove any memory regions in specified range.
|
||||
|
||||
This command notifies the memory manager that specified regions of RAM ought to
|
||||
be filtered out. This remains in effect after a payload kernel has been loaded
|
||||
by GRUB, as long as the loaded kernel obtains its memory map from GRUB. Kernels
|
||||
that support this include Linux, GNU Mach, the kernel of FreeBSD and Multiboot
|
||||
kernels in general.
|
||||
|
||||
The command is similar to @command{badram} command.
|
||||
|
||||
Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
This prevents removing EFI memory regions to potentially subvert the
|
||||
security mechanisms provided by the UEFI secure boot.
|
||||
@end deffn
|
||||
|
||||
@node date
|
||||
@subsection date
|
||||
@ -4220,13 +4347,15 @@ hour, minute, and second unchanged.
|
||||
|
||||
|
||||
@node devicetree
|
||||
@subsection linux
|
||||
@subsection devicetree
|
||||
|
||||
@deffn Command devicetree file
|
||||
Load a device tree blob (.dtb) from a filesystem, for later use by a Linux
|
||||
kernel. Does not perform merging with any device tree supplied by firmware,
|
||||
but rather replaces it completely.
|
||||
@ref{GNU/Linux}.
|
||||
|
||||
Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
This is done to prevent subverting various security mechanisms.
|
||||
@end deffn
|
||||
|
||||
@node distrust
|
||||
@ -4423,22 +4552,22 @@ about each of the commands whose names begin with those @var{patterns}.
|
||||
@node initrd
|
||||
@subsection initrd
|
||||
|
||||
@deffn Command initrd file
|
||||
Load an initial ramdisk for a Linux kernel image, and set the appropriate
|
||||
parameters in the Linux setup area in memory. This may only be used after
|
||||
the @command{linux} command (@pxref{linux}) has been run. See also
|
||||
@ref{GNU/Linux}.
|
||||
@deffn Command initrd file [file @dots{}]
|
||||
Load, in order, all initial ramdisks for a Linux kernel image, and set
|
||||
the appropriate parameters in the Linux setup area in memory. This may only
|
||||
be used after the @command{linux} command (@pxref{linux}) has been run. See
|
||||
also @ref{GNU/Linux}.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node initrd16
|
||||
@subsection initrd16
|
||||
|
||||
@deffn Command initrd16 file
|
||||
Load an initial ramdisk for a Linux kernel image to be booted in 16-bit
|
||||
mode, and set the appropriate parameters in the Linux setup area in memory.
|
||||
This may only be used after the @command{linux16} command (@pxref{linux16})
|
||||
has been run. See also @ref{GNU/Linux}.
|
||||
@deffn Command initrd16 file [file @dots{}]
|
||||
Load, in order, all initial ramdisks for a Linux kernel image to be booted in
|
||||
16-bit mode, and set the appropriate parameters in the Linux setup area in
|
||||
memory. This may only be used after the @command{linux16} command
|
||||
(@pxref{linux16}) has been run. See also @ref{GNU/Linux}.
|
||||
|
||||
This command is only available on x86 systems.
|
||||
@end deffn
|
||||
@ -4646,7 +4775,7 @@ be reloaded after using this command (@pxref{module}).
|
||||
Some kernels have known problems. You need to specify --quirk-* for those.
|
||||
--quirk-bad-kludge is a problem seen in several products that they include
|
||||
loading kludge information with invalid data in ELF file. GRUB prior to 0.97
|
||||
and some custom builds prefered ELF information while 0.97 and GRUB 2
|
||||
and some custom builds preferred ELF information while 0.97 and GRUB 2
|
||||
use kludge. Use this option to ignore kludge.
|
||||
Known affected systems: old Solaris, SkyOS.
|
||||
|
||||
@ -4771,19 +4900,11 @@ a rest.
|
||||
@node probe
|
||||
@subsection probe
|
||||
|
||||
@deffn Command probe [@option{--set} var] @option{--driver}|@option{--partmap}|@option{--fs}|@option{--fs-uuid}|@option{--label} device
|
||||
@deffn Command probe [@option{--set} var] @option{--driver}|@option{--partmap}|@option{--fs}|@option{--fs-uuid}|@option{--label}|@option{--part-uuid} device
|
||||
Retrieve device information. If option @option{--set} is given, assign result
|
||||
to variable @var{var}, otherwise print information on the screen.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node pxe_unload
|
||||
@subsection pxe_unload
|
||||
|
||||
@deffn Command pxe_unload
|
||||
Unload the PXE environment (@pxref{Network}).
|
||||
|
||||
This command is only available on PC BIOS systems.
|
||||
The option @option{--part-uuid} is currently only implemented for MSDOS and GPT formatted disks.
|
||||
@end deffn
|
||||
|
||||
|
||||
@ -5077,9 +5198,84 @@ Alias for @code{hashsum --hash sha512 arg @dots{}}. See command @command{hashsum
|
||||
|
||||
@deffn Command sleep [@option{--verbose}] [@option{--interruptible}] count
|
||||
Sleep for @var{count} seconds. If option @option{--interruptible} is given,
|
||||
allow @key{ESC} to interrupt sleep. With @option{--verbose} show countdown
|
||||
of remaining seconds. Exit code is set to 0 if timeout expired and to 1
|
||||
if timeout was interrupted by @key{ESC}.
|
||||
allow pressing @key{ESC}, @key{F4} or holding down @key{SHIFT} to interrupt
|
||||
sleep. With @option{--verbose} show countdown of remaining seconds. Exit code
|
||||
is set to 0 if timeout expired and to 1 if timeout was interrupted using any
|
||||
of the mentioned keys.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node smbios
|
||||
@subsection smbios
|
||||
|
||||
@deffn Command smbios @
|
||||
[@option{--type} @var{type}] @
|
||||
[@option{--handle} @var{handle}] @
|
||||
[@option{--match} @var{match}] @
|
||||
(@option{--get-byte} | @option{--get-word} | @option{--get-dword} | @
|
||||
@option{--get-qword} | @option{--get-string} | @option{--get-uuid}) @
|
||||
@var{offset} @
|
||||
[@option{--set} @var{variable}]
|
||||
Retrieve SMBIOS information.
|
||||
|
||||
The @command{smbios} command returns the value of a field in an SMBIOS
|
||||
structure. The following options determine which structure to select.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Specifying @option{--type} will select structures with a matching
|
||||
@var{type}. The type can be any integer from 0 to 255.
|
||||
@item
|
||||
Specifying @option{--handle} will select structures with a matching
|
||||
@var{handle}. The handle can be any integer from 0 to 65535.
|
||||
@item
|
||||
Specifying @option{--match} will select structure number @var{match} in the
|
||||
filtered list of structures; e.g. @code{smbios --type 4 --match 2} will select
|
||||
the second Process Information (Type 4) structure. The list is always ordered
|
||||
the same as the hardware's SMBIOS table. The match number must be a positive
|
||||
integer. If unspecified, the first matching structure will be selected.
|
||||
@end itemize
|
||||
|
||||
The remaining options determine which field in the selected SMBIOS structure to
|
||||
return. Only one of these options may be specified at a time.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
When given @option{--get-byte}, return the value of the byte
|
||||
at @var{offset} bytes into the selected SMBIOS structure.
|
||||
It will be formatted as an unsigned decimal integer.
|
||||
@item
|
||||
When given @option{--get-word}, return the value of the word (two bytes)
|
||||
at @var{offset} bytes into the selected SMBIOS structure.
|
||||
It will be formatted as an unsigned decimal integer.
|
||||
@item
|
||||
When given @option{--get-dword}, return the value of the dword (four bytes)
|
||||
at @var{offset} bytes into the selected SMBIOS structure.
|
||||
It will be formatted as an unsigned decimal integer.
|
||||
@item
|
||||
When given @option{--get-qword}, return the value of the qword (eight bytes)
|
||||
at @var{offset} bytes into the selected SMBIOS structure.
|
||||
It will be formatted as an unsigned decimal integer.
|
||||
@item
|
||||
When given @option{--get-string}, return the string with its index found
|
||||
at @var{offset} bytes into the selected SMBIOS structure.
|
||||
@item
|
||||
When given @option{--get-uuid}, return the value of the UUID (sixteen bytes)
|
||||
at @var{offset} bytes into the selected SMBIOS structure.
|
||||
It will be formatted as lower-case hyphenated hexadecimal digits, with the
|
||||
first three fields as little-endian, and the rest printed byte-by-byte.
|
||||
@end itemize
|
||||
|
||||
The default action is to print the value of the requested field to the console,
|
||||
but a variable name can be specified with @option{--set} to store the value
|
||||
instead of printing it.
|
||||
|
||||
For example, this will store and then display the system manufacturer's name.
|
||||
|
||||
@example
|
||||
smbios --type 1 --get-string 4 --set system_manufacturer
|
||||
echo $system_manufacturer
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
|
||||
@ -5199,12 +5395,6 @@ Unset the environment variable @var{envvar}.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node uppermem
|
||||
@subsection uppermem
|
||||
|
||||
This command is not yet implemented for GRUB 2, although it is planned.
|
||||
|
||||
|
||||
@ignore
|
||||
@node vbeinfo
|
||||
@subsection vbeinfo
|
||||
@ -5256,6 +5446,9 @@ only applies to the particular cpu/core/thread that runs the command.
|
||||
Also, if you specify a reserved or unimplemented MSR address, it will
|
||||
cause a general protection exception (which is not currently being handled)
|
||||
and the system will reboot.
|
||||
|
||||
Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
This is done to prevent subverting various security mechanisms.
|
||||
@end deffn
|
||||
|
||||
@node xen_hypervisor
|
||||
@ -5288,10 +5481,11 @@ This command is only available on AArch64 systems.
|
||||
* net_add_addr:: Add a network address
|
||||
* net_add_dns:: Add a DNS server
|
||||
* net_add_route:: Add routing entry
|
||||
* net_bootp:: Perform a bootp autoconfiguration
|
||||
* net_bootp:: Perform a bootp/DHCP autoconfiguration
|
||||
* net_del_addr:: Remove IP address from interface
|
||||
* net_del_dns:: Remove a DNS server
|
||||
* net_del_route:: Remove a route entry
|
||||
* net_dhcp:: Perform a DHCP autoconfiguration
|
||||
* net_get_dhcp_option:: Retrieve DHCP options
|
||||
* net_ipv6_autoconf:: Perform IPv6 autoconfiguration
|
||||
* net_ls_addr:: List interfaces
|
||||
@ -5338,8 +5532,44 @@ by @var{shortname} which can be used to remove it (@pxref{net_del_route}).
|
||||
@subsection net_bootp
|
||||
|
||||
@deffn Command net_bootp [@var{card}]
|
||||
Alias for net_dhcp, for compatibility with older Grub versions. Will perform
|
||||
the same DHCP handshake with potential fallback to BOOTP as the net_dhcp
|
||||
command (@pxref{net_dhcp}).
|
||||
|
||||
@end deffn
|
||||
|
||||
|
||||
@node net_del_addr
|
||||
@subsection net_del_addr
|
||||
|
||||
@deffn Command net_del_addr @var{interface}
|
||||
Remove configured @var{interface} with associated address.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node net_del_dns
|
||||
@subsection net_del_dns
|
||||
|
||||
@deffn Command net_del_dns @var{address}
|
||||
Remove @var{address} from list of servers used during name lookup.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node net_del_route
|
||||
@subsection net_del_route
|
||||
|
||||
@deffn Command net_del_route @var{shortname}
|
||||
Remove route entry identified by @var{shortname}.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node net_dhcp
|
||||
@subsection net_dhcp
|
||||
|
||||
@deffn Command net_dhcp [@var{card}]
|
||||
Perform configuration of @var{card} using DHCP protocol. If no card name
|
||||
is specified, try to configure all existing cards. If configuration was
|
||||
is specified, try to configure all existing cards.
|
||||
Falls back to the BOOTP protocol, if needed. If configuration was
|
||||
successful, interface with name @var{card}@samp{:dhcp} and configured
|
||||
address is added to @var{card}.
|
||||
@comment If server provided gateway information in
|
||||
@ -5366,35 +5596,17 @@ Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_rootpath}
|
||||
@item 18 (Extensions Path)
|
||||
Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_extensionspath}
|
||||
(@pxref{net_@var{<interface>}_extensionspath}) to the value of option.
|
||||
@item 66 (TFTP Server Name)
|
||||
Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_server_name}
|
||||
(@pxref{net_@var{<interface>}_dhcp_server_name}) to the value of option.
|
||||
@item 67 (Filename)
|
||||
Sets environment variable @samp{net_}@var{<card>}@samp{_boot_file}
|
||||
(@pxref{net_@var{<interface>}_boot_file}) to the value of option.
|
||||
@end table
|
||||
|
||||
@end deffn
|
||||
|
||||
|
||||
@node net_del_addr
|
||||
@subsection net_del_addr
|
||||
|
||||
@deffn Command net_del_addr @var{interface}
|
||||
Remove configured @var{interface} with associated address.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node net_del_dns
|
||||
@subsection net_del_dns
|
||||
|
||||
@deffn Command net_del_dns @var{address}
|
||||
Remove @var{address} from list of servers used during name lookup.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node net_del_route
|
||||
@subsection net_del_route
|
||||
|
||||
@deffn Command net_del_route @var{shortname}
|
||||
Remove route entry identified by @var{shortname}.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node net_get_dhcp_option
|
||||
@subsection net_get_dhcp_option
|
||||
|
||||
@ -5580,7 +5792,9 @@ environment variables and commands are listed in the same order.
|
||||
* Authentication and authorisation:: Users and access control
|
||||
* Using digital signatures:: Booting digitally signed code
|
||||
* UEFI secure boot and shim:: Booting digitally signed PE files
|
||||
* Secure Boot Advanced Targeting:: Embedded information for generation number based revocation
|
||||
* Measured Boot:: Measuring boot components
|
||||
* Lockdown:: Lockdown when booting on a secure setup
|
||||
@end menu
|
||||
|
||||
@node Authentication and authorisation
|
||||
@ -5612,7 +5826,8 @@ the GRUB command line, edit menu entries, and execute any menu entry. If
|
||||
@samp{superusers} is set, then use of the command line and editing of menu
|
||||
entries are automatically restricted to superusers. Setting @samp{superusers}
|
||||
to empty string effectively disables both access to CLI and editing of menu
|
||||
entries.
|
||||
entries. Note: The environment variable needs to be exported to also affect
|
||||
the section defined by the @samp{submenu} command (@pxref{submenu}).
|
||||
|
||||
Other users may be allowed to execute specific menu entries by giving a list of
|
||||
usernames (as above) using the @option{--users} option to the
|
||||
@ -5672,15 +5887,9 @@ verified with a public key currently trusted by GRUB
|
||||
validation fails, then file @file{foo} cannot be opened. This failure
|
||||
may halt or otherwise impact the boot process.
|
||||
|
||||
@comment Unfortunately --pubkey is not yet supported by grub-install,
|
||||
@comment but we should not bring up internal detail grub-mkimage here
|
||||
@comment in the user guide (as opposed to developer's manual).
|
||||
|
||||
@comment An initial trusted public key can be embedded within the GRUB
|
||||
@comment @file{core.img} using the @code{--pubkey} option to
|
||||
@comment @command{grub-mkimage} (@pxref{Invoking grub-install}). Presently it
|
||||
@comment is necessary to write a custom wrapper around @command{grub-mkimage}
|
||||
@comment using the @code{--grub-mkimage} flag to @command{grub-install}.
|
||||
An initial trusted public key can be embedded within the GRUB @file{core.img}
|
||||
using the @code{--pubkey} option to @command{grub-install}
|
||||
(@pxref{Invoking grub-install}).
|
||||
|
||||
GRUB uses GPG-style detached signatures (meaning that a file
|
||||
@file{foo.sig} will be produced when file @file{foo} is signed), and
|
||||
@ -5747,15 +5956,37 @@ secure boot chain.
|
||||
@section UEFI secure boot and shim support
|
||||
|
||||
The GRUB, except the @command{chainloader} command, works with the UEFI secure
|
||||
boot and the shim. This functionality is provided by the shim_lock module. It
|
||||
is recommend to build in this and other required modules into the @file{core.img}.
|
||||
All modules not stored in the @file{core.img} and the ACPI tables for the
|
||||
@command{acpi} command have to be signed, e.g. using PGP. Additionally, the
|
||||
@command{iorw}, the @command{memrw} and the @command{wrmsr} commands are
|
||||
prohibited if the UEFI secure boot is enabled. This is done due to
|
||||
security reasons. All above mentioned requirements are enforced by the
|
||||
shim_lock module. And itself it is a persistent module which means that
|
||||
it cannot be unloaded if it was loaded into the memory.
|
||||
boot and the shim. This functionality is provided by the shim_lock verifier. It
|
||||
is built into the @file{core.img} and is registered if the UEFI secure boot is
|
||||
enabled. The @samp{shim_lock} variable is set to @samp{y} when shim_lock verifier
|
||||
is registered. If it is desired to use UEFI secure boot without shim, one can
|
||||
disable shim_lock by disabling shim verification with MokSbState UEFI variable
|
||||
or by building grub image with @samp{--disable-shim-lock} option.
|
||||
|
||||
All GRUB modules not stored in the @file{core.img}, OS kernels, ACPI tables,
|
||||
Device Trees, etc. have to be signed, e.g, using PGP. Additionally, the commands
|
||||
that can be used to subvert the UEFI secure boot mechanism, such as @command{iorw}
|
||||
and @command{memrw} will not be available when the UEFI secure boot is enabled.
|
||||
This is done for security reasons and are enforced by the GRUB Lockdown mechanism
|
||||
(@pxref{Lockdown}).
|
||||
|
||||
@node Secure Boot Advanced Targeting
|
||||
@section Embedded information for generation number based revocation
|
||||
|
||||
The Secure Boot Advanced Targeting (SBAT) is a mechanism to allow the revocation
|
||||
of components in the boot path by using generation numbers embedded into the EFI
|
||||
binaries. The SBAT metadata is located in an .sbat data section that has set of
|
||||
UTF-8 strings as comma-separated values (CSV). See
|
||||
@uref{https://github.com/rhboot/shim/blob/main/SBAT.md} for more details.
|
||||
|
||||
To add a data section containing the SBAT information into the binary, the
|
||||
@option{--sbat} option of @command{grub-mkimage} command should be used. The content
|
||||
of a CSV file, encoded with UTF-8, is copied as is to the .sbat data section into
|
||||
the generated EFI binary. The CSV file can be stored anywhere on the file system.
|
||||
|
||||
@example
|
||||
grub-mkimage -O x86_64-efi -o grubx64.efi -p '(tftp)/grub' --sbat sbat.csv efinet tftp
|
||||
@end example
|
||||
|
||||
@node Measured Boot
|
||||
@section Measuring boot components
|
||||
@ -5794,6 +6025,16 @@ into @file{core.img} in order to avoid a potential gap in measurement between
|
||||
|
||||
Measured boot is currently only supported on EFI platforms.
|
||||
|
||||
@node Lockdown
|
||||
@section Lockdown when booting on a secure setup
|
||||
|
||||
The GRUB can be locked down when booted on a secure boot environment, for example
|
||||
if the UEFI secure boot is enabled. On a locked down configuration, the GRUB will
|
||||
be restricted and some operations/commands cannot be executed.
|
||||
|
||||
The @samp{lockdown} variable is set to @samp{y} when the GRUB is locked down.
|
||||
Otherwise it does not exit.
|
||||
|
||||
@node Platform limitations
|
||||
@chapter Platform limitations
|
||||
|
||||
@ -5801,6 +6042,15 @@ GRUB2 is designed to be portable and is actually ported across platforms. We
|
||||
try to keep all platforms at the level. Unfortunately some platforms are better
|
||||
supported than others. This is detailed in current and 2 following sections.
|
||||
|
||||
All platforms have an artificially GRUB imposed disk size restriction of 1 EiB.
|
||||
In some cases, larger disk sizes can be used, but access will not be allowed
|
||||
beyond 1 EiB.
|
||||
|
||||
LUKS2 devices with size larger than 16 EiB are currently not supported. They
|
||||
can not be created as crypto devices by cryptomount, so can not even be
|
||||
partially read from. LUKS have no limitations other than those imposed by the
|
||||
format.
|
||||
|
||||
ARC platform is unable to change datetime (firmware doesn't seem to provide a
|
||||
function for it).
|
||||
EMU has similar limitation.
|
||||
@ -5819,8 +6069,8 @@ by national encoding compatible only in pseudographics.
|
||||
Unicode is the most versatile charset which supports many languages. However
|
||||
the actual console may be much more limited depending on firmware
|
||||
|
||||
On BIOS network is supported only if the image is loaded through network.
|
||||
On sparc64 GRUB is unable to determine which server it was booted from.
|
||||
On BIOS, network is supported only if the image is loaded through network.
|
||||
On sparc64, GRUB is unable to determine which server it was booted from.
|
||||
|
||||
Direct ATA/AHCI support allows to circumvent various firmware limitations but
|
||||
isn't needed for normal operation except on baremetal ports.
|
||||
@ -5849,7 +6099,7 @@ Bootlocation is ability of GRUB to automatically detect where it boots from.
|
||||
``disk'' means the detection is limited to detecting the disk with partition
|
||||
being discovered on install time. ``partition'' means that disk and partiton
|
||||
can be automatically discovered. ``file'' means that boot image file name as
|
||||
well as disk and partition can be discovered. For consistency default install ignores
|
||||
well as disk and partition can be discovered. For consistency, default install ignores
|
||||
partition and relies solely on disk detection. If no bootlocation discovery is available
|
||||
or boot and grub-root disks are different, UUID is used instead. On ARC if no device
|
||||
to install to is specified, UUID is used instead as well.
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set UPDATED 24 June 2019
|
||||
@set UPDATED-MONTH June 2019
|
||||
@set EDITION 2.04
|
||||
@set VERSION 2.04
|
||||
@set UPDATED 10 May 2021
|
||||
@set UPDATED-MONTH May 2021
|
||||
@set EDITION 2.06
|
||||
@set VERSION 2.06
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set UPDATED 24 June 2019
|
||||
@set UPDATED-MONTH June 2019
|
||||
@set EDITION 2.04
|
||||
@set VERSION 2.04
|
||||
@set UPDATED 10 May 2021
|
||||
@set UPDATED-MONTH May 2021
|
||||
@set EDITION 2.06
|
||||
@set VERSION 2.06
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set UPDATED 24 June 2019
|
||||
@set UPDATED-MONTH June 2019
|
||||
@set EDITION 2.04
|
||||
@set VERSION 2.04
|
||||
@set UPDATED 10 May 2021
|
||||
@set UPDATED-MONTH May 2021
|
||||
@set EDITION 2.06
|
||||
@set VERSION 2.06
|
||||
|
@ -1,4 +1,4 @@
|
||||
@set UPDATED 24 June 2019
|
||||
@set UPDATED-MONTH June 2019
|
||||
@set EDITION 2.04
|
||||
@set VERSION 2.04
|
||||
@set UPDATED 10 May 2021
|
||||
@set UPDATED-MONTH May 2021
|
||||
@set EDITION 2.06
|
||||
@set VERSION 2.06
|
||||
|
@ -766,7 +766,7 @@ def image(defn, platform):
|
||||
if test x$(TARGET_APPLE_LINKER) = x1; then \
|
||||
$(MACHO2IMG) $< $@; \
|
||||
else \
|
||||
$(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; \
|
||||
$(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; \
|
||||
fi
|
||||
""")
|
||||
|
||||
|
@ -71,6 +71,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
|
||||
@ -79,6 +80,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
|
||||
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/lockdown.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
|
||||
if COND_emu
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt-emu.h
|
||||
@ -88,8 +90,10 @@ endif
|
||||
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
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/stack_protector.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/verify.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
|
||||
@ -375,8 +379,10 @@ command.lst: $(MARKER_FILES)
|
||||
b=`basename $$pp .marker`; \
|
||||
sed -n \
|
||||
-e "/EXTCOMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||
-e "/EXTCOMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||
-e "/P1COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||
-e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
|
||||
-e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" \
|
||||
-e "/COMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
|
||||
done) | sort -u > $@
|
||||
platform_DATA += command.lst
|
||||
CLEANFILES += command.lst
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -123,6 +123,7 @@ kernel = {
|
||||
riscv32_efi_startup = kern/riscv/efi/startup.S;
|
||||
riscv64_efi_startup = kern/riscv/efi/startup.S;
|
||||
|
||||
common = kern/buffer.c;
|
||||
common = kern/command.c;
|
||||
common = kern/corecmd.c;
|
||||
common = kern/device.c;
|
||||
@ -140,6 +141,7 @@ kernel = {
|
||||
common = kern/rescue_parser.c;
|
||||
common = kern/rescue_reader.c;
|
||||
common = kern/term.c;
|
||||
common = kern/verifiers.c;
|
||||
|
||||
noemu = kern/compiler-rt.c;
|
||||
noemu = kern/mm.c;
|
||||
@ -203,6 +205,8 @@ kernel = {
|
||||
efi = term/efi/console.c;
|
||||
efi = kern/acpi.c;
|
||||
efi = kern/efi/acpi.c;
|
||||
efi = kern/efi/sb.c;
|
||||
efi = kern/lockdown.c;
|
||||
i386_coreboot = kern/i386/pc/acpi.c;
|
||||
i386_multiboot = kern/i386/pc/acpi.c;
|
||||
i386_coreboot = kern/acpi.c;
|
||||
@ -942,17 +946,6 @@ module = {
|
||||
cppflags = '-I$(srcdir)/lib/posix_wrap';
|
||||
};
|
||||
|
||||
module = {
|
||||
name = verifiers;
|
||||
common = commands/verifiers.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = shim_lock;
|
||||
common = commands/efi/shim_lock.c;
|
||||
enable = x86_64_efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = hdparm;
|
||||
common = commands/hdparm.c;
|
||||
@ -1097,6 +1090,21 @@ module = {
|
||||
common = commands/sleep.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = smbios;
|
||||
|
||||
common = commands/smbios.c;
|
||||
efi = commands/efi/smbios.c;
|
||||
i386_pc = commands/i386/pc/smbios.c;
|
||||
i386_coreboot = commands/i386/pc/smbios.c;
|
||||
i386_multiboot = commands/i386/pc/smbios.c;
|
||||
|
||||
enable = efi;
|
||||
enable = i386_pc;
|
||||
enable = i386_coreboot;
|
||||
enable = i386_multiboot;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = suspend;
|
||||
ieee1275 = commands/ieee1275/suspend.c;
|
||||
@ -1161,10 +1169,27 @@ module = {
|
||||
common = disk/cryptodisk.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = json;
|
||||
common = lib/json/json.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = afsplitter;
|
||||
common = disk/AFSplitter.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = luks;
|
||||
common = disk/luks.c;
|
||||
common = disk/AFSplitter.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = luks2;
|
||||
common = disk/luks2.c;
|
||||
common = lib/gnulib/base64.c;
|
||||
cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
|
||||
cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB) -I$(srcdir)/lib/json';
|
||||
};
|
||||
|
||||
module = {
|
||||
@ -1655,6 +1680,7 @@ module = {
|
||||
|
||||
module = {
|
||||
name = datetime;
|
||||
common = lib/datetime.c;
|
||||
cmos = lib/cmos_datetime.c;
|
||||
efi = lib/efi/datetime.c;
|
||||
uboot = lib/dummy/datetime.c;
|
||||
@ -1667,7 +1693,6 @@ module = {
|
||||
i386_xen_pvh = lib/xen/datetime.c;
|
||||
|
||||
mips_arc = lib/arc/datetime.c;
|
||||
enable = noemu;
|
||||
};
|
||||
|
||||
module = {
|
||||
@ -1894,7 +1919,6 @@ module = {
|
||||
common = normal/autofs.c;
|
||||
common = normal/color.c;
|
||||
common = normal/completion.c;
|
||||
common = normal/datetime.c;
|
||||
common = normal/menu.c;
|
||||
common = normal/menu_entry.c;
|
||||
common = normal/menu_text.c;
|
||||
@ -2469,7 +2493,7 @@ module = {
|
||||
name = tpm;
|
||||
common = commands/tpm.c;
|
||||
efi = commands/efi/tpm.c;
|
||||
enable = x86_64_efi;
|
||||
enable = efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
12241
grub-core/Makefile.in
12241
grub-core/Makefile.in
File diff suppressed because it is too large
Load Diff
@ -75,6 +75,9 @@ grub_usb_controller_iterate (grub_usb_controller_iterate_hook_t hook,
|
||||
grub_usb_err_t
|
||||
grub_usb_clear_halt (grub_usb_device_t dev, int endpoint)
|
||||
{
|
||||
if (endpoint >= GRUB_USB_MAX_TOGGLE)
|
||||
return GRUB_USB_ERR_BADDEVICE;
|
||||
|
||||
dev->toggle[endpoint] = 0;
|
||||
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||
| GRUB_USB_REQTYPE_STANDARD
|
||||
@ -134,10 +137,10 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
||||
return err;
|
||||
descdev = &dev->descdev;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < GRUB_USB_MAX_CONF; i++)
|
||||
dev->config[i].descconf = NULL;
|
||||
|
||||
if (descdev->configcnt == 0)
|
||||
if (descdev->configcnt == 0 || descdev->configcnt > GRUB_USB_MAX_CONF)
|
||||
{
|
||||
err = GRUB_USB_ERR_BADDEVICE;
|
||||
goto fail;
|
||||
@ -172,6 +175,12 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
||||
/* Skip the configuration descriptor. */
|
||||
pos = dev->config[i].descconf->length;
|
||||
|
||||
if (dev->config[i].descconf->numif > GRUB_USB_MAX_IF)
|
||||
{
|
||||
err = GRUB_USB_ERR_BADDEVICE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Read all interfaces. */
|
||||
for (currif = 0; currif < dev->config[i].descconf->numif; currif++)
|
||||
{
|
||||
@ -217,7 +226,7 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
||||
|
||||
fail:
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < GRUB_USB_MAX_CONF; i++)
|
||||
grub_free (dev->config[i].descconf);
|
||||
|
||||
return err;
|
||||
|
@ -82,7 +82,7 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller,
|
||||
if (i == GRUB_USBHUB_MAX_DEVICES)
|
||||
{
|
||||
grub_error (GRUB_ERR_IO, "can't assign address to USB device");
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < GRUB_USB_MAX_CONF; i++)
|
||||
grub_free (dev->config[i].descconf);
|
||||
grub_free (dev);
|
||||
return NULL;
|
||||
@ -96,7 +96,7 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller,
|
||||
i, 0, 0, NULL);
|
||||
if (err)
|
||||
{
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < GRUB_USB_MAX_CONF; i++)
|
||||
grub_free (dev->config[i].descconf);
|
||||
grub_free (dev);
|
||||
return NULL;
|
||||
@ -149,8 +149,8 @@ grub_usb_add_hub (grub_usb_device_t dev)
|
||||
grub_usb_set_configuration (dev, 1);
|
||||
|
||||
dev->nports = hubdesc.portcnt;
|
||||
dev->children = grub_zalloc (hubdesc.portcnt * sizeof (dev->children[0]));
|
||||
dev->ports = grub_zalloc (dev->nports * sizeof (dev->ports[0]));
|
||||
dev->children = grub_calloc (hubdesc.portcnt, sizeof (dev->children[0]));
|
||||
dev->ports = grub_calloc (dev->nports, sizeof (dev->ports[0]));
|
||||
if (!dev->children || !dev->ports)
|
||||
{
|
||||
grub_free (dev->children);
|
||||
@ -268,8 +268,8 @@ grub_usb_controller_dev_register_iter (grub_usb_controller_t controller, void *d
|
||||
|
||||
/* Query the number of ports the root Hub has. */
|
||||
hub->nports = controller->dev->hubports (controller);
|
||||
hub->devices = grub_zalloc (sizeof (hub->devices[0]) * hub->nports);
|
||||
hub->ports = grub_zalloc (sizeof (hub->ports[0]) * hub->nports);
|
||||
hub->devices = grub_calloc (hub->nports, sizeof (hub->devices[0]));
|
||||
hub->ports = grub_calloc (hub->nports, sizeof (hub->ports[0]));
|
||||
if (!hub->devices || !hub->ports)
|
||||
{
|
||||
grub_free (hub->devices);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <grub/mm.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/lockdown.h>
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
#include <grub/efi/efi.h>
|
||||
@ -775,7 +776,7 @@ static grub_extcmd_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(acpi)
|
||||
{
|
||||
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi, 0,
|
||||
cmd = grub_register_extcmd_lockdown ("acpi", grub_cmd_acpi, 0,
|
||||
N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
|
||||
"--load-only=TABLE1,TABLE2] FILE1"
|
||||
" [FILE2] [...]"),
|
||||
|
@ -59,7 +59,8 @@ grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
for (; argc; argc--, args++)
|
||||
{
|
||||
char *p, c;
|
||||
const char *p;
|
||||
char c;
|
||||
int m1, ofs, n, cur_mask;
|
||||
|
||||
p = args[0];
|
||||
|
@ -38,8 +38,8 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)),
|
||||
grub_size_t oi_size;
|
||||
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
|
||||
old_os_indications = grub_efi_get_variable ("OsIndications", &global,
|
||||
&oi_size);
|
||||
grub_efi_get_variable ("OsIndications", &global, &oi_size,
|
||||
(void **) &old_os_indications);
|
||||
|
||||
if (old_os_indications != NULL && oi_size == sizeof (os_indications))
|
||||
os_indications |= *old_os_indications;
|
||||
@ -63,8 +63,8 @@ efifwsetup_is_supported (void)
|
||||
grub_size_t oi_size = 0;
|
||||
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
|
||||
os_indications_supported = grub_efi_get_variable ("OsIndicationsSupported",
|
||||
&global, &oi_size);
|
||||
grub_efi_get_variable ("OsIndicationsSupported", &global, &oi_size,
|
||||
(void **) &os_indications_supported);
|
||||
|
||||
if (!os_indications_supported)
|
||||
return 0;
|
||||
|
@ -205,12 +205,12 @@ static grub_command_t cmd_fakebios, cmd_loadbios;
|
||||
|
||||
GRUB_MOD_INIT(loadbios)
|
||||
{
|
||||
cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
|
||||
cmd_fakebios = grub_register_command_lockdown ("fakebios", grub_cmd_fakebios,
|
||||
0, N_("Create BIOS-like structures for"
|
||||
" backward compatibility with"
|
||||
" existing OS."));
|
||||
|
||||
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
|
||||
cmd_loadbios = grub_register_command_lockdown ("loadbios", grub_cmd_loadbios,
|
||||
N_("BIOS_DUMP [INT10_DUMP]"),
|
||||
N_("Load BIOS dump."));
|
||||
}
|
||||
|
@ -40,14 +40,17 @@ static const struct guid_mapping guid_mappings[] =
|
||||
{ GRUB_EFI_CRC32_GUIDED_SECTION_EXTRACTION_GUID,
|
||||
"CRC32 GUIDED SECTION EXTRACTION"},
|
||||
{ GRUB_EFI_DEBUG_IMAGE_INFO_TABLE_GUID, "DEBUG IMAGE INFO"},
|
||||
{ GRUB_EFI_DEVICE_TREE_GUID, "DEVICE TREE"},
|
||||
{ GRUB_EFI_DXE_SERVICES_TABLE_GUID, "DXE SERVICES"},
|
||||
{ GRUB_EFI_HCDP_TABLE_GUID, "HCDP"},
|
||||
{ GRUB_EFI_HOB_LIST_GUID, "HOB LIST"},
|
||||
{ GRUB_EFI_LZMA_CUSTOM_DECOMPRESS_GUID, "LZMA CUSTOM DECOMPRESS"},
|
||||
{ GRUB_EFI_MEMORY_TYPE_INFORMATION_GUID, "MEMORY TYPE INFO"},
|
||||
{ GRUB_EFI_MPS_TABLE_GUID, "MPS"},
|
||||
{ GRUB_EFI_RT_PROPERTIES_TABLE_GUID, "RT PROPERTIES"},
|
||||
{ GRUB_EFI_SAL_TABLE_GUID, "SAL"},
|
||||
{ GRUB_EFI_SMBIOS_TABLE_GUID, "SMBIOS"},
|
||||
{ GRUB_EFI_SMBIOS3_TABLE_GUID, "SMBIOS3"},
|
||||
{ GRUB_EFI_SYSTEM_RESOURCE_TABLE_GUID, "SYSTEM RESOURCE TABLE"},
|
||||
{ GRUB_EFI_TIANO_CUSTOM_DECOMPRESS_GUID, "TIANO CUSTOM DECOMPRESS"},
|
||||
{ GRUB_EFI_TSC_FREQUENCY_GUID, "TSC FREQUENCY"},
|
||||
@ -71,7 +74,8 @@ grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)),
|
||||
grub_printf ("Vendor: ");
|
||||
|
||||
for (vendor_utf16 = st->firmware_vendor; *vendor_utf16; vendor_utf16++);
|
||||
vendor = grub_malloc (4 * (vendor_utf16 - st->firmware_vendor) + 1);
|
||||
/* Allocate extra 3 bytes to simplify math. */
|
||||
vendor = grub_calloc (4, vendor_utf16 - st->firmware_vendor + 1);
|
||||
if (!vendor)
|
||||
return grub_errno;
|
||||
*grub_utf16_to_utf8 ((grub_uint8_t *) vendor, st->firmware_vendor,
|
||||
|
@ -1,142 +0,0 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2017 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/>.
|
||||
*
|
||||
* EFI shim lock verifier.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/verify.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define GRUB_EFI_SHIM_LOCK_GUID \
|
||||
{ 0x605dab50, 0xe046, 0x4300, \
|
||||
{ 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23 } \
|
||||
}
|
||||
|
||||
struct grub_efi_shim_lock_protocol
|
||||
{
|
||||
grub_efi_status_t
|
||||
(*verify) (void *buffer, grub_uint32_t size);
|
||||
};
|
||||
typedef struct grub_efi_shim_lock_protocol grub_efi_shim_lock_protocol_t;
|
||||
|
||||
static grub_efi_guid_t shim_lock_guid = GRUB_EFI_SHIM_LOCK_GUID;
|
||||
static grub_efi_shim_lock_protocol_t *sl;
|
||||
|
||||
/* List of modules which cannot be loaded if UEFI secure boot mode is enabled. */
|
||||
static const char * const disabled_mods[] = {"iorw", "memrw", "wrmsr", NULL};
|
||||
|
||||
static grub_err_t
|
||||
shim_lock_init (grub_file_t io, enum grub_file_type type,
|
||||
void **context __attribute__ ((unused)),
|
||||
enum grub_verify_flags *flags)
|
||||
{
|
||||
const char *b, *e;
|
||||
int i;
|
||||
|
||||
*flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION;
|
||||
|
||||
if (!sl)
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
switch (type & GRUB_FILE_TYPE_MASK)
|
||||
{
|
||||
case GRUB_FILE_TYPE_GRUB_MODULE:
|
||||
/* Establish GRUB module name. */
|
||||
b = grub_strrchr (io->name, '/');
|
||||
e = grub_strrchr (io->name, '.');
|
||||
|
||||
b = b ? (b + 1) : io->name;
|
||||
e = e ? e : io->name + grub_strlen (io->name);
|
||||
e = (e > b) ? e : io->name + grub_strlen (io->name);
|
||||
|
||||
for (i = 0; disabled_mods[i]; i++)
|
||||
if (!grub_strncmp (b, disabled_mods[i], grub_strlen (b) - grub_strlen (e)))
|
||||
{
|
||||
grub_error (GRUB_ERR_ACCESS_DENIED,
|
||||
N_("module cannot be loaded in UEFI secure boot mode: %s"),
|
||||
io->name);
|
||||
return GRUB_ERR_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
/* Fall through. */
|
||||
|
||||
case GRUB_FILE_TYPE_ACPI_TABLE:
|
||||
case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE:
|
||||
*flags = GRUB_VERIFY_FLAGS_DEFER_AUTH;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
case GRUB_FILE_TYPE_LINUX_KERNEL:
|
||||
case GRUB_FILE_TYPE_MULTIBOOT_KERNEL:
|
||||
case GRUB_FILE_TYPE_BSD_KERNEL:
|
||||
case GRUB_FILE_TYPE_XNU_KERNEL:
|
||||
case GRUB_FILE_TYPE_PLAN9_KERNEL:
|
||||
for (i = 0; disabled_mods[i]; i++)
|
||||
if (grub_dl_get (disabled_mods[i]))
|
||||
{
|
||||
grub_error (GRUB_ERR_ACCESS_DENIED,
|
||||
N_("cannot boot due to dangerous module in memory: %s"),
|
||||
disabled_mods[i]);
|
||||
return GRUB_ERR_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
*flags = GRUB_VERIFY_FLAGS_SINGLE_CHUNK;
|
||||
|
||||
/* Fall through. */
|
||||
|
||||
default:
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
shim_lock_write (void *context __attribute__ ((unused)), void *buf, grub_size_t size)
|
||||
{
|
||||
if (sl->verify (buf, size) != GRUB_EFI_SUCCESS)
|
||||
return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad shim signature"));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
struct grub_file_verifier shim_lock =
|
||||
{
|
||||
.name = "shim_lock",
|
||||
.init = shim_lock_init,
|
||||
.write = shim_lock_write
|
||||
};
|
||||
|
||||
GRUB_MOD_INIT(shim_lock)
|
||||
{
|
||||
sl = grub_efi_locate_protocol (&shim_lock_guid, 0);
|
||||
grub_verifier_register (&shim_lock);
|
||||
|
||||
if (!sl)
|
||||
return;
|
||||
|
||||
grub_dl_set_persistent (mod);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(shim_lock)
|
||||
{
|
||||
grub_verifier_unregister (&shim_lock);
|
||||
}
|
61
grub-core/commands/efi/smbios.c
Normal file
61
grub-core/commands/efi/smbios.c
Normal file
@ -0,0 +1,61 @@
|
||||
/* smbios.c - get smbios tables. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2019 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/smbios.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/efi/api.h>
|
||||
|
||||
struct grub_smbios_eps *
|
||||
grub_machine_smbios_get_eps (void)
|
||||
{
|
||||
unsigned i;
|
||||
static grub_efi_packed_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
|
||||
|
||||
for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
|
||||
{
|
||||
grub_efi_packed_guid_t *guid =
|
||||
&grub_efi_system_table->configuration_table[i].vendor_guid;
|
||||
|
||||
if (! grub_memcmp (guid, &smbios_guid, sizeof (grub_efi_packed_guid_t)))
|
||||
return (struct grub_smbios_eps *)
|
||||
grub_efi_system_table->configuration_table[i].vendor_table;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct grub_smbios_eps3 *
|
||||
grub_machine_smbios_get_eps3 (void)
|
||||
{
|
||||
unsigned i;
|
||||
static grub_efi_packed_guid_t smbios3_guid = GRUB_EFI_SMBIOS3_TABLE_GUID;
|
||||
|
||||
for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
|
||||
{
|
||||
grub_efi_packed_guid_t *guid =
|
||||
&grub_efi_system_table->configuration_table[i].vendor_guid;
|
||||
|
||||
if (! grub_memcmp (guid, &smbios3_guid, sizeof (grub_efi_packed_guid_t)))
|
||||
return (struct grub_smbios_eps3 *)
|
||||
grub_efi_system_table->configuration_table[i].vendor_table;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -56,9 +56,13 @@ grub_tpm1_present (grub_efi_tpm_protocol_t *tpm)
|
||||
|
||||
if (status != GRUB_EFI_SUCCESS || caps.TPMDeactivatedFlag
|
||||
|| !caps.TPMPresentFlag)
|
||||
return tpm1_present = 0;
|
||||
tpm1_present = 0;
|
||||
else
|
||||
tpm1_present = 1;
|
||||
|
||||
return tpm1_present = 1;
|
||||
grub_dprintf ("tpm", "tpm1%s present\n", tpm1_present ? "" : " NOT");
|
||||
|
||||
return (grub_efi_boolean_t) tpm1_present;
|
||||
}
|
||||
|
||||
static grub_efi_boolean_t
|
||||
@ -75,9 +79,13 @@ grub_tpm2_present (grub_efi_tpm2_protocol_t *tpm)
|
||||
status = efi_call_2 (tpm->get_capability, tpm, &caps);
|
||||
|
||||
if (status != GRUB_EFI_SUCCESS || !caps.TPMPresentFlag)
|
||||
return tpm2_present = 0;
|
||||
tpm2_present = 0;
|
||||
else
|
||||
tpm2_present = 1;
|
||||
|
||||
return tpm2_present = 1;
|
||||
grub_dprintf ("tpm", "tpm2%s present\n", tpm2_present ? "" : " NOT");
|
||||
|
||||
return (grub_efi_boolean_t) tpm2_present;
|
||||
}
|
||||
|
||||
static grub_efi_boolean_t
|
||||
@ -102,6 +110,7 @@ grub_tpm_handle_find (grub_efi_handle_t *tpm_handle,
|
||||
*tpm_handle = handles[0];
|
||||
grub_tpm_version = 1;
|
||||
*protocol_version = 1;
|
||||
grub_dprintf ("tpm", "TPM handle Found, version: 1\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -113,6 +122,7 @@ grub_tpm_handle_find (grub_efi_handle_t *tpm_handle,
|
||||
*tpm_handle = handles[0];
|
||||
grub_tpm_version = 2;
|
||||
*protocol_version = 2;
|
||||
grub_dprintf ("tpm", "TPM handle Found, version: 2\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -120,27 +130,8 @@ grub_tpm_handle_find (grub_efi_handle_t *tpm_handle,
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_tpm1_execute (grub_efi_handle_t tpm_handle,
|
||||
PassThroughToTPM_InputParamBlock *inbuf,
|
||||
PassThroughToTPM_OutputParamBlock *outbuf)
|
||||
grub_efi_log_event_status (grub_efi_status_t status)
|
||||
{
|
||||
grub_efi_status_t status;
|
||||
grub_efi_tpm_protocol_t *tpm;
|
||||
grub_uint32_t inhdrsize = sizeof (*inbuf) - sizeof (inbuf->TPMOperandIn);
|
||||
grub_uint32_t outhdrsize =
|
||||
sizeof (*outbuf) - sizeof (outbuf->TPMOperandOut);
|
||||
|
||||
tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid,
|
||||
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
|
||||
if (!grub_tpm1_present (tpm))
|
||||
return 0;
|
||||
|
||||
/* UEFI TPM protocol takes the raw operand block, no param block header. */
|
||||
status = efi_call_5 (tpm->pass_through_to_tpm, tpm,
|
||||
inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn,
|
||||
outbuf->OPBLength - outhdrsize, outbuf->TPMOperandOut);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case GRUB_EFI_SUCCESS:
|
||||
@ -150,8 +141,7 @@ grub_tpm1_execute (grub_efi_handle_t tpm_handle,
|
||||
case GRUB_EFI_INVALID_PARAMETER:
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter"));
|
||||
case GRUB_EFI_BUFFER_TOO_SMALL:
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("Output buffer too small"));
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small"));
|
||||
case GRUB_EFI_NOT_FOUND:
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
|
||||
default:
|
||||
@ -159,63 +149,6 @@ grub_tpm1_execute (grub_efi_handle_t tpm_handle,
|
||||
}
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_tpm2_execute (grub_efi_handle_t tpm_handle,
|
||||
PassThroughToTPM_InputParamBlock *inbuf,
|
||||
PassThroughToTPM_OutputParamBlock *outbuf)
|
||||
{
|
||||
grub_efi_status_t status;
|
||||
grub_efi_tpm2_protocol_t *tpm;
|
||||
grub_uint32_t inhdrsize = sizeof (*inbuf) - sizeof (inbuf->TPMOperandIn);
|
||||
grub_uint32_t outhdrsize =
|
||||
sizeof (*outbuf) - sizeof (outbuf->TPMOperandOut);
|
||||
|
||||
tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid,
|
||||
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
|
||||
if (!grub_tpm2_present (tpm))
|
||||
return 0;
|
||||
|
||||
/* UEFI TPM protocol takes the raw operand block, no param block header. */
|
||||
status = efi_call_5 (tpm->submit_command, tpm,
|
||||
inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn,
|
||||
outbuf->OPBLength - outhdrsize, outbuf->TPMOperandOut);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case GRUB_EFI_SUCCESS:
|
||||
return 0;
|
||||
case GRUB_EFI_DEVICE_ERROR:
|
||||
return grub_error (GRUB_ERR_IO, N_("Command failed"));
|
||||
case GRUB_EFI_INVALID_PARAMETER:
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter"));
|
||||
case GRUB_EFI_BUFFER_TOO_SMALL:
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("Output buffer too small"));
|
||||
case GRUB_EFI_NOT_FOUND:
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
|
||||
default:
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error"));
|
||||
}
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_tpm_execute (PassThroughToTPM_InputParamBlock *inbuf,
|
||||
PassThroughToTPM_OutputParamBlock *outbuf)
|
||||
{
|
||||
grub_efi_handle_t tpm_handle;
|
||||
grub_uint8_t protocol_version;
|
||||
|
||||
/* Absence of a TPM isn't a failure. */
|
||||
if (!grub_tpm_handle_find (&tpm_handle, &protocol_version))
|
||||
return 0;
|
||||
|
||||
if (protocol_version == 1)
|
||||
return grub_tpm1_execute (tpm_handle, inbuf, outbuf);
|
||||
else
|
||||
return grub_tpm2_execute (tpm_handle, inbuf, outbuf);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_tpm1_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
|
||||
grub_size_t size, grub_uint8_t pcr,
|
||||
@ -247,23 +180,9 @@ grub_tpm1_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
|
||||
algorithm = TCG_ALG_SHA;
|
||||
status = efi_call_7 (tpm->log_extend_event, tpm, (grub_addr_t) buf, (grub_uint64_t) size,
|
||||
algorithm, event, &eventnum, &lastevent);
|
||||
grub_free (event);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case GRUB_EFI_SUCCESS:
|
||||
return 0;
|
||||
case GRUB_EFI_DEVICE_ERROR:
|
||||
return grub_error (GRUB_ERR_IO, N_("Command failed"));
|
||||
case GRUB_EFI_INVALID_PARAMETER:
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter"));
|
||||
case GRUB_EFI_BUFFER_TOO_SMALL:
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("Output buffer too small"));
|
||||
case GRUB_EFI_NOT_FOUND:
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
|
||||
default:
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error"));
|
||||
}
|
||||
return grub_efi_log_event_status (status);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
@ -297,27 +216,13 @@ grub_tpm2_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
|
||||
|
||||
status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (grub_addr_t) buf,
|
||||
(grub_uint64_t) size, event);
|
||||
grub_free (event);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case GRUB_EFI_SUCCESS:
|
||||
return 0;
|
||||
case GRUB_EFI_DEVICE_ERROR:
|
||||
return grub_error (GRUB_ERR_IO, N_("Command failed"));
|
||||
case GRUB_EFI_INVALID_PARAMETER:
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter"));
|
||||
case GRUB_EFI_BUFFER_TOO_SMALL:
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("Output buffer too small"));
|
||||
case GRUB_EFI_NOT_FOUND:
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
|
||||
default:
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error"));
|
||||
}
|
||||
return grub_efi_log_event_status (status);
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_tpm_log_event (unsigned char *buf, grub_size_t size, grub_uint8_t pcr,
|
||||
grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr,
|
||||
const char *description)
|
||||
{
|
||||
grub_efi_handle_t tpm_handle;
|
||||
@ -326,6 +231,9 @@ grub_tpm_log_event (unsigned char *buf, grub_size_t size, grub_uint8_t pcr,
|
||||
if (!grub_tpm_handle_find (&tpm_handle, &protocol_version))
|
||||
return 0;
|
||||
|
||||
grub_dprintf ("tpm", "log_event, pcr = %d, size = 0x%" PRIxGRUB_SIZE ", %s\n",
|
||||
pcr, size, description);
|
||||
|
||||
if (protocol_version == 1)
|
||||
return grub_tpm1_log_event (tpm_handle, buf, size, pcr, description);
|
||||
else
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <grub/mm.h>
|
||||
#include <grub/list.h>
|
||||
#include <grub/lockdown.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/script_sh.h>
|
||||
@ -110,6 +111,28 @@ grub_register_extcmd (const char *name, grub_extcmd_func_t func,
|
||||
summary, description, parser, 1);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_extcmd_lockdown (grub_extcmd_context_t ctxt __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **argv __attribute__ ((unused)))
|
||||
{
|
||||
return grub_error (GRUB_ERR_ACCESS_DENIED,
|
||||
N_("%s: the command is not allowed when lockdown is enforced"),
|
||||
ctxt->extcmd->cmd->name);
|
||||
}
|
||||
|
||||
grub_extcmd_t
|
||||
grub_register_extcmd_lockdown (const char *name, grub_extcmd_func_t func,
|
||||
grub_command_flags_t flags, const char *summary,
|
||||
const char *description,
|
||||
const struct grub_arg_option *parser)
|
||||
{
|
||||
if (grub_is_lockdown () == GRUB_LOCKDOWN_ENABLED)
|
||||
func = grub_extcmd_lockdown;
|
||||
|
||||
return grub_register_extcmd (name, func, flags, summary, description, parser);
|
||||
}
|
||||
|
||||
void
|
||||
grub_unregister_extcmd (grub_extcmd_t ext)
|
||||
{
|
||||
|
@ -134,7 +134,8 @@ enum
|
||||
IS_IA_EFI,
|
||||
IS_ARM64_EFI,
|
||||
IS_ARM_EFI,
|
||||
IS_RISCV_EFI,
|
||||
IS_RISCV32_EFI,
|
||||
IS_RISCV64_EFI,
|
||||
IS_HIBERNATED,
|
||||
IS_XNU64,
|
||||
IS_XNU32,
|
||||
@ -576,7 +577,8 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
case IS_IA_EFI:
|
||||
case IS_ARM64_EFI:
|
||||
case IS_ARM_EFI:
|
||||
case IS_RISCV_EFI:
|
||||
case IS_RISCV32_EFI:
|
||||
case IS_RISCV64_EFI:
|
||||
{
|
||||
char signature[4];
|
||||
grub_uint32_t pe_offset;
|
||||
@ -622,13 +624,13 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
&& coff_head.machine !=
|
||||
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_ARMTHUMB_MIXED))
|
||||
break;
|
||||
if (type == IS_RISCV_EFI
|
||||
if ((type == IS_RISCV32_EFI || type == IS_RISCV64_EFI)
|
||||
&& coff_head.machine !=
|
||||
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_RISCV64))
|
||||
/* TODO: Determine bitness dynamically */
|
||||
break;
|
||||
if (type == IS_IA_EFI || type == IS_64_EFI || type == IS_ARM64_EFI ||
|
||||
type == IS_RISCV_EFI)
|
||||
type == IS_RISCV32_EFI || type == IS_RISCV64_EFI)
|
||||
{
|
||||
struct grub_pe64_optional_header o64;
|
||||
if (grub_file_read (file, &o64, sizeof (o64)) != sizeof (o64))
|
||||
|
@ -128,11 +128,17 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
||||
high = hextoval (*p++);
|
||||
low = hextoval (*p++);
|
||||
if (high < 0 || low < 0)
|
||||
{
|
||||
grub_free (buf);
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
|
||||
}
|
||||
expected[i] = (high << 4) | low;
|
||||
}
|
||||
if ((p[0] != ' ' && p[0] != '\t') || (p[1] != ' ' && p[1] != '\t'))
|
||||
{
|
||||
grub_free (buf);
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
|
||||
}
|
||||
p += 2;
|
||||
if (prefix)
|
||||
{
|
||||
@ -140,7 +146,10 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
||||
|
||||
filename = grub_xasprintf ("%s/%s", prefix, p);
|
||||
if (!filename)
|
||||
{
|
||||
grub_free (buf);
|
||||
return grub_errno;
|
||||
}
|
||||
file = grub_file_open (filename, GRUB_FILE_TYPE_TO_HASH
|
||||
| (!uncompress ? GRUB_FILE_TYPE_NO_DECOMPRESS
|
||||
: GRUB_FILE_TYPE_NONE));
|
||||
|
@ -436,7 +436,7 @@ static grub_extcmd_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(hdparm)
|
||||
{
|
||||
cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm, 0,
|
||||
cmd = grub_register_extcmd_lockdown ("hdparm", grub_cmd_hdparm, 0,
|
||||
N_("[OPTIONS] DISK"),
|
||||
N_("Get/set ATA disk parameters."), options);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
static grub_err_t
|
||||
parse_args (int argc, char *argv[], int *byte, int *bit)
|
||||
{
|
||||
char *rest;
|
||||
const char *rest;
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "address required");
|
||||
|
@ -132,7 +132,7 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
||||
}
|
||||
else
|
||||
{
|
||||
char *end;
|
||||
const char *end;
|
||||
unsigned tempo;
|
||||
struct note note;
|
||||
int i;
|
||||
|
52
grub-core/commands/i386/pc/smbios.c
Normal file
52
grub-core/commands/i386/pc/smbios.c
Normal file
@ -0,0 +1,52 @@
|
||||
/* smbios.c - get smbios tables. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2019 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/acpi.h>
|
||||
#include <grub/smbios.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
struct grub_smbios_eps *
|
||||
grub_machine_smbios_get_eps (void)
|
||||
{
|
||||
grub_uint8_t *ptr;
|
||||
|
||||
grub_dprintf ("smbios", "Looking for SMBIOS EPS. Scanning BIOS\n");
|
||||
|
||||
for (ptr = (grub_uint8_t *) 0xf0000; ptr < (grub_uint8_t *) 0x100000; ptr += 16)
|
||||
if (grub_memcmp (ptr, "_SM_", 4) == 0
|
||||
&& grub_byte_checksum (ptr, sizeof (struct grub_smbios_eps)) == 0)
|
||||
return (struct grub_smbios_eps *) ptr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct grub_smbios_eps3 *
|
||||
grub_machine_smbios_get_eps3 (void)
|
||||
{
|
||||
grub_uint8_t *ptr;
|
||||
|
||||
grub_dprintf ("smbios", "Looking for SMBIOS3 EPS. Scanning BIOS\n");
|
||||
|
||||
for (ptr = (grub_uint8_t *) 0xf0000; ptr < (grub_uint8_t *) 0x100000; ptr += 16)
|
||||
if (grub_memcmp (ptr, "_SM3_", 5) == 0
|
||||
&& grub_byte_checksum (ptr, sizeof (struct grub_smbios_eps3)) == 0)
|
||||
return (struct grub_smbios_eps3 *) ptr;
|
||||
|
||||
return 0;
|
||||
}
|
@ -44,7 +44,7 @@ grub_cmd_msr_read (grub_extcmd_context_t ctxt, int argc, char **argv)
|
||||
{
|
||||
grub_uint32_t manufacturer[3], max_cpuid, a, b, c, features, addr;
|
||||
grub_uint64_t value;
|
||||
char *ptr;
|
||||
const char *ptr;
|
||||
char buf[sizeof("1122334455667788")];
|
||||
|
||||
/*
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <grub/env.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/lockdown.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/i386/cpuid.h>
|
||||
#include <grub/i386/wrmsr.h>
|
||||
@ -37,7 +38,7 @@ grub_cmd_msr_write (grub_command_t cmd __attribute__ ((unused)), int argc, char
|
||||
{
|
||||
grub_uint32_t manufacturer[3], max_cpuid, a, b, c, features, addr;
|
||||
grub_uint64_t value;
|
||||
char *ptr;
|
||||
const char *ptr;
|
||||
|
||||
/*
|
||||
* The CPUID instruction should be used to determine whether MSRs
|
||||
@ -83,7 +84,7 @@ grub_cmd_msr_write (grub_command_t cmd __attribute__ ((unused)), int argc, char
|
||||
|
||||
GRUB_MOD_INIT(wrmsr)
|
||||
{
|
||||
cmd_write = grub_register_command ("wrmsr", grub_cmd_msr_write, N_("ADDR VALUE"),
|
||||
cmd_write = grub_register_command_lockdown ("wrmsr", grub_cmd_msr_write, N_("ADDR VALUE"),
|
||||
N_("Write a value to a CPU model specific register."));
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <grub/env.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/lockdown.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@ -131,15 +132,15 @@ GRUB_MOD_INIT(memrw)
|
||||
N_("PORT"), N_("Read 32-bit value from PORT."),
|
||||
options);
|
||||
cmd_write_byte =
|
||||
grub_register_command ("outb", grub_cmd_write,
|
||||
grub_register_command_lockdown ("outb", grub_cmd_write,
|
||||
N_("PORT VALUE [MASK]"),
|
||||
N_("Write 8-bit VALUE to PORT."));
|
||||
cmd_write_word =
|
||||
grub_register_command ("outw", grub_cmd_write,
|
||||
grub_register_command_lockdown ("outw", grub_cmd_write,
|
||||
N_("PORT VALUE [MASK]"),
|
||||
N_("Write 16-bit VALUE to PORT."));
|
||||
cmd_write_dword =
|
||||
grub_register_command ("outl", grub_cmd_write,
|
||||
grub_register_command_lockdown ("outl", grub_cmd_write,
|
||||
N_("ADDR VALUE [MASK]"),
|
||||
N_("Write 32-bit VALUE to PORT."));
|
||||
}
|
||||
|
@ -35,24 +35,6 @@ static const struct grub_arg_option options[] =
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static int
|
||||
grub_getkeystatus (void)
|
||||
{
|
||||
int status = 0;
|
||||
grub_term_input_t term;
|
||||
|
||||
if (grub_term_poll_usb)
|
||||
grub_term_poll_usb (0);
|
||||
|
||||
FOR_ACTIVE_TERM_INPUTS(term)
|
||||
{
|
||||
if (term->getkeystatus)
|
||||
status |= term->getkeystatus (term);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_keystatus (grub_extcmd_context_t ctxt,
|
||||
int argc __attribute__ ((unused)),
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <grub/auth.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@ -104,13 +105,22 @@ legacy_file (const char *filename)
|
||||
if (newsuffix)
|
||||
{
|
||||
char *t;
|
||||
grub_size_t sz;
|
||||
|
||||
if (grub_add (grub_strlen (suffix), grub_strlen (newsuffix), &sz) ||
|
||||
grub_add (sz, 1, &sz))
|
||||
{
|
||||
grub_errno = GRUB_ERR_OUT_OF_RANGE;
|
||||
goto fail_0;
|
||||
}
|
||||
|
||||
t = suffix;
|
||||
suffix = grub_realloc (suffix, grub_strlen (suffix)
|
||||
+ grub_strlen (newsuffix) + 1);
|
||||
suffix = grub_realloc (suffix, sz);
|
||||
if (!suffix)
|
||||
{
|
||||
grub_free (t);
|
||||
|
||||
fail_0:
|
||||
grub_free (entrysrc);
|
||||
grub_free (parsed);
|
||||
grub_free (newsuffix);
|
||||
@ -154,13 +164,22 @@ legacy_file (const char *filename)
|
||||
else
|
||||
{
|
||||
char *t;
|
||||
grub_size_t sz;
|
||||
|
||||
if (grub_add (grub_strlen (entrysrc), grub_strlen (parsed), &sz) ||
|
||||
grub_add (sz, 1, &sz))
|
||||
{
|
||||
grub_errno = GRUB_ERR_OUT_OF_RANGE;
|
||||
goto fail_1;
|
||||
}
|
||||
|
||||
t = entrysrc;
|
||||
entrysrc = grub_realloc (entrysrc, grub_strlen (entrysrc)
|
||||
+ grub_strlen (parsed) + 1);
|
||||
entrysrc = grub_realloc (entrysrc, sz);
|
||||
if (!entrysrc)
|
||||
{
|
||||
grub_free (t);
|
||||
|
||||
fail_1:
|
||||
grub_free (parsed);
|
||||
grub_free (suffix);
|
||||
return grub_errno;
|
||||
@ -314,7 +333,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
||||
if (argc < 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
cutargs = grub_malloc (sizeof (cutargs[0]) * (argc - 1));
|
||||
cutargs = grub_calloc (argc - 1, sizeof (cutargs[0]));
|
||||
if (!cutargs)
|
||||
return grub_errno;
|
||||
cutargc = argc - 1;
|
||||
@ -436,7 +455,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
|
||||
{
|
||||
char rbuf[3] = "-r";
|
||||
bsdargc = cutargc + 2;
|
||||
bsdargs = grub_malloc (sizeof (bsdargs[0]) * bsdargc);
|
||||
bsdargs = grub_calloc (bsdargc, sizeof (bsdargs[0]));
|
||||
if (!bsdargs)
|
||||
{
|
||||
err = grub_errno;
|
||||
@ -559,7 +578,7 @@ grub_cmd_legacy_initrdnounzip (struct grub_command *mycmd __attribute__ ((unused
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("can't find command `%s'"),
|
||||
"module");
|
||||
|
||||
newargs = grub_malloc ((argc + 1) * sizeof (newargs[0]));
|
||||
newargs = grub_calloc (argc + 1, sizeof (newargs[0]));
|
||||
if (!newargs)
|
||||
return grub_errno;
|
||||
grub_memcpy (newargs + 1, args, argc * sizeof (newargs[0]));
|
||||
|
@ -70,7 +70,7 @@ grub_ls_list_devices (int longlist)
|
||||
FOR_NET_APP_LEVEL (proto)
|
||||
{
|
||||
if (first)
|
||||
grub_puts_ (N_ ("Network protocols:"));
|
||||
grub_puts_ (N_("Network protocols:"));
|
||||
first = 0;
|
||||
grub_printf ("%s ", proto->name);
|
||||
}
|
||||
@ -196,7 +196,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (! *path)
|
||||
if (! *path && device_name)
|
||||
{
|
||||
if (grub_errno == GRUB_ERR_UNKNOWN_FS)
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/lockdown.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@ -133,15 +134,15 @@ GRUB_MOD_INIT(memrw)
|
||||
N_("ADDR"), N_("Read 32-bit value from ADDR."),
|
||||
options);
|
||||
cmd_write_byte =
|
||||
grub_register_command ("write_byte", grub_cmd_write,
|
||||
grub_register_command_lockdown ("write_byte", grub_cmd_write,
|
||||
N_("ADDR VALUE [MASK]"),
|
||||
N_("Write 8-bit VALUE to ADDR."));
|
||||
cmd_write_word =
|
||||
grub_register_command ("write_word", grub_cmd_write,
|
||||
grub_register_command_lockdown ("write_word", grub_cmd_write,
|
||||
N_("ADDR VALUE [MASK]"),
|
||||
N_("Write 16-bit VALUE to ADDR."));
|
||||
cmd_write_dword =
|
||||
grub_register_command ("write_dword", grub_cmd_write,
|
||||
grub_register_command_lockdown ("write_dword", grub_cmd_write,
|
||||
N_("ADDR VALUE [MASK]"),
|
||||
N_("Write 32-bit VALUE to ADDR."));
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
|
||||
goto fail;
|
||||
|
||||
/* Save argc, args to pass as parameters to block arg later. */
|
||||
menu_args = grub_malloc (sizeof (char*) * (argc + 1));
|
||||
menu_args = grub_calloc (argc + 1, sizeof (char *));
|
||||
if (! menu_args)
|
||||
goto fail;
|
||||
|
||||
@ -230,7 +230,7 @@ setparams_prefix (int argc, char **args)
|
||||
len += 3; /* 3 = 1 space + 2 quotes */
|
||||
p = args[i];
|
||||
while (*p)
|
||||
len += (*p++ == '\'' ? 3 : 1);
|
||||
len += (*p++ == '\'' ? 4 : 1);
|
||||
}
|
||||
|
||||
result = grub_malloc (len + 2);
|
||||
|
@ -140,7 +140,10 @@ grub_mini_cmd_rmmod (struct grub_command *cmd __attribute__ ((unused)),
|
||||
if (grub_dl_is_persistent (mod))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "cannot unload persistent module");
|
||||
|
||||
if (grub_dl_unref (mod) <= 0)
|
||||
if (grub_dl_ref_count (mod) > 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "cannot unload referenced module");
|
||||
|
||||
grub_dl_unref (mod);
|
||||
grub_dl_unload (mod);
|
||||
|
||||
return 0;
|
||||
|
@ -195,7 +195,7 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
|
||||
else
|
||||
path_prefix = prefix;
|
||||
|
||||
mods = grub_malloc (argc * sizeof (mods[0]));
|
||||
mods = grub_calloc (argc, sizeof (mods[0]));
|
||||
if (!mods)
|
||||
return grub_errno;
|
||||
|
||||
|
@ -59,7 +59,13 @@ grub_parttool_register(const char *part_name,
|
||||
for (nargs = 0; args[nargs].name != 0; nargs++);
|
||||
cur->nargs = nargs;
|
||||
cur->args = (struct grub_parttool_argdesc *)
|
||||
grub_malloc ((nargs + 1) * sizeof (struct grub_parttool_argdesc));
|
||||
grub_calloc (nargs + 1, sizeof (struct grub_parttool_argdesc));
|
||||
if (!cur->args)
|
||||
{
|
||||
grub_free (cur);
|
||||
curhandle--;
|
||||
return -1;
|
||||
}
|
||||
grub_memcpy (cur->args, args,
|
||||
(nargs + 1) * sizeof (struct grub_parttool_argdesc));
|
||||
|
||||
@ -257,7 +263,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
||||
return err;
|
||||
}
|
||||
|
||||
parsed = (int *) grub_zalloc (argc * sizeof (int));
|
||||
parsed = (int *) grub_calloc (argc, sizeof (int));
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
if (! parsed[i])
|
||||
@ -290,7 +296,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
||||
}
|
||||
ptool = cur;
|
||||
pargs = (struct grub_parttool_args *)
|
||||
grub_zalloc (ptool->nargs * sizeof (struct grub_parttool_args));
|
||||
grub_calloc (ptool->nargs, sizeof (struct grub_parttool_args));
|
||||
for (j = i; j < argc; j++)
|
||||
if (! parsed[j])
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
grub_err_t err;
|
||||
char *ptr, *ptr2;
|
||||
const char *ptr, *ptr2;
|
||||
grub_uint8_t *ptro;
|
||||
struct pbkdf2_password *pass;
|
||||
|
||||
|
@ -95,7 +95,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt,
|
||||
if (ctxt->state[0].set)
|
||||
{
|
||||
ptr = ctxt->state[0].arg;
|
||||
ctx.pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff);
|
||||
ctx.pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff);
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
@ -108,8 +108,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt,
|
||||
if (*ptr != ':')
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':');
|
||||
ptr++;
|
||||
ctx.pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff)
|
||||
<< 16;
|
||||
ctx.pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff) << 16;
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
else
|
||||
@ -124,7 +123,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt,
|
||||
|
||||
ptr = ctxt->state[1].arg;
|
||||
optr = ptr;
|
||||
ctx.bus = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
ctx.bus = grub_strtoul (ptr, &ptr, 16);
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
@ -138,7 +137,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt,
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':');
|
||||
ptr++;
|
||||
optr = ptr;
|
||||
ctx.device = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
ctx.device = grub_strtoul (ptr, &ptr, 16);
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
@ -149,7 +148,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt,
|
||||
if (*ptr == '.')
|
||||
{
|
||||
ptr++;
|
||||
ctx.function = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
ctx.function = grub_strtoul (ptr, &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
ctx.check_function = 1;
|
||||
|
@ -633,8 +633,8 @@ grub_verify_signature_real (struct grub_pubkey_context *ctxt,
|
||||
if (!sk)
|
||||
{
|
||||
/* TRANSLATORS: %08x is 32-bit key id. */
|
||||
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("public key %08x not found"),
|
||||
keyid);
|
||||
grub_error (GRUB_ERR_BAD_SIGNATURE,
|
||||
N_("public key %08" PRIxGRUB_UINT64_T " not found"), keyid);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <grub/device.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/gpt_partition.h>
|
||||
#include <grub/net.h>
|
||||
#include <grub/fs.h>
|
||||
#include <grub/file.h>
|
||||
@ -31,6 +32,7 @@
|
||||
#include <grub/env.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/i386/pc/boot.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@ -45,6 +47,7 @@ static const struct grub_arg_option options[] =
|
||||
{"fs", 'f', 0, N_("Determine filesystem type."), 0, 0},
|
||||
{"fs-uuid", 'u', 0, N_("Determine filesystem UUID."), 0, 0},
|
||||
{"label", 'l', 0, N_("Determine filesystem label."), 0, 0},
|
||||
{"part-uuid", 0, 0, N_("Determine partition UUID."), 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
@ -98,6 +101,56 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
grub_device_close (dev);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
if (state[6].set)
|
||||
{
|
||||
/* AAAABBBB-CCCC-DDDD-EEEE-FFFFFFFFFFFF + null terminator */
|
||||
char val[37] = "none";
|
||||
if (dev->disk && dev->disk->partition)
|
||||
{
|
||||
struct grub_partition *p = dev->disk->partition;
|
||||
grub_disk_t disk = grub_disk_open(dev->disk->name);
|
||||
|
||||
if (!disk)
|
||||
{
|
||||
grub_device_close (dev);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
if (grub_strcmp(dev->disk->partition->partmap->name, "gpt") == 0)
|
||||
{
|
||||
struct grub_gpt_partentry entry;
|
||||
grub_gpt_part_guid_t *guid;
|
||||
|
||||
if (grub_disk_read(disk, p->offset, p->index, sizeof(entry), &entry))
|
||||
return grub_errno;
|
||||
guid = &entry.guid;
|
||||
grub_snprintf (val, sizeof(val),
|
||||
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
grub_le_to_cpu32 (guid->data1),
|
||||
grub_le_to_cpu16 (guid->data2),
|
||||
grub_le_to_cpu16 (guid->data3),
|
||||
guid->data4[0], guid->data4[1], guid->data4[2],
|
||||
guid->data4[3], guid->data4[4], guid->data4[5],
|
||||
guid->data4[6], guid->data4[7]);
|
||||
}
|
||||
else if (grub_strcmp(dev->disk->partition->partmap->name, "msdos") == 0)
|
||||
{
|
||||
grub_uint32_t nt_disk_sig;
|
||||
|
||||
if (grub_disk_read(disk, 0, GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
|
||||
sizeof(nt_disk_sig), &nt_disk_sig) == 0)
|
||||
grub_snprintf (val, sizeof(val), "%08x-%02x",
|
||||
grub_le_to_cpu32(nt_disk_sig), 1 + p->number);
|
||||
}
|
||||
grub_disk_close(disk);
|
||||
}
|
||||
if (state[0].set)
|
||||
grub_env_set (state[0].arg, val);
|
||||
else
|
||||
grub_printf ("%s", val);
|
||||
grub_device_close (dev);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
fs = grub_fs_probe (dev);
|
||||
if (! fs)
|
||||
return grub_errno;
|
||||
|
@ -64,7 +64,7 @@ set_matches (char **varnames, char *str, grub_size_t nmatches,
|
||||
{
|
||||
int i;
|
||||
char *p;
|
||||
char *q;
|
||||
const char * q;
|
||||
grub_err_t err;
|
||||
unsigned long j;
|
||||
|
||||
@ -116,7 +116,7 @@ grub_cmd_regexp (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
matches = grub_zalloc (sizeof (*matches) * (regex.re_nsub + 1));
|
||||
matches = grub_calloc (regex.re_nsub + 1, sizeof (*matches));
|
||||
if (! matches)
|
||||
goto fail;
|
||||
|
||||
|
@ -122,7 +122,7 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
for (i = 0; state[SEARCH_HINT_BAREMETAL].args[i]; i++)
|
||||
nhints++;
|
||||
|
||||
hints = grub_malloc (sizeof (hints[0]) * nhints);
|
||||
hints = grub_calloc (nhints, sizeof (hints[0]));
|
||||
if (!hints)
|
||||
return grub_errno;
|
||||
j = 0;
|
||||
|
@ -169,7 +169,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
||||
if (ctxt->state[0].set)
|
||||
{
|
||||
ptr = ctxt->state[0].arg;
|
||||
pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff);
|
||||
pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff);
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
@ -182,8 +182,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
||||
if (*ptr != ':')
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':');
|
||||
ptr++;
|
||||
pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff)
|
||||
<< 16;
|
||||
pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff) << 16;
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
else
|
||||
@ -200,7 +199,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
||||
|
||||
ptr = ctxt->state[1].arg;
|
||||
optr = ptr;
|
||||
bus = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
bus = grub_strtoul (ptr, &ptr, 16);
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
@ -214,7 +213,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':');
|
||||
ptr++;
|
||||
optr = ptr;
|
||||
device = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
device = grub_strtoul (ptr, &ptr, 16);
|
||||
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
@ -225,7 +224,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
||||
if (*ptr == '.')
|
||||
{
|
||||
ptr++;
|
||||
function = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
function = grub_strtoul (ptr, &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
check_function = 1;
|
||||
@ -253,7 +252,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
||||
if (i == ARRAY_SIZE (pci_registers))
|
||||
{
|
||||
regsize = 0;
|
||||
regaddr = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
regaddr = grub_strtoul (ptr, &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown register");
|
||||
}
|
||||
@ -270,7 +269,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
||||
if (*ptr == '+')
|
||||
{
|
||||
ptr++;
|
||||
regaddr += grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
regaddr += grub_strtoul (ptr, &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
}
|
||||
@ -302,14 +301,14 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv)
|
||||
if (*ptr == '=')
|
||||
{
|
||||
ptr++;
|
||||
regwrite = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
regwrite = grub_strtoul (ptr, &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
write_mask = 0xffffffff;
|
||||
if (*ptr == ':')
|
||||
{
|
||||
ptr++;
|
||||
write_mask = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||
write_mask = grub_strtoul (ptr, &ptr, 16);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
write_mask = 0xffffffff;
|
||||
@ -329,7 +328,7 @@ static grub_extcmd_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(setpci)
|
||||
{
|
||||
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, 0,
|
||||
cmd = grub_register_extcmd_lockdown ("setpci", grub_cmd_setpci, 0,
|
||||
N_("[-s POSITION] [-d DEVICE] [-v VAR] "
|
||||
"REGISTER[=VALUE[:MASK]]"),
|
||||
N_("Manipulate PCI devices."), options);
|
||||
|
@ -55,7 +55,7 @@ grub_interruptible_millisleep (grub_uint32_t ms)
|
||||
start = grub_get_time_ms ();
|
||||
|
||||
while (grub_get_time_ms () - start < ms)
|
||||
if (grub_getkey_noblock () == GRUB_TERM_ESC)
|
||||
if (grub_key_is_interrupt (grub_getkey_noblock ()))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
398
grub-core/commands/smbios.c
Normal file
398
grub-core/commands/smbios.c
Normal file
@ -0,0 +1,398 @@
|
||||
/* smbios.c - retrieve smbios information. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/smbios.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* Abstract useful values found in either the SMBIOS3 or SMBIOS EPS. */
|
||||
static struct {
|
||||
grub_addr_t start;
|
||||
grub_addr_t end;
|
||||
grub_uint16_t structures;
|
||||
} table_desc;
|
||||
|
||||
static grub_extcmd_t cmd;
|
||||
|
||||
/* Locate the SMBIOS entry point structure depending on the hardware. */
|
||||
struct grub_smbios_eps *
|
||||
grub_smbios_get_eps (void)
|
||||
{
|
||||
static struct grub_smbios_eps *eps = NULL;
|
||||
|
||||
if (eps != NULL)
|
||||
return eps;
|
||||
|
||||
eps = grub_machine_smbios_get_eps ();
|
||||
|
||||
return eps;
|
||||
}
|
||||
|
||||
/* Locate the SMBIOS3 entry point structure depending on the hardware. */
|
||||
static struct grub_smbios_eps3 *
|
||||
grub_smbios_get_eps3 (void)
|
||||
{
|
||||
static struct grub_smbios_eps3 *eps = NULL;
|
||||
|
||||
if (eps != NULL)
|
||||
return eps;
|
||||
|
||||
eps = grub_machine_smbios_get_eps3 ();
|
||||
|
||||
return eps;
|
||||
}
|
||||
|
||||
static char *
|
||||
linux_string (const char *value)
|
||||
{
|
||||
char *out = grub_malloc( grub_strlen (value) + 1);
|
||||
const char *src = value;
|
||||
char *dst = out;
|
||||
|
||||
for (; *src; src++)
|
||||
if (*src > ' ' && *src < 127 && *src != ':')
|
||||
*dst++ = *src;
|
||||
|
||||
*dst = 0;
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions convert values from the various SMBIOS structure field types
|
||||
* into a string formatted to be returned to the user. They expect that the
|
||||
* structure and offset were already validated. When the requested data is
|
||||
* successfully retrieved and formatted, the pointer to the string is returned;
|
||||
* otherwise, NULL is returned on failure. Don't free the result.
|
||||
*/
|
||||
|
||||
static const char *
|
||||
grub_smbios_format_byte (const grub_uint8_t *structure, grub_uint8_t offset)
|
||||
{
|
||||
static char buffer[sizeof ("255")];
|
||||
|
||||
grub_snprintf (buffer, sizeof (buffer), "%u", structure[offset]);
|
||||
|
||||
return (const char *)buffer;
|
||||
}
|
||||
|
||||
static const char *
|
||||
grub_smbios_format_word (const grub_uint8_t *structure, grub_uint8_t offset)
|
||||
{
|
||||
static char buffer[sizeof ("65535")];
|
||||
|
||||
grub_uint16_t value = grub_get_unaligned16 (structure + offset);
|
||||
grub_snprintf (buffer, sizeof (buffer), "%u", value);
|
||||
|
||||
return (const char *)buffer;
|
||||
}
|
||||
|
||||
static const char *
|
||||
grub_smbios_format_dword (const grub_uint8_t *structure, grub_uint8_t offset)
|
||||
{
|
||||
static char buffer[sizeof ("4294967295")];
|
||||
|
||||
grub_uint32_t value = grub_get_unaligned32 (structure + offset);
|
||||
grub_snprintf (buffer, sizeof (buffer), "%" PRIuGRUB_UINT32_T, value);
|
||||
|
||||
return (const char *)buffer;
|
||||
}
|
||||
|
||||
static const char *
|
||||
grub_smbios_format_qword (const grub_uint8_t *structure, grub_uint8_t offset)
|
||||
{
|
||||
static char buffer[sizeof ("18446744073709551615")];
|
||||
|
||||
grub_uint64_t value = grub_get_unaligned64 (structure + offset);
|
||||
grub_snprintf (buffer, sizeof (buffer), "%" PRIuGRUB_UINT64_T, value);
|
||||
|
||||
return (const char *)buffer;
|
||||
}
|
||||
|
||||
static const char *
|
||||
grub_smbios_get_string (const grub_uint8_t *structure, grub_uint8_t offset)
|
||||
{
|
||||
const grub_uint8_t *ptr = structure + structure[1];
|
||||
const grub_uint8_t *table_end = (const grub_uint8_t *)table_desc.end;
|
||||
const grub_uint8_t referenced_string_number = structure[offset];
|
||||
grub_uint8_t i;
|
||||
|
||||
/* A string referenced with zero is interpreted as unset. */
|
||||
if (referenced_string_number == 0)
|
||||
return NULL;
|
||||
|
||||
/* Search the string set. */
|
||||
for (i = 1; *ptr != 0 && ptr < table_end; i++)
|
||||
if (i == referenced_string_number)
|
||||
{
|
||||
const char *str = (const char *)ptr;
|
||||
while (*ptr++ != 0)
|
||||
if (ptr >= table_end)
|
||||
return NULL; /* The string isn't terminated. */
|
||||
return str;
|
||||
}
|
||||
else
|
||||
while (*ptr++ != 0 && ptr < table_end);
|
||||
|
||||
/* The string number is greater than the number of strings in the set. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
grub_smbios_format_uuid (const grub_uint8_t *structure, grub_uint8_t offset)
|
||||
{
|
||||
static char buffer[sizeof ("ffffffff-ffff-ffff-ffff-ffffffffffff")];
|
||||
const grub_uint8_t *f = structure + offset; /* little-endian fields */
|
||||
const grub_uint8_t *g = f + 8; /* byte-by-byte fields */
|
||||
|
||||
grub_snprintf (buffer, sizeof (buffer),
|
||||
"%02x%02x%02x%02x-%02x%02x-%02x%02x-"
|
||||
"%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
f[3], f[2], f[1], f[0], f[5], f[4], f[7], f[6],
|
||||
g[0], g[1], g[2], g[3], g[4], g[5], g[6], g[7]);
|
||||
|
||||
return (const char *)buffer;
|
||||
}
|
||||
|
||||
/* List the field formatting functions and the number of bytes they need. */
|
||||
static const struct {
|
||||
const char *(*format) (const grub_uint8_t *structure, grub_uint8_t offset);
|
||||
grub_uint8_t field_length;
|
||||
} field_extractors[] = {
|
||||
{grub_smbios_format_byte, 1},
|
||||
{grub_smbios_format_word, 2},
|
||||
{grub_smbios_format_dword, 4},
|
||||
{grub_smbios_format_qword, 8},
|
||||
{grub_smbios_get_string, 1},
|
||||
{grub_smbios_format_uuid, 16}
|
||||
};
|
||||
|
||||
/* List command options, with structure field getters ordered as above. */
|
||||
#define FIRST_GETTER_OPT (3)
|
||||
#define SETTER_OPT (FIRST_GETTER_OPT + ARRAY_SIZE(field_extractors))
|
||||
#define LINUX_OPT (FIRST_GETTER_OPT + ARRAY_SIZE(field_extractors) + 1)
|
||||
|
||||
static const struct grub_arg_option options[] = {
|
||||
{"type", 't', 0, N_("Match structures with the given type."),
|
||||
N_("type"), ARG_TYPE_INT},
|
||||
{"handle", 'h', 0, N_("Match structures with the given handle."),
|
||||
N_("handle"), ARG_TYPE_INT},
|
||||
{"match", 'm', 0, N_("Select a structure when several match."),
|
||||
N_("match"), ARG_TYPE_INT},
|
||||
{"get-byte", 'b', 0, N_("Get the byte's value at the given offset."),
|
||||
N_("offset"), ARG_TYPE_INT},
|
||||
{"get-word", 'w', 0, N_("Get two bytes' value at the given offset."),
|
||||
N_("offset"), ARG_TYPE_INT},
|
||||
{"get-dword", 'd', 0, N_("Get four bytes' value at the given offset."),
|
||||
N_("offset"), ARG_TYPE_INT},
|
||||
{"get-qword", 'q', 0, N_("Get eight bytes' value at the given offset."),
|
||||
N_("offset"), ARG_TYPE_INT},
|
||||
{"get-string", 's', 0, N_("Get the string specified at the given offset."),
|
||||
N_("offset"), ARG_TYPE_INT},
|
||||
{"get-uuid", 'u', 0, N_("Get the UUID's value at the given offset."),
|
||||
N_("offset"), ARG_TYPE_INT},
|
||||
{"set", '\0', 0, N_("Store the value in the given variable name."),
|
||||
N_("variable"), ARG_TYPE_STRING},
|
||||
{"linux", '\0', 0, N_("Filter the result like linux does."),
|
||||
N_("variable"), ARG_TYPE_NONE},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
* Return a matching SMBIOS structure.
|
||||
*
|
||||
* This method can use up to three criteria for selecting a structure:
|
||||
* - The "type" field (use -1 to ignore)
|
||||
* - The "handle" field (use -1 to ignore)
|
||||
* - Which to return if several match (use 0 to ignore)
|
||||
*
|
||||
* The return value is a pointer to the first matching structure. If no
|
||||
* structures match the given parameters, NULL is returned.
|
||||
*/
|
||||
static const grub_uint8_t *
|
||||
grub_smbios_match_structure (const grub_int16_t type,
|
||||
const grub_int32_t handle,
|
||||
const grub_uint16_t match)
|
||||
{
|
||||
const grub_uint8_t *ptr = (const grub_uint8_t *)table_desc.start;
|
||||
const grub_uint8_t *table_end = (const grub_uint8_t *)table_desc.end;
|
||||
grub_uint16_t structures = table_desc.structures;
|
||||
grub_uint16_t structure_count = 0;
|
||||
grub_uint16_t matches = 0;
|
||||
|
||||
while (ptr < table_end
|
||||
&& ptr[1] >= 4 /* Valid structures include the 4-byte header. */
|
||||
&& (structure_count++ < structures || structures == 0))
|
||||
{
|
||||
grub_uint16_t structure_handle = grub_get_unaligned16 (ptr + 2);
|
||||
grub_uint8_t structure_type = ptr[0];
|
||||
|
||||
if ((handle < 0 || handle == structure_handle)
|
||||
&& (type < 0 || type == structure_type)
|
||||
&& (match == 0 || match == ++matches))
|
||||
return ptr;
|
||||
else
|
||||
{
|
||||
ptr += ptr[1];
|
||||
while ((*ptr++ != 0 || *ptr++ != 0) && ptr < table_end);
|
||||
}
|
||||
|
||||
if (structure_type == GRUB_SMBIOS_TYPE_END_OF_TABLE)
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_smbios (grub_extcmd_context_t ctxt,
|
||||
int argc __attribute__ ((unused)),
|
||||
char **argv __attribute__ ((unused)))
|
||||
{
|
||||
struct grub_arg_list *state = ctxt->state;
|
||||
|
||||
grub_int16_t type = -1;
|
||||
grub_int32_t handle = -1;
|
||||
grub_uint16_t match = 0;
|
||||
grub_uint8_t offset = 0;
|
||||
|
||||
const grub_uint8_t *structure;
|
||||
const char *value;
|
||||
char *modified_value = NULL;
|
||||
grub_int32_t option;
|
||||
grub_int8_t field_type = -1;
|
||||
grub_uint8_t i;
|
||||
|
||||
if (table_desc.start == 0)
|
||||
return grub_error (GRUB_ERR_IO,
|
||||
N_("the SMBIOS entry point structure was not found"));
|
||||
|
||||
/* Read the given filtering options. */
|
||||
if (state[0].set)
|
||||
{
|
||||
option = grub_strtol (state[0].arg, NULL, 0);
|
||||
if (option < 0 || option > 255)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("the type must be between 0 and 255"));
|
||||
type = (grub_int16_t)option;
|
||||
}
|
||||
if (state[1].set)
|
||||
{
|
||||
option = grub_strtol (state[1].arg, NULL, 0);
|
||||
if (option < 0 || option > 65535)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("the handle must be between 0 and 65535"));
|
||||
handle = (grub_int32_t)option;
|
||||
}
|
||||
if (state[2].set)
|
||||
{
|
||||
option = grub_strtol (state[2].arg, NULL, 0);
|
||||
if (option <= 0 || option > 65535)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("the match must be a positive integer"));
|
||||
match = (grub_uint16_t)option;
|
||||
}
|
||||
|
||||
/* Determine the data type of the structure field to retrieve. */
|
||||
for (i = 0; i < ARRAY_SIZE(field_extractors); i++)
|
||||
if (state[FIRST_GETTER_OPT + i].set)
|
||||
{
|
||||
if (field_type >= 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("only one --get option is usable at a time"));
|
||||
field_type = i;
|
||||
}
|
||||
|
||||
/* Require a choice of a structure field to return. */
|
||||
if (field_type < 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("one of the --get options is required"));
|
||||
|
||||
/* Locate a matching SMBIOS structure. */
|
||||
structure = grub_smbios_match_structure (type, handle, match);
|
||||
if (structure == NULL)
|
||||
return grub_error (GRUB_ERR_IO,
|
||||
N_("no structure matched the given options"));
|
||||
|
||||
/* Ensure the requested byte offset is inside the structure. */
|
||||
option = grub_strtol (state[FIRST_GETTER_OPT + field_type].arg, NULL, 0);
|
||||
if (option < 0 || option >= structure[1])
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("the given offset is outside the structure"));
|
||||
|
||||
/* Ensure the requested data type at the offset is inside the structure. */
|
||||
offset = (grub_uint8_t)option;
|
||||
if (offset + field_extractors[field_type].field_length > structure[1])
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("the field ends outside the structure"));
|
||||
|
||||
/* Format the requested structure field into a readable string. */
|
||||
value = field_extractors[field_type].format (structure, offset);
|
||||
if (value == NULL)
|
||||
return grub_error (GRUB_ERR_IO,
|
||||
N_("failed to retrieve the structure field"));
|
||||
|
||||
if (state[LINUX_OPT].set)
|
||||
value = modified_value = linux_string (value);
|
||||
|
||||
/* Store or print the formatted value. */
|
||||
if (state[SETTER_OPT].set)
|
||||
grub_env_set (state[SETTER_OPT].arg, value);
|
||||
else
|
||||
grub_printf ("%s\n", value);
|
||||
|
||||
grub_free(modified_value);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT(smbios)
|
||||
{
|
||||
struct grub_smbios_eps3 *eps3;
|
||||
struct grub_smbios_eps *eps;
|
||||
|
||||
if ((eps3 = grub_smbios_get_eps3 ()))
|
||||
{
|
||||
table_desc.start = (grub_addr_t)eps3->table_address;
|
||||
table_desc.end = table_desc.start + eps3->maximum_table_length;
|
||||
table_desc.structures = 0; /* SMBIOS3 drops the structure count. */
|
||||
}
|
||||
else if ((eps = grub_smbios_get_eps ()))
|
||||
{
|
||||
table_desc.start = (grub_addr_t)eps->intermediate.table_address;
|
||||
table_desc.end = table_desc.start + eps->intermediate.table_length;
|
||||
table_desc.structures = eps->intermediate.structures;
|
||||
}
|
||||
|
||||
cmd = grub_register_extcmd ("smbios", grub_cmd_smbios, 0,
|
||||
N_("[-t type] [-h handle] [-m match] "
|
||||
"(-b|-w|-d|-q|-s|-u) offset "
|
||||
"[--set variable]"),
|
||||
N_("Retrieve SMBIOS information."), options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(smbios)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
}
|
@ -87,7 +87,7 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
|
||||
i++;
|
||||
|
||||
if (i == argc)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("no terminal specified"));
|
||||
|
||||
for (; i < argc; i++)
|
||||
{
|
||||
@ -241,8 +241,8 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||
(struct abstract_terminal **) (void *) &grub_term_inputs,
|
||||
(struct abstract_terminal **) (void *) &grub_term_inputs_disabled,
|
||||
grub_term_input_autoload,
|
||||
N_ ("Active input terminals:"),
|
||||
N_ ("Available input terminals:"));
|
||||
N_("Active input terminals:"),
|
||||
N_("Available input terminals:"));
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
@ -258,8 +258,8 @@ grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
|
||||
(struct abstract_terminal **) (void *) &grub_term_outputs,
|
||||
(struct abstract_terminal **) (void *) &grub_term_outputs_disabled,
|
||||
grub_term_output_autoload,
|
||||
N_ ("Active output terminals:"),
|
||||
N_ ("Available output terminals:"));
|
||||
N_("Active output terminals:"),
|
||||
N_("Available output terminals:"));
|
||||
}
|
||||
|
||||
static grub_command_t cmd_terminal_input, cmd_terminal_output;
|
||||
|
@ -31,7 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* A simple implementation for signed numbers. */
|
||||
static int
|
||||
grub_strtosl (char *arg, char **end, int base)
|
||||
grub_strtosl (char *arg, const char ** const end, int base)
|
||||
{
|
||||
if (arg[0] == '-')
|
||||
return -grub_strtoul (arg + 1, end, base);
|
||||
|
@ -29,13 +29,6 @@
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
grub_err_t
|
||||
grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr,
|
||||
const char *description)
|
||||
{
|
||||
return grub_tpm_log_event (buf, size, pcr, description);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_tpm_verify_init (grub_file_t io,
|
||||
enum grub_file_type type __attribute__ ((unused)),
|
||||
|
@ -136,7 +136,7 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
|
||||
ctx.height = ctx.width = ctx.depth = 0;
|
||||
if (argc)
|
||||
{
|
||||
char *ptr;
|
||||
const char *ptr;
|
||||
ptr = args[0];
|
||||
ctx.width = grub_strtoul (ptr, &ptr, 0);
|
||||
if (grub_errno)
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <grub/file.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/script_sh.h>
|
||||
#include <grub/safemath.h>
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
@ -48,6 +49,7 @@ merge (char **dest, char **ps)
|
||||
int i;
|
||||
int j;
|
||||
char **p;
|
||||
grub_size_t sz;
|
||||
|
||||
if (! dest)
|
||||
return ps;
|
||||
@ -60,7 +62,12 @@ merge (char **dest, char **ps)
|
||||
for (j = 0; ps[j]; j++)
|
||||
;
|
||||
|
||||
p = grub_realloc (dest, sizeof (char*) * (i + j + 1));
|
||||
if (grub_add (i, j, &sz) ||
|
||||
grub_add (sz, 1, &sz) ||
|
||||
grub_mul (sz, sizeof (char *), &sz))
|
||||
return dest;
|
||||
|
||||
p = grub_realloc (dest, sz);
|
||||
if (! p)
|
||||
{
|
||||
grub_free (dest);
|
||||
@ -115,8 +122,15 @@ make_regex (const char *start, const char *end, regex_t *regexp)
|
||||
char ch;
|
||||
int i = 0;
|
||||
unsigned len = end - start;
|
||||
char *buffer = grub_malloc (len * 2 + 2 + 1); /* worst case size. */
|
||||
char *buffer;
|
||||
grub_size_t sz;
|
||||
|
||||
/* Worst case size is (len * 2 + 2 + 1). */
|
||||
if (grub_mul (len, 2, &sz) ||
|
||||
grub_add (sz, 3, &sz))
|
||||
return 1;
|
||||
|
||||
buffer = grub_malloc (sz);
|
||||
if (! buffer)
|
||||
return 1;
|
||||
|
||||
@ -226,6 +240,7 @@ match_devices_iter (const char *name, void *data)
|
||||
struct match_devices_ctx *ctx = data;
|
||||
char **t;
|
||||
char *buffer;
|
||||
grub_size_t sz;
|
||||
|
||||
/* skip partitions if asked to. */
|
||||
if (ctx->noparts && grub_strchr (name, ','))
|
||||
@ -239,11 +254,16 @@ match_devices_iter (const char *name, void *data)
|
||||
if (regexec (ctx->regexp, buffer, 0, 0, 0))
|
||||
{
|
||||
grub_dprintf ("expand", "not matched\n");
|
||||
fail:
|
||||
grub_free (buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
t = grub_realloc (ctx->devs, sizeof (char*) * (ctx->ndev + 2));
|
||||
if (grub_add (ctx->ndev, 2, &sz) ||
|
||||
grub_mul (sz, sizeof (char *), &sz))
|
||||
goto fail;
|
||||
|
||||
t = grub_realloc (ctx->devs, sz);
|
||||
if (! t)
|
||||
{
|
||||
grub_free (buffer);
|
||||
@ -300,6 +320,7 @@ match_files_iter (const char *name,
|
||||
struct match_files_ctx *ctx = data;
|
||||
char **t;
|
||||
char *buffer;
|
||||
grub_size_t sz;
|
||||
|
||||
/* skip . and .. names */
|
||||
if (grub_strcmp(".", name) == 0 || grub_strcmp("..", name) == 0)
|
||||
@ -315,9 +336,14 @@ match_files_iter (const char *name,
|
||||
if (! buffer)
|
||||
return 1;
|
||||
|
||||
t = grub_realloc (ctx->files, sizeof (char*) * (ctx->nfile + 2));
|
||||
if (! t)
|
||||
if (grub_add (ctx->nfile, 2, &sz) ||
|
||||
grub_mul (sz, sizeof (char *), &sz))
|
||||
goto fail;
|
||||
|
||||
t = grub_realloc (ctx->files, sz);
|
||||
if (!t)
|
||||
{
|
||||
fail:
|
||||
grub_free (buffer);
|
||||
return 1;
|
||||
}
|
||||
|
@ -21,9 +21,12 @@
|
||||
*/
|
||||
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv2+");
|
||||
|
||||
gcry_err_code_t AF_merge (const gcry_md_spec_t * hash, grub_uint8_t * src,
|
||||
grub_uint8_t * dst, grub_size_t blocksize,
|
||||
grub_size_t blocknumbers);
|
||||
|
@ -219,8 +219,9 @@ grub_ata_setaddress (struct grub_ata *dev,
|
||||
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);
|
||||
"sector %" PRIxGRUB_UINT64_T " 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;
|
||||
@ -232,8 +233,9 @@ grub_ata_setaddress (struct grub_ata *dev,
|
||||
|| cylinder > dev->cylinders
|
||||
|| head > dev->heads)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"sector %d cannot be addressed "
|
||||
"using CHS addressing", sector);
|
||||
"sector %" PRIxGRUB_UINT64_T " cannot be "
|
||||
"addressed using CHS addressing",
|
||||
sector);
|
||||
|
||||
parms->taskfile.disk = 0xE0 | head;
|
||||
parms->taskfile.sectnum = sect;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2007,2010,2011 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2003,2007,2010,2011,2019 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
|
||||
@ -224,7 +224,8 @@ lrw_xor (const struct lrw_sector *sec,
|
||||
static gcry_err_code_t
|
||||
grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
grub_uint8_t * data, grub_size_t len,
|
||||
grub_disk_addr_t sector, int do_encrypt)
|
||||
grub_disk_addr_t sector, grub_size_t log_sector_size,
|
||||
int do_encrypt)
|
||||
{
|
||||
grub_size_t i;
|
||||
gcry_err_code_t err;
|
||||
@ -237,7 +238,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
return (do_encrypt ? grub_crypto_ecb_encrypt (dev->cipher, data, data, len)
|
||||
: grub_crypto_ecb_decrypt (dev->cipher, data, data, len));
|
||||
|
||||
for (i = 0; i < len; i += (1U << dev->log_sector_size))
|
||||
for (i = 0; i < len; i += (1U << log_sector_size))
|
||||
{
|
||||
grub_size_t sz = ((dev->cipher->cipher->blocksize
|
||||
+ sizeof (grub_uint32_t) - 1)
|
||||
@ -270,7 +271,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
if (!ctx)
|
||||
return GPG_ERR_OUT_OF_MEMORY;
|
||||
|
||||
tmp = grub_cpu_to_le64 (sector << dev->log_sector_size);
|
||||
tmp = grub_cpu_to_le64 (sector << log_sector_size);
|
||||
dev->iv_hash->init (ctx);
|
||||
dev->iv_hash->write (ctx, dev->iv_prefix, dev->iv_prefix_len);
|
||||
dev->iv_hash->write (ctx, &tmp, sizeof (tmp));
|
||||
@ -281,25 +282,38 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
}
|
||||
break;
|
||||
case GRUB_CRYPTODISK_MODE_IV_PLAIN64:
|
||||
iv[1] = grub_cpu_to_le32 (sector >> 32);
|
||||
/* FALLTHROUGH */
|
||||
case GRUB_CRYPTODISK_MODE_IV_PLAIN:
|
||||
iv[0] = grub_cpu_to_le32 (sector & 0xFFFFFFFF);
|
||||
/*
|
||||
* The IV is a 32 or 64 bit value of the dm-crypt native sector
|
||||
* number. If using 32 bit IV mode, zero out the most significant
|
||||
* 32 bits.
|
||||
*/
|
||||
{
|
||||
grub_uint64_t iv64;
|
||||
|
||||
iv64 = grub_cpu_to_le64 (sector << (log_sector_size
|
||||
- GRUB_CRYPTODISK_IV_LOG_SIZE));
|
||||
grub_set_unaligned64 (iv, iv64);
|
||||
if (dev->mode_iv == GRUB_CRYPTODISK_MODE_IV_PLAIN)
|
||||
iv[1] = 0;
|
||||
}
|
||||
break;
|
||||
case GRUB_CRYPTODISK_MODE_IV_BYTECOUNT64:
|
||||
iv[1] = grub_cpu_to_le32 (sector >> (32 - dev->log_sector_size));
|
||||
iv[0] = grub_cpu_to_le32 ((sector << dev->log_sector_size)
|
||||
& 0xFFFFFFFF);
|
||||
/* The IV is the 64 bit byte offset of the sector. */
|
||||
iv[1] = grub_cpu_to_le32 (sector >> (GRUB_TYPE_BITS (iv[1])
|
||||
- log_sector_size));
|
||||
iv[0] = grub_cpu_to_le32 ((sector << log_sector_size)
|
||||
& GRUB_TYPE_U_MAX (iv[0]));
|
||||
break;
|
||||
case GRUB_CRYPTODISK_MODE_IV_BENBI:
|
||||
{
|
||||
grub_uint64_t num = (sector << dev->benbi_log) + 1;
|
||||
iv[sz - 2] = grub_cpu_to_be32 (num >> 32);
|
||||
iv[sz - 1] = grub_cpu_to_be32 (num & 0xFFFFFFFF);
|
||||
iv[sz - 2] = grub_cpu_to_be32 (num >> GRUB_TYPE_BITS (iv[0]));
|
||||
iv[sz - 1] = grub_cpu_to_be32 (num & GRUB_TYPE_U_MAX (iv[0]));
|
||||
}
|
||||
break;
|
||||
case GRUB_CRYPTODISK_MODE_IV_ESSIV:
|
||||
iv[0] = grub_cpu_to_le32 (sector & 0xFFFFFFFF);
|
||||
iv[0] = grub_cpu_to_le32 (sector & GRUB_TYPE_U_MAX (iv[0]));
|
||||
err = grub_crypto_ecb_encrypt (dev->essiv_cipher, iv, iv,
|
||||
dev->cipher->cipher->blocksize);
|
||||
if (err)
|
||||
@ -311,10 +325,10 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
case GRUB_CRYPTODISK_MODE_CBC:
|
||||
if (do_encrypt)
|
||||
err = grub_crypto_cbc_encrypt (dev->cipher, data + i, data + i,
|
||||
(1U << dev->log_sector_size), iv);
|
||||
((grub_size_t) 1 << log_sector_size), iv);
|
||||
else
|
||||
err = grub_crypto_cbc_decrypt (dev->cipher, data + i, data + i,
|
||||
(1U << dev->log_sector_size), iv);
|
||||
((grub_size_t) 1 << log_sector_size), iv);
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
@ -322,10 +336,10 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
case GRUB_CRYPTODISK_MODE_PCBC:
|
||||
if (do_encrypt)
|
||||
err = grub_crypto_pcbc_encrypt (dev->cipher, data + i, data + i,
|
||||
(1U << dev->log_sector_size), iv);
|
||||
((grub_size_t) 1 << log_sector_size), iv);
|
||||
else
|
||||
err = grub_crypto_pcbc_decrypt (dev->cipher, data + i, data + i,
|
||||
(1U << dev->log_sector_size), iv);
|
||||
((grub_size_t) 1 << log_sector_size), iv);
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
@ -337,7 +351,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
for (j = 0; j < (1U << dev->log_sector_size);
|
||||
for (j = 0; j < (1U << log_sector_size);
|
||||
j += dev->cipher->cipher->blocksize)
|
||||
{
|
||||
grub_crypto_xor (data + i + j, data + i + j, iv,
|
||||
@ -368,11 +382,11 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
if (do_encrypt)
|
||||
err = grub_crypto_ecb_encrypt (dev->cipher, data + i,
|
||||
data + i,
|
||||
(1U << dev->log_sector_size));
|
||||
(1U << log_sector_size));
|
||||
else
|
||||
err = grub_crypto_ecb_decrypt (dev->cipher, data + i,
|
||||
data + i,
|
||||
(1U << dev->log_sector_size));
|
||||
(1U << log_sector_size));
|
||||
if (err)
|
||||
return err;
|
||||
lrw_xor (&sec, dev, data + i);
|
||||
@ -381,10 +395,10 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
case GRUB_CRYPTODISK_MODE_ECB:
|
||||
if (do_encrypt)
|
||||
err = grub_crypto_ecb_encrypt (dev->cipher, data + i, data + i,
|
||||
(1U << dev->log_sector_size));
|
||||
(1U << log_sector_size));
|
||||
else
|
||||
err = grub_crypto_ecb_decrypt (dev->cipher, data + i, data + i,
|
||||
(1U << dev->log_sector_size));
|
||||
(1U << log_sector_size));
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
@ -399,9 +413,174 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
gcry_err_code_t
|
||||
grub_cryptodisk_decrypt (struct grub_cryptodisk *dev,
|
||||
grub_uint8_t * data, grub_size_t len,
|
||||
grub_disk_addr_t sector)
|
||||
grub_disk_addr_t sector, grub_size_t log_sector_size)
|
||||
{
|
||||
return grub_cryptodisk_endecrypt (dev, data, len, sector, 0);
|
||||
return grub_cryptodisk_endecrypt (dev, data, len, sector, log_sector_size, 0);
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_cryptodisk_setcipher (grub_cryptodisk_t crypt, const char *ciphername, const char *ciphermode)
|
||||
{
|
||||
const char *cipheriv = NULL;
|
||||
grub_crypto_cipher_handle_t cipher = NULL, secondary_cipher = NULL;
|
||||
grub_crypto_cipher_handle_t essiv_cipher = NULL;
|
||||
const gcry_md_spec_t *essiv_hash = NULL;
|
||||
const struct gcry_cipher_spec *ciph;
|
||||
grub_cryptodisk_mode_t mode;
|
||||
grub_cryptodisk_mode_iv_t mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN64;
|
||||
int benbi_log = 0;
|
||||
grub_err_t ret = GRUB_ERR_NONE;
|
||||
|
||||
ciph = grub_crypto_lookup_cipher_by_name (ciphername);
|
||||
if (!ciph)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_FILE_NOT_FOUND, "Cipher %s isn't available",
|
||||
ciphername);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Configure the cipher used for the bulk data. */
|
||||
cipher = grub_crypto_cipher_open (ciph);
|
||||
if (!cipher)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_FILE_NOT_FOUND, "Cipher %s could not be initialized",
|
||||
ciphername);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Configure the cipher mode. */
|
||||
if (grub_strcmp (ciphermode, "ecb") == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_ECB;
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN;
|
||||
cipheriv = NULL;
|
||||
}
|
||||
else if (grub_strcmp (ciphermode, "plain") == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_CBC;
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN;
|
||||
cipheriv = NULL;
|
||||
}
|
||||
else if (grub_memcmp (ciphermode, "cbc-", sizeof ("cbc-") - 1) == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_CBC;
|
||||
cipheriv = ciphermode + sizeof ("cbc-") - 1;
|
||||
}
|
||||
else if (grub_memcmp (ciphermode, "pcbc-", sizeof ("pcbc-") - 1) == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_PCBC;
|
||||
cipheriv = ciphermode + sizeof ("pcbc-") - 1;
|
||||
}
|
||||
else if (grub_memcmp (ciphermode, "xts-", sizeof ("xts-") - 1) == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_XTS;
|
||||
cipheriv = ciphermode + sizeof ("xts-") - 1;
|
||||
secondary_cipher = grub_crypto_cipher_open (ciph);
|
||||
if (!secondary_cipher)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_FILE_NOT_FOUND,
|
||||
"Secondary cipher %s isn't available", ciphername);
|
||||
goto err;
|
||||
}
|
||||
if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Unsupported XTS block size: %" PRIuGRUB_SIZE,
|
||||
cipher->cipher->blocksize);
|
||||
goto err;
|
||||
}
|
||||
if (secondary_cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Unsupported XTS block size: %" PRIuGRUB_SIZE,
|
||||
secondary_cipher->cipher->blocksize);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
else if (grub_memcmp (ciphermode, "lrw-", sizeof ("lrw-") - 1) == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_LRW;
|
||||
cipheriv = ciphermode + sizeof ("lrw-") - 1;
|
||||
if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Unsupported LRW block size: %" PRIuGRUB_SIZE,
|
||||
cipher->cipher->blocksize);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown cipher mode: %s",
|
||||
ciphermode);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (cipheriv == NULL)
|
||||
;
|
||||
else if (grub_memcmp (cipheriv, "plain64", sizeof ("plain64") - 1) == 0)
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN64;
|
||||
else if (grub_memcmp (cipheriv, "plain", sizeof ("plain") - 1) == 0)
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN;
|
||||
else if (grub_memcmp (cipheriv, "benbi", sizeof ("benbi") - 1) == 0)
|
||||
{
|
||||
if (cipher->cipher->blocksize & (cipher->cipher->blocksize - 1)
|
||||
|| cipher->cipher->blocksize == 0)
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Unsupported benbi blocksize: %" PRIuGRUB_SIZE,
|
||||
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++);
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_BENBI;
|
||||
}
|
||||
else if (grub_memcmp (cipheriv, "null", sizeof ("null") - 1) == 0)
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_NULL;
|
||||
else if (grub_memcmp (cipheriv, "essiv:", sizeof ("essiv:") - 1) == 0)
|
||||
{
|
||||
const char *hash_str = cipheriv + 6;
|
||||
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_ESSIV;
|
||||
|
||||
/* Configure the hash and cipher used for ESSIV. */
|
||||
essiv_hash = grub_crypto_lookup_md_by_name (hash_str);
|
||||
if (!essiv_hash)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_FILE_NOT_FOUND,
|
||||
"Couldn't load %s hash", hash_str);
|
||||
goto err;
|
||||
}
|
||||
essiv_cipher = grub_crypto_cipher_open (ciph);
|
||||
if (!essiv_cipher)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_FILE_NOT_FOUND,
|
||||
"Couldn't load %s cipher", ciphername);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown IV mode: %s",
|
||||
cipheriv);
|
||||
goto err;
|
||||
}
|
||||
|
||||
crypt->cipher = cipher;
|
||||
crypt->benbi_log = benbi_log;
|
||||
crypt->mode = mode;
|
||||
crypt->mode_iv = mode_iv;
|
||||
crypt->secondary_cipher = secondary_cipher;
|
||||
crypt->essiv_cipher = essiv_cipher;
|
||||
crypt->essiv_hash = essiv_hash;
|
||||
|
||||
err:
|
||||
if (ret)
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_crypto_cipher_close (secondary_cipher);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
gcry_err_code_t
|
||||
@ -538,7 +717,7 @@ grub_cryptodisk_open (const char *name, grub_disk_t disk)
|
||||
}
|
||||
|
||||
disk->data = dev;
|
||||
disk->total_sectors = dev->total_length;
|
||||
disk->total_sectors = dev->total_sectors;
|
||||
disk->max_agglomerate = GRUB_DISK_MAX_MAX_AGGLOMERATE;
|
||||
disk->id = dev->id;
|
||||
dev->ref++;
|
||||
@ -593,12 +772,11 @@ grub_cryptodisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
grub_dprintf ("cryptodisk",
|
||||
"Reading %" PRIuGRUB_SIZE " sectors from sector 0x%"
|
||||
PRIxGRUB_UINT64_T " with offset of %" PRIuGRUB_UINT64_T "\n",
|
||||
size, sector, dev->offset);
|
||||
size, sector, dev->offset_sectors);
|
||||
|
||||
err = grub_disk_read (dev->source_disk,
|
||||
(sector << (disk->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS)) + dev->offset, 0,
|
||||
size << disk->log_sector_size, buf);
|
||||
grub_disk_from_native_sector (disk, sector + dev->offset_sectors),
|
||||
0, size << disk->log_sector_size, buf);
|
||||
if (err)
|
||||
{
|
||||
grub_dprintf ("cryptodisk", "grub_disk_read failed with error %d\n", err);
|
||||
@ -606,7 +784,7 @@ grub_cryptodisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
}
|
||||
gcry_err = grub_cryptodisk_endecrypt (dev, (grub_uint8_t *) buf,
|
||||
size << disk->log_sector_size,
|
||||
sector, 0);
|
||||
sector, dev->log_sector_size, 0);
|
||||
return grub_crypto_gcry_error (gcry_err);
|
||||
}
|
||||
|
||||
@ -643,11 +821,11 @@ grub_cryptodisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
grub_dprintf ("cryptodisk",
|
||||
"Writing %" PRIuGRUB_SIZE " sectors to sector 0x%"
|
||||
PRIxGRUB_UINT64_T " with offset of %" PRIuGRUB_UINT64_T "\n",
|
||||
size, sector, dev->offset);
|
||||
size, sector, dev->offset_sectors);
|
||||
|
||||
gcry_err = grub_cryptodisk_endecrypt (dev, (grub_uint8_t *) tmp,
|
||||
size << disk->log_sector_size,
|
||||
sector, 1);
|
||||
sector, disk->log_sector_size, 1);
|
||||
if (gcry_err)
|
||||
{
|
||||
grub_free (tmp);
|
||||
@ -655,12 +833,10 @@ grub_cryptodisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
}
|
||||
|
||||
/* Since ->write was called so disk.mod is loaded but be paranoid */
|
||||
|
||||
sector = sector + dev->offset_sectors;
|
||||
if (grub_disk_write_weak)
|
||||
err = grub_disk_write_weak (dev->source_disk,
|
||||
(sector << (disk->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS))
|
||||
+ dev->offset,
|
||||
grub_disk_from_native_sector (disk, sector),
|
||||
0, size << disk->log_sector_size, tmp);
|
||||
else
|
||||
err = grub_error (GRUB_ERR_BUG, "disk.mod not loaded");
|
||||
@ -1070,7 +1246,7 @@ luks_script_get (grub_size_t *sz)
|
||||
ptr = grub_stpcpy (ptr, "luks_mount ");
|
||||
ptr = grub_stpcpy (ptr, i->uuid);
|
||||
*ptr++ = ' ';
|
||||
grub_snprintf (ptr, 21, "%" PRIuGRUB_UINT64_T " ", i->offset);
|
||||
grub_snprintf (ptr, 21, "%" PRIuGRUB_UINT64_T " ", i->offset_sectors);
|
||||
while (*ptr)
|
||||
ptr++;
|
||||
for (iptr = i->cipher->cipher->name; *iptr; iptr++)
|
||||
@ -1150,5 +1326,6 @@ GRUB_MOD_FINI (cryptodisk)
|
||||
{
|
||||
grub_disk_dev_unregister (&grub_cryptodisk_dev);
|
||||
cryptodisk_cleanup ();
|
||||
grub_unregister_extcmd (cmd);
|
||||
grub_procfs_unregister (&luks_script);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ scan_disk_partition_iter (grub_disk_t disk, grub_partition_t p, void *data)
|
||||
if (m->disk && m->disk->id == disk->id
|
||||
&& m->disk->dev->id == disk->dev->id
|
||||
&& m->part_start == grub_partition_get_start (disk->partition)
|
||||
&& m->part_size == grub_disk_get_size (disk))
|
||||
&& m->part_size == grub_disk_native_sectors (disk))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -969,7 +969,8 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg)
|
||||
for (p = vgp->lvs; p; p = p->next)
|
||||
{
|
||||
int cur_num;
|
||||
char *num, *end;
|
||||
char *num;
|
||||
const char *end;
|
||||
if (!p->fullname)
|
||||
continue;
|
||||
if (grub_strncmp (p->fullname, lv->fullname, len) != 0)
|
||||
@ -1134,7 +1135,7 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb,
|
||||
array->lvs->segments->node_count = nmemb;
|
||||
array->lvs->segments->raid_member_size = disk_size;
|
||||
array->lvs->segments->nodes
|
||||
= grub_zalloc (nmemb * sizeof (array->lvs->segments->nodes[0]));
|
||||
= grub_calloc (nmemb, sizeof (array->lvs->segments->nodes[0]));
|
||||
array->lvs->segments->stripe_size = stripe_size;
|
||||
for (i = 0; i < nmemb; i++)
|
||||
{
|
||||
@ -1189,13 +1190,13 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
|
||||
|
||||
grub_dprintf ("diskfilter", "Inserting %s (+%lld,%lld) into %s (%s)\n", disk->name,
|
||||
(unsigned long long) grub_partition_get_start (disk->partition),
|
||||
(unsigned long long) grub_disk_get_size (disk),
|
||||
(unsigned long long) grub_disk_native_sectors (disk),
|
||||
array->name, diskfilter->name);
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("Inserting %s (+%" GRUB_HOST_PRIuLONG_LONG ",%"
|
||||
GRUB_HOST_PRIuLONG_LONG ") into %s (%s)\n", disk->name,
|
||||
(unsigned long long) grub_partition_get_start (disk->partition),
|
||||
(unsigned long long) grub_disk_get_size (disk),
|
||||
(unsigned long long) grub_disk_native_sectors (disk),
|
||||
array->name, diskfilter->name);
|
||||
array->driver = diskfilter;
|
||||
#endif
|
||||
@ -1209,7 +1210,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
|
||||
struct grub_diskfilter_lv *lv;
|
||||
/* FIXME: Check whether the update time of the superblocks are
|
||||
the same. */
|
||||
if (pv->disk && grub_disk_get_size (disk) >= pv->part_size)
|
||||
if (pv->disk && grub_disk_native_sectors (disk) >= pv->part_size)
|
||||
return GRUB_ERR_NONE;
|
||||
pv->disk = grub_disk_open (disk->name);
|
||||
if (!pv->disk)
|
||||
@ -1218,7 +1219,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
|
||||
raid device, we shouldn't change it. */
|
||||
pv->start_sector -= pv->part_start;
|
||||
pv->part_start = grub_partition_get_start (disk->partition);
|
||||
pv->part_size = grub_disk_get_size (disk);
|
||||
pv->part_size = grub_disk_native_sectors (disk);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
{
|
||||
@ -1226,7 +1227,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
|
||||
grub_partition_t p;
|
||||
for (p = disk->partition; p; p = p->parent)
|
||||
s++;
|
||||
pv->partmaps = xmalloc (s * sizeof (pv->partmaps[0]));
|
||||
pv->partmaps = xcalloc (s, sizeof (pv->partmaps[0]));
|
||||
s = 0;
|
||||
for (p = disk->partition; p; p = p->parent)
|
||||
pv->partmaps[s++] = xstrdup (p->partmap->name);
|
||||
@ -1310,7 +1311,7 @@ grub_diskfilter_get_pv_from_disk (grub_disk_t disk,
|
||||
if (pv->disk && pv->disk->id == disk->id
|
||||
&& pv->disk->dev->id == disk->dev->id
|
||||
&& pv->part_start == grub_partition_get_start (disk->partition)
|
||||
&& pv->part_size == grub_disk_get_size (disk))
|
||||
&& pv->part_size == grub_disk_native_sectors (disk))
|
||||
{
|
||||
if (vg_out)
|
||||
*vg_out = vg;
|
||||
|
@ -107,7 +107,7 @@ grub_dmraid_nv_detect (grub_disk_t disk,
|
||||
/* Skip partition. */
|
||||
return NULL;
|
||||
|
||||
sector = grub_disk_get_size (disk);
|
||||
sector = grub_disk_native_sectors (disk);
|
||||
if (sector == GRUB_DISK_SIZE_UNKNOWN)
|
||||
/* Not raid. */
|
||||
return NULL;
|
||||
@ -122,7 +122,7 @@ grub_dmraid_nv_detect (grub_disk_t disk,
|
||||
if (sb.version != NV_VERSION)
|
||||
{
|
||||
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"unknown version: %d.%d", sb.version);
|
||||
"unknown version: %d.%d", sb.version >> 8, sb.version & 0xFF);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -867,7 +867,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
|
||||
if (ctx.hd->partition_start == 0
|
||||
&& (ctx.hd->partition_size << (parent->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS))
|
||||
== grub_disk_get_size (parent))
|
||||
== grub_disk_native_sectors (parent))
|
||||
{
|
||||
dev_name = grub_strdup (parent->name);
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
if (2 * GRUB_MD_SHA256->mdlen + 1 > GRUB_CRYPTODISK_MAX_UUID_LENGTH)
|
||||
return NULL;
|
||||
|
||||
sector = grub_disk_get_size (disk);
|
||||
sector = grub_disk_native_sectors (disk);
|
||||
if (sector == GRUB_DISK_SIZE_UNKNOWN || sector == 0)
|
||||
return NULL;
|
||||
|
||||
@ -361,7 +361,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
}
|
||||
newdev->cipher = cipher;
|
||||
newdev->secondary_cipher = secondary_cipher;
|
||||
newdev->offset = 0;
|
||||
newdev->offset_sectors = 0;
|
||||
newdev->source_disk = NULL;
|
||||
newdev->benbi_log = 0;
|
||||
if (grub_le_to_cpu16 (header.alg) == 0x16)
|
||||
@ -391,7 +391,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
|
||||
newdev->modname = "geli";
|
||||
|
||||
newdev->total_length = grub_disk_get_size (disk) - 1;
|
||||
newdev->total_sectors = grub_disk_native_sectors (disk) - 1;
|
||||
grub_memcpy (newdev->uuid, uuid, sizeof (newdev->uuid));
|
||||
COMPILE_TIME_ASSERT (sizeof (newdev->uuid) >= 32 * 2 + 1);
|
||||
return newdev;
|
||||
@ -420,7 +420,7 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
||||
if (dev->hash->mdlen > GRUB_CRYPTO_MAX_MDLEN)
|
||||
return grub_error (GRUB_ERR_BUG, "mdlen is too long");
|
||||
|
||||
sector = grub_disk_get_size (source);
|
||||
sector = grub_disk_native_sectors (source);
|
||||
if (sector == GRUB_DISK_SIZE_UNKNOWN || sector == 0)
|
||||
return grub_error (GRUB_ERR_BUG, "not a geli");
|
||||
|
||||
|
@ -297,7 +297,7 @@ dev_iterate (const struct grub_ieee1275_devalias *alias)
|
||||
/* Power machines documentation specify 672 as maximum SAS disks in
|
||||
one system. Using a slightly larger value to be safe. */
|
||||
table_size = 768;
|
||||
table = grub_malloc (table_size * sizeof (grub_uint64_t));
|
||||
table = grub_calloc (table_size, sizeof (grub_uint64_t));
|
||||
|
||||
if (!table)
|
||||
{
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/gpt_partition.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/safemath.h>
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/emu/misc.h>
|
||||
@ -198,6 +199,7 @@ make_vg (grub_disk_t disk,
|
||||
{
|
||||
grub_free (vg->uuid);
|
||||
grub_free (vg->name);
|
||||
grub_free (vg);
|
||||
return NULL;
|
||||
}
|
||||
grub_memcpy (vg->uuid, label->group_guid, LDM_GUID_STRLEN);
|
||||
@ -289,6 +291,7 @@ make_vg (grub_disk_t disk,
|
||||
struct grub_ldm_vblk vblk[GRUB_DISK_SECTOR_SIZE
|
||||
/ sizeof (struct grub_ldm_vblk)];
|
||||
unsigned i;
|
||||
grub_size_t sz;
|
||||
err = grub_disk_read (disk, cursec, 0,
|
||||
sizeof(vblk), &vblk);
|
||||
if (err)
|
||||
@ -318,15 +321,21 @@ make_vg (grub_disk_t disk,
|
||||
lv->visible = 1;
|
||||
lv->segments = grub_zalloc (sizeof (*lv->segments));
|
||||
if (!lv->segments)
|
||||
{
|
||||
grub_free (lv);
|
||||
goto fail2;
|
||||
}
|
||||
lv->segments->start_extent = 0;
|
||||
lv->segments->type = GRUB_DISKFILTER_MIRROR;
|
||||
lv->segments->node_count = 0;
|
||||
lv->segments->node_alloc = 8;
|
||||
lv->segments->nodes = grub_zalloc (sizeof (*lv->segments->nodes)
|
||||
* lv->segments->node_alloc);
|
||||
lv->segments->nodes = grub_calloc (lv->segments->node_alloc,
|
||||
sizeof (*lv->segments->nodes));
|
||||
if (!lv->segments->nodes)
|
||||
{
|
||||
grub_free (lv);
|
||||
goto fail2;
|
||||
}
|
||||
ptr = vblk[i].dynamic;
|
||||
if (ptr + *ptr + 1 >= vblk[i].dynamic
|
||||
+ sizeof (vblk[i].dynamic))
|
||||
@ -350,7 +359,13 @@ make_vg (grub_disk_t disk,
|
||||
grub_free (lv);
|
||||
goto fail2;
|
||||
}
|
||||
lv->name = grub_malloc (*ptr + 1);
|
||||
if (grub_add (*ptr, 1, &sz))
|
||||
{
|
||||
grub_free (lv->internal_id);
|
||||
grub_free (lv);
|
||||
goto fail2;
|
||||
}
|
||||
lv->name = grub_malloc (sz);
|
||||
if (!lv->name)
|
||||
{
|
||||
grub_free (lv->internal_id);
|
||||
@ -543,18 +558,26 @@ make_vg (grub_disk_t disk,
|
||||
{
|
||||
comp->segment_alloc = 8;
|
||||
comp->segment_count = 0;
|
||||
comp->segments = grub_malloc (sizeof (*comp->segments)
|
||||
* comp->segment_alloc);
|
||||
comp->segments = grub_calloc (comp->segment_alloc,
|
||||
sizeof (*comp->segments));
|
||||
if (!comp->segments)
|
||||
{
|
||||
grub_free (comp->internal_id);
|
||||
grub_free (comp);
|
||||
goto fail2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
comp->segment_alloc = 1;
|
||||
comp->segment_count = 1;
|
||||
comp->segments = grub_malloc (sizeof (*comp->segments));
|
||||
if (!comp->segments)
|
||||
{
|
||||
grub_free (comp->internal_id);
|
||||
grub_free (comp);
|
||||
goto fail2;
|
||||
}
|
||||
comp->segments->start_extent = 0;
|
||||
comp->segments->extent_count = lv->size;
|
||||
comp->segments->layout = 0;
|
||||
@ -566,15 +589,26 @@ make_vg (grub_disk_t disk,
|
||||
comp->segments->layout = GRUB_RAID_LAYOUT_SYMMETRIC_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_free (comp->segments);
|
||||
grub_free (comp->internal_id);
|
||||
grub_free (comp);
|
||||
goto fail2;
|
||||
}
|
||||
ptr += *ptr + 1;
|
||||
ptr++;
|
||||
if (!(vblk[i].flags & 0x10))
|
||||
{
|
||||
grub_free (comp->segments);
|
||||
grub_free (comp->internal_id);
|
||||
grub_free (comp);
|
||||
goto fail2;
|
||||
}
|
||||
if (ptr >= vblk[i].dynamic + sizeof (vblk[i].dynamic)
|
||||
|| ptr + *ptr + 1 >= vblk[i].dynamic
|
||||
+ sizeof (vblk[i].dynamic))
|
||||
{
|
||||
grub_free (comp->segments);
|
||||
grub_free (comp->internal_id);
|
||||
grub_free (comp);
|
||||
goto fail2;
|
||||
@ -584,27 +618,48 @@ make_vg (grub_disk_t disk,
|
||||
if (ptr + *ptr + 1 >= vblk[i].dynamic
|
||||
+ sizeof (vblk[i].dynamic))
|
||||
{
|
||||
grub_free (comp->segments);
|
||||
grub_free (comp->internal_id);
|
||||
grub_free (comp);
|
||||
goto fail2;
|
||||
}
|
||||
comp->segments->node_count = read_int (ptr + 1, *ptr);
|
||||
comp->segments->node_alloc = comp->segments->node_count;
|
||||
comp->segments->nodes = grub_zalloc (sizeof (*comp->segments->nodes)
|
||||
* comp->segments->node_alloc);
|
||||
comp->segments->nodes = grub_calloc (comp->segments->node_alloc,
|
||||
sizeof (*comp->segments->nodes));
|
||||
if (!lv->segments->nodes)
|
||||
{
|
||||
grub_free (comp->segments);
|
||||
grub_free (comp->internal_id);
|
||||
grub_free (comp);
|
||||
goto fail2;
|
||||
}
|
||||
}
|
||||
|
||||
if (lv->segments->node_alloc == lv->segments->node_count)
|
||||
{
|
||||
void *t;
|
||||
lv->segments->node_alloc *= 2;
|
||||
t = grub_realloc (lv->segments->nodes,
|
||||
sizeof (*lv->segments->nodes)
|
||||
* lv->segments->node_alloc);
|
||||
if (!t)
|
||||
grub_size_t sz;
|
||||
|
||||
if (grub_mul (lv->segments->node_alloc, 2, &lv->segments->node_alloc) ||
|
||||
grub_mul (lv->segments->node_alloc, sizeof (*lv->segments->nodes), &sz))
|
||||
{
|
||||
grub_free (comp->segments->nodes);
|
||||
grub_free (comp->segments);
|
||||
grub_free (comp->internal_id);
|
||||
grub_free (comp);
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
t = grub_realloc (lv->segments->nodes, sz);
|
||||
if (!t)
|
||||
{
|
||||
grub_free (comp->segments->nodes);
|
||||
grub_free (comp->segments);
|
||||
grub_free (comp->internal_id);
|
||||
grub_free (comp);
|
||||
goto fail2;
|
||||
}
|
||||
lv->segments->nodes = t;
|
||||
}
|
||||
lv->segments->nodes[lv->segments->node_count].pv = 0;
|
||||
@ -723,10 +778,13 @@ make_vg (grub_disk_t disk,
|
||||
if (comp->segment_alloc == comp->segment_count)
|
||||
{
|
||||
void *t;
|
||||
comp->segment_alloc *= 2;
|
||||
t = grub_realloc (comp->segments,
|
||||
comp->segment_alloc
|
||||
* sizeof (*comp->segments));
|
||||
grub_size_t sz;
|
||||
|
||||
if (grub_mul (comp->segment_alloc, 2, &comp->segment_alloc) ||
|
||||
grub_mul (comp->segment_alloc, sizeof (*comp->segments), &sz))
|
||||
goto fail2;
|
||||
|
||||
t = grub_realloc (comp->segments, sz);
|
||||
if (!t)
|
||||
goto fail2;
|
||||
comp->segments = t;
|
||||
@ -807,7 +865,7 @@ grub_ldm_detect (grub_disk_t disk,
|
||||
/* LDM is never inside a partition. */
|
||||
if (!has_ldm || disk->partition)
|
||||
continue;
|
||||
sector = grub_disk_get_size (disk);
|
||||
sector = grub_disk_native_sectors (disk);
|
||||
if (sector == GRUB_DISK_SIZE_UNKNOWN)
|
||||
continue;
|
||||
sector--;
|
||||
@ -924,7 +982,7 @@ grub_util_is_ldm (grub_disk_t disk)
|
||||
/* LDM is never inside a partition. */
|
||||
if (!has_ldm || disk->partition)
|
||||
continue;
|
||||
sector = grub_disk_get_size (disk);
|
||||
sector = grub_disk_native_sectors (disk);
|
||||
if (sector == GRUB_DISK_SIZE_UNKNOWN)
|
||||
continue;
|
||||
sector--;
|
||||
@ -1017,7 +1075,7 @@ grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors,
|
||||
*nsectors = lv->size;
|
||||
if (*nsectors > max_nsectors)
|
||||
*nsectors = max_nsectors;
|
||||
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
|
||||
*sectors = grub_calloc (*nsectors, sizeof (**sectors));
|
||||
if (!*sectors)
|
||||
return grub_errno;
|
||||
for (i = 0; i < *nsectors; i++)
|
||||
|
@ -92,24 +92,16 @@ grub_cmd_loopback (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
if (argc < 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
|
||||
/* Check that a device with requested name does not already exist. */
|
||||
for (newdev = loopback_list; newdev; newdev = newdev->next)
|
||||
if (grub_strcmp (newdev->devname, args[0]) == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name already exists");
|
||||
|
||||
file = grub_file_open (args[1], GRUB_FILE_TYPE_LOOPBACK
|
||||
| GRUB_FILE_TYPE_NO_DECOMPRESS);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
|
||||
/* First try to replace the old device. */
|
||||
for (newdev = loopback_list; newdev; newdev = newdev->next)
|
||||
if (grub_strcmp (newdev->devname, args[0]) == 0)
|
||||
break;
|
||||
|
||||
if (newdev)
|
||||
{
|
||||
grub_file_close (newdev->file);
|
||||
newdev->file = file;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Unable to replace it, make a new entry. */
|
||||
newdev = grub_malloc (sizeof (struct grub_loopback));
|
||||
if (! newdev)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2007,2010,2011 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2003,2007,2010,2011,2019 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
|
||||
@ -75,15 +75,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
char uuid[sizeof (header.uuid) + 1];
|
||||
char ciphername[sizeof (header.cipherName) + 1];
|
||||
char ciphermode[sizeof (header.cipherMode) + 1];
|
||||
char *cipheriv = NULL;
|
||||
char hashspec[sizeof (header.hashSpec) + 1];
|
||||
grub_crypto_cipher_handle_t cipher = NULL, secondary_cipher = NULL;
|
||||
grub_crypto_cipher_handle_t essiv_cipher = NULL;
|
||||
const gcry_md_spec_t *hash = NULL, *essiv_hash = NULL;
|
||||
const struct gcry_cipher_spec *ciph;
|
||||
grub_cryptodisk_mode_t mode;
|
||||
grub_cryptodisk_mode_iv_t mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN64;
|
||||
int benbi_log = 0;
|
||||
grub_err_t err;
|
||||
|
||||
if (check_boot)
|
||||
@ -103,6 +95,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
|| grub_be_to_cpu16 (header.version) != 1)
|
||||
return NULL;
|
||||
|
||||
grub_memset (uuid, 0, sizeof (uuid));
|
||||
optr = uuid;
|
||||
for (iptr = header.uuid; iptr < &header.uuid[ARRAY_SIZE (header.uuid)];
|
||||
iptr++)
|
||||
@ -126,183 +119,33 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
grub_memcpy (hashspec, header.hashSpec, sizeof (header.hashSpec));
|
||||
hashspec[sizeof (header.hashSpec)] = 0;
|
||||
|
||||
ciph = grub_crypto_lookup_cipher_by_name (ciphername);
|
||||
if (!ciph)
|
||||
{
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "Cipher %s isn't available",
|
||||
ciphername);
|
||||
newdev = grub_zalloc (sizeof (struct grub_cryptodisk));
|
||||
if (!newdev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Configure the cipher used for the bulk data. */
|
||||
cipher = grub_crypto_cipher_open (ciph);
|
||||
if (!cipher)
|
||||
return NULL;
|
||||
|
||||
if (grub_be_to_cpu32 (header.keyBytes) > 1024)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid keysize %d",
|
||||
grub_be_to_cpu32 (header.keyBytes));
|
||||
grub_crypto_cipher_close (cipher);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Configure the cipher mode. */
|
||||
if (grub_strcmp (ciphermode, "ecb") == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_ECB;
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN;
|
||||
cipheriv = NULL;
|
||||
}
|
||||
else if (grub_strcmp (ciphermode, "plain") == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_CBC;
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN;
|
||||
cipheriv = NULL;
|
||||
}
|
||||
else if (grub_memcmp (ciphermode, "cbc-", sizeof ("cbc-") - 1) == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_CBC;
|
||||
cipheriv = ciphermode + sizeof ("cbc-") - 1;
|
||||
}
|
||||
else if (grub_memcmp (ciphermode, "pcbc-", sizeof ("pcbc-") - 1) == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_PCBC;
|
||||
cipheriv = ciphermode + sizeof ("pcbc-") - 1;
|
||||
}
|
||||
else if (grub_memcmp (ciphermode, "xts-", sizeof ("xts-") - 1) == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_XTS;
|
||||
cipheriv = ciphermode + sizeof ("xts-") - 1;
|
||||
secondary_cipher = grub_crypto_cipher_open (ciph);
|
||||
if (!secondary_cipher)
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
return NULL;
|
||||
}
|
||||
if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
else if (grub_memcmp (ciphermode, "lrw-", sizeof ("lrw-") - 1) == 0)
|
||||
{
|
||||
mode = GRUB_CRYPTODISK_MODE_LRW;
|
||||
cipheriv = ciphermode + sizeof ("lrw-") - 1;
|
||||
if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported LRW block size: %d",
|
||||
cipher->cipher->blocksize);
|
||||
grub_crypto_cipher_close (cipher);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown cipher mode: %s",
|
||||
ciphermode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (cipheriv == NULL);
|
||||
else if (grub_memcmp (cipheriv, "plain", sizeof ("plain") - 1) == 0)
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN;
|
||||
else if (grub_memcmp (cipheriv, "plain64", sizeof ("plain64") - 1) == 0)
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN64;
|
||||
else if (grub_memcmp (cipheriv, "benbi", sizeof ("benbi") - 1) == 0)
|
||||
{
|
||||
if (cipher->cipher->blocksize & (cipher->cipher->blocksize - 1)
|
||||
|| 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++);
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_BENBI;
|
||||
}
|
||||
else if (grub_memcmp (cipheriv, "null", sizeof ("null") - 1) == 0)
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_NULL;
|
||||
else if (grub_memcmp (cipheriv, "essiv:", sizeof ("essiv:") - 1) == 0)
|
||||
{
|
||||
char *hash_str = cipheriv + 6;
|
||||
|
||||
mode_iv = GRUB_CRYPTODISK_MODE_IV_ESSIV;
|
||||
|
||||
/* Configure the hash and cipher used for ESSIV. */
|
||||
essiv_hash = grub_crypto_lookup_md_by_name (hash_str);
|
||||
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;
|
||||
}
|
||||
essiv_cipher = grub_crypto_cipher_open (ciph);
|
||||
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;
|
||||
}
|
||||
newdev->offset_sectors = grub_be_to_cpu32 (header.payloadOffset);
|
||||
newdev->source_disk = NULL;
|
||||
newdev->log_sector_size = GRUB_LUKS1_LOG_SECTOR_SIZE;
|
||||
newdev->total_sectors = grub_disk_native_sectors (disk) - newdev->offset_sectors;
|
||||
grub_memcpy (newdev->uuid, uuid, sizeof (uuid));
|
||||
newdev->modname = "luks";
|
||||
|
||||
/* Configure the hash used for the AF splitter and HMAC. */
|
||||
hash = grub_crypto_lookup_md_by_name (hashspec);
|
||||
if (!hash)
|
||||
newdev->hash = grub_crypto_lookup_md_by_name (hashspec);
|
||||
if (!newdev->hash)
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_crypto_cipher_close (essiv_cipher);
|
||||
grub_crypto_cipher_close (secondary_cipher);
|
||||
grub_free (newdev);
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "Couldn't load %s hash",
|
||||
hashspec);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
newdev = grub_zalloc (sizeof (struct grub_cryptodisk));
|
||||
if (!newdev)
|
||||
err = grub_cryptodisk_setcipher (newdev, ciphername, ciphermode);
|
||||
if (err)
|
||||
{
|
||||
grub_crypto_cipher_close (cipher);
|
||||
grub_crypto_cipher_close (essiv_cipher);
|
||||
grub_crypto_cipher_close (secondary_cipher);
|
||||
grub_free (newdev);
|
||||
return NULL;
|
||||
}
|
||||
newdev->cipher = cipher;
|
||||
newdev->offset = grub_be_to_cpu32 (header.payloadOffset);
|
||||
newdev->source_disk = NULL;
|
||||
newdev->benbi_log = benbi_log;
|
||||
newdev->mode = mode;
|
||||
newdev->mode_iv = mode_iv;
|
||||
newdev->secondary_cipher = secondary_cipher;
|
||||
newdev->essiv_cipher = essiv_cipher;
|
||||
newdev->essiv_hash = essiv_hash;
|
||||
newdev->hash = hash;
|
||||
newdev->log_sector_size = 9;
|
||||
newdev->total_length = grub_disk_get_size (disk) - newdev->offset;
|
||||
grub_memcpy (newdev->uuid, uuid, sizeof (newdev->uuid));
|
||||
newdev->modname = "luks";
|
||||
|
||||
COMPILE_TIME_ASSERT (sizeof (newdev->uuid) >= sizeof (uuid));
|
||||
return newdev;
|
||||
}
|
||||
@ -336,7 +179,7 @@ luks_recover_key (grub_disk_t source,
|
||||
&& grub_be_to_cpu32 (header.keyblock[i].stripes) > max_stripes)
|
||||
max_stripes = grub_be_to_cpu32 (header.keyblock[i].stripes);
|
||||
|
||||
split_key = grub_malloc (keysize * max_stripes);
|
||||
split_key = grub_calloc (keysize, max_stripes);
|
||||
if (!split_key)
|
||||
return grub_errno;
|
||||
|
||||
@ -404,7 +247,8 @@ luks_recover_key (grub_disk_t source,
|
||||
return err;
|
||||
}
|
||||
|
||||
gcry_err = grub_cryptodisk_decrypt (dev, split_key, length, 0);
|
||||
gcry_err = grub_cryptodisk_decrypt (dev, split_key, length, 0,
|
||||
GRUB_LUKS1_LOG_SECTOR_SIZE);
|
||||
if (gcry_err)
|
||||
{
|
||||
grub_free (split_key);
|
||||
|
791
grub-core/disk/luks2.c
Normal file
791
grub-core/disk/luks2.c
Normal file
@ -0,0 +1,791 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2019 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/cryptodisk.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include <base64.h>
|
||||
#include <json.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define LUKS_MAGIC_1ST "LUKS\xBA\xBE"
|
||||
#define LUKS_MAGIC_2ND "SKUL\xBA\xBE"
|
||||
|
||||
#define MAX_PASSPHRASE 256
|
||||
|
||||
enum grub_luks2_kdf_type
|
||||
{
|
||||
LUKS2_KDF_TYPE_ARGON2I,
|
||||
LUKS2_KDF_TYPE_PBKDF2
|
||||
};
|
||||
typedef enum grub_luks2_kdf_type grub_luks2_kdf_type_t;
|
||||
|
||||
/* On disk LUKS header */
|
||||
struct grub_luks2_header
|
||||
{
|
||||
char magic[6];
|
||||
grub_uint16_t version;
|
||||
grub_uint64_t hdr_size;
|
||||
grub_uint64_t seqid;
|
||||
char label[48];
|
||||
char csum_alg[32];
|
||||
grub_uint8_t salt[64];
|
||||
char uuid[40];
|
||||
char subsystem[48];
|
||||
grub_uint64_t hdr_offset;
|
||||
char _padding[184];
|
||||
grub_uint8_t csum[64];
|
||||
char _padding4096[7*512];
|
||||
} GRUB_PACKED;
|
||||
typedef struct grub_luks2_header grub_luks2_header_t;
|
||||
|
||||
struct grub_luks2_keyslot
|
||||
{
|
||||
/* The integer key to the associative array of keyslots. */
|
||||
grub_uint64_t idx;
|
||||
grub_int64_t key_size;
|
||||
grub_int64_t priority;
|
||||
struct
|
||||
{
|
||||
const char *encryption;
|
||||
grub_uint64_t offset;
|
||||
grub_uint64_t size;
|
||||
grub_int64_t key_size;
|
||||
} area;
|
||||
struct
|
||||
{
|
||||
const char *hash;
|
||||
grub_int64_t stripes;
|
||||
} af;
|
||||
struct
|
||||
{
|
||||
grub_luks2_kdf_type_t type;
|
||||
const char *salt;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
grub_int64_t time;
|
||||
grub_int64_t memory;
|
||||
grub_int64_t cpus;
|
||||
} argon2i;
|
||||
struct
|
||||
{
|
||||
const char *hash;
|
||||
grub_int64_t iterations;
|
||||
} pbkdf2;
|
||||
} u;
|
||||
} kdf;
|
||||
};
|
||||
typedef struct grub_luks2_keyslot grub_luks2_keyslot_t;
|
||||
|
||||
struct grub_luks2_segment
|
||||
{
|
||||
grub_uint64_t idx;
|
||||
grub_uint64_t offset;
|
||||
const char *size;
|
||||
const char *encryption;
|
||||
grub_int64_t sector_size;
|
||||
};
|
||||
typedef struct grub_luks2_segment grub_luks2_segment_t;
|
||||
|
||||
struct grub_luks2_digest
|
||||
{
|
||||
grub_uint64_t idx;
|
||||
/* Both keyslots and segments are interpreted as bitfields here */
|
||||
grub_uint64_t keyslots;
|
||||
grub_uint64_t segments;
|
||||
const char *salt;
|
||||
const char *digest;
|
||||
const char *hash;
|
||||
grub_int64_t iterations;
|
||||
};
|
||||
typedef struct grub_luks2_digest grub_luks2_digest_t;
|
||||
|
||||
gcry_err_code_t AF_merge (const gcry_md_spec_t * hash, grub_uint8_t * src,
|
||||
grub_uint8_t * dst, grub_size_t blocksize,
|
||||
grub_size_t blocknumbers);
|
||||
|
||||
static grub_err_t
|
||||
luks2_parse_keyslot (grub_luks2_keyslot_t *out, const grub_json_t *keyslot)
|
||||
{
|
||||
grub_json_t area, af, kdf;
|
||||
const char *type;
|
||||
|
||||
if (grub_json_getstring (&type, keyslot, "type"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Missing or invalid keyslot");
|
||||
else if (grub_strcmp (type, "luks2"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported keyslot type %s", type);
|
||||
else if (grub_json_getint64 (&out->key_size, keyslot, "key_size"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Missing keyslot information");
|
||||
if (grub_json_getint64 (&out->priority, keyslot, "priority"))
|
||||
out->priority = 1;
|
||||
|
||||
if (grub_json_getvalue (&area, keyslot, "area") ||
|
||||
grub_json_getstring (&type, &area, "type"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Missing or invalid key area");
|
||||
else if (grub_strcmp (type, "raw"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported key area type: %s", type);
|
||||
else if (grub_json_getuint64 (&out->area.offset, &area, "offset") ||
|
||||
grub_json_getuint64 (&out->area.size, &area, "size") ||
|
||||
grub_json_getstring (&out->area.encryption, &area, "encryption") ||
|
||||
grub_json_getint64 (&out->area.key_size, &area, "key_size"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Missing key area information");
|
||||
|
||||
if (grub_json_getvalue (&kdf, keyslot, "kdf") ||
|
||||
grub_json_getstring (&type, &kdf, "type") ||
|
||||
grub_json_getstring (&out->kdf.salt, &kdf, "salt"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Missing or invalid KDF");
|
||||
else if (!grub_strcmp (type, "argon2i") || !grub_strcmp (type, "argon2id"))
|
||||
{
|
||||
out->kdf.type = LUKS2_KDF_TYPE_ARGON2I;
|
||||
if (grub_json_getint64 (&out->kdf.u.argon2i.time, &kdf, "time") ||
|
||||
grub_json_getint64 (&out->kdf.u.argon2i.memory, &kdf, "memory") ||
|
||||
grub_json_getint64 (&out->kdf.u.argon2i.cpus, &kdf, "cpus"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Missing Argon2i parameters");
|
||||
}
|
||||
else if (!grub_strcmp (type, "pbkdf2"))
|
||||
{
|
||||
out->kdf.type = LUKS2_KDF_TYPE_PBKDF2;
|
||||
if (grub_json_getstring (&out->kdf.u.pbkdf2.hash, &kdf, "hash") ||
|
||||
grub_json_getint64 (&out->kdf.u.pbkdf2.iterations, &kdf, "iterations"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Missing PBKDF2 parameters");
|
||||
}
|
||||
else
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported KDF type %s", type);
|
||||
|
||||
if (grub_json_getvalue (&af, keyslot, "af") ||
|
||||
grub_json_getstring (&type, &af, "type"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "missing or invalid area");
|
||||
if (grub_strcmp (type, "luks1"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported AF type %s", type);
|
||||
if (grub_json_getint64 (&out->af.stripes, &af, "stripes") ||
|
||||
grub_json_getstring (&out->af.hash, &af, "hash"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Missing AF parameters");
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
luks2_parse_segment (grub_luks2_segment_t *out, const grub_json_t *segment)
|
||||
{
|
||||
const char *type;
|
||||
|
||||
if (grub_json_getstring (&type, segment, "type"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid segment type");
|
||||
else if (grub_strcmp (type, "crypt"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported segment type %s", type);
|
||||
|
||||
if (grub_json_getuint64 (&out->offset, segment, "offset") ||
|
||||
grub_json_getstring (&out->size, segment, "size") ||
|
||||
grub_json_getstring (&out->encryption, segment, "encryption") ||
|
||||
grub_json_getint64 (&out->sector_size, segment, "sector_size"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Missing segment parameters");
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
luks2_parse_digest (grub_luks2_digest_t *out, const grub_json_t *digest)
|
||||
{
|
||||
grub_json_t segments, keyslots, o;
|
||||
grub_size_t i, size;
|
||||
grub_uint64_t bit;
|
||||
const char *type;
|
||||
|
||||
if (grub_json_getstring (&type, digest, "type"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid digest type");
|
||||
else if (grub_strcmp (type, "pbkdf2"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported digest type %s", type);
|
||||
|
||||
if (grub_json_getvalue (&segments, digest, "segments") ||
|
||||
grub_json_getvalue (&keyslots, digest, "keyslots") ||
|
||||
grub_json_getstring (&out->salt, digest, "salt") ||
|
||||
grub_json_getstring (&out->digest, digest, "digest") ||
|
||||
grub_json_getstring (&out->hash, digest, "hash") ||
|
||||
grub_json_getint64 (&out->iterations, digest, "iterations"))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Missing digest parameters");
|
||||
|
||||
if (grub_json_getsize (&size, &segments))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Digest references no segments");
|
||||
|
||||
out->segments = 0;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (grub_json_getchild (&o, &segments, i) ||
|
||||
grub_json_getuint64 (&bit, &o, NULL))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid segment");
|
||||
out->segments |= (1 << bit);
|
||||
}
|
||||
|
||||
if (grub_json_getsize (&size, &keyslots))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"Digest references no keyslots");
|
||||
|
||||
out->keyslots = 0;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (grub_json_getchild (&o, &keyslots, i) ||
|
||||
grub_json_getuint64 (&bit, &o, NULL))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid keyslot");
|
||||
out->keyslots |= (1 << bit);
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
luks2_get_keyslot (grub_luks2_keyslot_t *k, grub_luks2_digest_t *d, grub_luks2_segment_t *s,
|
||||
const grub_json_t *root, grub_size_t keyslot_json_idx)
|
||||
{
|
||||
grub_json_t keyslots, keyslot, digests, digest, segments, segment;
|
||||
grub_size_t json_idx, size;
|
||||
|
||||
/* Get nth keyslot */
|
||||
if (grub_json_getvalue (&keyslots, root, "keyslots") ||
|
||||
grub_json_getchild (&keyslot, &keyslots, keyslot_json_idx) ||
|
||||
grub_json_getuint64 (&k->idx, &keyslot, NULL) ||
|
||||
grub_json_getchild (&keyslot, &keyslot, 0) ||
|
||||
luks2_parse_keyslot (k, &keyslot))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse keyslot index %" PRIuGRUB_SIZE, keyslot_json_idx);
|
||||
|
||||
/* Get digest that matches the keyslot. */
|
||||
if (grub_json_getvalue (&digests, root, "digests") ||
|
||||
grub_json_getsize (&size, &digests))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not get digests");
|
||||
for (json_idx = 0; json_idx < size; json_idx++)
|
||||
{
|
||||
if (grub_json_getchild (&digest, &digests, json_idx) ||
|
||||
grub_json_getuint64 (&d->idx, &digest, NULL) ||
|
||||
grub_json_getchild (&digest, &digest, 0) ||
|
||||
luks2_parse_digest (d, &digest))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse digest index %" PRIuGRUB_SIZE, json_idx);
|
||||
|
||||
if ((d->keyslots & (1 << k->idx)))
|
||||
break;
|
||||
}
|
||||
if (json_idx == size)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No digest for keyslot \"%" PRIuGRUB_UINT64_T "\"", k->idx);
|
||||
|
||||
/* Get segment that matches the digest. */
|
||||
if (grub_json_getvalue (&segments, root, "segments") ||
|
||||
grub_json_getsize (&size, &segments))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not get segments");
|
||||
for (json_idx = 0; json_idx < size; json_idx++)
|
||||
{
|
||||
if (grub_json_getchild (&segment, &segments, json_idx) ||
|
||||
grub_json_getuint64 (&s->idx, &segment, NULL) ||
|
||||
grub_json_getchild (&segment, &segment, 0) ||
|
||||
luks2_parse_segment (s, &segment))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse segment index %" PRIuGRUB_SIZE, json_idx);
|
||||
|
||||
if ((d->segments & (1 << s->idx)))
|
||||
break;
|
||||
}
|
||||
if (json_idx == size)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No segment for digest \"%" PRIuGRUB_UINT64_T "\"", d->idx);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
/* Determine whether to use primary or secondary header */
|
||||
static grub_err_t
|
||||
luks2_read_header (grub_disk_t disk, grub_luks2_header_t *outhdr)
|
||||
{
|
||||
grub_luks2_header_t primary, secondary, *header = &primary;
|
||||
grub_err_t ret;
|
||||
|
||||
/* Read the primary LUKS header. */
|
||||
ret = grub_disk_read (disk, 0, 0, sizeof (primary), &primary);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Look for LUKS magic sequence. */
|
||||
if (grub_memcmp (primary.magic, LUKS_MAGIC_1ST, sizeof (primary.magic)) ||
|
||||
grub_be_to_cpu16 (primary.version) != 2)
|
||||
return GRUB_ERR_BAD_SIGNATURE;
|
||||
|
||||
/* Read the secondary header. */
|
||||
ret = grub_disk_read (disk, 0, grub_be_to_cpu64 (primary.hdr_size), sizeof (secondary), &secondary);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Look for LUKS magic sequence. */
|
||||
if (grub_memcmp (secondary.magic, LUKS_MAGIC_2ND, sizeof (secondary.magic)) ||
|
||||
grub_be_to_cpu16 (secondary.version) != 2)
|
||||
return GRUB_ERR_BAD_SIGNATURE;
|
||||
|
||||
if (grub_be_to_cpu64 (primary.seqid) < grub_be_to_cpu64 (secondary.seqid))
|
||||
header = &secondary;
|
||||
grub_memcpy (outhdr, header, sizeof (*header));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_cryptodisk_t
|
||||
luks2_scan (grub_disk_t disk, const char *check_uuid, int check_boot)
|
||||
{
|
||||
grub_cryptodisk_t cryptodisk;
|
||||
grub_luks2_header_t header;
|
||||
char uuid[sizeof (header.uuid) + 1];
|
||||
grub_size_t i, j;
|
||||
|
||||
if (check_boot)
|
||||
return NULL;
|
||||
|
||||
if (luks2_read_header (disk, &header))
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0, j = 0; i < sizeof (header.uuid); i++)
|
||||
if (header.uuid[i] != '-')
|
||||
uuid[j++] = header.uuid[i];
|
||||
uuid[j] = '\0';
|
||||
|
||||
if (check_uuid && grub_strcasecmp (check_uuid, uuid) != 0)
|
||||
return NULL;
|
||||
|
||||
cryptodisk = grub_zalloc (sizeof (*cryptodisk));
|
||||
if (!cryptodisk)
|
||||
return NULL;
|
||||
|
||||
COMPILE_TIME_ASSERT (sizeof (cryptodisk->uuid) >= sizeof (uuid));
|
||||
grub_memcpy (cryptodisk->uuid, uuid, sizeof (uuid));
|
||||
|
||||
cryptodisk->modname = "luks2";
|
||||
return cryptodisk;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
luks2_verify_key (grub_luks2_digest_t *d, grub_uint8_t *candidate_key,
|
||||
grub_size_t candidate_key_len)
|
||||
{
|
||||
grub_uint8_t candidate_digest[GRUB_CRYPTODISK_MAX_KEYLEN];
|
||||
grub_uint8_t digest[GRUB_CRYPTODISK_MAX_KEYLEN], salt[GRUB_CRYPTODISK_MAX_KEYLEN];
|
||||
grub_size_t saltlen = sizeof (salt), digestlen = sizeof (digest);
|
||||
const gcry_md_spec_t *hash;
|
||||
gcry_err_code_t gcry_ret;
|
||||
|
||||
/* Decode both digest and salt */
|
||||
if (!base64_decode (d->digest, grub_strlen (d->digest), (char *)digest, &digestlen))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid digest");
|
||||
if (!base64_decode (d->salt, grub_strlen (d->salt), (char *)salt, &saltlen))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid digest salt");
|
||||
|
||||
/* Configure the hash used for the digest. */
|
||||
hash = grub_crypto_lookup_md_by_name (d->hash);
|
||||
if (!hash)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "Couldn't load %s hash", d->hash);
|
||||
|
||||
/* Calculate the candidate key's digest */
|
||||
gcry_ret = grub_crypto_pbkdf2 (hash,
|
||||
candidate_key, candidate_key_len,
|
||||
salt, saltlen,
|
||||
d->iterations,
|
||||
candidate_digest, digestlen);
|
||||
if (gcry_ret)
|
||||
return grub_crypto_gcry_error (gcry_ret);
|
||||
|
||||
if (grub_memcmp (candidate_digest, digest, digestlen) != 0)
|
||||
return grub_error (GRUB_ERR_ACCESS_DENIED, "Mismatching digests");
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
luks2_decrypt_key (grub_uint8_t *out_key,
|
||||
grub_disk_t source, grub_cryptodisk_t crypt,
|
||||
grub_luks2_keyslot_t *k,
|
||||
const grub_uint8_t *passphrase, grub_size_t passphraselen)
|
||||
{
|
||||
grub_uint8_t area_key[GRUB_CRYPTODISK_MAX_KEYLEN];
|
||||
grub_uint8_t salt[GRUB_CRYPTODISK_MAX_KEYLEN];
|
||||
grub_uint8_t *split_key = NULL;
|
||||
grub_size_t saltlen = sizeof (salt);
|
||||
char cipher[32], *p;
|
||||
const gcry_md_spec_t *hash;
|
||||
gcry_err_code_t gcry_ret;
|
||||
grub_err_t ret;
|
||||
|
||||
if (!base64_decode (k->kdf.salt, grub_strlen (k->kdf.salt),
|
||||
(char *)salt, &saltlen))
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid keyslot salt");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Calculate the binary area key of the user supplied passphrase. */
|
||||
switch (k->kdf.type)
|
||||
{
|
||||
case LUKS2_KDF_TYPE_ARGON2I:
|
||||
ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Argon2 not supported");
|
||||
goto err;
|
||||
case LUKS2_KDF_TYPE_PBKDF2:
|
||||
hash = grub_crypto_lookup_md_by_name (k->kdf.u.pbkdf2.hash);
|
||||
if (!hash)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_FILE_NOT_FOUND, "Couldn't load %s hash",
|
||||
k->kdf.u.pbkdf2.hash);
|
||||
goto err;
|
||||
}
|
||||
|
||||
gcry_ret = grub_crypto_pbkdf2 (hash, (grub_uint8_t *) passphrase,
|
||||
passphraselen,
|
||||
salt, saltlen,
|
||||
k->kdf.u.pbkdf2.iterations,
|
||||
area_key, k->area.key_size);
|
||||
if (gcry_ret)
|
||||
{
|
||||
ret = grub_crypto_gcry_error (gcry_ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set up disk encryption parameters for the key area */
|
||||
grub_strncpy (cipher, k->area.encryption, sizeof (cipher));
|
||||
p = grub_memchr (cipher, '-', grub_strlen (cipher));
|
||||
if (!p)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid encryption");
|
||||
*p = '\0';
|
||||
|
||||
ret = grub_cryptodisk_setcipher (crypt, cipher, p + 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
gcry_ret = grub_cryptodisk_setkey (crypt, area_key, k->area.key_size);
|
||||
if (gcry_ret)
|
||||
{
|
||||
ret = grub_crypto_gcry_error (gcry_ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Read and decrypt the binary key area with the area key. */
|
||||
split_key = grub_malloc (k->area.size);
|
||||
if (!split_key)
|
||||
{
|
||||
ret = grub_errno;
|
||||
goto err;
|
||||
}
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
ret = grub_disk_read (source, 0, k->area.offset, k->area.size, split_key);
|
||||
if (ret)
|
||||
{
|
||||
grub_error (GRUB_ERR_IO, "Read error: %s\n", grub_errmsg);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* The key slots area is always encrypted in 512-byte sectors,
|
||||
* regardless of encrypted data sector size.
|
||||
*/
|
||||
gcry_ret = grub_cryptodisk_decrypt (crypt, split_key, k->area.size, 0,
|
||||
GRUB_LUKS1_LOG_SECTOR_SIZE);
|
||||
if (gcry_ret)
|
||||
{
|
||||
ret = grub_crypto_gcry_error (gcry_ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Configure the hash used for anti-forensic merging. */
|
||||
hash = grub_crypto_lookup_md_by_name (k->af.hash);
|
||||
if (!hash)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_FILE_NOT_FOUND, "Couldn't load %s hash",
|
||||
k->af.hash);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Merge the decrypted key material to get the candidate master key. */
|
||||
gcry_ret = AF_merge (hash, split_key, out_key, k->key_size, k->af.stripes);
|
||||
if (gcry_ret)
|
||||
{
|
||||
ret = grub_crypto_gcry_error (gcry_ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
grub_dprintf ("luks2", "Candidate key recovered\n");
|
||||
|
||||
err:
|
||||
grub_free (split_key);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
luks2_recover_key (grub_disk_t source,
|
||||
grub_cryptodisk_t crypt)
|
||||
{
|
||||
grub_uint8_t candidate_key[GRUB_CRYPTODISK_MAX_KEYLEN];
|
||||
char passphrase[MAX_PASSPHRASE], cipher[32];
|
||||
char *json_header = NULL, *part = NULL, *ptr;
|
||||
grub_size_t candidate_key_len = 0, json_idx, size;
|
||||
grub_luks2_header_t header;
|
||||
grub_luks2_keyslot_t keyslot;
|
||||
grub_luks2_digest_t digest;
|
||||
grub_luks2_segment_t segment;
|
||||
gcry_err_code_t gcry_ret;
|
||||
grub_json_t *json = NULL, keyslots;
|
||||
grub_err_t ret;
|
||||
|
||||
ret = luks2_read_header (source, &header);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
json_header = grub_zalloc (grub_be_to_cpu64 (header.hdr_size) - sizeof (header));
|
||||
if (!json_header)
|
||||
return GRUB_ERR_OUT_OF_MEMORY;
|
||||
|
||||
/* Read the JSON area. */
|
||||
ret = grub_disk_read (source, 0, grub_be_to_cpu64 (header.hdr_offset) + sizeof (header),
|
||||
grub_be_to_cpu64 (header.hdr_size) - sizeof (header), json_header);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
ptr = grub_memchr (json_header, 0, grub_be_to_cpu64 (header.hdr_size) - sizeof (header));
|
||||
if (!ptr)
|
||||
goto err;
|
||||
|
||||
ret = grub_json_parse (&json, json_header, grub_be_to_cpu64 (header.hdr_size));
|
||||
if (ret)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid LUKS2 JSON header");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Get the passphrase from the user. */
|
||||
if (source->partition)
|
||||
part = grub_partition_get_name (source->partition);
|
||||
grub_printf_ (N_("Enter passphrase for %s%s%s (%s): "), source->name,
|
||||
source->partition ? "," : "", part ? : "",
|
||||
crypt->uuid);
|
||||
if (!grub_password_get (passphrase, MAX_PASSPHRASE))
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Passphrase not supplied");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (grub_json_getvalue (&keyslots, json, "keyslots") ||
|
||||
grub_json_getsize (&size, &keyslots))
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not get keyslots");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (grub_disk_native_sectors (source) == GRUB_DISK_SIZE_UNKNOWN)
|
||||
{
|
||||
/* FIXME: Allow use of source disk, and maybe cause errors in read. */
|
||||
grub_dprintf ("luks2", "Source disk %s has an unknown size, "
|
||||
"conservatively returning error\n", source->name);
|
||||
ret = grub_error (GRUB_ERR_BUG, "Unknown size of luks2 source device");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Try all keyslot */
|
||||
for (json_idx = 0; json_idx < size; json_idx++)
|
||||
{
|
||||
char indexstr[21]; /* log10(2^64) ~ 20, plus NUL character. */
|
||||
typeof (source->total_sectors) max_crypt_sectors = 0;
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
ret = luks2_get_keyslot (&keyslot, &digest, &segment, json, json_idx);
|
||||
if (ret)
|
||||
goto err;
|
||||
if (grub_errno != GRUB_ERR_NONE)
|
||||
grub_dprintf ("luks2", "Ignoring unhandled error %d from luks2_get_keyslot\n", grub_errno);
|
||||
|
||||
if (keyslot.priority == 0)
|
||||
{
|
||||
grub_dprintf ("luks2", "Ignoring keyslot \"%" PRIuGRUB_UINT64_T "\" due to priority\n", keyslot.idx);
|
||||
continue;
|
||||
}
|
||||
|
||||
grub_dprintf ("luks2", "Trying keyslot \"%" PRIuGRUB_UINT64_T "\"\n", keyslot.idx);
|
||||
|
||||
/* Sector size should be one of 512, 1024, 2048, or 4096. */
|
||||
if (!(segment.sector_size == 512 || segment.sector_size == 1024 ||
|
||||
segment.sector_size == 2048 || segment.sector_size == 4096))
|
||||
{
|
||||
grub_dprintf ("luks2", "Segment \"%" PRIuGRUB_UINT64_T "\" sector"
|
||||
" size %" PRIuGRUB_UINT64_T " is not one of"
|
||||
" 512, 1024, 2048, or 4096\n",
|
||||
segment.idx, segment.sector_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Set up disk according to keyslot's segment. */
|
||||
crypt->offset_sectors = grub_divmod64 (segment.offset, segment.sector_size, NULL);
|
||||
crypt->log_sector_size = grub_log2ull (segment.sector_size);
|
||||
/* Set to the source disk/partition size, which is the maximum we allow. */
|
||||
max_crypt_sectors = grub_disk_native_sectors (source);
|
||||
max_crypt_sectors = grub_convert_sector (max_crypt_sectors, GRUB_DISK_SECTOR_BITS,
|
||||
crypt->log_sector_size);
|
||||
|
||||
if (max_crypt_sectors < crypt->offset_sectors)
|
||||
{
|
||||
grub_dprintf ("luks2", "Segment \"%" PRIuGRUB_UINT64_T "\" has offset"
|
||||
" %" PRIuGRUB_UINT64_T " which is greater than"
|
||||
" source disk size %" PRIuGRUB_UINT64_T ","
|
||||
" skipping\n", segment.idx, crypt->offset_sectors,
|
||||
max_crypt_sectors);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (grub_strcmp (segment.size, "dynamic") == 0)
|
||||
crypt->total_sectors = max_crypt_sectors - crypt->offset_sectors;
|
||||
else
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
/* Convert segment.size to sectors, rounding up to nearest sector */
|
||||
crypt->total_sectors = grub_strtoull (segment.size, NULL, 10);
|
||||
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
{
|
||||
crypt->total_sectors = ALIGN_UP (crypt->total_sectors,
|
||||
1 << crypt->log_sector_size);
|
||||
crypt->total_sectors >>= crypt->log_sector_size;
|
||||
}
|
||||
else if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||
{
|
||||
grub_dprintf ("luks2", "Segment \"%" PRIuGRUB_UINT64_T "\" size"
|
||||
" \"%s\" is not a parsable number,"
|
||||
" skipping keyslot\n",
|
||||
segment.idx, segment.size);
|
||||
continue;
|
||||
}
|
||||
else if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
|
||||
{
|
||||
/*
|
||||
* There was an overflow in parsing segment.size, so disk must
|
||||
* be very large or the string is incorrect.
|
||||
*
|
||||
* TODO: Allow reading of at least up max_crypt_sectors. Really,
|
||||
* its very unlikely one would be booting from such a large drive
|
||||
* anyway. Use another smaller LUKS2 boot device.
|
||||
*/
|
||||
grub_dprintf ("luks2", "Segment \"%" PRIuGRUB_UINT64_T "\" size"
|
||||
" %s overflowed 64-bit unsigned integer,"
|
||||
" skipping keyslot\n", segment.idx, segment.size);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (crypt->total_sectors == 0)
|
||||
{
|
||||
grub_dprintf ("luks2", "Segment \"%" PRIuGRUB_UINT64_T "\" has zero"
|
||||
" sectors, skipping\n", segment.idx);
|
||||
continue;
|
||||
}
|
||||
else if (max_crypt_sectors < (crypt->offset_sectors + crypt->total_sectors))
|
||||
{
|
||||
grub_dprintf ("luks2", "Segment \"%" PRIuGRUB_UINT64_T "\" has last"
|
||||
" data position greater than source disk size,"
|
||||
" the end of the crypto device will be"
|
||||
" inaccessible\n", segment.idx);
|
||||
|
||||
/* Allow decryption up to the end of the source disk. */
|
||||
crypt->total_sectors = max_crypt_sectors - crypt->offset_sectors;
|
||||
}
|
||||
|
||||
ret = luks2_decrypt_key (candidate_key, source, crypt, &keyslot,
|
||||
(const grub_uint8_t *) passphrase, grub_strlen (passphrase));
|
||||
if (ret)
|
||||
{
|
||||
grub_dprintf ("luks2", "Decryption with keyslot \"%" PRIuGRUB_UINT64_T "\" failed: %s\n",
|
||||
keyslot.idx, grub_errmsg);
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = luks2_verify_key (&digest, candidate_key, keyslot.key_size);
|
||||
if (ret)
|
||||
{
|
||||
grub_dprintf ("luks2", "Could not open keyslot \"%" PRIuGRUB_UINT64_T "\": %s\n",
|
||||
keyslot.idx, grub_errmsg);
|
||||
continue;
|
||||
}
|
||||
|
||||
grub_snprintf (indexstr, sizeof (indexstr) - 1, "%" PRIuGRUB_UINT64_T, keyslot.idx);
|
||||
/*
|
||||
* TRANSLATORS: It's a cryptographic key slot: one element of an array
|
||||
* where each element is either empty or holds a key.
|
||||
*/
|
||||
grub_printf_ (N_("Slot \"%s\" opened\n"), indexstr);
|
||||
|
||||
candidate_key_len = keyslot.key_size;
|
||||
break;
|
||||
}
|
||||
if (candidate_key_len == 0)
|
||||
{
|
||||
ret = grub_error (GRUB_ERR_ACCESS_DENIED, "Invalid passphrase");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Set up disk cipher. */
|
||||
grub_strncpy (cipher, segment.encryption, sizeof (cipher));
|
||||
ptr = grub_memchr (cipher, '-', grub_strlen (cipher));
|
||||
if (!ptr)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid encryption");
|
||||
*ptr = '\0';
|
||||
|
||||
ret = grub_cryptodisk_setcipher (crypt, cipher, ptr + 1);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
/* Set the master key. */
|
||||
gcry_ret = grub_cryptodisk_setkey (crypt, candidate_key, candidate_key_len);
|
||||
if (gcry_ret)
|
||||
{
|
||||
ret = grub_crypto_gcry_error (gcry_ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
err:
|
||||
grub_free (part);
|
||||
grub_free (json_header);
|
||||
grub_json_free (json);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct grub_cryptodisk_dev luks2_crypto = {
|
||||
.scan = luks2_scan,
|
||||
.recover_key = luks2_recover_key
|
||||
};
|
||||
|
||||
GRUB_MOD_INIT (luks2)
|
||||
{
|
||||
grub_cryptodisk_dev_register (&luks2_crypto);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI (luks2)
|
||||
{
|
||||
grub_cryptodisk_dev_unregister (&luks2_crypto);
|
||||
}
|
@ -25,6 +25,7 @@
|
||||
#include <grub/lvm.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/safemath.h>
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/emu/misc.h>
|
||||
@ -33,12 +34,20 @@
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
struct cache_lv
|
||||
{
|
||||
struct grub_diskfilter_lv *lv;
|
||||
char *cache_pool;
|
||||
char *origin;
|
||||
struct cache_lv *next;
|
||||
};
|
||||
|
||||
|
||||
/* Go the string STR and return the number after STR. *P will point
|
||||
at the number. In case STR is not found, *P will be NULL and the
|
||||
return value will be 0. */
|
||||
static grub_uint64_t
|
||||
grub_lvm_getvalue (char **p, const char *str)
|
||||
grub_lvm_getvalue (const char ** const p, const char *str)
|
||||
{
|
||||
*p = grub_strstr (*p, str);
|
||||
if (! *p)
|
||||
@ -63,12 +72,12 @@ grub_lvm_checkvalue (char **p, char *str, char *tmpl)
|
||||
#endif
|
||||
|
||||
static int
|
||||
grub_lvm_check_flag (char *p, const char *str, const char *flag)
|
||||
grub_lvm_check_flag (const char *p, const char *str, const char *flag)
|
||||
{
|
||||
grub_size_t len_str = grub_strlen (str), len_flag = grub_strlen (flag);
|
||||
while (1)
|
||||
{
|
||||
char *q;
|
||||
const char *q;
|
||||
p = grub_strstr (p, str);
|
||||
if (! p)
|
||||
return 0;
|
||||
@ -95,6 +104,34 @@ grub_lvm_check_flag (char *p, const char *str, const char *flag)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
grub_lvm_free_cache_lvs (struct cache_lv *cache_lvs)
|
||||
{
|
||||
struct cache_lv *cache;
|
||||
|
||||
while ((cache = cache_lvs))
|
||||
{
|
||||
cache_lvs = cache_lvs->next;
|
||||
|
||||
if (cache->lv)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < cache->lv->segment_count; ++i)
|
||||
if (cache->lv->segments)
|
||||
grub_free (cache->lv->segments[i].nodes);
|
||||
grub_free (cache->lv->segments);
|
||||
grub_free (cache->lv->fullname);
|
||||
grub_free (cache->lv->idname);
|
||||
grub_free (cache->lv->name);
|
||||
}
|
||||
grub_free (cache->lv);
|
||||
grub_free (cache->origin);
|
||||
grub_free (cache->cache_pool);
|
||||
grub_free (cache);
|
||||
}
|
||||
}
|
||||
|
||||
static struct grub_diskfilter_vg *
|
||||
grub_lvm_detect (grub_disk_t disk,
|
||||
struct grub_diskfilter_pv_id *id,
|
||||
@ -102,10 +139,12 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
{
|
||||
grub_err_t err;
|
||||
grub_uint64_t mda_offset, mda_size;
|
||||
grub_size_t ptr;
|
||||
char buf[GRUB_LVM_LABEL_SIZE];
|
||||
char vg_id[GRUB_LVM_ID_STRLEN+1];
|
||||
char pv_id[GRUB_LVM_ID_STRLEN+1];
|
||||
char *metadatabuf, *p, *q, *vgname;
|
||||
char *metadatabuf, *mda_end, *vgname;
|
||||
const char *p, *q;
|
||||
struct grub_lvm_label_header *lh = (struct grub_lvm_label_header *) buf;
|
||||
struct grub_lvm_pv_header *pvh;
|
||||
struct grub_lvm_disk_locn *dlocn;
|
||||
@ -139,6 +178,20 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/*
|
||||
* We read a grub_lvm_pv_header and then 2 grub_lvm_disk_locns that
|
||||
* immediately follow the PV header. Make sure we have space for both.
|
||||
*/
|
||||
if (grub_le_to_cpu32 (lh->offset_xl) >=
|
||||
GRUB_LVM_LABEL_SIZE - sizeof (struct grub_lvm_pv_header) -
|
||||
2 * sizeof (struct grub_lvm_disk_locn))
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("LVM PV header/disk locations are beyond the end of the block");
|
||||
#endif
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pvh = (struct grub_lvm_pv_header *) (buf + grub_le_to_cpu32(lh->offset_xl));
|
||||
|
||||
for (i = 0, j = 0; i < GRUB_LVM_ID_LEN; i++)
|
||||
@ -173,7 +226,7 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
first one. */
|
||||
|
||||
/* Allocate buffer space for the circular worst-case scenario. */
|
||||
metadatabuf = grub_malloc (2 * mda_size);
|
||||
metadatabuf = grub_calloc (2, mda_size);
|
||||
if (! metadatabuf)
|
||||
goto fail;
|
||||
|
||||
@ -195,9 +248,27 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
}
|
||||
|
||||
rlocn = mdah->raw_locns;
|
||||
if (grub_le_to_cpu64 (rlocn->offset) >= grub_le_to_cpu64 (mda_size))
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("metadata offset is beyond end of metadata area");
|
||||
#endif
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
if (grub_le_to_cpu64 (rlocn->offset) + grub_le_to_cpu64 (rlocn->size) >
|
||||
grub_le_to_cpu64 (mdah->size))
|
||||
{
|
||||
if (2 * mda_size < GRUB_LVM_MDA_HEADER_SIZE ||
|
||||
(grub_le_to_cpu64 (rlocn->offset) + grub_le_to_cpu64 (rlocn->size) -
|
||||
grub_le_to_cpu64 (mdah->size) > mda_size - GRUB_LVM_MDA_HEADER_SIZE))
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("cannot copy metadata wrap in circular buffer");
|
||||
#endif
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
/* Metadata is circular. Copy the wrap in place. */
|
||||
grub_memcpy (metadatabuf + mda_size,
|
||||
metadatabuf + GRUB_LVM_MDA_HEADER_SIZE,
|
||||
@ -205,19 +276,31 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
grub_le_to_cpu64 (rlocn->size) -
|
||||
grub_le_to_cpu64 (mdah->size));
|
||||
}
|
||||
p = q = metadatabuf + grub_le_to_cpu64 (rlocn->offset);
|
||||
|
||||
while (*q != ' ' && q < metadatabuf + mda_size)
|
||||
q++;
|
||||
|
||||
if (q == metadatabuf + mda_size)
|
||||
if (grub_add ((grub_size_t)metadatabuf,
|
||||
(grub_size_t)grub_le_to_cpu64 (rlocn->offset),
|
||||
&ptr))
|
||||
{
|
||||
error_parsing_metadata:
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("error parsing metadata");
|
||||
#endif
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
p = q = (char *)ptr;
|
||||
|
||||
if (grub_add ((grub_size_t)metadatabuf, (grub_size_t)mda_size, &ptr))
|
||||
goto error_parsing_metadata;
|
||||
|
||||
mda_end = (char *)ptr;
|
||||
|
||||
while (*q != ' ' && q < mda_end)
|
||||
q++;
|
||||
|
||||
if (q == mda_end)
|
||||
goto error_parsing_metadata;
|
||||
|
||||
vgname_len = q - p;
|
||||
vgname = grub_malloc (vgname_len + 1);
|
||||
if (!vgname)
|
||||
@ -242,6 +325,8 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
|
||||
if (! vg)
|
||||
{
|
||||
struct cache_lv *cache_lvs = NULL;
|
||||
|
||||
/* First time we see this volume group. We've to create the
|
||||
whole volume group structure. */
|
||||
vg = grub_malloc (sizeof (*vg));
|
||||
@ -275,17 +360,23 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
while (1)
|
||||
{
|
||||
grub_ssize_t s;
|
||||
while (grub_isspace (*p))
|
||||
while (grub_isspace (*p) && p < mda_end)
|
||||
p++;
|
||||
|
||||
if (p == mda_end)
|
||||
goto fail4;
|
||||
|
||||
if (*p == '}')
|
||||
break;
|
||||
|
||||
pv = grub_zalloc (sizeof (*pv));
|
||||
q = p;
|
||||
while (*q != ' ')
|
||||
while (*q != ' ' && q < mda_end)
|
||||
q++;
|
||||
|
||||
if (q == mda_end)
|
||||
goto pvs_fail_noname;
|
||||
|
||||
s = q - p;
|
||||
pv->name = grub_malloc (s + 1);
|
||||
grub_memcpy (pv->name, p, s);
|
||||
@ -328,10 +419,13 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
continue;
|
||||
pvs_fail:
|
||||
grub_free (pv->name);
|
||||
pvs_fail_noname:
|
||||
grub_free (pv);
|
||||
goto fail4;
|
||||
}
|
||||
}
|
||||
else
|
||||
goto fail4;
|
||||
|
||||
p = grub_strstr (p, "logical_volumes {");
|
||||
if (p)
|
||||
@ -347,18 +441,24 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
struct grub_diskfilter_segment *seg;
|
||||
int is_pvmove;
|
||||
|
||||
while (grub_isspace (*p))
|
||||
while (grub_isspace (*p) && p < mda_end)
|
||||
p++;
|
||||
|
||||
if (p == mda_end)
|
||||
goto fail4;
|
||||
|
||||
if (*p == '}')
|
||||
break;
|
||||
|
||||
lv = grub_zalloc (sizeof (*lv));
|
||||
|
||||
q = p;
|
||||
while (*q != ' ')
|
||||
while (*q != ' ' && q < mda_end)
|
||||
q++;
|
||||
|
||||
if (q == mda_end)
|
||||
goto lvs_fail;
|
||||
|
||||
s = q - p;
|
||||
lv->name = grub_strndup (p, s);
|
||||
if (!lv->name)
|
||||
@ -367,8 +467,26 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
{
|
||||
const char *iptr;
|
||||
char *optr;
|
||||
lv->fullname = grub_malloc (sizeof ("lvm/") - 1 + 2 * vgname_len
|
||||
+ 1 + 2 * s + 1);
|
||||
|
||||
/*
|
||||
* This is kind of hard to read with our safe (but rather
|
||||
* baroque) math primatives, but it boils down to:
|
||||
*
|
||||
* sz0 = vgname_len * 2 + 1 +
|
||||
* s * 2 + 1 +
|
||||
* sizeof ("lvm/") - 1;
|
||||
*/
|
||||
grub_size_t sz0 = vgname_len, sz1 = s;
|
||||
|
||||
if (grub_mul (sz0, 2, &sz0) ||
|
||||
grub_add (sz0, 1, &sz0) ||
|
||||
grub_mul (sz1, 2, &sz1) ||
|
||||
grub_add (sz1, 1, &sz1) ||
|
||||
grub_add (sz0, sz1, &sz0) ||
|
||||
grub_add (sz0, sizeof ("lvm/") - 1, &sz0))
|
||||
goto lvs_fail;
|
||||
|
||||
lv->fullname = grub_malloc (sz0);
|
||||
if (!lv->fullname)
|
||||
goto lvs_fail;
|
||||
|
||||
@ -426,7 +544,7 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
#endif
|
||||
goto lvs_fail;
|
||||
}
|
||||
lv->segments = grub_zalloc (sizeof (*seg) * lv->segment_count);
|
||||
lv->segments = grub_calloc (lv->segment_count, sizeof (*seg));
|
||||
seg = lv->segments;
|
||||
|
||||
for (i = 0; i < lv->segment_count; i++)
|
||||
@ -481,10 +599,19 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
}
|
||||
|
||||
if (seg->node_count != 1)
|
||||
{
|
||||
seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
|
||||
if (p == NULL)
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("unknown stripe_size");
|
||||
#endif
|
||||
goto lvs_segment_fail;
|
||||
}
|
||||
}
|
||||
|
||||
seg->nodes = grub_zalloc (sizeof (*stripe)
|
||||
* seg->node_count);
|
||||
seg->nodes = grub_calloc (seg->node_count,
|
||||
sizeof (*stripe));
|
||||
stripe = seg->nodes;
|
||||
|
||||
p = grub_strstr (p, "stripes = [");
|
||||
@ -501,11 +628,14 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
{
|
||||
p = grub_strchr (p, '"');
|
||||
if (p == NULL)
|
||||
continue;
|
||||
goto lvs_segment_fail2;
|
||||
q = ++p;
|
||||
while (*q != '"')
|
||||
while (q < mda_end && *q != '"')
|
||||
q++;
|
||||
|
||||
if (q == mda_end)
|
||||
goto lvs_segment_fail2;
|
||||
|
||||
s = q - p;
|
||||
|
||||
stripe->name = grub_malloc (s + 1);
|
||||
@ -520,7 +650,10 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
stripe->start = grub_lvm_getvalue (&p, ",")
|
||||
* vg->extent_size;
|
||||
if (p == NULL)
|
||||
continue;
|
||||
{
|
||||
grub_free (stripe->name);
|
||||
goto lvs_segment_fail2;
|
||||
}
|
||||
|
||||
stripe++;
|
||||
}
|
||||
@ -557,11 +690,14 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
|
||||
p = grub_strchr (p, '"');
|
||||
if (p == NULL)
|
||||
continue;
|
||||
goto lvs_segment_fail2;
|
||||
q = ++p;
|
||||
while (*q != '"')
|
||||
while (q < mda_end && *q != '"')
|
||||
q++;
|
||||
|
||||
if (q == mda_end)
|
||||
goto lvs_segment_fail2;
|
||||
|
||||
s = q - p;
|
||||
|
||||
lvname = grub_malloc (s + 1);
|
||||
@ -645,7 +781,7 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
p = p ? grub_strchr (p + 1, '"') : 0;
|
||||
p = p ? grub_strchr (p + 1, '"') : 0;
|
||||
if (p == NULL)
|
||||
continue;
|
||||
goto lvs_segment_fail2;
|
||||
q = ++p;
|
||||
while (*q != '"')
|
||||
q++;
|
||||
@ -671,6 +807,110 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
seg->nodes[seg->node_count - 1].name = tmp;
|
||||
}
|
||||
}
|
||||
else if (grub_memcmp (p, "cache\"",
|
||||
sizeof ("cache\"") - 1) == 0)
|
||||
{
|
||||
struct cache_lv *cache = NULL;
|
||||
|
||||
char *p2, *p3;
|
||||
grub_size_t sz;
|
||||
|
||||
cache = grub_zalloc (sizeof (*cache));
|
||||
if (!cache)
|
||||
goto cache_lv_fail;
|
||||
cache->lv = grub_zalloc (sizeof (*cache->lv));
|
||||
if (!cache->lv)
|
||||
goto cache_lv_fail;
|
||||
grub_memcpy (cache->lv, lv, sizeof (*cache->lv));
|
||||
|
||||
if (lv->fullname)
|
||||
{
|
||||
cache->lv->fullname = grub_strdup (lv->fullname);
|
||||
if (!cache->lv->fullname)
|
||||
goto cache_lv_fail;
|
||||
}
|
||||
if (lv->idname)
|
||||
{
|
||||
cache->lv->idname = grub_strdup (lv->idname);
|
||||
if (!cache->lv->idname)
|
||||
goto cache_lv_fail;
|
||||
}
|
||||
if (lv->name)
|
||||
{
|
||||
cache->lv->name = grub_strdup (lv->name);
|
||||
if (!cache->lv->name)
|
||||
goto cache_lv_fail;
|
||||
}
|
||||
|
||||
skip_lv = 1;
|
||||
|
||||
p2 = grub_strstr (p, "cache_pool = \"");
|
||||
if (!p2)
|
||||
goto cache_lv_fail;
|
||||
|
||||
p2 = grub_strchr (p2, '"');
|
||||
if (!p2)
|
||||
goto cache_lv_fail;
|
||||
|
||||
p3 = ++p2;
|
||||
if (p3 == mda_end)
|
||||
goto cache_lv_fail;
|
||||
p3 = grub_strchr (p3, '"');
|
||||
if (!p3)
|
||||
goto cache_lv_fail;
|
||||
|
||||
sz = p3 - p2;
|
||||
|
||||
cache->cache_pool = grub_malloc (sz + 1);
|
||||
if (!cache->cache_pool)
|
||||
goto cache_lv_fail;
|
||||
grub_memcpy (cache->cache_pool, p2, sz);
|
||||
cache->cache_pool[sz] = '\0';
|
||||
|
||||
p2 = grub_strstr (p, "origin = \"");
|
||||
if (!p2)
|
||||
goto cache_lv_fail;
|
||||
|
||||
p2 = grub_strchr (p2, '"');
|
||||
if (!p2)
|
||||
goto cache_lv_fail;
|
||||
|
||||
p3 = ++p2;
|
||||
if (p3 == mda_end)
|
||||
goto cache_lv_fail;
|
||||
p3 = grub_strchr (p3, '"');
|
||||
if (!p3)
|
||||
goto cache_lv_fail;
|
||||
|
||||
sz = p3 - p2;
|
||||
|
||||
cache->origin = grub_malloc (sz + 1);
|
||||
if (!cache->origin)
|
||||
goto cache_lv_fail;
|
||||
grub_memcpy (cache->origin, p2, sz);
|
||||
cache->origin[sz] = '\0';
|
||||
|
||||
cache->next = cache_lvs;
|
||||
cache_lvs = cache;
|
||||
break;
|
||||
|
||||
cache_lv_fail:
|
||||
if (cache)
|
||||
{
|
||||
grub_free (cache->origin);
|
||||
grub_free (cache->cache_pool);
|
||||
if (cache->lv)
|
||||
{
|
||||
grub_free (cache->lv->fullname);
|
||||
grub_free (cache->lv->idname);
|
||||
grub_free (cache->lv->name);
|
||||
}
|
||||
grub_free (cache->lv);
|
||||
grub_free (cache);
|
||||
}
|
||||
grub_lvm_free_cache_lvs (cache_lvs);
|
||||
goto fail4;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
@ -741,12 +981,68 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
}
|
||||
if (lv1->segments[i].nodes[j].pv == NULL)
|
||||
for (lv2 = vg->lvs; lv2; lv2 = lv2->next)
|
||||
{
|
||||
if (lv1 == lv2)
|
||||
continue;
|
||||
if (grub_strcmp (lv2->name,
|
||||
lv1->segments[i].nodes[j].name) == 0)
|
||||
lv1->segments[i].nodes[j].lv = lv2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
struct cache_lv *cache;
|
||||
|
||||
for (cache = cache_lvs; cache; cache = cache->next)
|
||||
{
|
||||
struct grub_diskfilter_lv *lv;
|
||||
|
||||
for (lv = vg->lvs; lv; lv = lv->next)
|
||||
if (grub_strcmp (lv->name, cache->origin) == 0)
|
||||
break;
|
||||
if (lv)
|
||||
{
|
||||
cache->lv->segments = grub_calloc (lv->segment_count, sizeof (*lv->segments));
|
||||
if (!cache->lv->segments)
|
||||
{
|
||||
grub_lvm_free_cache_lvs (cache_lvs);
|
||||
goto fail4;
|
||||
}
|
||||
grub_memcpy (cache->lv->segments, lv->segments, lv->segment_count * sizeof (*lv->segments));
|
||||
|
||||
for (i = 0; i < lv->segment_count; ++i)
|
||||
{
|
||||
struct grub_diskfilter_node *nodes = lv->segments[i].nodes;
|
||||
grub_size_t node_count = lv->segments[i].node_count;
|
||||
|
||||
cache->lv->segments[i].nodes = grub_calloc (node_count, sizeof (*nodes));
|
||||
if (!cache->lv->segments[i].nodes)
|
||||
{
|
||||
for (j = 0; j < i; ++j)
|
||||
grub_free (cache->lv->segments[j].nodes);
|
||||
grub_free (cache->lv->segments);
|
||||
cache->lv->segments = NULL;
|
||||
grub_lvm_free_cache_lvs (cache_lvs);
|
||||
goto fail4;
|
||||
}
|
||||
grub_memcpy (cache->lv->segments[i].nodes, nodes, node_count * sizeof (*nodes));
|
||||
}
|
||||
|
||||
if (cache->lv->segments)
|
||||
{
|
||||
cache->lv->segment_count = lv->segment_count;
|
||||
cache->lv->vg = vg;
|
||||
cache->lv->next = vg->lvs;
|
||||
vg->lvs = cache->lv;
|
||||
cache->lv = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
grub_lvm_free_cache_lvs (cache_lvs);
|
||||
if (grub_diskfilter_vg_register (vg))
|
||||
goto fail4;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ grub_mdraid_detect (grub_disk_t disk,
|
||||
grub_uint64_t size;
|
||||
grub_uint8_t minor_version;
|
||||
|
||||
size = grub_disk_get_size (disk);
|
||||
size = grub_disk_native_sectors (disk);
|
||||
|
||||
/* Check for an 1.x superblock.
|
||||
* It's always aligned to a 4K boundary
|
||||
@ -178,7 +178,7 @@ grub_mdraid_detect (grub_disk_t disk,
|
||||
return NULL;
|
||||
|
||||
if (grub_disk_read (disk, sector,
|
||||
(char *) &sb.dev_roles[grub_le_to_cpu32 (sb.dev_number)]
|
||||
(char *) (sb.dev_roles + grub_le_to_cpu32 (sb.dev_number))
|
||||
- (char *) &sb,
|
||||
sizeof (role), &role))
|
||||
return NULL;
|
||||
|
@ -190,7 +190,7 @@ grub_mdraid_detect (grub_disk_t disk,
|
||||
struct grub_diskfilter_vg *ret;
|
||||
|
||||
/* The sector where the mdraid 0.90 superblock is stored, if available. */
|
||||
size = grub_disk_get_size (disk);
|
||||
size = grub_disk_native_sectors (disk);
|
||||
if (size == GRUB_DISK_SIZE_UNKNOWN)
|
||||
/* not 0.9x raid. */
|
||||
return NULL;
|
||||
|
@ -331,6 +331,12 @@ grub_pata_device_initialize (int port, int device, int addr)
|
||||
*devp = dev;
|
||||
|
||||
err = check_device (dev);
|
||||
if (err == GRUB_ERR_UNKNOWN_DEVICE)
|
||||
{
|
||||
grub_dprintf ("pata", "%s\n", grub_errmsg);
|
||||
grub_error_pop ();
|
||||
}
|
||||
|
||||
if (err)
|
||||
grub_print_error ();
|
||||
|
||||
|
@ -426,7 +426,7 @@ grub_xendisk_init (void)
|
||||
if (!ctr)
|
||||
return;
|
||||
|
||||
virtdisks = grub_malloc (ctr * sizeof (virtdisks[0]));
|
||||
virtdisks = grub_calloc (ctr, sizeof (virtdisks[0]));
|
||||
if (!virtdisks)
|
||||
return;
|
||||
if (grub_xenstore_dir ("device/vbd", fill, &ctr))
|
||||
|
@ -121,9 +121,14 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
|
||||
return err;
|
||||
break;
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%x is not implemented yet"),
|
||||
{
|
||||
char rel_info[17]; /* log16(2^64) = 16, plus NUL. */
|
||||
|
||||
grub_snprintf (rel_info, sizeof (rel_info) - 1, "%" PRIxGRUB_UINT64_T,
|
||||
ELF_R_TYPE (rel->r_info));
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("relocation 0x%s is not implemented yet"), rel_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,11 @@
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/acpi.h>
|
||||
#include <grub/smbios.h>
|
||||
|
||||
grub_err_t
|
||||
grub_machine_efiemu_init_tables (void)
|
||||
{
|
||||
grub_uint8_t *ptr;
|
||||
void *table;
|
||||
grub_err_t err;
|
||||
grub_efi_guid_t smbios = GRUB_EFI_SMBIOS_TABLE_GUID;
|
||||
@ -57,17 +57,10 @@ grub_machine_efiemu_init_tables (void)
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
for (ptr = (grub_uint8_t *) 0xf0000; ptr < (grub_uint8_t *) 0x100000;
|
||||
ptr += 16)
|
||||
if (grub_memcmp (ptr, "_SM_", 4) == 0
|
||||
&& grub_byte_checksum (ptr, *(ptr + 5)) == 0)
|
||||
break;
|
||||
|
||||
if (ptr < (grub_uint8_t *) 0x100000)
|
||||
table = grub_smbios_get_eps ();
|
||||
if (table)
|
||||
{
|
||||
grub_dprintf ("efiemu", "Registering SMBIOS\n");
|
||||
err = grub_efiemu_register_configuration_table (smbios, 0, 0, ptr);
|
||||
err = grub_efiemu_register_configuration_table (smbios, 0, 0, table);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ grub_efiemu_count_symbols (const Elf_Ehdr *e)
|
||||
|
||||
grub_efiemu_nelfsyms = (unsigned) s->sh_size / (unsigned) s->sh_entsize;
|
||||
grub_efiemu_elfsyms = (struct grub_efiemu_elf_sym *)
|
||||
grub_malloc (sizeof (struct grub_efiemu_elf_sym) * grub_efiemu_nelfsyms);
|
||||
grub_calloc (grub_efiemu_nelfsyms, sizeof (struct grub_efiemu_elf_sym));
|
||||
|
||||
/* Relocators */
|
||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||
|
@ -554,11 +554,11 @@ grub_efiemu_mmap_sort_and_uniq (void)
|
||||
/* Initialize variables*/
|
||||
grub_memset (present, 0, sizeof (int) * GRUB_EFI_MAX_MEMORY_TYPE);
|
||||
scanline_events = (struct grub_efiemu_mmap_scan *)
|
||||
grub_malloc (sizeof (struct grub_efiemu_mmap_scan) * 2 * mmap_num);
|
||||
grub_calloc (mmap_num, sizeof (struct grub_efiemu_mmap_scan) * 2);
|
||||
|
||||
/* Number of chunks can't increase more than by factor of 2 */
|
||||
result = (grub_efi_memory_descriptor_t *)
|
||||
grub_malloc (sizeof (grub_efi_memory_descriptor_t) * 2 * mmap_num);
|
||||
grub_calloc (mmap_num, sizeof (grub_efi_memory_descriptor_t) * 2);
|
||||
if (!result || !scanline_events)
|
||||
{
|
||||
grub_free (result);
|
||||
@ -660,7 +660,7 @@ grub_efiemu_mm_do_alloc (void)
|
||||
|
||||
/* Preallocate mmap */
|
||||
efiemu_mmap = (grub_efi_memory_descriptor_t *)
|
||||
grub_malloc (mmap_reserved_size * sizeof (grub_efi_memory_descriptor_t));
|
||||
grub_calloc (mmap_reserved_size, sizeof (grub_efi_memory_descriptor_t));
|
||||
if (!efiemu_mmap)
|
||||
{
|
||||
grub_efiemu_unload ();
|
||||
|
@ -39,7 +39,7 @@ static grub_size_t nvramsize;
|
||||
|
||||
/* Parse signed value */
|
||||
static int
|
||||
grub_strtosl (const char *arg, char **end, int base)
|
||||
grub_strtosl (const char *arg, const char ** const end, int base)
|
||||
{
|
||||
if (arg[0] == '-')
|
||||
return -grub_strtoul (arg + 1, end, base);
|
||||
@ -120,7 +120,8 @@ nvram_set (void * data __attribute__ ((unused)))
|
||||
grub_memset (nvram, 0, nvramsize);
|
||||
FOR_SORTED_ENV (var)
|
||||
{
|
||||
char *guid, *attr, *name, *varname;
|
||||
const char *guid;
|
||||
char *attr, *name, *varname;
|
||||
struct efi_variable *efivar;
|
||||
int len = 0;
|
||||
int i;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <grub/unicode.h>
|
||||
#include <grub/fontformat.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@ -293,8 +294,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
||||
font->num_chars = sect_length / FONT_CHAR_INDEX_ENTRY_SIZE;
|
||||
|
||||
/* Allocate the character index array. */
|
||||
font->char_index = grub_malloc (font->num_chars
|
||||
* sizeof (struct char_index_entry));
|
||||
font->char_index = grub_calloc (font->num_chars, sizeof (struct char_index_entry));
|
||||
if (!font->char_index)
|
||||
return 1;
|
||||
font->bmp_idx = grub_malloc (0x10000 * sizeof (grub_uint16_t));
|
||||
@ -361,9 +361,13 @@ static char *
|
||||
read_section_as_string (struct font_file_section *section)
|
||||
{
|
||||
char *str;
|
||||
grub_size_t sz;
|
||||
grub_ssize_t ret;
|
||||
|
||||
str = grub_malloc (section->length + 1);
|
||||
if (grub_add (section->length, 1, &sz))
|
||||
return NULL;
|
||||
|
||||
str = grub_malloc (sz);
|
||||
if (!str)
|
||||
return 0;
|
||||
|
||||
@ -528,6 +532,12 @@ grub_font_load (const char *filename)
|
||||
if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FONT_NAME,
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_FONT_NAME) - 1) == 0)
|
||||
{
|
||||
if (font->name != NULL)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT, "invalid font file: too many NAME sections");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
font->name = read_section_as_string (§ion);
|
||||
if (!font->name)
|
||||
goto fail;
|
||||
|
@ -301,7 +301,7 @@ grub_affs_read_symlink (grub_fshelp_node_t node)
|
||||
return 0;
|
||||
}
|
||||
latin1[symlink_size] = 0;
|
||||
utf8 = grub_malloc (symlink_size * GRUB_MAX_UTF8_PER_LATIN1 + 1);
|
||||
utf8 = grub_calloc (GRUB_MAX_UTF8_PER_LATIN1 + 1, symlink_size);
|
||||
if (!utf8)
|
||||
{
|
||||
grub_free (latin1);
|
||||
@ -400,12 +400,12 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
||||
{
|
||||
unsigned int i;
|
||||
struct grub_affs_file file;
|
||||
struct grub_fshelp_node *node = 0;
|
||||
struct grub_fshelp_node *node, *orig_node;
|
||||
struct grub_affs_data *data = dir->data;
|
||||
grub_uint32_t *hashtable;
|
||||
|
||||
/* Create the directory entries for `.' and `..'. */
|
||||
node = grub_zalloc (sizeof (*node));
|
||||
node = orig_node = grub_zalloc (sizeof (*node));
|
||||
if (!node)
|
||||
return 1;
|
||||
|
||||
@ -414,15 +414,12 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
||||
return 1;
|
||||
if (dir->parent)
|
||||
{
|
||||
node = grub_zalloc (sizeof (*node));
|
||||
if (!node)
|
||||
return 1;
|
||||
*node = *dir->parent;
|
||||
if (hook ("..", GRUB_FSHELP_DIR, node, hook_data))
|
||||
return 1;
|
||||
}
|
||||
|
||||
hashtable = grub_zalloc (data->htsize * sizeof (*hashtable));
|
||||
hashtable = grub_calloc (data->htsize, sizeof (*hashtable));
|
||||
if (!hashtable)
|
||||
return 1;
|
||||
|
||||
@ -456,17 +453,18 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
||||
|
||||
if (grub_affs_create_node (dir, hook, hook_data, &node, &hashtable,
|
||||
next, &file))
|
||||
{
|
||||
/* Node has been replaced in function. */
|
||||
grub_free (orig_node);
|
||||
return 1;
|
||||
}
|
||||
|
||||
next = grub_be_to_cpu32 (file.next);
|
||||
}
|
||||
}
|
||||
|
||||
grub_free (hashtable);
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
grub_free (node);
|
||||
grub_free (orig_node);
|
||||
grub_free (hashtable);
|
||||
return 0;
|
||||
}
|
||||
@ -628,7 +626,7 @@ grub_affs_label (grub_device_t device, char **label)
|
||||
len = file.namelen;
|
||||
if (len > sizeof (file.name))
|
||||
len = sizeof (file.name);
|
||||
*label = grub_malloc (len * GRUB_MAX_UTF8_PER_LATIN1 + 1);
|
||||
*label = grub_calloc (GRUB_MAX_UTF8_PER_LATIN1 + 1, len);
|
||||
if (*label)
|
||||
*grub_latin1_to_utf8 ((grub_uint8_t *) *label, file.name, len) = '\0';
|
||||
}
|
||||
@ -643,7 +641,7 @@ grub_affs_label (grub_device_t device, char **label)
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_affs_mtime (grub_device_t device, grub_int32_t *t)
|
||||
grub_affs_mtime (grub_device_t device, grub_int64_t *t)
|
||||
{
|
||||
struct grub_affs_data *data;
|
||||
grub_disk_t disk = device->disk;
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <grub/btrfs.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/diskfilter.h>
|
||||
#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@ -136,6 +137,8 @@ struct grub_btrfs_chunk_item
|
||||
#define GRUB_BTRFS_CHUNK_TYPE_RAID10 0x40
|
||||
#define GRUB_BTRFS_CHUNK_TYPE_RAID5 0x80
|
||||
#define GRUB_BTRFS_CHUNK_TYPE_RAID6 0x100
|
||||
#define GRUB_BTRFS_CHUNK_TYPE_RAID1C3 0x200
|
||||
#define GRUB_BTRFS_CHUNK_TYPE_RAID1C4 0x400
|
||||
grub_uint8_t dummy2[0xc];
|
||||
grub_uint16_t nstripes;
|
||||
grub_uint16_t nsubstripes;
|
||||
@ -329,9 +332,13 @@ save_ref (struct grub_btrfs_leaf_descriptor *desc,
|
||||
if (desc->allocated < desc->depth)
|
||||
{
|
||||
void *newdata;
|
||||
desc->allocated *= 2;
|
||||
newdata = grub_realloc (desc->data, sizeof (desc->data[0])
|
||||
* desc->allocated);
|
||||
grub_size_t sz;
|
||||
|
||||
if (grub_mul (desc->allocated, 2, &desc->allocated) ||
|
||||
grub_mul (desc->allocated, sizeof (desc->data[0]), &sz))
|
||||
return GRUB_ERR_OUT_OF_RANGE;
|
||||
|
||||
newdata = grub_realloc (desc->data, sz);
|
||||
if (!newdata)
|
||||
return grub_errno;
|
||||
desc->data = newdata;
|
||||
@ -376,9 +383,9 @@ next (struct grub_btrfs_data *data,
|
||||
|
||||
err = grub_btrfs_read_logical (data, grub_le_to_cpu64 (node.addr),
|
||||
&head, sizeof (head), 0);
|
||||
check_btrfs_header (data, &head, grub_le_to_cpu64 (node.addr));
|
||||
if (err)
|
||||
return -err;
|
||||
check_btrfs_header (data, &head, grub_le_to_cpu64 (node.addr));
|
||||
|
||||
save_ref (desc, grub_le_to_cpu64 (node.addr), 0,
|
||||
grub_le_to_cpu32 (head.nitems), !head.level);
|
||||
@ -413,7 +420,7 @@ lower_bound (struct grub_btrfs_data *data,
|
||||
{
|
||||
desc->allocated = 16;
|
||||
desc->depth = 0;
|
||||
desc->data = grub_malloc (sizeof (desc->data[0]) * desc->allocated);
|
||||
desc->data = grub_calloc (desc->allocated, sizeof (desc->data[0]));
|
||||
if (!desc->data)
|
||||
return grub_errno;
|
||||
}
|
||||
@ -438,9 +445,9 @@ lower_bound (struct grub_btrfs_data *data,
|
||||
/* FIXME: preread few nodes into buffer. */
|
||||
err = grub_btrfs_read_logical (data, addr, &head, sizeof (head),
|
||||
recursion_depth + 1);
|
||||
check_btrfs_header (data, &head, addr);
|
||||
if (err)
|
||||
return err;
|
||||
check_btrfs_header (data, &head, addr);
|
||||
addr += sizeof (head);
|
||||
if (head.level)
|
||||
{
|
||||
@ -622,16 +629,21 @@ find_device (struct grub_btrfs_data *data, grub_uint64_t id)
|
||||
if (data->n_devices_attached > data->n_devices_allocated)
|
||||
{
|
||||
void *tmp;
|
||||
data->n_devices_allocated = 2 * data->n_devices_attached + 1;
|
||||
data->devices_attached
|
||||
= grub_realloc (tmp = data->devices_attached,
|
||||
data->n_devices_allocated
|
||||
* sizeof (data->devices_attached[0]));
|
||||
grub_size_t sz;
|
||||
|
||||
if (grub_mul (data->n_devices_attached, 2, &data->n_devices_allocated) ||
|
||||
grub_add (data->n_devices_allocated, 1, &data->n_devices_allocated) ||
|
||||
grub_mul (data->n_devices_allocated, sizeof (data->devices_attached[0]), &sz))
|
||||
goto fail;
|
||||
|
||||
data->devices_attached = grub_realloc (tmp = data->devices_attached, sz);
|
||||
if (!data->devices_attached)
|
||||
{
|
||||
data->devices_attached = tmp;
|
||||
|
||||
fail:
|
||||
if (ctx.dev_found)
|
||||
grub_device_close (ctx.dev_found);
|
||||
data->devices_attached = tmp;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -752,7 +764,7 @@ raid56_read_retry (struct grub_btrfs_data *data,
|
||||
grub_err_t ret = GRUB_ERR_OUT_OF_MEMORY;
|
||||
grub_uint64_t i, failed_devices;
|
||||
|
||||
buffers = grub_zalloc (sizeof(*buffers) * nstripes);
|
||||
buffers = grub_calloc (nstripes, sizeof (*buffers));
|
||||
if (!buffers)
|
||||
goto cleanup;
|
||||
|
||||
@ -964,14 +976,19 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
||||
csize = (stripen + 1) * stripe_length - off;
|
||||
break;
|
||||
}
|
||||
case GRUB_BTRFS_CHUNK_TYPE_RAID1C4:
|
||||
redundancy++;
|
||||
/* fall through */
|
||||
case GRUB_BTRFS_CHUNK_TYPE_RAID1C3:
|
||||
redundancy++;
|
||||
/* fall through */
|
||||
case GRUB_BTRFS_CHUNK_TYPE_DUPLICATED:
|
||||
case GRUB_BTRFS_CHUNK_TYPE_RAID1:
|
||||
{
|
||||
grub_dprintf ("btrfs", "RAID1\n");
|
||||
grub_dprintf ("btrfs", "RAID1 (copies: %d)\n", ++redundancy);
|
||||
stripen = 0;
|
||||
stripe_offset = off;
|
||||
csize = grub_le_to_cpu64 (chunk->size) - off;
|
||||
redundancy = 2;
|
||||
break;
|
||||
}
|
||||
case GRUB_BTRFS_CHUNK_TYPE_RAID0:
|
||||
@ -1066,6 +1083,9 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
||||
* stripen is computed without the parities
|
||||
* (0 for A0, A1, A2, 1 for B0, B1, B2, etc.).
|
||||
*/
|
||||
if (nparities >= nstripes)
|
||||
return grub_error (GRUB_ERR_BAD_FS,
|
||||
"invalid RAID5/6: nparities >= nstripes");
|
||||
high = grub_divmod64 (stripe_nr, nstripes - nparities, &stripen);
|
||||
|
||||
/*
|
||||
@ -2160,7 +2180,7 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
|
||||
*nsectors = 64 * 2 - 1;
|
||||
if (*nsectors > max_nsectors)
|
||||
*nsectors = max_nsectors;
|
||||
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
|
||||
*sectors = grub_calloc (*nsectors, sizeof (**sectors));
|
||||
if (!*sectors)
|
||||
return grub_errno;
|
||||
for (i = 0; i < *nsectors; i++)
|
||||
|
@ -148,16 +148,16 @@ 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)
|
||||
if (grub_disk_native_sectors (disk) == GRUB_DISK_SIZE_UNKNOWN)
|
||||
goto fail;
|
||||
|
||||
if (grub_disk_read (disk, grub_disk_get_size (disk) - 1,
|
||||
if (grub_disk_read (disk, grub_disk_native_sectors (disk) - 1,
|
||||
GRUB_DISK_SECTOR_SIZE - sizeof (ptr),
|
||||
sizeof (ptr), &ptr))
|
||||
goto fail;
|
||||
|
||||
ptr = grub_cpu_to_le32 (ptr);
|
||||
header_off = (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
header_off = (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
+ (grub_int32_t) ptr;
|
||||
|
||||
if (grub_disk_read (disk, 0, header_off,
|
||||
@ -171,16 +171,16 @@ grub_cbfs_mount (grub_disk_t disk)
|
||||
if (!data)
|
||||
goto fail;
|
||||
|
||||
data->cbfs_start = (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
data->cbfs_start = (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
- (grub_be_to_cpu32 (head.romsize) - grub_be_to_cpu32 (head.offset));
|
||||
data->cbfs_end = (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
data->cbfs_end = (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
- grub_be_to_cpu32 (head.bootblocksize);
|
||||
data->cbfs_align = grub_be_to_cpu32 (head.align);
|
||||
|
||||
if (data->cbfs_start >= (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS))
|
||||
if (data->cbfs_start >= (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS))
|
||||
goto fail;
|
||||
if (data->cbfs_end > (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS))
|
||||
data->cbfs_end = (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS);
|
||||
if (data->cbfs_end > (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS))
|
||||
data->cbfs_end = (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS);
|
||||
|
||||
data->next_hofs = data->cbfs_start;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user