Annotation of /trunk/mkinitrd-magellan/isolinux/checksumiso.pl
Parent Directory | Revision Log
Revision 532 -
(hide annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (17 years, 1 month ago) by niro
File MIME type: text/plain
File size: 634 byte(s)
Sat Sep 1 22:45:15 2007 UTC (17 years, 1 month ago) by niro
File MIME type: text/plain
File size: 634 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | niro | 532 | #!/usr/bin/perl |
2 | # | ||
3 | # Construct a checksum for isolinux*.bin, compatible | ||
4 | # with an mkisofs boot-info-table | ||
5 | # | ||
6 | |||
7 | use bytes; | ||
8 | use integer; | ||
9 | |||
10 | ($file) = @ARGV; | ||
11 | |||
12 | open(FILE, '+<', $file) or die "$0: Cannot open $file: $!\n"; | ||
13 | binmode FILE; | ||
14 | |||
15 | if ( !seek(FILE,64,0) ) { | ||
16 | die "$0: Cannot seek past header\n"; | ||
17 | } | ||
18 | |||
19 | $csum = 0; | ||
20 | $bytes = 64; | ||
21 | while ( ($n = read(FILE, $dw, 4)) > 0 ) { | ||
22 | $dw .= "\0\0\0\0"; # Pad to at least 32 bits | ||
23 | ($v) = unpack("V", $dw); | ||
24 | $csum = ($csum + $v) & 0xffffffff; | ||
25 | $bytes += $n; | ||
26 | } | ||
27 | |||
28 | if ( !seek(FILE,16,0) ) { | ||
29 | die "$0: Cannot seek to header\n"; | ||
30 | } | ||
31 | |||
32 | print FILE pack("VV", $bytes, $csum); | ||
33 | |||
34 | close(FILE); | ||
35 | |||
36 | exit 0; |
Properties
Name | Value |
---|---|
svn:executable | * |