Bill XIE has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/60640 )
Change subject: payloads/external: Add an option to build "GRUB2 running atop SeaBIOS" ......................................................................
payloads/external: Add an option to build "GRUB2 running atop SeaBIOS"
Also known as "SeaGRUB", running GRUB2 atop SeaBIOS proves to be a useful configuration, since SeaBIOS has improved its hardware compatibility. For example, some USB drive can work under SeaBIOS but do not work under native GRUB2, and GRUB2 can use BIOS call (provided by SeaBIOS) as a fallback method to access hardware if it is present.
Signed-off-by: Bill XIE persmule@hardenedlinux.org Change-Id: Ie681fa231abfe4a8f1e4510b3c17957550a9d2f8 --- M payloads/external/GRUB2/Kconfig M payloads/external/GRUB2/Kconfig.name A payloads/external/GRUB2/bootorder-seagrub M payloads/external/Makefile.inc M payloads/external/SeaBIOS/Kconfig M payloads/external/SeaBIOS/Kconfig.name 6 files changed, 64 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/40/60640/1
diff --git a/payloads/external/GRUB2/Kconfig b/payloads/external/GRUB2/Kconfig index 552f06a..e6c0515 100644 --- a/payloads/external/GRUB2/Kconfig +++ b/payloads/external/GRUB2/Kconfig @@ -1,5 +1,15 @@ +config PAYLOAD_BUILD_GRUB2 + bool + if PAYLOAD_GRUB2
+config PAYLOAD_FILE + default "payloads/external/GRUB2/grub2/build/default_payload.elf" + +endif + +if PAYLOAD_BUILD_GRUB2 + choice prompt "GRUB2 version" default GRUB2_STABLE @@ -42,12 +52,9 @@ * gfxmenu for graphical menus (you'll need a theme as well) * gfxterm_background for setting background
-config PAYLOAD_FILE - default "payloads/external/GRUB2/grub2/build/default_payload.elf" - config GRUB2_INCLUDE_RUNTIME_CONFIG_FILE bool "Include GRUB2 runtime config file into ROM image" - depends on PAYLOAD_GRUB2 + depends on PAYLOAD_BUILD_GRUB2 default n help The GRUB2 payload reads its runtime configuration file from etc/grub.cfg @@ -72,3 +79,18 @@ The path of the GRUB2 runtime configuration file to be added to CBFS.
endif + +if PAYLOAD_SEAGRUB + +config SEABIOS_BOOTORDER_FILE + default "payloads/external/GRUB2/bootorder-seagrub" + +config SEAGRUB_ALLOW_SEABIOS_BOOTMENU + bool "Allow to access SeaBIOS boot menu before launching GRUB" + help + Enable this to allow the access to the boot menu of + SeaBIOS. It increases the flexibility but allows to + bypass the secure mechanism implemented in the GRUB + runtime config. Please use this with cautiousness. + +endif diff --git a/payloads/external/GRUB2/Kconfig.name b/payloads/external/GRUB2/Kconfig.name index fe60d76..bd1d949 100644 --- a/payloads/external/GRUB2/Kconfig.name +++ b/payloads/external/GRUB2/Kconfig.name @@ -1,9 +1,22 @@ config PAYLOAD_GRUB2 bool "GRUB2" depends on ARCH_X86 || ARCH_ARM + select PAYLOAD_BUILD_GRUB2 help Select this option if you want to build a coreboot image with a GRUB2 payload. If you don't know what this is about, just leave it enabled.
See https://coreboot.org/Payloads for more information. + +config PAYLOAD_SEAGRUB + bool "GRUB2 atop SeaBIOS" + depends on ARCH_X86 + select PAYLOAD_BUILD_SEABIOS + select PAYLOAD_BUILD_GRUB2 + help + Select this option if you want to build a coreboot image + with a GRUB2 payload running atop SeaBIOS to improve its + hardware compatibility. + + See https://coreboot.org/Payloads for more information. diff --git a/payloads/external/GRUB2/bootorder-seagrub b/payloads/external/GRUB2/bootorder-seagrub new file mode 100644 index 0000000..b33e129 --- /dev/null +++ b/payloads/external/GRUB2/bootorder-seagrub @@ -0,0 +1 @@ +/rom@img/grub2 diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc index 072d8d1..71ee31a 100644 --- a/payloads/external/Makefile.inc +++ b/payloads/external/Makefile.inc @@ -1,7 +1,7 @@ ## SPDX-License-Identifier: GPL-2.0-only
# set up payload config and version files for later inclusion -ifeq ($(CONFIG_PAYLOAD_SEABIOS),y) +ifeq ($(CONFIG_PAYLOAD_BUILD_SEABIOS),y) PAYLOAD_CONFIG=payloads/external/SeaBIOS/seabios/.config PAYLOAD_VERSION=payloads/external/SeaBIOS/seabios/out/autoversion.h endif @@ -122,6 +122,16 @@ $(CBFSTOOL) $< add-int -i 2 -n etc/threads endif
+ifneq ($(CONFIG_SEAGRUB_ALLOW_SEABIOS_BOOTMENU),y) +$(call add_intermediate, seabios_bootmenu, $(CBFSTOOL)) + @printf " SeaBIOS Disable boot menu\n" + $(if $(CONFIG_UPDATE_IMAGE),-$(CBFSTOOL) $< remove -n etc/show-boot-menu 2>/dev/null) + $(CBFSTOOL) $< add-int -i 0 -n etc/show-boot-menu +else +$(call add_intermediate, seabios_bootmenu, $(CBFSTOOL)) + $(if $(CONFIG_UPDATE_IMAGE),-$(CBFSTOOL) $< remove -n etc/show-boot-menu 2>/dev/null) +endif + # Depthcharge
payloads/external/depthcharge/depthcharge/build/depthcharge.elf depthcharge: $(DOTCONFIG) $(CBFSTOOL) @@ -181,6 +191,13 @@
# Grub
+GRUB_TARGET_PATH=payloads/external/GRUB2/grub2/build/default_payload.elf + +cbfs-files-$(CONFIG_PAYLOAD_SEAGRUB) += img/grub2 +img/grub2-file := $(GRUB_TARGET_PATH) +img/grub2-type := payload +img/grub2-compression := $(CBFS_PAYLOAD_COMPRESS_FLAG) + grub2: $(obj)/config.h $(MAKE) -C payloads/external/GRUB2 \ HOSTCC="$(HOSTCC)" \ @@ -193,7 +210,7 @@ CONFIG_GRUB2_REVISION_ID=$(CONFIG_GRUB2_REVISION_ID) \ CONFIG_GRUB2_EXTRA_MODULES=$(CONFIG_GRUB2_EXTRA_MODULES)
-payloads/external/GRUB2/grub2/build/default_payload.elf: grub2 +$(GRUB_TARGET_PATH): grub2
# U-Boot
diff --git a/payloads/external/SeaBIOS/Kconfig b/payloads/external/SeaBIOS/Kconfig index 18f2a47..a70e6fa 100644 --- a/payloads/external/SeaBIOS/Kconfig +++ b/payloads/external/SeaBIOS/Kconfig @@ -1,4 +1,7 @@ -if PAYLOAD_SEABIOS +config PAYLOAD_BUILD_SEABIOS + bool + +if PAYLOAD_BUILD_SEABIOS
choice prompt "SeaBIOS version" diff --git a/payloads/external/SeaBIOS/Kconfig.name b/payloads/external/SeaBIOS/Kconfig.name index bb1f30c..623c298 100644 --- a/payloads/external/SeaBIOS/Kconfig.name +++ b/payloads/external/SeaBIOS/Kconfig.name @@ -1,6 +1,7 @@ config PAYLOAD_SEABIOS bool "SeaBIOS" depends on ARCH_X86 + select PAYLOAD_BUILD_SEABIOS help Select this option if you want to build a coreboot image with a SeaBIOS payload. If you don't know what this is