[Debburn-devel] geteltorito.pl
Santiago Garcia Mantinan
manty at debian.org
Tue Jan 2 13:50:51 CET 2007
Hi!
I'm sending a patch against geteltorito.pl version 0.3 to correct a problem
when trying to extract non emulated images.
The problem was on two sides:
First of all... the sector count was being unpacked as "n", the "El Torito"
specs say it is a word, and specifies words as being little endian, not big
endian, so that should be a "v" and not a "n". While checking this I have
also changed all other "S" to "v", they are not used for anything on
geteltorito right now, but just in case...
I have one doubt here, all the "S" we had were descrived as words by the
specs except for the checksum which is supposed to be a integer. We are not
using this so it is just a silly doubt I have, will that be machine
dependant and thus a "S"?
The second thing was that we were having the same sizes for the sectors on
the CD and for the virtual sectors and the specs say that the virtual
sectors are 0x200 bytes long, thus I have incorporated vSecSize for the
virtual sector size and all the images are counted in vSectsize sectors.
This solves the problem when extracting non emulated images (the image being
extracted after fixing the first bug was 4 times bigger than it should be).
I have tested this couple of fixes with both emulated and not emulated
images. I didn't have any CD with a HD image around, so I could not test
those.
One more thing for the cdrkit guys... geteltorito.pl doesn't seem to be
installed on Debian, wouldn't it be good to get it installed with one of the
packages? And if so... while you are at it... have something on the
description specifying that a boot image extractor or similar is included, I
have been apt-cache searching for a long time without finding any tool to do
that on Debian.
Well, I guess that's all for now. Comments are welcome.
Regards...
--
Manty/BestiaTester -> http://manty.net
--- geteltorito.pl.orig 2007-01-02 11:53:48.000000000 +0100
+++ geteltorito.pl 2007-01-02 13:27:32.000000000 +0100
@@ -12,8 +12,13 @@
# Get latest version from:
# http://www.uni-koblenz.de/~krienke/ftp/noarch/geteltorito
#
-$utilVersion="0.3";
+$utilVersion="0.4";
#
+# Version 0.4
+# 2007/02/01
+# A patch from Santiago Garcia <manty at debian.org> to use a virtual sector
+# size (vSecSize) of 512 bytes, as defined on "El Torito" specs and change
+# unpack of the sector count from n to v to get the correct sector count.
# Version 0.3
# 2006/02/21
# A patch from Ben Collins <bcollins at ubuntu.com> to make the
@@ -27,6 +32,7 @@
# For information on El Torito see
# http://www.cdpage.com/Compact_Disc_Variations/eltoritoi.html
+$vSecSize=512;
$secSize=2048;
$ret=undef;$version=undef;$opt_h=undef;$loadSegment=undef;$systemType=undef;
@@ -41,9 +47,9 @@
open(FILE, $file) || die "Cannot open \"$file\" \n";
seek(FILE, $secNum*$secSize, 0);
- $count=read(FILE, $sec, $secSize*$secCount, 0) ;
- if( $count != $secSize*$secCount ){
- warn "Error reading $secSize bytes from file \"$file\"\n";
+ $count=read(FILE, $sec, $vSecSize*$secCount, 0) ;
+ if( $count != $vSecSize*$secCount ){
+ warn "Error reading from file \"$file\"\n";
}
close(FILE);
@@ -136,7 +142,7 @@
$validateEntry=substr($sector, 0, 32);
($header, $platform, $unUsed, $manufact, $unUsed, $five, $aa)=
- unpack( "CCSA24SCC", $validateEntry);
+ unpack( "CCvA24vCC", $validateEntry);
if( $header != 1 || $five != 0x55 || $aa != 0xaa ){
die "Invalid Validation Entry on image \n";
@@ -157,7 +163,7 @@
$initialEntry=substr($sector, 32, 32);
($boot, $media, $loadSegment, $systemType, $unUsed,
- $sCount, $imgStart, $unUsed)=unpack( "CCSCCnVC", $initialEntry);
+ $sCount, $imgStart, $unUsed)=unpack( "CCvCCvVC", $initialEntry);
if( $boot != 0x88 ){
die "Boot indicator in Initial/Default-Entry is not 0x88. CD is not bootable. \n";
@@ -170,15 +176,15 @@
}
if( $media == 1 ){
print STDERR "1.2meg floppy";
- $count=1200*1024/$secSize;
+ $count=1200*1024/$vSecSize;
}
if( $media == 2 ){
print STDERR "1.44meg floppy";
- $count=1440*1024/$secSize;
+ $count=1440*1024/$vSecSize;
}
if( $media == 3 ){
print STDERR "2.88meg floppy";
- $count=2880*1024/$secSize;
+ $count=2880*1024/$vSecSize;
}
if( $media == 4 ){
print STDERR "harddisk";
@@ -190,7 +196,7 @@
# ($count==0)
$cnt=$count==0?$sCount:$count;
-print STDERR "El Torito image starts at sector $imgStart and has $cnt sector(s) of $secSize Bytes\n";
+print STDERR "El Torito image starts at sector $imgStart and has $cnt sector(s) of $vSecSize Bytes\n";
# We are there:
# Now read the bootimage to stdout
More information about the Debburn-devel
mailing list