From 85c07a5a379e5874aef0e5a0560536a2e6fa6114 Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Wed, 26 Apr 2017 01:32:38 +0100 Subject: Kconfig: fix SPL_FIT dependency SPL_FIT obviously requires libfdt in SPL, so let Kconfig express that by selecting SPL_OF_LIBFDT. Also make the actual options that users want (SPL signature and SPL FIT loading) visible in the menu and let them select the SPL_FIT as a requirement. Also remove the now redundant SPL_OF_LIBFDT from those Kconfigs that had it in for the SPL FIT loading feature. Signed-off-by: Andre Przywara Reviewed-by: Simon Glass [Remove change from configs/evb-rk3399_defconfig] Signed-off-by: Jagan Teki --- Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Kconfig') diff --git a/Kconfig b/Kconfig index 1cf990dfce..deacec44f2 100644 --- a/Kconfig +++ b/Kconfig @@ -208,15 +208,17 @@ config FIT_IMAGE_POST_PROCESS config SPL_FIT bool "Support Flattened Image Tree within SPL" depends on SPL + select SPL_OF_LIBFDT config SPL_FIT_SIGNATURE bool "Enable signature verification of FIT firmware within SPL" - depends on SPL_FIT depends on SPL_DM + select SPL_FIT select SPL_RSA config SPL_LOAD_FIT bool "Enable SPL loading U-Boot as a FIT" + select SPL_FIT help Normally with the SPL framework a legacy image is generated as part of the build. This contains U-Boot along with information as to -- cgit v1.2.3 From 1a12fdc461421b5a385ab5d7926e5425d429d48e Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Wed, 26 Apr 2017 01:32:45 +0100 Subject: Makefile: add rules to generate SPL FIT images Some platforms require more complex U-Boot images than we can easily generate via the mkimage command line, for instance to load additional image files. Introduce a CONFIG_SPL_FIT_SOURCE and CONFIG_SPL_FIT_GENERATOR symbol, which can either hold an .its source file describing the image layout, or, in the second case, a generator tool (script) to create such a source file. This script gets passed the list of device tree files from the CONFIG_OF_LIST variable. A platform or board can define either of those in their defconfig file to allow an easy building of such an image. Signed-off-by: Andre Przywara Reviewed-by: Jagan Teki --- Kconfig | 17 +++++++++++++++++ Makefile | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+) (limited to 'Kconfig') diff --git a/Kconfig b/Kconfig index deacec44f2..335392f022 100644 --- a/Kconfig +++ b/Kconfig @@ -241,6 +241,23 @@ config SPL_FIT_IMAGE_POST_PROCESS injected into the FIT creation (i.e. the blobs would have been pre- processed before being added to the FIT image). +config SPL_FIT_SOURCE + string ".its source file for U-Boot FIT image" + depends on SPL_FIT + help + Specifies a (platform specific) FIT source file to generate the + U-Boot FIT image. This could specify further image to load and/or + execute. + +config SPL_FIT_GENERATOR + string ".its file generator script for U-Boot FIT image" + depends on SPL_FIT + help + Specifies a (platform specific) script file to generate the FIT + source file used to build the U-Boot FIT image file. This gets + passed a list of supported device tree file stub names to + include in the generated image. + endif # FIT config OF_BOARD_SETUP diff --git a/Makefile b/Makefile index bcab72697f..1b7cab2121 100644 --- a/Makefile +++ b/Makefile @@ -833,6 +833,10 @@ quiet_cmd_mkimage = MKIMAGE $@ cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT)) +quiet_cmd_mkfitimage = MKIMAGE $@ +cmd_mkfitimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -f $(U_BOOT_ITS) -E $@ \ + $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT)) + quiet_cmd_cat = CAT $@ cmd_cat = cat $(filter-out $(PHONY), $^) > $@ @@ -952,6 +956,19 @@ quiet_cmd_cpp_cfg = CFG $@ cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ -DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $< +# Boards with more complex image requirments can provide an .its source file +# or a generator script +ifneq ($(CONFIG_SPL_FIT_SOURCE),"") +U_BOOT_ITS = $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) +else +ifneq ($(CONFIG_SPL_FIT_GENERATOR),"") +U_BOOT_ITS := u-boot.its +$(U_BOOT_ITS): FORCE + $(srctree)/$(CONFIG_SPL_FIT_GENERATOR) \ + $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@ +endif +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) \ @@ -984,6 +1001,9 @@ u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \ $(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin dts/dt.dtb,u-boot.bin) FORCE $(call if_changed,mkimage) +u-boot.itb: u-boot-nodtb.bin dts/dt.dtb $(U_BOOT_ITS) FORCE + $(call if_changed,mkfitimage) + u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE $(call if_changed,mkimage) -- cgit v1.2.3 From d29adf8eef4e9557326fd0bc09a08c7dfa688eab Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Wed, 26 Apr 2017 01:32:48 +0100 Subject: sunxi: enable automatic FIT build for 64-bit SoCs The Allwinner SoCs with 64-bit cores use an ARM Trusted Firmware binary, which needs to be loaded alongside U-Boot proper. Set the respective Kconfig options to let them select this feature and also automatically build the FIT image. Signed-off-by: Andre Przywara Acked-by: Maxime Ripard [Rename Kconfig path to arch/arm/mach-sunxi/Kconfig] Signed-off-by: Jagan Teki Reviewed-by: Jagan Teki --- Kconfig | 1 + arch/arm/mach-sunxi/Kconfig | 4 ++++ include/configs/sunxi-common.h | 4 ++++ 3 files changed, 9 insertions(+) (limited to 'Kconfig') diff --git a/Kconfig b/Kconfig index 335392f022..8e773b8a86 100644 --- a/Kconfig +++ b/Kconfig @@ -252,6 +252,7 @@ config SPL_FIT_SOURCE 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 help Specifies a (platform specific) script file to generate the FIT source file used to build the U-Boot FIT image file. This gets diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 8d9900e00b..7ced838d6a 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -143,12 +143,16 @@ config MACH_SUN50I select SUNXI_GEN_SUN6I select SUNXI_HIGH_SRAM select SUPPORT_SPL + select FIT + select SPL_LOAD_FIT config MACH_SUN50I_H5 bool "sun50i (Allwinner H5)" select ARM64 select MACH_SUNXI_H3_H5 select SUNXI_HIGH_SRAM + select FIT + select SPL_LOAD_FIT endchoice diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 0511397a5b..3f86cefe0f 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -32,6 +32,10 @@ # define CONFIG_MACH_TYPE_COMPAT_REV 1 #endif +#ifdef CONFIG_ARM64 +#define CONFIG_BUILD_TARGET "u-boot.itb" +#endif + /* Serial & console */ #define CONFIG_SYS_NS16550_SERIAL /* ns16550 reg in the low bits of cpu reg */ -- cgit v1.2.3