x86: Allow building an SPL image for coreboot
authorSimon Glass <sjg@chromium.org>
Fri, 1 May 2020 03:21:40 +0000 (21:21 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Mon, 4 May 2020 07:28:28 +0000 (15:28 +0800)
Coreboot runs in 32-bit mode and cannot run a 64-bit U-Boot. To get around
this we can build a combined image with 32-bit SPL and 64-bit U-Boot. Add
a build rule and binman definition for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Makefile
arch/x86/cpu/coreboot/Kconfig
arch/x86/dts/coreboot-u-boot.dtsi [new file with mode: 0644]

index 6bb9cf55f2aa1c0456618725798ee78c50793cc8..cc99873062f0093bab218bb3c4cf711a0f48f04c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -926,6 +926,9 @@ ALL-$(CONFIG_EFI_STUB) += u-boot-payload.efi
 ifneq ($(BUILD_ROM)$(CONFIG_BUILD_ROM),)
 ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom
 endif
+ifeq ($(CONFIG_SYS_COREBOOT)$(CONFIG_SPL),yy)
+ALL-$(CONFIG_BINMAN) += u-boot-x86-with-spl.bin
+endif
 
 # Build a combined spl + u-boot image for sunxi
 ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_SPL),yy)
@@ -1626,6 +1629,9 @@ u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE
 endif
 endif
 
+u-boot-x86-with-spl.bin: spl/u-boot-spl.bin u-boot.bin FORCE
+       $(call if_changed,binman)
+
 ifneq ($(CONFIG_TEGRA),)
 ifneq ($(CONFIG_BINMAN),)
 # Makes u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin
index c8e6a889d023b25159e2d985c99cd182a6103492..497d6284ac19ddd6cec8752ddb3fae1db9f7b245 100644 (file)
@@ -25,5 +25,6 @@ config SYS_COREBOOT
        imply FS_CBFS
        imply CBMEM_CONSOLE
        imply X86_TSC_READ_BASE
+       select BINMAN if X86_64
 
 endif
diff --git a/arch/x86/dts/coreboot-u-boot.dtsi b/arch/x86/dts/coreboot-u-boot.dtsi
new file mode 100644 (file)
index 0000000..38efc48
--- /dev/null
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <config.h>
+
+/ {
+       binman {
+               filename = "u-boot-x86-with-spl.bin";
+               u-boot-spl {
+               };
+               u-boot {
+                       offset = <0x10000>;
+               };
+       };
+};