* [PATCH master] firmware: fix dependency tracking for PBL firmware files
@ 2023-09-05 14:23 Ahmad Fatoum
2023-09-06 14:14 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-09-05 14:23 UTC (permalink / raw)
To: barebox; +Cc: mfe, rcz, Ahmad Fatoum
$(wildcard $(fwdir)/%) was added to allow for optional firmware, but in
return it broke dependency tracking, because it was evaluated before the
static pattern rule it's a part of.
Fix the dependency tracking by only evaluating it in a secondary
expansion. That this works as expected can be verified with:
make -p | grep 'imx8mn-bl31.bin.gen.pbl.o:.*imx8mn-bl31.bin '
Which will return no result before this patch, but with it applied, it
will correctly show the dependency. Manual touching and rebuilding also
builds the firmware now as expected:
AS [P] firmware/imx8mm-bl31.bin.gen.pbl.o
Fixes: 5b171b7b7eda ("firmware: turn missing firmware into linker error")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
firmware/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/firmware/Makefile b/firmware/Makefile
index 5853950dfe4e..4fca83f808f6 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -99,7 +99,8 @@ clean-files += *.sha.bin *.sum
$(patsubst %.gen.o,$(obj)/%.gen.o, $(obj-pbl-y)): $(obj)/%.gen.o: $(fwdir)/%
# The same for pbl:
-$(patsubst %.gen.o,$(obj)/%.gen.pbl.o, $(obj-pbl-y) $(pbl-y)): $(obj)/%.gen.pbl.o: $(wildcard $(fwdir)/%)
+.SECONDEXPANSION:
+$(patsubst %.gen.o,$(obj)/%.gen.pbl.o, $(obj-pbl-y) $(pbl-y)): $(obj)/%.gen.pbl.o: $$(wildcard $(fwdir)/%)
$(patsubst %.gen.o,$(obj)/%.extgen.pbl.o, $(pbl-y)): $(obj)/%.extgen.pbl.o: $(fwdir)/%
pbl-y += $(addsuffix .extgen.o, $(fw-external-y))
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH master] firmware: fix dependency tracking for PBL firmware files
2023-09-05 14:23 [PATCH master] firmware: fix dependency tracking for PBL firmware files Ahmad Fatoum
@ 2023-09-06 14:14 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-09-06 14:14 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox, mfe, rcz
On Tue, Sep 05, 2023 at 04:23:28PM +0200, Ahmad Fatoum wrote:
> $(wildcard $(fwdir)/%) was added to allow for optional firmware, but in
> return it broke dependency tracking, because it was evaluated before the
> static pattern rule it's a part of.
>
> Fix the dependency tracking by only evaluating it in a secondary
> expansion. That this works as expected can be verified with:
>
> make -p | grep 'imx8mn-bl31.bin.gen.pbl.o:.*imx8mn-bl31.bin '
>
> Which will return no result before this patch, but with it applied, it
> will correctly show the dependency. Manual touching and rebuilding also
> builds the firmware now as expected:
>
> AS [P] firmware/imx8mm-bl31.bin.gen.pbl.o
>
> Fixes: 5b171b7b7eda ("firmware: turn missing firmware into linker error")
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> firmware/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Applied, thanks
Sascha
>
> diff --git a/firmware/Makefile b/firmware/Makefile
> index 5853950dfe4e..4fca83f808f6 100644
> --- a/firmware/Makefile
> +++ b/firmware/Makefile
> @@ -99,7 +99,8 @@ clean-files += *.sha.bin *.sum
> $(patsubst %.gen.o,$(obj)/%.gen.o, $(obj-pbl-y)): $(obj)/%.gen.o: $(fwdir)/%
>
> # The same for pbl:
> -$(patsubst %.gen.o,$(obj)/%.gen.pbl.o, $(obj-pbl-y) $(pbl-y)): $(obj)/%.gen.pbl.o: $(wildcard $(fwdir)/%)
> +.SECONDEXPANSION:
> +$(patsubst %.gen.o,$(obj)/%.gen.pbl.o, $(obj-pbl-y) $(pbl-y)): $(obj)/%.gen.pbl.o: $$(wildcard $(fwdir)/%)
> $(patsubst %.gen.o,$(obj)/%.extgen.pbl.o, $(pbl-y)): $(obj)/%.extgen.pbl.o: $(fwdir)/%
>
> pbl-y += $(addsuffix .extgen.o, $(fw-external-y))
> --
> 2.39.2
>
>
>
--
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] 2+ messages in thread
end of thread, other threads:[~2023-09-06 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-05 14:23 [PATCH master] firmware: fix dependency tracking for PBL firmware files Ahmad Fatoum
2023-09-06 14:14 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox