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 3/3] ARM: i.MX: rebuild .imximg if DCD table in .imxcfg changes
Date: Wed,  4 Dec 2019 17:02:00 +0100	[thread overview]
Message-ID: <20191204160200.4920-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20191204160200.4920-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>
---
 images/Makefile.imx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/images/Makefile.imx b/images/Makefile.imx
index 078b6b9d6a93..c34d72eb1b59 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -23,8 +23,9 @@ endef
 # %.imximg - convert into i.MX image
 # ----------------------------------------------------------------
 
+.SECONDEXPANSION:
 define imx_image_rule
-$$(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
 
@@ -36,7 +37,6 @@ $(eval $(call imx_image_rule,usimximg, -u -s))
 $(eval $(call imx_image_rule,esimximg, -e -s))
 $(eval $(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-04 16:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04 16:01 [PATCH 1/3] images: i.MX: rearrange image rules in preparation for boilerplate removal Ahmad Fatoum
2019-12-04 16:01 ` [PATCH 2/3] ARM: i.MX: introduce imx_image_rule variable for code deduplication Ahmad Fatoum
2019-12-09 13:31   ` Sascha Hauer
2019-12-09 13:32     ` Ahmad Fatoum
2019-12-04 16:02 ` Ahmad Fatoum [this message]
2019-12-09  9:24 ` [PATCH 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=20191204160200.4920-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