From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MXBCj-0000ms-KV for qemu-devel@nongnu.org; Sat, 01 Aug 2009 05:48:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MXBCe-0000mc-Du for qemu-devel@nongnu.org; Sat, 01 Aug 2009 05:48:40 -0400 Received: from [199.232.76.173] (port=53754 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXBCe-0000mP-1a for qemu-devel@nongnu.org; Sat, 01 Aug 2009 05:48:36 -0400 Received: from cantor2.suse.de ([195.135.220.15]:47537 helo=mx2.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MXBCd-0003xU-7K for qemu-devel@nongnu.org; Sat, 01 Aug 2009 05:48:35 -0400 From: Alexander Graf Date: Sat, 1 Aug 2009 11:48:31 +0200 Message-Id: <1249120111-31757-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH] Fix checksum writing in signboot.sh List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jan Ondrej , Glauber Costa , Paolo Bonzini , avi@redhat.com 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 --- pc-bios/optionrom/signrom.sh | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) 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 -- 1.6.0.2