sunxi: Support building a SPL as a TOC0 image
authorSamuel Holland <samuel@sholland.org>
Fri, 18 Mar 2022 05:00:45 +0000 (00:00 -0500)
committerAndre Przywara <andre.przywara@arm.com>
Mon, 4 Apr 2022 22:24:17 +0000 (23:24 +0100)
Now that mkimage can generate TOC0 images, and the SPL can interpret
them, hook up the build infrastructure so the user can choose which
image type to build. Since the absolute load address is stored in the
TOC0 header, that information must be passed to mkimage.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
arch/arm/mach-sunxi/Kconfig
board/sunxi/Kconfig [new file with mode: 0644]
scripts/Makefile.spl

index e5ed1d9..1f43b25 100644 (file)
@@ -1047,6 +1047,8 @@ config BLUETOOTH_DT_DEVICE_FIXUP
          The used address is "bdaddr" if set, and "ethaddr" with the LSB
          flipped elsewise.
 
+source "board/sunxi/Kconfig"
+
 endif
 
 config CHIP_DIP_SCAN
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
new file mode 100644 (file)
index 0000000..084a8b0
--- /dev/null
@@ -0,0 +1,24 @@
+choice
+       prompt "SPL Image Type"
+       default SPL_IMAGE_TYPE_SUNXI_EGON
+
+config SPL_IMAGE_TYPE_SUNXI_EGON
+       bool "eGON (normal)"
+       help
+         Select this option to embed the SPL binary in an eGON.BT0 image,
+         which is compatible with the normal boot ROM (NBROM).
+
+         This is usually the correct option to choose.
+
+config SPL_IMAGE_TYPE_SUNXI_TOC0
+       bool "TOC0 (secure)"
+       help
+         Select this option to embed the SPL binary in a TOC0 image,
+         which is compatible with the secure boot ROM (SBROM).
+
+endchoice
+
+config SPL_IMAGE_TYPE
+       string
+       default "sunxi_egon" if SPL_IMAGE_TYPE_SUNXI_EGON
+       default "sunxi_toc0" if SPL_IMAGE_TYPE_SUNXI_TOC0
index 16b5a3d..6ad82ce 100644 (file)
@@ -411,7 +411,10 @@ endif
 $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE
        $(call if_changed,mkimage)
 
-MKIMAGEFLAGS_sunxi-spl.bin = -A $(ARCH) -T sunxi_egon \
+MKIMAGEFLAGS_sunxi-spl.bin = \
+       -A $(ARCH) \
+       -T $(CONFIG_SPL_IMAGE_TYPE) \
+       -a $(CONFIG_SPL_TEXT_BASE) \
        -n $(CONFIG_DEFAULT_DEVICE_TREE)
 
 OBJCOPYFLAGS_u-boot-spl-dtb.hex := -I binary -O ihex --change-address=$(CONFIG_SPL_TEXT_BASE)