qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix checksum writing in signboot.sh
@ 2009-08-01  9:48 Alexander Graf
  2009-08-02 10:04 ` [Qemu-devel] " Avi Kivity
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Graf @ 2009-08-01  9:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Ondrej, Glauber Costa, Paolo Bonzini, avi

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 <glommer@redhat.com>.
Printf idea by Paolo Bonzini <bonzini@gnu.org>.

Signed-off-by: Alexander Graf <agraf@suse.de>
CC: Glauber Costa <glommer@redhat.com>
CC: Paolo Bonzini <bonzini@gnu.org>
CC: Jan Ondrej <ondrejj@salstar.sk>
---
 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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-08-03 12:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-01  9:48 [Qemu-devel] [PATCH] Fix checksum writing in signboot.sh Alexander Graf
2009-08-02 10:04 ` [Qemu-devel] " Avi Kivity
2009-08-02 10:25   ` Filip Navara
2009-08-02 11:15     ` Avi Kivity
2009-08-02 11:58       ` Alexander Graf
2009-08-02 12:21         ` Avi Kivity
2009-08-02 21:29         ` [Qemu-devel] " Sebastian Herbszt
2009-08-03  2:30         ` [Qemu-devel] " Anthony Liguori
2009-08-03  6:12           ` Paolo Bonzini
2009-08-03 12:55           ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).