mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] sripts/k3img: determine size of files, not links
@ 2025-06-10 15:13 Sascha Hauer
  2025-06-11  7:02 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2025-06-10 15:13 UTC (permalink / raw)
  To: Barebox List

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-11  8:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-10 15:13 [PATCH] sripts/k3img: determine size of files, not links Sascha Hauer
2025-06-11  7:02 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox