Commit 1a12fdc461421b5a385ab5d7926e5425d429d48e
Committed by
Jagan Teki
1 parent
9ea3c35a32
Exists in
smarc_8mq_lf_v2020.04
and in
20 other branches
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 <andre.przywara@arm.com> Reviewed-by: Jagan Teki <jagan@openedev.com>
Showing 2 changed files with 37 additions and 0 deletions Side-by-side Diff
Kconfig
| ... | ... | @@ -241,6 +241,23 @@ |
| 241 | 241 | injected into the FIT creation (i.e. the blobs would have been pre- |
| 242 | 242 | processed before being added to the FIT image). |
| 243 | 243 | |
| 244 | +config SPL_FIT_SOURCE | |
| 245 | + string ".its source file for U-Boot FIT image" | |
| 246 | + depends on SPL_FIT | |
| 247 | + help | |
| 248 | + Specifies a (platform specific) FIT source file to generate the | |
| 249 | + U-Boot FIT image. This could specify further image to load and/or | |
| 250 | + execute. | |
| 251 | + | |
| 252 | +config SPL_FIT_GENERATOR | |
| 253 | + string ".its file generator script for U-Boot FIT image" | |
| 254 | + depends on SPL_FIT | |
| 255 | + help | |
| 256 | + Specifies a (platform specific) script file to generate the FIT | |
| 257 | + source file used to build the U-Boot FIT image file. This gets | |
| 258 | + passed a list of supported device tree file stub names to | |
| 259 | + include in the generated image. | |
| 260 | + | |
| 244 | 261 | endif # FIT |
| 245 | 262 | |
| 246 | 263 | config OF_BOARD_SETUP |
Makefile
| ... | ... | @@ -833,6 +833,10 @@ |
| 833 | 833 | cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ |
| 834 | 834 | $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT)) |
| 835 | 835 | |
| 836 | +quiet_cmd_mkfitimage = MKIMAGE $@ | |
| 837 | +cmd_mkfitimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -f $(U_BOOT_ITS) -E $@ \ | |
| 838 | + $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT)) | |
| 839 | + | |
| 836 | 840 | quiet_cmd_cat = CAT $@ |
| 837 | 841 | cmd_cat = cat $(filter-out $(PHONY), $^) > $@ |
| 838 | 842 | |
| ... | ... | @@ -952,6 +956,19 @@ |
| 952 | 956 | cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ |
| 953 | 957 | -DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $< |
| 954 | 958 | |
| 959 | +# Boards with more complex image requirments can provide an .its source file | |
| 960 | +# or a generator script | |
| 961 | +ifneq ($(CONFIG_SPL_FIT_SOURCE),"") | |
| 962 | +U_BOOT_ITS = $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) | |
| 963 | +else | |
| 964 | +ifneq ($(CONFIG_SPL_FIT_GENERATOR),"") | |
| 965 | +U_BOOT_ITS := u-boot.its | |
| 966 | +$(U_BOOT_ITS): FORCE | |
| 967 | + $(srctree)/$(CONFIG_SPL_FIT_GENERATOR) \ | |
| 968 | + $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@ | |
| 969 | +endif | |
| 970 | +endif | |
| 971 | + | |
| 955 | 972 | ifdef CONFIG_SPL_LOAD_FIT |
| 956 | 973 | MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ |
| 957 | 974 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ |
| ... | ... | @@ -983,6 +1000,9 @@ |
| 983 | 1000 | u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \ |
| 984 | 1001 | $(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin dts/dt.dtb,u-boot.bin) FORCE |
| 985 | 1002 | $(call if_changed,mkimage) |
| 1003 | + | |
| 1004 | +u-boot.itb: u-boot-nodtb.bin dts/dt.dtb $(U_BOOT_ITS) FORCE | |
| 1005 | + $(call if_changed,mkfitimage) | |
| 986 | 1006 | |
| 987 | 1007 | u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE |
| 988 | 1008 | $(call if_changed,mkimage) |