signrom.sh: portability fix
PATCH 1/1 signrom.sh: portability fix
Hi!
Attached patch makes signrom.sh working on NetBSD. The output of the 'od' command leads to a syntax error which breaks the build.
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
pc-bios/optionrom/signrom.sh +3 -2
@@ -31,9 +31,10 @@ x=`dd if="$1" bs=1 count=1 skip=2 2>/dev/null | od -t u1 -A n` size=$(( $x * 512 - 1 )) # now get the checksum -for i in `od -A n -t u1 -v "$1"`; do +nums=`od -A n -t u1 -v "$1"` +for i in ${nums}; do # add each byte's value to sum - sum=$(( $sum + $i )) + sum=`expr $sum + $i` done sum=$(( $sum % 256 ))
Quoted 6 lines · Christoph Egger
Hi!
Attached patch makes
signrom.shworking on NetBSD. The output of the 'od' command leads to a syntax error which breaks the build.
So why replace the $(( ... )) calculation with expr then? A few lines below there's another $(( )) that apparently works.
Btw: Inlined patches are very much appreciated :-)
Alex
Quoted 4 lines · Alexander Graf
Quoted 1 line · Christoph Egger
Quoted 8 lines
Quoted 5 lines
Hi!
Attached patch makes
signrom.shworking on NetBSD. The output of the 'od' command leads to a syntax error which breaks the build.So why replace the $(( ... )) calculation with expr then? A few lines below there's another $(( )) that apparently works.
Picking up this old topic again: Forking expr in this tight loop is a very bad idea. It makes signing a fairly long running step of the build process for any non-trivial rom (I'm about to add one of those).
Can you please provide an example output for the ${nums} variable that used to break for you so that we can find a fork-free algorithm?
Thanks,
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux