summaryrefslogtreecommitdiffstats
path: root/images/Makefile
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2023-09-13 14:57:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2023-09-21 10:53:04 +0200
commit3268f5175e566bf19c30a787f4e7e5a47c49eb10 (patch)
tree893078a262e9d690f527ced3f1110a62f07c0d09 /images/Makefile
parentde3da79362d036899e607571618db34c10c2f279 (diff)
downloadbarebox-3268f5175e566bf19c30a787f4e7e5a47c49eb10.tar.gz
barebox-3268f5175e566bf19c30a787f4e7e5a47c49eb10.tar.xz
kbuild: support generating stripped ELF files for PBL
For testing remoteproc and ELF loading mechanisms, it can be useful to have the consumed ELF files result from the barebox build itself. The *.pblb intermediate artifacts can be used for this purpose, but they are at least 64K larger than need be, because of generous alignment in addition to debug and symbol information. Let's add a separate %.elf target, that behaves like %.pblb with the difference that the result is stripped and alignment of sections on-disk is disabled. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230913125715.2142524-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'images/Makefile')
-rw-r--r--images/Makefile10
1 files changed, 7 insertions, 3 deletions
diff --git a/images/Makefile b/images/Makefile
index c1cb56f5b1..9739a15c06 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -57,9 +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 $@ \
- --defsym=__pbl_board_entry=$(2) \
+ --gc-sections --defsym=__pbl_board_entry=$(2) \
-T $(pbl-lds) \
--whole-archive $(BAREBOX_PBL_OBJS) $(obj)/piggy.o \
$(obj)/sha_sum.o
@@ -70,6 +70,10 @@ $(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
@@ -218,7 +222,7 @@ $(flash-link): $(link-dest) FORCE
$(flash-list): $(image-y-path)
@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 *.rkimg \
start_*.simximg start_*.usimximg *.zynqimg *.image *.swapped *.missing-firmware