From: Alexander Graf Date: Sat, 1 Aug 2009 09:48:31 +0000 (+0200) Subject: Fix checksum writing in signboot.sh X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~11128 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c66b57fc144345e7f4b5f2bfc6a389d57d927647;p=sdk%2Femulator%2Fqemu.git Fix checksum writing in signboot.sh The printf command takes an octal value after \, so we have to convert our decimal representation to octal first and then write it. This unbreaks extboot signing. Multiboot wasn't affected yet because the checksum was < 8. Spotted and first patch by Glauber Costa . Printf idea by Paolo Bonzini . Signed-off-by: Alexander Graf CC: Glauber Costa CC: Paolo Bonzini CC: Jan Ondrej Signed-off-by: Anthony Liguori Message-Id: --- diff --git a/pc-bios/optionrom/signrom.sh b/pc-bios/optionrom/signrom.sh index 4322811..975b27d 100755 --- a/pc-bios/optionrom/signrom.sh +++ b/pc-bios/optionrom/signrom.sh @@ -39,7 +39,8 @@ done sum=$(( $sum % 256 )) sum=$(( 256 - $sum )) +sum_octal=$( printf "%o" $sum ) # and write the output file cp "$1" "$2" -printf "\\$sum" | dd of="$2" bs=1 count=1 seek=$size conv=notrunc 2>/dev/null +printf "\\$sum_octal" | dd of="$2" bs=1 count=1 seek=$size conv=notrunc 2>/dev/null