From 3dda4dad1d3add373e2cc7d0c47badecf851eaa2 Mon Sep 17 00:00:00 2001 From: Bill XIE Date: Sat, 1 Jan 2022 11:56:00 +0800 Subject: payloads/external: Add more option related to SeaBIOS and GRUB2 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. But more option is added addition to "SeaGRUB": now GRUB2 and SeaBIOS can be built as secondary payloads, and "SeaGRUB" is now implemented as "Primary SeaBIOS + Secondary GRUB2 (selected) + config files". Signed-off-by: Bill XIE Change-Id: Ie681fa231abfe4a8f1e4510b3c17957550a9d2f8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/60640 Tested-by: build bot (Jenkins) Reviewed-by: Martin L Roth Reviewed-by: Paul Menzel --- payloads/external/Makefile.inc | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'payloads/external/Makefile.inc') diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc index e805a07b0a..e2fb9c7279 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 @@ -61,7 +61,8 @@ etc/grub.cfg-required := the GRUB runtime configuration file ($(CONFIG_GRUB2_RUN # SeaBIOS SEABIOS_CC_OFFSET=$(if $(filter %ccache,$(HOSTCC)),2,1) -payloads/external/SeaBIOS/seabios/out/bios.bin.elf: $(DOTCONFIG) +SEABIOS_TARGET_PATH=payloads/external/SeaBIOS/seabios/out/bios.bin.elf +$(SEABIOS_TARGET_PATH): $(DOTCONFIG) $(MAKE) -C payloads/external/SeaBIOS \ HOSTCC="$(HOSTCC)" \ CC=$(word $(SEABIOS_CC_OFFSET),$(CC_x86_32)) \ @@ -88,9 +89,14 @@ payloads/external/SeaBIOS/seabios/out/bios.bin.elf: $(DOTCONFIG) CONFIG_CONSOLE_UART_BASE_ADDRESS=$(CONFIG_CONSOLE_UART_BASE_ADDRESS) \ CONFIG_SEABIOS_HARDWARE_IRQ=$(CONFIG_SEABIOS_HARDWARE_IRQ) -payloads/external/SeaBIOS/seabios/out/vgabios.bin: payloads/external/SeaBIOS/seabios/out/bios.bin.elf -payloads/external/SeaBIOS/seabios/.config: payloads/external/SeaBIOS/seabios/out/bios.bin.elf -payloads/external/SeaBIOS/seabios/out/autoversion.h: payloads/external/SeaBIOS/seabios/out/bios.bin.elf +payloads/external/SeaBIOS/seabios/out/vgabios.bin: $(SEABIOS_TARGET_PATH) +payloads/external/SeaBIOS/seabios/.config: $(SEABIOS_TARGET_PATH) +payloads/external/SeaBIOS/seabios/out/autoversion.h: $(SEABIOS_TARGET_PATH) + +cbfs-files-$(CONFIG_SEABIOS_SECONDARY_PAYLOAD) += img/seabios +img/seabios-file := $(SEABIOS_TARGET_PATH) +img/seabios-type := payload +img/seabios-compression := $(CBFS_SECONDARY_PAYLOAD_COMPRESS_FLAG) # add a SeaBIOS bootorder file ifneq ($(strip $(CONFIG_SEABIOS_BOOTORDER_FILE)),) @@ -122,6 +128,18 @@ $(call add_intermediate, seabios_thread_optionroms, $(CBFSTOOL)) $(CBFSTOOL) $< add-int -i 2 -n etc/threads endif +ifeq ($(CONFIG_PAYLOAD_SEAGRUB),y) +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 +endif + # Depthcharge payloads/external/depthcharge/depthcharge/build/depthcharge.elf depthcharge: $(DOTCONFIG) $(CBFSTOOL) @@ -189,6 +207,13 @@ payloads/external/FILO/filo/build/version.h: filo # Grub +GRUB_TARGET_PATH=payloads/external/GRUB2/grub2/build/default_payload.elf + +cbfs-files-$(CONFIG_GRUB2_SECONDARY_PAYLOAD) += img/grub2 +img/grub2-file := $(GRUB_TARGET_PATH) +img/grub2-type := payload +img/grub2-compression := $(CBFS_SECONDARY_PAYLOAD_COMPRESS_FLAG) + grub2: $(obj)/config.h $(MAKE) -C payloads/external/GRUB2 \ HOSTCC="$(HOSTCC)" \ @@ -201,7 +226,7 @@ grub2: $(obj)/config.h 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 -- cgit v1.2.3