david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Use byte 6 for the checksum, rather than byte 5. (Byte 5 may be part of

the jmp instruction).
This commit is contained in:
Michael Brown 2006-06-06 15:29:14 +00:00
parent 02df45352c
commit 8d0c5f3302
1 changed files with 6 additions and 10 deletions

View File

@ -131,9 +131,9 @@ sub writerom ($$) {
sub checksum ($) { sub checksum ($) {
my ($romref) = @_; my ($romref) = @_;
substr($$romref, 5, 1) = "\x00"; substr($$romref, 6, 1) = "\x00";
my $sum = unpack('%8C*', $$romref); my $sum = unpack('%8C*', $$romref);
substr($$romref, 5, 1) = chr(256 - $sum); substr($$romref, 6, 1) = chr(256 - $sum);
# Double check # Double check
$sum = unpack('%8C*', $$romref); $sum = unpack('%8C*', $$romref);
if ($sum != 0) { if ($sum != 0) {
@ -168,14 +168,10 @@ sub makerom () {
$romsize = ($filesize + 511) & ~511 $romsize = ($filesize + 511) & ~511
} }
} else { } else {
$romsize = getromsize(\$rom); # Shrink romsize down to the smallest power of two that will do
# 0 put there by *loader.S means makerom should pick the size for ($romsize = MAXROMSIZE;
if ($romsize == 0) { $romsize > MINROMSIZE and $romsize >= 2*$filesize;
# Shrink romsize down to the smallest power of two that will do $romsize /= 2) { }
for ($romsize = MAXROMSIZE;
$romsize > MINROMSIZE and $romsize >= 2*$filesize;
$romsize /= 2) { }
}
} }
if ($filesize > $romsize) { if ($filesize > $romsize) {
print STDERR "ROM size of $romsize not big enough for data, "; print STDERR "ROM size of $romsize not big enough for data, ";