payloads/external/LinuxBoot: Adopt u-root change

The u-root toolkit dropped the original uinit bootloader in the master
branch and respectively the systemboot-option in templates.go. In
consequence the LinuxBoot builds will boot into the u-root shell and
waiting for input. This commit enables the reuse of the -uinitcmd flag
to specify a command, which runs after the u-root init-process.

Systemboot as a bootloader wrapper will mimic a BIOS/UEFI boot device
selection. Other preselections, i.e. stboot and boot2 are implemented as
well. Custom strings or programs can be set as well, but they cannot
contain program flags. E.g. 'fbnetboot -class linuxboot' will not work,
because they aren't symlinkable.

This commit and its respective LinuxBoot builds with systemboot, none
and one custom option have been tested successfully on a UP squared
single board computer with the intended behavior.

Change-Id: I4ac3409040ea77a1836f90f43fba07d2cd05a952
Signed-off-by: Patrik Tesarik <mail@patrik-tesarik.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40316
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Patrik Tesarik 2020-04-11 16:17:35 +02:00 committed by Felix Held
parent b35c1f45a9
commit 868282e195
3 changed files with 57 additions and 0 deletions

View File

@ -258,6 +258,61 @@ config LINUXBOOT_UROOT_COMMANDS
List of additional modules to include, List of additional modules to include,
separated by space. (default "boot coreboot-app") separated by space. (default "boot coreboot-app")
if LINUXBOOT_UROOT_MAIN
choice
prompt "Choose a specific bootloader"
default SPECIFIC_BOOTLOADER_NONE
help
Specify a bootloader which starts after u-root init. It will be a symlink
to /bin/uinit. Default: None
config SPECIFIC_BOOTLOADER_NONE
bool "none"
help
Leave u-root to decide which bootloaders to load first after init, if
any at all. Most likely u-root will start into the defined u-root shell.
config SPECIFIC_BOOTLOADER_SYSTEMBOOT
bool "systemboot"
help
If systemboot has been used as a bootloader wrapper in the past,
enable this option. It will invoke -uinitcmd=systemboot and result in
a BIOS/UEFI BDS boot behavior.
config SPECIFIC_BOOTLOADER_BOOT2
bool "boot2"
config SPECIFIC_BOOTLOADER_PXEBOOT
bool "pxeboot"
config SPECIFIC_BOOTLOADER_STBOOT
bool "stboot"
config SPECIFIC_BOOTLOADER_CUSTOM
bool "custom"
endchoice
config SPECIFIC_BOOTLOADER_CUSTOM_CMD
string "Specify a custom program to start"
depends on SPECIFIC_BOOTLOADER_CUSTOM
help
This option will symlink the input to /bin/unit which will set it as the
first boot program after the u-root init. Program flags are not
symlinkable.
config LINUXBOOT_UROOT_UINITCMD
string
default "" if SPECIFIC_BOOTLOADER_NONE
default "systemboot" if SPECIFIC_BOOTLOADER_SYSTEMBOOT
default "boot2" if SPECIFIC_BOOTLOADER_BOOT2
default "pxeboot" if SPECIFIC_BOOTLOADER_PXEBOOT
default "stboot" if SPECIFIC_BOOTLOADER_STBOOT
default SPECIFIC_BOOTLOADER_CUSTOM_CMD if SPECIFIC_BOOTLOADER_CUSTOM
endif #LINUXBOOT_UROOT_MAIN
endif #LINUXBOOT_UROOT endif #LINUXBOOT_UROOT
endif #LINUXBOOT_BUILD_INITRAMFS endif #LINUXBOOT_BUILD_INITRAMFS

View File

@ -15,6 +15,7 @@ go_version_minor=$(shell echo $(go_version) | sed -nr 's/^([0-9]+)\.([0-9]+)\.?
uroot_args+=-build=$(CONFIG_LINUXBOOT_UROOT_FORMAT) uroot_args+=-build=$(CONFIG_LINUXBOOT_UROOT_FORMAT)
uroot_args+=-initcmd $(CONFIG_LINUXBOOT_UROOT_INITCMD) uroot_args+=-initcmd $(CONFIG_LINUXBOOT_UROOT_INITCMD)
uroot_args+=-uinitcmd=$(CONFIG_LINUXBOOT_UROOT_UINITCMD)
uroot_args+=-defaultsh $(CONFIG_LINUXBOOT_UROOT_SHELL) uroot_args+=-defaultsh $(CONFIG_LINUXBOOT_UROOT_SHELL)
ifneq (CONFIG_LINUXBOOT_UROOT_FILES,) ifneq (CONFIG_LINUXBOOT_UROOT_FILES,)
uroot_args+=$(foreach file,$(CONFIG_LINUXBOOT_UROOT_FILES),-files $(PWD)/$(file)) uroot_args+=$(foreach file,$(CONFIG_LINUXBOOT_UROOT_FILES),-files $(PWD)/$(file))

View File

@ -343,6 +343,7 @@ linuxboot:
CONFIG_LINUXBOOT_UROOT_VERSION=$(CONFIG_LINUXBOOT_UROOT_VERSION) \ CONFIG_LINUXBOOT_UROOT_VERSION=$(CONFIG_LINUXBOOT_UROOT_VERSION) \
CONFIG_LINUXBOOT_UROOT_FORMAT=$(CONFIG_LINUXBOOT_UROOT_FORMAT) \ CONFIG_LINUXBOOT_UROOT_FORMAT=$(CONFIG_LINUXBOOT_UROOT_FORMAT) \
CONFIG_LINUXBOOT_UROOT_INITCMD=$(CONFIG_LINUXBOOT_UROOT_INITCMD) \ CONFIG_LINUXBOOT_UROOT_INITCMD=$(CONFIG_LINUXBOOT_UROOT_INITCMD) \
CONFIG_LINUXBOOT_UROOT_UINITCMD=$(CONFIG_LINUXBOOT_UROOT_UINITCMD)\
CONFIG_LINUXBOOT_UROOT_SHELL=$(CONFIG_LINUXBOOT_UROOT_SHELL) \ CONFIG_LINUXBOOT_UROOT_SHELL=$(CONFIG_LINUXBOOT_UROOT_SHELL) \
CONFIG_LINUXBOOT_UROOT_COMMANDS=$(CONFIG_LINUXBOOT_UROOT_COMMANDS) \ CONFIG_LINUXBOOT_UROOT_COMMANDS=$(CONFIG_LINUXBOOT_UROOT_COMMANDS) \
CONFIG_LINUXBOOT_UROOT_FILES=$(CONFIG_LINUXBOOT_UROOT_FILES) \ CONFIG_LINUXBOOT_UROOT_FILES=$(CONFIG_LINUXBOOT_UROOT_FILES) \