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: "Rouven Czerwinski" <r.czerwinski@pengutronix.de>,
	"Michael Olbrich" <mol@pengutronix.de>,
	"Enrico Jörns" <e.joerns@pengutronix.de>,
	"Ahmad Fatoum" <a.fatoum@pengutronix.de>
Subject: [PATCH master] kbuild: delete images with missing firmware instead of truncating
Date: Mon,  3 Jul 2023 11:56:08 +0200	[thread overview]
Message-ID: <20230703095608.2188064-1-a.fatoum@pengutronix.de> (raw)

It may be confusing to users to be left with a 0-byte image, so let's
delete it instead. This means that every build with missing firmware will
attempt the final make targets, only to delete them at the end.

At the flip-side, there is no risk of broken images to be used later on.

Suggested-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Suggested-by: Michael Olbrich <mol@pengutronix.de>
Suggested-by: Enrico Jörns <e.joerns@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 images/Makefile      | 4 ++--
 scripts/Makefile.lib | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/images/Makefile b/images/Makefile
index e26880de50b4..c1cb56f5b189 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -136,7 +136,7 @@ missing_fw = $(strip $(wildcard $(obj)/$(FILE_$(@F)).missing-firmware $(basename
 $(obj)/%.img: $(obj)/$$(FILE_$$(@F))
 	$(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),0size,shipped))
+	$(call if_changed,$(if $(missing_fw),delete,shipped))
 
 board = $(srctree)/arch/$(SRCARCH)/boards
 objboard = $(objtree)/arch/$(SRCARCH)/boards
@@ -202,7 +202,7 @@ images: $(image-y-path) $(flash-link) $(flash-list) FORCE
 	@echo "images built:"
 	@for i in $(image-y); do \
 	  if [ -s $(obj)/$$i ]; then echo $$i; \
-	  else >&2 echo "** firmware missing for $$i **"; \
+	  else >&2 echo "** $$i skipped due to missing firmware **"; \
 	  $(if $(CONFIG_MISSING_FIRMWARE_ERROR), >&2 sed 's/^/\t/' <$(obj)/$${i}.missing-firmware; missing=1;) \
 	  fi; done; if [ -n "$$missing" ]; then \
 	    echo >&2 "Firmware missing in CONFIG_MISSING_FIRMWARE_ERROR=y build"; exit 1; fi
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index b8fb2684421e..f04c09f9e280 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -239,6 +239,9 @@ endef
 quiet_cmd_0size = 0SIZE $@
 cmd_0size = : > $@
 
+quiet_cmd_delete = DELETE  $@
+      cmd_delete = rm -f $@
+
 quiet_cmd_shipped = SHIPPED $@
 cmd_shipped = cat $< > $@
 
-- 
2.39.2




             reply	other threads:[~2023-07-03  9:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03  9:56 Ahmad Fatoum [this message]
2023-07-03 12:48 ` 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=20230703095608.2188064-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=e.joerns@pengutronix.de \
    --cc=mol@pengutronix.de \
    --cc=r.czerwinski@pengutronix.de \
    /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