@@ -517,10 +517,13 @@ config SPL_FIT_SOURCE
U-Boot FIT image. This could specify further image to load and/or
execute.
+config SPL_FIT_TEMPLATE
+ bool "Use Dust template based .its file generation for U-Boot FIT image"
+ default y if SPL_LOAD_FIT && ARCH_SUNXI
+
config SPL_FIT_GENERATOR
string ".its file generator script for U-Boot FIT image"
depends on SPL_FIT
- default "board/sunxi/mksunxi_fit_atf.sh" if SPL_LOAD_FIT && ARCH_SUNXI
default "arch/arm/mach-rockchip/make_fit_atf.py" if SPL_LOAD_FIT && ARCH_ROCKCHIP
default "arch/arm/mach-zynqmp/mkimage_fit_atf.sh" if SPL_LOAD_FIT && ARCH_ZYNQMP
default "arch/riscv/lib/mkimage_fit_opensbi.sh" if SPL_LOAD_FIT && RISCV
@@ -1290,6 +1290,14 @@ $(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE
endif
endif
+ifeq ($(CONFIG_SPL_FIT_TEMPLATE),y)
+U_BOOT_ITS := u-boot.its
+include $(srctree)/include/u-boot-its.mk
+sinclude $(srctree)/board/$(BOARDDIR)/u-boot-its.mk
+$(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) $(U_BOOT_ITS_JSON) FORCE
+ $(call cmd,gen_its)
+endif
+
ifdef CONFIG_SPL_LOAD_FIT
MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
deleted file mode 100755
@@ -1,87 +0,0 @@
-#!/bin/sh
-#
-# script to generate FIT image source for 64-bit sunxi boards with
-# ARM Trusted Firmware and multiple device trees (given on the command line)
-#
-# usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
-
-[ -z "$BL31" ] && BL31="bl31.bin"
-
-if [ ! -f $BL31 ]; then
- echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
- echo "Please read the section on ARM Trusted Firmware (ATF) in board/sunxi/README.sunxi64" >&2
- BL31=/dev/null
-fi
-
-if grep -q "^CONFIG_MACH_SUN50I_H6=y" .config; then
- BL31_ADDR=0x104000
-else
- BL31_ADDR=0x44000
-fi
-
-cat << __HEADER_EOF
-/dts-v1/;
-
-/ {
- description = "Configuration to load ATF before U-Boot";
- #address-cells = <1>;
-
- images {
- uboot {
- description = "U-Boot (64-bit)";
- data = /incbin/("u-boot-nodtb.bin");
- type = "standalone";
- arch = "arm64";
- compression = "none";
- load = <0x4a000000>;
- };
- atf {
- description = "ARM Trusted Firmware";
- data = /incbin/("$BL31");
- type = "firmware";
- arch = "arm64";
- compression = "none";
- load = <$BL31_ADDR>;
- entry = <$BL31_ADDR>;
- };
-__HEADER_EOF
-
-cnt=1
-for dtname in $*
-do
- cat << __FDT_IMAGE_EOF
- fdt_$cnt {
- description = "$(basename $dtname .dtb)";
- data = /incbin/("$dtname");
- type = "flat_dt";
- compression = "none";
- };
-__FDT_IMAGE_EOF
- cnt=$((cnt+1))
-done
-
-cat << __CONF_HEADER_EOF
- };
- configurations {
- default = "config_1";
-
-__CONF_HEADER_EOF
-
-cnt=1
-for dtname in $*
-do
- cat << __CONF_SECTION_EOF
- config_$cnt {
- description = "$(basename $dtname .dtb)";
- firmware = "uboot";
- loadables = "atf";
- fdt = "fdt_$cnt";
- };
-__CONF_SECTION_EOF
- cnt=$((cnt+1))
-done
-
-cat << __ITS_EOF
- };
-};
-__ITS_EOF
new file mode 100644
@@ -0,0 +1,19 @@
+BL31 := $(CURDIR)/bl31.bin
+BL31_ADDR := $(if $(CONFIG_MACH_SUN50I_H6),0x104000,0x104000)
+
+$(BL31):
+ $(call check_its_dep,$@,BL31)
+
+U_BOOT_ITS_DEPS += $(BL31)
+
+quiet_cmd_gen_its_json = GENITS_JSON $@
+define cmd_gen_its_json
+ echo '{ \
+ "bl31": "$(BL31)", \
+ "load": "$(BL31_ADDR)", \
+ "dtbs": [ \
+ $(call gen_its_json_dtbs) \
+ ] \
+ }' > $@
+endef
+
new file mode 100644
@@ -0,0 +1,45 @@
+/dts-v1/;
+
+/ {
+ description = "Configuration to load ATF before U-Boot";
+ #address-cells = <1>;
+
+ images {
+ uboot {
+ description = "U-Boot (64-bit)";
+ data = /incbin/("u-boot-nodtb.bin");
+ type = "standalone";
+ arch = "arm64";
+ compression = "none";
+ load = <0x4a000000>;
+ };
+ atf {
+ description = "ARM Trusted Firmware";
+ data = /incbin/("{bl31}");
+ type = "firmware";
+ arch = "arm64";
+ compression = "none";
+ load = <{load}>;
+ entry = <{load}>;
+ };
+{#dtbs}
+ fdt_{@idx}{.}{/idx} {
+ description = "{name}";
+ data = /incbin/("{path}");
+ type = "flat_dt";
+ compression = "none";
+ };
+{/dtbs}
+ };
+ configurations {
+ default = "config_0";
+{#dtbs}
+ config_{@idx}{.}{/idx} {
+ description = "{name}";
+ firmware = "uboot";
+ loadables = "atf";
+ fdt = "fdt_{@idx}{.}{/idx}";
+ };
+{/dtbs}
+ };
+};
Replace current .its file based generator with generic Dust template based approach, including the proper .its file dependency tracking, so working images are produced by default. bl31.bin file is mandatory for functional, usable and bootable binaries, and currently missing bl31.bin is not hard error, just a warning. Signed-off-by: Petr ?tetiar <ynezz at true.cz> --- Kconfig | 5 +- Makefile | 8 ++++ board/sunxi/mksunxi_fit_atf.sh | 87 ---------------------------------- board/sunxi/u-boot-its.mk | 19 ++++++++ board/sunxi/u-boot.its.dust | 45 ++++++++++++++++++ 5 files changed, 76 insertions(+), 88 deletions(-) delete mode 100755 board/sunxi/mksunxi_fit_atf.sh create mode 100644 board/sunxi/u-boot-its.mk create mode 100644 board/sunxi/u-boot.its.dust