From 868282e195dd8700d0e3d2a26ba7295f21a15f56 Mon Sep 17 00:00:00 2001 From: Patrik Tesarik Date: Sat, 11 Apr 2020 16:17:35 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/40316 Tested-by: build bot (Jenkins) Reviewed-by: Christian Walter Reviewed-by: Arthur Heymans --- payloads/external/LinuxBoot/Kconfig | 55 +++++++++++++++++++++++++++ payloads/external/LinuxBoot/targets/u-root.mk | 1 + payloads/external/Makefile.inc | 1 + 3 files changed, 57 insertions(+) (limited to 'payloads/external') diff --git a/payloads/external/LinuxBoot/Kconfig b/payloads/external/LinuxBoot/Kconfig index b4bb05333a..edd4779306 100644 --- a/payloads/external/LinuxBoot/Kconfig +++ b/payloads/external/LinuxBoot/Kconfig @@ -258,6 +258,61 @@ config LINUXBOOT_UROOT_COMMANDS List of additional modules to include, 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_BUILD_INITRAMFS diff --git a/payloads/external/LinuxBoot/targets/u-root.mk b/payloads/external/LinuxBoot/targets/u-root.mk index 7e5444141d..e673aabf11 100644 --- a/payloads/external/LinuxBoot/targets/u-root.mk +++ b/payloads/external/LinuxBoot/targets/u-root.mk @@ -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+=-initcmd $(CONFIG_LINUXBOOT_UROOT_INITCMD) +uroot_args+=-uinitcmd=$(CONFIG_LINUXBOOT_UROOT_UINITCMD) uroot_args+=-defaultsh $(CONFIG_LINUXBOOT_UROOT_SHELL) ifneq (CONFIG_LINUXBOOT_UROOT_FILES,) uroot_args+=$(foreach file,$(CONFIG_LINUXBOOT_UROOT_FILES),-files $(PWD)/$(file)) diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc index 38e7dad0c6..7bdf9b094e 100644 --- a/payloads/external/Makefile.inc +++ b/payloads/external/Makefile.inc @@ -343,6 +343,7 @@ linuxboot: CONFIG_LINUXBOOT_UROOT_VERSION=$(CONFIG_LINUXBOOT_UROOT_VERSION) \ CONFIG_LINUXBOOT_UROOT_FORMAT=$(CONFIG_LINUXBOOT_UROOT_FORMAT) \ 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_COMMANDS=$(CONFIG_LINUXBOOT_UROOT_COMMANDS) \ CONFIG_LINUXBOOT_UROOT_FILES=$(CONFIG_LINUXBOOT_UROOT_FILES) \ -- cgit v1.2.3