* [PATCH 1/3] images: i.MX: rearrange image rules in preparation for boilerplate removal @ 2019-12-04 16:01 Ahmad Fatoum 2019-12-04 16:01 ` [PATCH 2/3] ARM: i.MX: introduce imx_image_rule variable for code deduplication Ahmad Fatoum ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Ahmad Fatoum @ 2019-12-04 16:01 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum The following commit will introduce a variable define to remove the duplication in the different [supe]*imximg rules. Prepare for this by rearranging the command line flags to line up with the letters in the extension (i.e. -e -s for esimximg instead of -s -e) and by splitting off a multi-target rule into two. The former improves readability when the define is introduced, as it is then easy to see the correspondence between extension and arguments. The latter is needed because we will call the variable for each target. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- images/Makefile.imx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/images/Makefile.imx b/images/Makefile.imx index 6572474e19c8..53d4ac8202c5 100644 --- a/images/Makefile.imx +++ b/images/Makefile.imx @@ -31,17 +31,20 @@ $(obj)/%.pimximg: $(obj)/% FORCE -p $($(patsubst $(obj)/%.pblb,PBL_MEMORY_SIZE_%,$<))) $(obj)/%.psimximg: $(obj)/% FORCE - $(call if_changed,imx_image,$(CFG_$(patsubst %.psimximg,%.imximg,$(@F))),-s \ - -p $($(patsubst $(obj)/%.pblb,PBL_MEMORY_SIZE_%,$<))) + $(call if_changed,imx_image,$(CFG_$(patsubst %.psimximg,%.imximg,$(@F))),\ + -p $($(patsubst $(obj)/%.pblb,PBL_MEMORY_SIZE_%,$<)) -s) $(obj)/%.simximg: $(obj)/% FORCE $(call if_changed,imx_image,$(CFG_$(patsubst %.simximg,%.imximg,$(@F))),-s) $(obj)/%.usimximg: $(obj)/% FORCE - $(call if_changed,imx_image,$(CFG_$(patsubst %.usimximg,%.imximg,$(@F))),-s -u) + $(call if_changed,imx_image,$(CFG_$(patsubst %.usimximg,%.imximg,$(@F))),-u -s) + +$(obj)/%.esimximg: $(obj)/% FORCE + $(call if_changed,imx_image,$(CFG_$(patsubst %.esimximg,%.imximg,$(@F))),-e -s) -$(obj)/%.esimximg $(obj)/%.esimximg.dek: $(obj)/% FORCE - $(call if_changed,imx_image,$(CFG_$(patsubst %.esimximg,%.imximg,$(@F))),-s -e) +$(obj)/%.esimximg.dek: $(obj)/% FORCE + $(call if_changed,imx_image,$(CFG_$(patsubst %.esimximg,%.imximg,$(@F))),-e -s) .SECONDEXPANSION: $(obj)/%.img.dek: $(obj)/$$(FILE_$$(@F)) -- 2.24.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] ARM: i.MX: introduce imx_image_rule variable for code deduplication 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 ` Ahmad Fatoum 2019-12-09 13:31 ` Sascha Hauer 2019-12-04 16:02 ` [PATCH 3/3] ARM: i.MX: rebuild .imximg if DCD table in .imxcfg changes Ahmad Fatoum 2019-12-09 9:24 ` [PATCH 1/3] images: i.MX: rearrange image rules in preparation for boilerplate removal Sascha Hauer 2 siblings, 1 reply; 6+ messages in thread From: Ahmad Fatoum @ 2019-12-04 16:01 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum The next patch will add the .imxcfg file as a rule prerequisite, so the target is rebuilt if it changes. Instead of duplicating it in all rules, factor out the common parts into a imx_image_rule variable. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- images/Makefile.imx | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/images/Makefile.imx b/images/Makefile.imx index 53d4ac8202c5..078b6b9d6a93 100644 --- a/images/Makefile.imx +++ b/images/Makefile.imx @@ -23,28 +23,18 @@ endef # %.imximg - convert into i.MX image # ---------------------------------------------------------------- -$(obj)/%.imximg: $(obj)/% FORCE - $(call if_changed,imx_image,$(CFG_$(@F)),) - -$(obj)/%.pimximg: $(obj)/% FORCE - $(call if_changed,imx_image,$(CFG_$(patsubst %.pimximg,%.imximg,$(@F))),\ - -p $($(patsubst $(obj)/%.pblb,PBL_MEMORY_SIZE_%,$<))) - -$(obj)/%.psimximg: $(obj)/% FORCE - $(call if_changed,imx_image,$(CFG_$(patsubst %.psimximg,%.imximg,$(@F))),\ - -p $($(patsubst $(obj)/%.pblb,PBL_MEMORY_SIZE_%,$<)) -s) - -$(obj)/%.simximg: $(obj)/% FORCE - $(call if_changed,imx_image,$(CFG_$(patsubst %.simximg,%.imximg,$(@F))),-s) - -$(obj)/%.usimximg: $(obj)/% FORCE - $(call if_changed,imx_image,$(CFG_$(patsubst %.usimximg,%.imximg,$(@F))),-u -s) - -$(obj)/%.esimximg: $(obj)/% FORCE - $(call if_changed,imx_image,$(CFG_$(patsubst %.esimximg,%.imximg,$(@F))),-e -s) +define imx_image_rule +$$(obj)/%.$(strip $(1)): $$(obj)/% FORCE + $$(call if_changed,imx_image,$$(CFG_$$(patsubst %.$(strip $(1)),%.imximg,$$(@F))),$(strip $(2))) +endef -$(obj)/%.esimximg.dek: $(obj)/% FORCE - $(call if_changed,imx_image,$(CFG_$(patsubst %.esimximg,%.imximg,$(@F))),-e -s) +$(eval $(call imx_image_rule,imximg)) +$(eval $(call imx_image_rule,pimximg, -p $($(patsubst $(obj)/%.pblb,PBL_MEMORY_SIZE_%,$<)))) +$(eval $(call imx_image_rule,psimximg, -p $($(patsubst $(obj)/%.pblb,PBL_MEMORY_SIZE_%,$<)) -s)) +$(eval $(call imx_image_rule,simximg, -s)) +$(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)) -- 2.24.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] ARM: i.MX: introduce imx_image_rule variable for code deduplication 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 0 siblings, 1 reply; 6+ messages in thread From: Sascha Hauer @ 2019-12-09 13:31 UTC (permalink / raw) To: Ahmad Fatoum; +Cc: barebox On Wed, Dec 04, 2019 at 05:01:59PM +0100, Ahmad Fatoum wrote: > The next patch will add the .imxcfg file as a rule prerequisite, so the > target is rebuilt if it changes. Instead of duplicating it in all rules, > factor out the common parts into a imx_image_rule variable. > > No functional change. Famous last words... This breaks imx_v8_defconfig build with: IMX-IMG images/start_nxp_imx8mq_evk.pblb.pimximg image name not given Sascha -- 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 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] ARM: i.MX: introduce imx_image_rule variable for code deduplication 2019-12-09 13:31 ` Sascha Hauer @ 2019-12-09 13:32 ` Ahmad Fatoum 0 siblings, 0 replies; 6+ messages in thread From: Ahmad Fatoum @ 2019-12-09 13:32 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox On 12/9/19 2:31 PM, Sascha Hauer wrote: > On Wed, Dec 04, 2019 at 05:01:59PM +0100, Ahmad Fatoum wrote: >> The next patch will add the .imxcfg file as a rule prerequisite, so the >> target is rebuilt if it changes. Instead of duplicating it in all rules, >> factor out the common parts into a imx_image_rule variable. >> >> No functional change. intended*. :-D > > Famous last words... > > This breaks imx_v8_defconfig build with: > > IMX-IMG images/start_nxp_imx8mq_evk.pblb.pimximg > image name not given Will check. Cheers, Ahmad -- Pengutronix e.K. | | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] ARM: i.MX: rebuild .imximg if DCD table in .imxcfg changes 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-04 16:02 ` Ahmad Fatoum 2019-12-09 9:24 ` [PATCH 1/3] images: i.MX: rearrange image rules in preparation for boilerplate removal Sascha Hauer 2 siblings, 0 replies; 6+ messages in thread From: Ahmad Fatoum @ 2019-12-04 16:02 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] images: i.MX: rearrange image rules in preparation for boilerplate removal 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-04 16:02 ` [PATCH 3/3] ARM: i.MX: rebuild .imximg if DCD table in .imxcfg changes Ahmad Fatoum @ 2019-12-09 9:24 ` Sascha Hauer 2 siblings, 0 replies; 6+ messages in thread From: Sascha Hauer @ 2019-12-09 9:24 UTC (permalink / raw) To: Ahmad Fatoum; +Cc: barebox On Wed, Dec 04, 2019 at 05:01:58PM +0100, Ahmad Fatoum wrote: > The following commit will introduce a variable define to remove the > duplication in the different [supe]*imximg rules. > > Prepare for this by rearranging the command line flags to line up with > the letters in the extension (i.e. -e -s for esimximg instead of -s -e) > and by splitting off a multi-target rule into two. > > The former improves readability when the define is introduced, as it is > then easy to see the correspondence between extension and arguments. > > The latter is needed because we will call the variable for each target. > > No functional change. Applied, thanks Sascha -- 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 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-12-09 13:32 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 ` [PATCH 3/3] ARM: i.MX: rebuild .imximg if DCD table in .imxcfg changes Ahmad Fatoum 2019-12-09 9:24 ` [PATCH 1/3] images: i.MX: rearrange image rules in preparation for boilerplate removal Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox