summaryrefslogtreecommitdiffstats
path: root/images/Makefile
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-10-09 15:28:12 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-12-03 09:17:09 +0100
commit5a1a5ed2537d7d12f851f3778707681d6c08d6e8 (patch)
tree730e26cba815bdca0849115b1207ff2dcfe4c52e /images/Makefile
parent4cd223777314233e681c3eef54ead81932d891fc (diff)
downloadbarebox-5a1a5ed2537d7d12f851f3778707681d6c08d6e8.tar.gz
barebox-5a1a5ed2537d7d12f851f3778707681d6c08d6e8.tar.xz
ARM: images: use piggydata
The way we assemble the multi images on ARM is rather complicated and error prone. We currently cat the compressed barebox image behind the PBL executable and need some magic to obtain the size of the payload and also have to do tricks to reliably get a pointer to the compressed image. This patch switches over to compile the compressed payload into the PBL image itself which has proven to work for the single PBL case and for the ARM Linux Kernel aswell. The goal is to unify the single PBL and the multi PBL cases together in the future to get an easier startup path for ARM. This patch has been tested on the i.MX53 QSB, i.MX53 Vincell, Beaglebone black (both MLO and 2nd stage) and a Phytec phyFLEX i.MX6 board. SoCFPGA Arria10 has also be changed slightly with this patch. We used to generate a single image (barebox-socfpga-achilles.img) which was used as xload image and full image. We now instead generate two images: barebox-socfpga-achilles-xload.img and barebox-socfpga-achilles.img, the former loaded by the ROM and the latter loaded by the xload image. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'images/Makefile')
-rw-r--r--images/Makefile44
1 files changed, 17 insertions, 27 deletions
diff --git a/images/Makefile b/images/Makefile
index 5c4d99ac5a..4c6d486f08 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -6,14 +6,12 @@
# encapsulated in SoC (or SoC boot type) specific image formats.
#
# The basic idea here is that we generate a single barebox main binary. This
-# is compressed and prepended with a self extractor, generated as barebox.x.
-# barebox.x is then prepended with different board specific pbls. The pbls
+# is compressed and included into a board specific PBL image. The PBL images
# are generally named after their entrypoints. So a pcm038 specific pbl will
# generate the following files:
#
# start_imx27_pcm038.pbl - The ELF file, linked with the entrypoint start_imx27_pcm038
# start_imx27_pcm038.pblb - The raw binary of the above.
-# start_imx27_pcm038.pblx - The pblb appended with barebox.x
# start_imx27_pcm038.pbl.map - The linker map file
# start_imx27_pcm038.pbl.s - the disassembled ELF, generated with:
# make images/start_imx27_pcm038.pbl.s
@@ -25,21 +23,21 @@
#
# For CONFIG_MACH_FREESCALE_MX51_PDK build barebox-imx51-babbage.img
#
-## FILE_barebox-imx51-babbage.img = start_imx51_babbage.pblx.imximg
+## FILE_barebox-imx51-babbage.img = start_imx51_babbage.pblb.imximg
#
# barebox-imx51-babbage.img should be generated (copied) from
-# start_imx51_babbage.pblx.imximg. This copy process is only done so that we
+# start_imx51_babbage.pblb.imximg. This copy process is only done so that we
# can generate images with a sane name. So what we really need for this
# board is a i.MX specific image, a .imximg
#
-## CFG_start_imx51_babbage.pblx.imximg = $(board)/freescale-mx51-pdk/flash-header.imxcfg
+## CFG_start_imx51_babbage.pblb.imximg = $(board)/freescale-mx51-pdk/flash-header.imxcfg
#
-# The .imximg can be generated from a .pblx using a rule specified in Makefile.imx.
+# The .imximg can be generated from a .pblb using a rule specified in Makefile.imx.
# The configfile needed for this image is specified with CFG_<filename> = <configfile>
#
-## pblx-$(CONFIG_MACH_FREESCALE_MX51_PDK) += start_imx51_babbage
+## pblb-$(CONFIG_MACH_FREESCALE_MX51_PDK) += start_imx51_babbage
#
-# For this image we need a pblx (self extracting barebox binary) with
+# For this image we need a pblb (self extracting barebox binary) with
# start_imx51_babbage as entrypoint. start_imx51_babbage will be used
# both as entrypoint and as filename
#
@@ -57,27 +55,18 @@ quiet_cmd_elf__ ?= LD $@
cmd_elf__ ?= $(LD) $(LDFLAGS_barebox) --gc-sections -pie \
-e $(2) -Map $@.map $(LDFLAGS_$(@F)) -o $@ \
-T $(pbl-lds) \
- --start-group $(barebox-pbl-common) --end-group
+ --start-group $(barebox-pbl-common) $(obj)/piggy.o --end-group
PBL_CPPFLAGS += -fdata-sections -ffunction-sections
-$(obj)/%.pbl: $(pbl-lds) $(barebox-pbl-common) FORCE
+piggy_o := piggy.$(suffix_y).o
+
+$(obj)/%.pbl: $(pbl-lds) $(barebox-pbl-common) $(obj)/piggy.o FORCE
$(call if_changed,elf__,$(*F))
$(obj)/%.pblb: $(obj)/%.pbl FORCE
$(call if_changed,objcopy_bin,$(*F))
-quiet_cmd_pblx ?= PBLX $@
- cmd_pblx ?= cat $(obj)/$(patsubst %.pblx,%.pblb,$(2)) > $@; \
- $(call size_append, $(obj)/barebox.z) >> $@; \
- cat $(obj)/barebox.z >> $@; \
- $(objtree)/scripts/fix_size -f $@
-
-$(obj)/%.pblx: $(obj)/%.pblb $(obj)/barebox.z FORCE
- $(call if_changed,pblx,$(@F))
- $(call cmd,check_file_size,$@,$(CONFIG_BAREBOX_MAX_PBLX_SIZE))
-
-
$(obj)/%.s: $(obj)/% FORCE
$(call if_changed,disasm)
@@ -87,6 +76,8 @@ suffix_$(CONFIG_IMAGE_COMPRESSION_LZ4) = lz4
suffix_$(CONFIG_IMAGE_COMPRESSION_XZKERN) = xzkern
suffix_$(CONFIG_IMAGE_COMPRESSION_NONE) = comp_copy
+$(obj)/piggy.o: $(obj)/barebox.z FORCE
+
# barebox.z - compressed barebox binary
# ----------------------------------------------------------------
$(obj)/barebox.z: $(obj)/../barebox.bin FORCE
@@ -115,10 +106,9 @@ include $(srctree)/images/Makefile.vexpress
include $(srctree)/images/Makefile.at91
targets += $(image-y) pbl.lds barebox.x barebox.z
-targets += $(patsubst %,%.pblx,$(pblx-y))
-targets += $(patsubst %,%.pblb,$(pblx-y))
-targets += $(patsubst %,%.pbl,$(pblx-y))
-targets += $(patsubst %,%.s,$(pblx-y))
+targets += $(patsubst %,%.pblb,$(pblb-y))
+targets += $(patsubst %,%.pbl,$(pblb-y))
+targets += $(patsubst %,%.s,$(pblb-y))
targets += $(foreach m, $(image-y), $(FILE_$(m)))
SECONDARY: $(addprefix $(obj)/,$(targets))
@@ -143,7 +133,7 @@ $(flash-link): $(link-dest) FORCE
$(flash-list): $(image-y-path)
@for i in $^; do echo $$i; done > $@
-clean-files := *.pbl *.pblb *.pblx *.map start_*.imximg *.img barebox.z start_*.kwbimg \
+clean-files := *.pbl *.pblb *.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 *.imx-sram-img