提交 c66b57fc 编写于 作者: A Alexander Graf 提交者: Anthony Liguori

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 <glommer@redhat.com>.
Printf idea by Paolo Bonzini <bonzini@gnu.org>.
Signed-off-by: NAlexander Graf <agraf@suse.de>
CC: Glauber Costa <glommer@redhat.com>
CC: Paolo Bonzini <bonzini@gnu.org>
CC: Jan Ondrej <ondrejj@salstar.sk>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
Message-Id: 
上级 9aebd98a
...@@ -39,7 +39,8 @@ done ...@@ -39,7 +39,8 @@ done
sum=$(( $sum % 256 )) sum=$(( $sum % 256 ))
sum=$(( 256 - $sum )) sum=$(( 256 - $sum ))
sum_octal=$( printf "%o" $sum )
# and write the output file # and write the output file
cp "$1" "$2" 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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册