mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] sripts/k3img: determine size of files, not links
Date: Tue, 10 Jun 2025 17:13:21 +0200	[thread overview]
Message-ID: <20250610151321.2926513-1-s.hauer@pengutronix.de> (raw)

The input files to the k3img tool might be links, in that case we need
the sizes of the actual files, not of the links pointing to them, so add
the -L option to the stat command.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 scripts/k3img | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/k3img b/scripts/k3img
index a514852fcd..32ceb15ee9 100755
--- a/scripts/k3img
+++ b/scripts/k3img
@@ -71,10 +71,10 @@ shasysfw=$(sha512sum $sysfw | sed 's/ .*//')
 shasysfwdata=$(sha512sum $sysfwdata | sed 's/ .*//')
 shadmdata=$(sha512sum $dmdata | sed 's/ .*//')
 
-sblsize=$(stat -c%s $sbl)
-sysfwsize=$(stat -c%s $sysfw)
-sysfwdatasize=$(stat -c%s $sysfwdata)
-dmdatasize=$(stat -c%s $dmdata)
+sblsize=$(stat -L -c%s $sbl)
+sysfwsize=$(stat -L -c%s $sysfw)
+sysfwdatasize=$(stat -L -c%s $sysfwdata)
+dmdatasize=$(stat -L -c%s $dmdata)
 
 total=$(($sblsize + $sysfwsize + $sysfwdatasize + $dmdatasize))
 
@@ -88,7 +88,7 @@ num_comp=4
 
 if [ -n "${innerdata}" ]; then
 	shainnerdata=$(sha512sum $innerdata | sed 's/ .*//')
-	innerdatasize=$(stat -c%s $innerdata)
+	innerdatasize=$(stat -L -c%s $innerdata)
 
 	innercert=$(cat <<EOF
 [sysfw_inner_cert]
-- 
2.39.5




             reply	other threads:[~2025-06-10 18:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 15:13 Sascha Hauer [this message]
2025-06-11  7:02 ` 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=20250610151321.2926513-1-s.hauer@pengutronix.de \
    --to=s.hauer@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