[PATCH] kbuild: move PBL_CODE_SIZE_ out of rule_pblb

Sascha Hauer s.hauer at pengutronix.de
Mon Aug 25 06:18:06 PDT 2025


Before Commit 21613ae35f ("kbuild: images/Makefile: fix broken if_changed usage")
setting of PBL_CODE_SIZE_$*, PBL_MEMORY_SIZE_$* and PBL_IMAGE_SIZE_$*
were part of the

$(obj)/%.pblb: $(obj)/%.pbl FORCE

rule which was always executed due to the FORCE. Beginning with this
commit setting of these variables are part of rule_pblb which is only
executed when the pblb file is (re-)generated. In case the pblb is still
up to date this results in the variables being unset which then fails
in later stages.

Move setting of the variables back to the pblb rule to make sure they
are always set.

Reproducer:

make multi_v8_defconfig && make && make

The second make will fail while calling the imx-image tool which gets
the -p option without the actual size as optarg.

Fixes: 21613ae35f ("kbuild: images/Makefile: fix broken if_changed usage")
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 images/Makefile | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/images/Makefile b/images/Makefile
index 03c7fdc024..7406aee817 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -99,13 +99,6 @@ define rule_pblb
 	$(call cmd,check_missing_fw,$@,$<)
 	$(call cmd,check_file_size,$@,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE))
 
-	$(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_CODE_SIZE_$*), \
 		$(call cmd,check_size,$(PBL_CODE_SIZE_$*),$(MAX_PBL_CODE_SIZE_$*)) \
 	)
@@ -120,6 +113,13 @@ define rule_pblb
 endef
 
 $(obj)/%.pblb: $(obj)/%.pbl FORCE
+	$(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 $^))
+
 	$(call if_changed_rule,pblb)
 
 $(obj)/%.s: $(obj)/% FORCE
-- 
2.47.2




More information about the barebox mailing list