mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <>
Cc:, Ahmad Fatoum <>
Subject: [PATCH master] ARM: i.MX8M: HABv4: make barebox SHA256 embedding POSIX-shell compatible
Date: Mon, 15 Aug 2022 08:38:53 +0200	[thread overview]
Message-ID: <> (raw)

C-Style printf "\xHH" is not supported by a POSIX shell,
while printf "\oOOO" is. As we use printf "\xHH" for converting the
textual output of sha256sum into binary, systems using dash as shell
will end up embedding literal \xHH characters in the output resulting in
an ubootable barebox when CONFIG_PBL_VERIFY_PIGGY=y:

  !hash mismatch, refusing to decompress

Fix this by using octal escape sequences instead.

Signed-off-by: Ahmad Fatoum <>
 images/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/images/Makefile b/images/Makefile
index c79f1a272e9c..7a8bb94fe0df 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -113,7 +113,8 @@ $(obj)/piggy.o: $(obj)/barebox.z FORCE
 $(obj)/sha_sum.o: $(obj)/barebox.sha.bin FORCE
 quiet_cmd_sha256bin ?= SHA-BIN $@
-      cmd_sha256bin ?= printf "$(shell awk '{printf $$1}' < $(obj)/barebox.sum | sed -e 's/../\\x&/g' )" > $@
+      cmd_sha256bin = printf "$(shell sed 's/ .*$$//;s/../0x&\n/g;s/\n$$//' $(obj)/barebox.sum | \
+			while read -r byte; do printf '\%o' $$byte; done)" > $@
 quiet_cmd_sha256sum ?= SHA     $@
       cmd_sha256sum ?= sha256sum $(obj)/barebox.z > $@

             reply	other threads:[~2022-08-15  6:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15  6:38 Ahmad Fatoum [this message]
2022-08-15  6:46 ` Rouven Czerwinski
2022-08-16  6:34 ` 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:

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

  git send-email \ \ \ \ \

* 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