summaryrefslogtreecommitdiffstats
path: root/images/Makefile
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-03-12 16:11:22 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-03-13 10:24:52 +0100
commited04a7c3c8741204bf566f4662c7b56c409bbce3 (patch)
treec01e6ffe7ae4afc8f089619fef995d22f33c2c5c /images/Makefile
parent369d39adfe79334db5ed04d6f2acaf096c68b8a2 (diff)
downloadbarebox-ed04a7c3c8741204bf566f4662c7b56c409bbce3.tar.gz
barebox-ed04a7c3c8741204bf566f4662c7b56c409bbce3.tar.xz
pbl multiimage: Allow to check image sizes
PBL images are often constrained in size by limitations exposed by the SoCs SRAM size or partition sizes on the boot device. So far we tried to configure these limits in Kconfig, but with PBL multi images and thus different limitations for the different supported images this no longer works. This patch has another approach for it: During build time make variables containing the relevant sizes for each image are created. These are: PBL_CODE_SIZE_$(symbol) PBL_MEMORY_SIZE_$(symbol) PBL_IMAGE_SIZE_$(symbol) PBL_CODE_SIZE_$(symbol) contains the pure code size of the PBL, it should be smaller than the available SRAM during boot. Normally the PBL's bss segment also needs to be in the initial SRAM, for this case PBL_MEMORY_SIZE_$(symbol) is the relevant variable. PBL_IMAGE_SIZE_$(symbol) contains the full size of the PBL image including the compressed payload (but without any image headers created later by SoC specific image tools). $(symbol) is a placeholder for the start symbol used for this PBL image, thus for the i.MX53 QSB with entry start_imx53_loco PBL_CODE_SIZE_start_imx53_loco will be created. The images/Makefile.* can use these variables directly to check sizes or specify the same variables with a "MAX_" prefix. So when images/Makefile.imx specifies MAX_PBL_CODE_SIZE_start_imx53_loco = 0x10000 then the build system will make sure that the PBL code for the QSB will not get bigger than 64KiB. Also included in this patch are the size restrictions for the i.MX8MQ images as an example how to use this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'images/Makefile')
-rw-r--r--images/Makefile32
1 files changed, 32 insertions, 0 deletions
diff --git a/images/Makefile b/images/Makefile
index 59b81f9b6d..c0ad500303 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -68,6 +68,38 @@ $(obj)/%.pblb: $(obj)/%.pbl FORCE
$(call if_changed,objcopy_bin,$(*F))
$(call cmd,check_file_size,$@,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE))
+#
+# For each start symbol create three variables containing the
+# relevant sizes in the image:
+# PBL_CODE_SIZE_$(symbol) - contains the pure code size of the image
+# PBL_MEMORY_SIZE_$(symbol) - contains the code size + bss size of the
+# image
+# PBL_IMAGE_SIZE_$(symbol) - contains the full image size including the
+# compressed payload
+#
+ $(eval PBL_CODE_SIZE_$* = \
+ $(shell $(srctree)/scripts/extract_symbol_offset pbl_code_size $^))
+ $(eval PBL_MEMORY_SIZE_$*= \
+ $(shell $(srctree)/scripts/extract_symbol_offset pbl_memory_size $^))
+ $(eval PBL_IMAGE_SIZE_$*= \
+ $(shell $(srctree)/scripts/extract_symbol_offset pbl_image_size $^))
+
+#
+# if MAX_PBL_xxx_SIZE_$(symbol) is defined it contains the maximum size the
+# code/memory/image for this PBL may get. Check these values.
+#
+ $(if $(MAX_PBL_CODE_SIZE_$*), \
+ $(call cmd,check_size, $(PBL_CODE_SIZE_$*), $(MAX_PBL_CODE_SIZE_$*)) \
+ )
+
+ $(if $(MAX_PBL_MEMORY_SIZE_$*), \
+ $(call cmd,check_size, $(PBL_MEMORY_SIZE_$*), $(MAX_PBL_MEMORY_SIZE_$*)) \
+ )
+
+ $(if $(MAX_PBL_IMAGE_SIZE_$*), \
+ $(call cmd,check_size, $(PBL_IMAGE_SIZE_$*), $(MAX_PBL_IMAGE_SIZE_$*)) \
+ )
+
$(obj)/%.s: $(obj)/% FORCE
$(call if_changed,disasm)