Skip to content

Commit c11ef5e

Browse files
committed
Fix checksum computation for macOS
The two utilities use different ways to get the size of a file, both of which don't work on macOS. Replace them with `cat <file> | wc -c`. Signed-off-by: Christophe de Dinechin <[email protected]>
1 parent dc7f375 commit c11ef5e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

bin/add_pgm_chsum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dumppgm() {
4848

4949
# -- MAIN ------------------
5050

51-
checkutils sha1sum sed tac dd printf find type
51+
checkutils sha1sum sed tac dd printf find type wc
5252

5353
if [ ! -f "$bin" ]; then
5454
echo "ERROR: Cannot find program binary '$bin'"
@@ -60,7 +60,7 @@ if [ -z "$pgm" ]; then
6060
exit 1
6161
fi
6262

63-
pgmsz=`find "$bin" -printf "%s"`
63+
pgmsz=`cat $bin | wc -c`
6464
hexsz=`printf "%08x" $pgmsz`
6565

6666
sha=`dumppgm | sha1sum | tr -d ' -'`
@@ -71,5 +71,3 @@ echo "SHA1: $sha"
7171
dumppgm
7272
toint8 $sha
7373
) > $pgm
74-
75-

bin/check_qspi_crc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ q=build/${pgm}_qspi.bin
77

88

99
filesize() {
10-
stat -Lc%s "$1"
10+
cat "$1" | wc -c
1111
}
1212

1313

0 commit comments

Comments
 (0)