mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 3/3] ARM: i.MX: rebuild .imximg if DCD table in .imxcfg changes
Date: Mon,  9 Dec 2019 15:11:14 +0100	[thread overview]
Message-ID: <20191209141114.12130-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20191209141114.12130-1-a.fatoum@pengutronix.de>

So far changing the DCD table didn't trigger a rerun of the i.MX
image utility. To fix this, we need to have the DCD table as prerequisite
to the .imximg rule. The file name is contained in $(CFG_$(@F)), but
can't be used directly because $@ (and by extension @F) has no value
when first expanded in the read-in phase. If we expand a second time
during the target-update phase however, we would get the correct value.

GNU make provides .SECONDEXPANSION to expand all following prerequisites
a second time. Use it to have changes to the DCD table rebuild the
image.

Because we are now using imx_image_rule to generate the target, we must
escape each $ one more time to arrive at $$$$(CFG_$$$$(@F)).

In the final step, we replace $$$$(@F) with %.imximg, so we support the
rules not ending in .imximg as well.

Dependency file generation is still broken however and changed to headers
included in DCD tables won't be caught, but this functionality can be
fixed in a separate patch.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
No changes in v2.
---
 images/Makefile.imx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/images/Makefile.imx b/images/Makefile.imx
index 80e1acf941c5..c4b1bfb35e9f 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -5,9 +5,10 @@
 # %.imximg - convert into i.MX image
 # ----------------------------------------------------------------
 
+.SECONDEXPANSION:
 define imx_image_rule
 $(eval
-$$(obj)/%.$(strip $(1)): $$(obj)/% FORCE
+$$(obj)/%.$(strip $(1)): $$(obj)/% $$$$(CFG_%.imximg) FORCE
 	$$(call if_changed,imx_image,$$(CFG_$$(patsubst %.$(strip $(1)),%.imximg,$$(@F))),$(strip $(2)))
 )
 endef
@@ -20,7 +21,6 @@ $(call imx_image_rule,usimximg, -u -s)
 $(call imx_image_rule,esimximg, -e -s)
 $(call imx_image_rule,esimximg.dek, -e -s)
 
-.SECONDEXPANSION:
 $(obj)/%.img.dek: $(obj)/$$(FILE_$$(@F))
 	$(Q)if [ -z $(FILE_$(@F)) ]; then echo "FILE_$(@F) empty!"; false; fi
 	$(call if_changed,shipped)
-- 
2.24.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-12-09 14:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-09 14:11 [PATCH v2 1/3] images: i.MX: rearrange image rules in preparation for boilerplate removal Ahmad Fatoum
2019-12-09 14:11 ` [PATCH v2 2/3] ARM: i.MX: introduce imx_image_rule variable for code deduplication Ahmad Fatoum
2019-12-09 14:11 ` Ahmad Fatoum [this message]
2019-12-11  8:27 ` [PATCH v2 1/3] images: i.MX: rearrange image rules in preparation for boilerplate removal Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191209141114.12130-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox