qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH] Fix checksum writing in signboot.sh


From: Filip Navara
Subject: Re: [Qemu-devel] Re: [PATCH] Fix checksum writing in signboot.sh
Date: Sun, 2 Aug 2009 12:25:44 +0200

On Sun, Aug 2, 2009 at 12:04 PM, Avi Kivity<address@hidden> wrote:
> On 08/01/2009 12:48 PM, Alexander Graf wrote:
>>
>> 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<address@hidden>.
>> Printf idea by Paolo Bonzini<address@hidden>.
>>
>> Signed-off-by: Alexander Graf<address@hidden>
>> CC: Glauber Costa<address@hidden>
>> CC: Paolo Bonzini<address@hidden>
>> CC: Jan Ondrej<address@hidden>
>> ---
>>  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
>>
>
> While the patch is good, the code is unreadable.  Can we mandate python for
> such tricks?

No, please, no! Throwing additional tools at the problem is only going
to make it worse for Windows users. I'm not happy with using sh script
as it already added dependency on coreutils, but at least that's easy
to install. Python is a nightmare compared to that.

BTW, for years in ReactOS we had a way to build host tools with host
CC and these tools were written in plain ordinary C. This worked great
for both Windows and Linux builds and also for cross-compiling.

Best regards,
Filip Navara




reply via email to

[Prev in Thread] Current Thread [Next in Thread]