From patchwork Sat Aug 1 09:48:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 30453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 18753B7BBE for ; Sat, 1 Aug 2009 19:49:36 +1000 (EST) Received: from localhost ([127.0.0.1]:50599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXBDY-0000mx-Ne for incoming@patchwork.ozlabs.org; Sat, 01 Aug 2009 05:49:32 -0400 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 Received: from relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 2840F4844E; Sat, 1 Aug 2009 11:48:32 +0200 (CEST) From: Alexander Graf To: qemu-devel@nongnu.org Date: Sat, 1 Aug 2009 11:48:31 +0200 Message-Id: <1249120111-31757-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: Jan Ondrej , Glauber Costa , Paolo Bonzini , avi@redhat.com Subject: [Qemu-devel] [PATCH] Fix checksum writing in signboot.sh X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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