[PATCH] sripts/k3img: determine size of files, not links

Sascha Hauer s.hauer at pengutronix.de
Tue Jun 10 08:13:21 PDT 2025


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 at 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




More information about the barebox mailing list