Maximilian Brune has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/84119?usp=email )
Change subject: [WIP] payloads/Linuxboot: Fix u-root build ......................................................................
[WIP] payloads/Linuxboot: Fix u-root build
Currently u-root doesn't build for various reasons.
1. The boot cmds have changed. Some have been removed and the default has changed to the 'boot' cmd for loading an OS. 2. The elvish shell has been removed as default shell. The gosh is now the default. 3. For some reason the -uroot-source parameter doesn't exist anymore? So instead we just cd into the u-root directory and build the initramfs there.
Build tested: | CONFIG_LINUXBOOT_COMPILE_KERNEL | CONFIG_LINUXBOOT_BUILD_INITRAMFS | ---------------------------------------------------------------------- | n | n | | n | y | | y | n | | y | y | ----------------------------------------------------------------------
Change-Id: If66238cec248deb3594de82f3adbc608516a2fc5 Signed-off-by: Maximilian Brune maximilian.brune@9elements.com --- M payloads/external/LinuxBoot/Kconfig M payloads/external/LinuxBoot/Makefile M payloads/external/LinuxBoot/targets/u-root.mk M payloads/external/Makefile.mk 4 files changed, 38 insertions(+), 45 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/19/84119/1
diff --git a/payloads/external/LinuxBoot/Kconfig b/payloads/external/LinuxBoot/Kconfig index 454b7c5..728eee3 100644 --- a/payloads/external/LinuxBoot/Kconfig +++ b/payloads/external/LinuxBoot/Kconfig @@ -57,8 +57,8 @@
config LINUXBOOT_KERNEL_PATH string "Path to kernel" - default "build/uImage" if LINUXBOOT_KERNEL_UIMAGE - default "build/bzImage" if LINUXBOOT_KERNEL_BZIMAGE + default "" + depends on !LINUXBOOT_COMPILE_KERNEL help The kernel path is either and absolute path or relative to the LinuxBoot directory @@ -142,7 +142,7 @@
config LINUXBOOT_INITRAMFS_PATH string "Path to initramfs" - default "build/initramfs_u-root.cpio" if LINUXBOOT_UROOT + default "payloads/external/LinuxBoot/build/initramfs" if LINUXBOOT_UROOT
if LINUXBOOT_BUILD_INITRAMFS
@@ -248,7 +248,7 @@
config LINUXBOOT_UROOT_SHELL string "default shell" - default "elvish" + default "gosh" help Default shell. Can be an absolute path or a u-root command name. (default "elvish") @@ -264,10 +264,10 @@
choice prompt "Choose a specific bootloader" - default SPECIFIC_BOOTLOADER_SYSTEMBOOT + default SPECIFIC_BOOTLOADER_BOOT help Specify a bootloader which starts after u-root init. It will be a symlink - to /bin/uinit. Default: systemboot + to /bin/uinit. Default: boot
config SPECIFIC_BOOTLOADER_NONE bool "none" @@ -275,21 +275,14 @@ 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_BOOT + bool "boot"
config SPECIFIC_BOOTLOADER_PXEBOOT bool "pxeboot"
-config SPECIFIC_BOOTLOADER_STBOOT - bool "stboot" +config SPECIFIC_BOOTLOADER_FITBOOT + bool "fitboot"
config SPECIFIC_BOOTLOADER_CUSTOM bool "custom" @@ -328,6 +321,7 @@
config LINUXBOOT_INITRAMFS_COMPRESSION_XZ bool "xz compression" + depends on LINUXBOOT_BUILD_INITRAMFS
endchoice
diff --git a/payloads/external/LinuxBoot/Makefile b/payloads/external/LinuxBoot/Makefile index fc2c818..83b8d6e 100644 --- a/payloads/external/LinuxBoot/Makefile +++ b/payloads/external/LinuxBoot/Makefile @@ -10,10 +10,6 @@ LINUX_ARCH-$(CONFIG_LINUXBOOT_RISCV_RV32) = riscv LINUX_ARCH-$(CONFIG_LINUXBOOT_RISCV_RV64) = riscv
-build/Image: $(CONFIG_LINUXBOOT_KERNEL_PATH) | build - ln -s -r $< $@ - - ifeq ($(CONFIG_LINUXBOOT_COMPILE_KERNEL),y) include targets/linux.mk endif @@ -21,30 +17,32 @@ include targets/u-root.mk endif
-ifeq ($(CONFIG_LINUXBOOT_BUILD_INITRAMFS),y) -build/initramfs: $(CONFIG_LINUXBOOT_INITRAMFS_PATH) | build -else -build/initramfs: -endif -ifeq ($(CONFIG_LINUXBOOT_INITRAMFS_COMPRESSION_XZ),y) - xz --keep --force --check=crc32 --lzma2=dict=1MiB $(CONFIG_LINUXBOOT_INITRAMFS_PATH) -endif - cp $(CONFIG_LINUXBOOT_INITRAMFS_PATH)$(CONFIG_LINUXBOOT_INITRAMFS_SUFFIX) $@ - ifeq ($(CONFIG_LINUXBOOT_KERNEL_BZIMAGE),y)
-build/bzImage: $(kernel_dir)/arch/x86/boot/bzImage build/initramfs | build +build/Image: $(kernel_dir)/arch/x86/boot/bzImage | build cp $< $@
else ifeq ($(CONFIG_LINUXBOOT_KERNEL_UIMAGE),y)
-build/target.dtb: $(CONFIG_LINUXBOOT_DTS_FILE) +build/target.dtb: $(CONFIG_LINUXBOOT_DTS_FILE) | build $(DTC) -o $@ $<
-build/uImage: build/vmlinux.bin.lzma build/initramfs build/target.dtb $(LINUX_ARCH-y)/kernel_fdt_lzma.its | build +build/Image: build/vmlinux.bin.lzma build/initramfs build/target.dtb $(LINUX_ARCH-y)/kernel_fdt_lzma.its | build mkimage -f $(LINUX_ARCH-y)/kernel_fdt_lzma.its $@
-endif # CONFIG_LINUXBOOT_KERNEL_BZIMAGE +else ifneq ($(CONFIG_LINUXBOOT_COMPILE_KERNEL),y) + +build/Image: $(CONFIG_LINUXBOOT_KERNEL_PATH) | build + cp $< $@ + +endif + +build/initramfs: build/initramfs_u-root.cpio | build +ifeq ($(CONFIG_LINUXBOOT_INITRAMFS_COMPRESSION_XZ),y) + xz --stdout --keep --force --check=crc32 --lzma2=dict=1MiB $< > $@ +else + cp $< $@ +endif
build: mkdir build diff --git a/payloads/external/LinuxBoot/targets/u-root.mk b/payloads/external/LinuxBoot/targets/u-root.mk index 90b48ea..158a605 100644 --- a/payloads/external/LinuxBoot/targets/u-root.mk +++ b/payloads/external/LinuxBoot/targets/u-root.mk @@ -39,12 +39,13 @@ git clone https://$(uroot_package) $(uroot_build) git -C $(uroot_build) checkout --quiet $(CONFIG_LINUXBOOT_UROOT_VERSION)
-$(uroot_build)/u-root: $(uroot_build) +$(uroot_build)/u-root: | $(uroot_build) cd $(uroot_build); \ go build -o u-root .
-#$(CONFIG_LINUXBOOT_INITRAMFS_PATH) build/initramfs_u-root.cpio: $(uroot_build)/u-root - GOARCH=$(UROOT_ARCH-y) $(uroot_build)/u-root \ - -uroot-source $(uroot_build) \ - $(uroot_args) -o build/initramfs_u-root.cpio $(uroot_cmds) + cd $(uroot_build); \ + echo "GOARCH=$(UROOT_ARCH-y) ./u-root $(uroot_args) -o initramfs_u-root.cpio $(uroot_cmds)" + cd $(uroot_build); \ + GOARCH=$(UROOT_ARCH-y) ./u-root $(uroot_args) -o initramfs_u-root.cpio $(uroot_cmds) + cp $(uroot_build)/initramfs_u-root.cpio $@ diff --git a/payloads/external/Makefile.mk b/payloads/external/Makefile.mk index ac5c856..86fa444 100644 --- a/payloads/external/Makefile.mk +++ b/payloads/external/Makefile.mk @@ -26,8 +26,8 @@ endif ifneq ($(strip $(call strip_quotes,$(CONFIG_LINUX_INITRD)$(CONFIG_LINUXBOOT_INITRAMFS_PATH))),) ifneq ($(CONFIG_LINUXBOOT_ARM64),y) - ADDITIONAL_PAYLOAD_CONFIG+=-I $(CONFIG_LINUX_INITRD)$(CONFIG_LINUXBOOT_INITRAMFS_PATH)$(CONFIG_LINUXBOOT_INITRAMFS_SUFFIX) - prebuilt-files += $(strip $(call strip_quotes,$(CONFIG_LINUX_INITRD)$(CONFIG_LINUXBOOT_INITRAMFS))) + ADDITIONAL_PAYLOAD_CONFIG+=-I $(CONFIG_LINUX_INITRD)$(CONFIG_LINUXBOOT_INITRAMFS_PATH) + prebuilt-files += $(strip $(call strip_quotes,$(CONFIG_LINUX_INITRD)$(CONFIG_LINUXBOOT_INITRAMFS_PATH))) endif endif endif @@ -397,7 +397,7 @@ endif # CONFIG_LINUXBOOT_CROSS_COMPILE_PATH endif # CONFIG_LINUXBOOT_CROSS_COMPILE .PHONY: linuxboot -payloads/external/LinuxBoot/build/Image linuxboot: +payloads/external/LinuxBoot/build/Image payloads/external/LinuxBoot/build/initramfs linuxboot: $(MAKE) -C payloads/external/LinuxBoot \ CPUS=$(CPUS) \ CONFIG_LINUXBOOT_X86_64=$(CONFIG_LINUXBOOT_X86_64) \ @@ -409,7 +409,6 @@ CONFIG_LINUXBOOT_CROSS_COMPILE_PATH=$(CONFIG_LINUXBOOT_CROSS_COMPILE_PATH) \ CONFIG_LINUXBOOT_BUILD_INITRAMFS=$(CONFIG_LINUXBOOT_BUILD_INITRAMFS) \ CONFIG_LINUXBOOT_INITRAMFS_PATH=$(CONFIG_LINUXBOOT_INITRAMFS_PATH) \ - CONFIG_LINUXBOOT_INITRAMFS_SUFFIX=$(CONFIG_LINUXBOOT_INITRAMFS_SUFFIX) \ CONFIG_LINUXBOOT_INITRAMFS_COMPRESSION_XZ=$(CONFIG_LINUXBOOT_INITRAMFS_COMPRESSION_XZ) \ CONFIG_LINUXBOOT_COMPILE_KERNEL=$(CONFIG_LINUXBOOT_COMPILE_KERNEL) \ CONFIG_LINUXBOOT_KERNEL_PATH=$(CONFIG_LINUXBOOT_KERNEL_PATH) \ @@ -425,7 +424,8 @@ CONFIG_LINUXBOOT_UROOT_SHELL=$(CONFIG_LINUXBOOT_UROOT_SHELL) \ CONFIG_LINUXBOOT_UROOT_COMMANDS=$(CONFIG_LINUXBOOT_UROOT_COMMANDS) \ CONFIG_LINUXBOOT_UROOT_FILES=$(CONFIG_LINUXBOOT_UROOT_FILES) \ - CONFIG_LINUXBOOT_DTS_FILE=$(CONFIG_LINUXBOOT_DTS_FILE) + CONFIG_LINUXBOOT_DTS_FILE=$(CONFIG_LINUXBOOT_DTS_FILE) \ + $(subst payloads/external/LinuxBoot/,,$@)
# BOOTBOOT