diff options
Diffstat (limited to 'images/Makefile')
-rw-r--r-- | images/Makefile | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/images/Makefile b/images/Makefile index a148cf4176..c0105609ee 100644 --- a/images/Makefile +++ b/images/Makefile @@ -57,8 +57,9 @@ $(pbl-lds): $(obj)/../arch/$(SRCARCH)/lib/pbl.lds.S FORCE $(call if_changed_dep,cpp_lds_S) quiet_cmd_elf__ ?= LD $@ - cmd_elf__ ?= $(LD) $(LDFLAGS_pbl) --gc-sections \ + cmd_elf__ ?= $(LD) $(LDFLAGS_$(patsubst .%,%,$(suffix $(@F)))) \ -e $(2) -Map $@.map $(LDFLAGS_$(@F)) -o $@ \ + --gc-sections --defsym=__pbl_board_entry=$(2) \ -T $(pbl-lds) \ --whole-archive $(BAREBOX_PBL_OBJS) $(obj)/piggy.o \ $(obj)/sha_sum.o @@ -69,8 +70,14 @@ $(obj)/%.pbl: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(obj)/piggy.o $(obj)/sha_sum.o FOR $(call if_changed,elf__,$(*F)) $(call cmd,prelink__) +$(obj)/%.elf: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(obj)/piggy.o $(obj)/sha_sum.o FORCE + $(call if_changed,elf__,$(*F)) + $(call cmd,prelink__) + $(obj)/%.pblb: $(obj)/%.pbl FORCE $(call if_changed,objcopy_bin,$(*F)) + $(Q)$(OBJCOPY) -O binary --only-section=.missing_fw $< $@.missing-firmware + $(Q)[ -s $@.missing-firmware ] || rm -f $@.missing-firmware $(call cmd,check_file_size,$@,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) # @@ -108,27 +115,24 @@ $(obj)/%.pblb: $(obj)/%.pbl FORCE $(obj)/%.s: $(obj)/% FORCE $(call if_changed,disasm) -suffix_$(CONFIG_IMAGE_COMPRESSION_GZIP) = gzip -suffix_$(CONFIG_IMAGE_COMPRESSION_LZO) = lzo -suffix_$(CONFIG_IMAGE_COMPRESSION_LZ4) = lz4 -suffix_$(CONFIG_IMAGE_COMPRESSION_XZKERN) = xzkern -suffix_$(CONFIG_IMAGE_COMPRESSION_NONE) = comp_copy +quiet_cmd_fit = FIT $@ +cmd_fit = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) \ + -D'$(subst -,_,$(*F))_dts=1' $(foreach f,$< $(2),-include '$(f)') /dev/null ; \ + mkimage -f $(dtc-tmp) $@ -E \ + cat $(depfile).pre $(depfile).dtc > $(depfile) + +$(obj)/%.fit: $(obj)/%.its FORCE + $(call if_changed,fit) $(obj)/piggy.o: $(obj)/barebox.z FORCE $(obj)/sha_sum.o: $(obj)/barebox.sha.bin FORCE -quiet_cmd_sha256bin ?= SHA-BIN $@ - cmd_sha256bin ?= printf "$(shell awk '{printf $$1}' < $(obj)/barebox.sum | sed -e 's/../\\x&/g' )" > $@ - -quiet_cmd_sha256sum ?= SHA $@ - cmd_sha256sum ?= sha256sum $(obj)/barebox.z > $@ - $(obj)/barebox.sha.bin: $(obj)/barebox.sum FORCE $(call if_changed,sha256bin) $(obj)/barebox.sum: $(obj)/barebox.z FORCE - $(call if_changed,sha256sum) + $(call if_changed,sha256sum,$<) # barebox.z - compressed barebox binary @@ -138,10 +142,14 @@ $(obj)/barebox.z: $(obj)/../barebox.bin FORCE # %.img - create a copy from another file # ---------------------------------------------------------------- + +missing_fw = $(strip $(wildcard $(obj)/$(FILE_$(@F)).missing-firmware $(basename $(obj)/$(FILE_$(@F))).missing-firmware)) + .SECONDEXPANSION: $(obj)/%.img: $(obj)/$$(FILE_$$(@F)) $(Q)if [ -z $(FILE_$(@F)) ]; then echo "FILE_$(@F) empty!"; false; fi - $(call if_changed,shipped) + $(Q)$(if $(missing_fw),cat $(missing_fw) >$@.missing-firmware,rm -f $@.missing-firmware) + $(call if_changed,$(if $(missing_fw),delete,shipped)) board = $(srctree)/arch/$(SRCARCH)/boards objboard = $(objtree)/arch/$(SRCARCH)/boards @@ -163,6 +171,7 @@ include $(srctree)/images/Makefile.rockchip include $(srctree)/images/Makefile.socfpga include $(srctree)/images/Makefile.stm32mp include $(srctree)/images/Makefile.tegra +include $(srctree)/images/Makefile.versatile include $(srctree)/images/Makefile.vexpress include $(srctree)/images/Makefile.xburst include $(srctree)/images/Makefile.at91 @@ -170,6 +179,7 @@ include $(srctree)/images/Makefile.zynq include $(srctree)/images/Makefile.zynqmp include $(srctree)/images/Makefile.layerscape include $(srctree)/images/Makefile.riscv +include $(srctree)/images/Makefile.k3 pblb-$(CONFIG_BOARD_GENERIC_DT) += start_dt_2nd @@ -204,10 +214,15 @@ multi-image-build: images: $(image-y-path) $(flash-link) $(flash-list) FORCE @echo "images built:" - @for i in $(image-y); do echo $$i; done + @for i in $(image-y); do \ + if [ -s $(obj)/$$i ]; then echo $$i; \ + else >&2 echo "** $$i skipped due to missing firmware **"; \ + $(if $(CONFIG_MISSING_FIRMWARE_ERROR), >&2 sed 's/^/\t/' <$(obj)/$${i}.missing-firmware; missing=1;) \ + fi; done; if [ -n "$$missing" ]; then \ + echo >&2 "Firmware missing in CONFIG_MISSING_FIRMWARE_ERROR=y build"; exit 1; fi __images_install: images - @for i in $(image-y-path); do install -t "$(INSTALL_PATH)" $$i; done + @for i in $(image-y-path); do if [ -s $$i ]; then install -t "$(INSTALL_PATH)" $$i; fi; done PHONY += __images_install @@ -215,10 +230,11 @@ $(flash-link): $(link-dest) FORCE $(call if_changed,ln) $(flash-list): $(image-y-path) - @for i in $^; do echo $$i; done > $@ + @for i in $^; do if [ -s $$i ]; then echo $$i; fi; done > $@ -clean-files := *.pbl *.pblb *.map start_*.imximg *.img barebox.z start_*.kwbimg \ +clean-files := *.pbl *.pblb *.elf *.map start_*.imximg *.img barebox.z start_*.kwbimg \ start_*.kwbuartimg *.socfpgaimg *.mlo *.t20img *.t20img.cfg *.t30img \ - *.t30img.cfg *.t124img *.t124img.cfg *.mlospi *.mlo *.mxsbs *.mxssd \ - start_*.simximg start_*.usimximg *.zynqimg *.image *.swapped + *.t30img.cfg *.t124img *.t124img.cfg *.mlospi *.mlo *.mxsbs *.mxssd *.rkimg \ + start_*.simximg start_*.usimximg start_*.pimximg start_*.psimximg *.zynqimg \ + *.image *.swapped *.missing-firmware clean-files += pbl.lds |