* [PATCH 1/5] kbuild: images: don't compare filesizes if file didn't change
@ 2024-12-02 12:44 Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 2/5] kbuild: images: don't check for missing FW " Ahmad Fatoum
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2024-12-02 12:44 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
If the input file didn't change, there is no point in repeating the file
size check and cluttering the log. Therefore use if_changed and remove
the extraneous semicolon, which make would then complain about.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
images/Makefile | 2 +-
scripts/Makefile.lib | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/images/Makefile b/images/Makefile
index 9007911278e2..80ea582728a5 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -78,7 +78,7 @@ $(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))
+ $(call if_changed,check_file_size,$@,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE))
#
# For each start symbol create three variables containing the
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index e8a85f3f1bf6..b698161f43f6 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -531,7 +531,7 @@ quiet_cmd_check_file_size = CHKFILESIZE $2
then \
echo "$@ size $$size > maximum size $$max_size" >&2; \
exit 1 ; \
- fi;
+ fi
quiet_cmd_imximage__S_dcd= DCD_S $@
cmd_imximage_S_dcd= \
--
2.39.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/5] kbuild: images: don't check for missing FW if file didn't change
2024-12-02 12:44 [PATCH 1/5] kbuild: images: don't compare filesizes if file didn't change Ahmad Fatoum
@ 2024-12-02 12:44 ` Ahmad Fatoum
2024-12-03 8:24 ` Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 3/5] kbuild: images: fix missing FORCE prerequisite Ahmad Fatoum
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Ahmad Fatoum @ 2024-12-02 12:44 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The information about the missing firmware is contained in an ELF
section and the ELF file is dependency to the $(obj)/%.pblb: $(obj)/%.pbl
rule.
We can thus don't need to rerun the missing firmware check if the
input file hasn't been changed since the last time.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
images/Makefile | 3 +--
scripts/Makefile.lib | 6 ++++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/images/Makefile b/images/Makefile
index 80ea582728a5..f781ecb59ccb 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -76,8 +76,7 @@ $(obj)/%.elf: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(obj)/piggy.o $(obj)/sha_sum.o FOR
$(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 if_changed,check_missing_fw,$@,$<)
$(call if_changed,check_file_size,$@,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE))
#
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index b698161f43f6..e2d0168550f8 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -533,6 +533,12 @@ quiet_cmd_check_file_size = CHKFILESIZE $2
exit 1 ; \
fi
+# Check for missing firmware
+quiet_cmd_check_missing_fw = # no message as we collect info for later
+ cmd_check_missing_fw = set -e; \
+ $(OBJCOPY) -O binary --only-section=.missing_fw $3 $2.missing-firmware; \
+ [ -s $2.missing-firmware ] || rm -f $2.missing-firmware
+
quiet_cmd_imximage__S_dcd= DCD_S $@
cmd_imximage_S_dcd= \
( \
--
2.39.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/5] kbuild: images: fix missing FORCE prerequisite
2024-12-02 12:44 [PATCH 1/5] kbuild: images: don't compare filesizes if file didn't change Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 2/5] kbuild: images: don't check for missing FW " Ahmad Fatoum
@ 2024-12-02 12:44 ` Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 4/5] kbuild: don't prelink if input file didn't change Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 5/5] kbuild: images: don't compute size " Ahmad Fatoum
3 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2024-12-02 12:44 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
With the recent changes updating fixdep, we now get warnings when we
miss the FORCE prerequisite:
images/Makefile:151: FORCE prerequisite is missing
Fix this by adding the missing FORCE and using if_changed as intended.
While at it, we also make the output a little less verbose, so the
SHIPPED/DELETE output is omitted:
SHIPPED images/barebox-nxp-imx8mm-evk.img
SHIPPED images/barebox-prt-prt8mm.img
DELETE images/barebox-tqma93xx.img
images built:
barebox-nxp-imx8mm-evk.img
barebox-prt-prt8mm.img
** barebox-tqma93xx.img skipped due to missing firmware **
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
images/Makefile | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/images/Makefile b/images/Makefile
index f781ecb59ccb..5ce563a426ab 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -144,11 +144,13 @@ $(obj)/barebox.z: $(obj)/../barebox.bin FORCE
missing_fw = $(strip $(wildcard $(obj)/$(FILE_$(@F)).missing-firmware $(basename $(obj)/$(FILE_$(@F))).missing-firmware))
+quiet_cmd_report_missing_fw = # no message as we collect info for later
+ cmd_report_missing_fw = $(if $2,cat $2 >$@.missing-firmware;$(cmd_delete),rm -f $@.missing-firmware;$(cmd_shipped))
+
.SECONDEXPANSION:
-$(obj)/%.img: $(obj)/$$(FILE_$$(@F))
+$(obj)/%.img: $(obj)/$$(FILE_$$(@F)) FORCE
$(Q)if [ -z $(FILE_$(@F)) ]; then echo "FILE_$(@F) empty!"; false; fi
- $(Q)$(if $(missing_fw),cat $(missing_fw) >$@.missing-firmware,rm -f $@.missing-firmware)
- $(call if_changed,$(if $(missing_fw),delete,shipped))
+ $(call if_changed,report_missing_fw,$(missing_fw))
board = $(srctree)/arch/$(SRCARCH)/boards
objboard = $(objtree)/arch/$(SRCARCH)/boards
--
2.39.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/5] kbuild: don't prelink if input file didn't change
2024-12-02 12:44 [PATCH 1/5] kbuild: images: don't compare filesizes if file didn't change Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 2/5] kbuild: images: don't check for missing FW " Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 3/5] kbuild: images: fix missing FORCE prerequisite Ahmad Fatoum
@ 2024-12-02 12:44 ` Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 5/5] kbuild: images: don't compute size " Ahmad Fatoum
3 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2024-12-02 12:44 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
If the input file hasn't changed, there is no need to re-prelink it.
Thus turn the cmd into a if_changed and ensure it's not empty as
otherwise, make will raise an error.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
images/Makefile | 4 ++--
scripts/Makefile.lib | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/images/Makefile b/images/Makefile
index 5ce563a426ab..0ef2ea6bf6de 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -68,11 +68,11 @@ PBL_CPPFLAGS += -fdata-sections -ffunction-sections
$(obj)/%.pbl: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(obj)/piggy.o $(obj)/sha_sum.o FORCE
$(call if_changed,elf__,$(*F))
- $(call cmd,prelink__)
+ $(call if_changed,prelink__)
$(obj)/%.elf: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(obj)/piggy.o $(obj)/sha_sum.o FORCE
$(call if_changed,elf__,$(*F))
- $(call cmd,prelink__)
+ $(call if_changed,prelink__)
$(obj)/%.pblb: $(obj)/%.pbl FORCE
$(call if_changed,objcopy_bin,$(*F))
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index e2d0168550f8..19aa506dc645 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -282,7 +282,7 @@ quiet_cmd_prelink__ = PRELINK $@
endif
quiet_cmd_prelink__ ?=
- cmd_prelink__ ?=
+ cmd_prelink__ ?= :
# Linking
# ---------------------------------------------------------------------------
--
2.39.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 5/5] kbuild: images: don't compute size if input file didn't change
2024-12-02 12:44 [PATCH 1/5] kbuild: images: don't compare filesizes if file didn't change Ahmad Fatoum
` (2 preceding siblings ...)
2024-12-02 12:44 ` [PATCH 4/5] kbuild: don't prelink if input file didn't change Ahmad Fatoum
@ 2024-12-02 12:44 ` Ahmad Fatoum
3 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2024-12-02 12:44 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
If the input file didn't change, there is no point in repeating image
size checks and cluttering the log. Therefore use if_changed and remove
the extraneous semicolon, which make would then complain about.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
images/Makefile | 6 +++---
scripts/Makefile.lib | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/images/Makefile b/images/Makefile
index 0ef2ea6bf6de..a74aa6023e73 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -100,15 +100,15 @@ $(obj)/%.pblb: $(obj)/%.pbl FORCE
# 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_$*)) \
+ $(call if_changed,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_$*)) \
+ $(call if_changed,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_$*)) \
+ $(call if_changed,check_size,$(PBL_IMAGE_SIZE_$*),$(MAX_PBL_IMAGE_SIZE_$*)) \
)
$(obj)/%.s: $(obj)/% FORCE
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 19aa506dc645..c32adf07cc51 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -520,7 +520,7 @@ quiet_cmd_check_size = CHKSIZE $2
then \
echo "$@ size $$size > maximum size $$max_size" >&2; \
exit 1 ; \
- fi;
+ fi
# Check size of a file
quiet_cmd_check_file_size = CHKFILESIZE $2
--
2.39.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/5] kbuild: images: don't check for missing FW if file didn't change
2024-12-02 12:44 ` [PATCH 2/5] kbuild: images: don't check for missing FW " Ahmad Fatoum
@ 2024-12-03 8:24 ` Ahmad Fatoum
0 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2024-12-03 8:24 UTC (permalink / raw)
To: barebox
On 02.12.24 13:44, Ahmad Fatoum wrote:
> The information about the missing firmware is contained in an ELF
> section and the ELF file is dependency to the $(obj)/%.pblb: $(obj)/%.pbl
> rule.
>
> We can thus don't need to rerun the missing firmware check if the
> input file hasn't been changed since the last time.
Please dismiss this series. I will send a v2.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> images/Makefile | 3 +--
> scripts/Makefile.lib | 6 ++++++
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/images/Makefile b/images/Makefile
> index 80ea582728a5..f781ecb59ccb 100644
> --- a/images/Makefile
> +++ b/images/Makefile
> @@ -76,8 +76,7 @@ $(obj)/%.elf: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(obj)/piggy.o $(obj)/sha_sum.o FOR
>
> $(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 if_changed,check_missing_fw,$@,$<)
> $(call if_changed,check_file_size,$@,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE))
>
> #
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index b698161f43f6..e2d0168550f8 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -533,6 +533,12 @@ quiet_cmd_check_file_size = CHKFILESIZE $2
> exit 1 ; \
> fi
>
> +# Check for missing firmware
> +quiet_cmd_check_missing_fw = # no message as we collect info for later
> + cmd_check_missing_fw = set -e; \
> + $(OBJCOPY) -O binary --only-section=.missing_fw $3 $2.missing-firmware; \
> + [ -s $2.missing-firmware ] || rm -f $2.missing-firmware
> +
> quiet_cmd_imximage__S_dcd= DCD_S $@
> cmd_imximage_S_dcd= \
> ( \
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-12-03 8:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-02 12:44 [PATCH 1/5] kbuild: images: don't compare filesizes if file didn't change Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 2/5] kbuild: images: don't check for missing FW " Ahmad Fatoum
2024-12-03 8:24 ` Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 3/5] kbuild: images: fix missing FORCE prerequisite Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 4/5] kbuild: don't prelink if input file didn't change Ahmad Fatoum
2024-12-02 12:44 ` [PATCH 5/5] kbuild: images: don't compute size " Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox