summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Loibl <andreas@andreas-loibl.de>2011-11-15 22:44:51 +0100
committerAndreas Loibl <andreas@andreas-loibl.de>2011-11-15 22:46:15 +0100
commit39cf903e54873585284f2884025fe3f8560898d9 (patch)
tree3547290132cdda9256543d3a18decde54a84d4b2
parent10cd84c2744c628ed065015563aa4d438efd8d99 (diff)
downloadkanotix-39cf903e54873585284f2884025fe3f8560898d9.zip
kanotix-39cf903e54873585284f2884025fe3f8560898d9.tar.gz
isohybrid: support for FAT-partitions embedded in ISO9660
-rwxr-xr-xisohybrid-acritox3
-rwxr-xr-xisohybrid-embeddedfat57
2 files changed, 60 insertions, 0 deletions
diff --git a/isohybrid-acritox b/isohybrid-acritox
index e2bcd49..c12edec 100755
--- a/isohybrid-acritox
+++ b/isohybrid-acritox
@@ -112,6 +112,9 @@ if ($padding) {
print FILE "\0" x $padding;
}
+# TODO: merge isohybrid-embeddedfat into here
+exit 0;
+
# Append FAT partition to image
read FAT, $partition, $fatsize;
print FILE $partition;
diff --git a/isohybrid-embeddedfat b/isohybrid-embeddedfat
new file mode 100755
index 0000000..b35b3bc
--- /dev/null
+++ b/isohybrid-embeddedfat
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+# isohybrid-embeddedfat - written by Andreas Loibl <andreas@andreas-loibl.de>
+#
+
+die "Usage: $0 <isohybrid-bg2.iso> <filename>\n" if $#ARGV != 1;
+
+($file,$filename) = @ARGV;
+open(FILE, "+< $file\0") or die "$0: cannot open $file: $!\n";
+binmode FILE;
+
+# Get the total size of the image
+(@imgstat = stat(FILE)) or die "$0: $file: $!\n";
+$imgsize = $imgstat[7];
+if (!$imgsize) {
+ die "$0: $file: cannot determine length of file\n";
+}
+
+$start = `isoinfo -J -s -l -i kanotix64.iso | awk '/$filename/{print \$10}'`;
+if (!$start) {
+ die "$0: $filename: cannot determine position of file\n";
+}
+
+use integer;
+$lba = $start*4;
+$psize = $imgsize/512 - $lba;
+$h = 64; $s = 32;
+$hpc = 32; $spt = 63;
+$bcyl = $lba / ($spt * $hpc);
+$bhead = ($lba / $spt) % $hpc;
+$bsect = ($lba % $spt) + 1;
+$cylsize = $h*$s*512;
+$c = $imgsize/$cylsize;
+if ($c > 1024) {
+ $cc = 1024;
+} else {
+ $cc = $c;
+}
+$ehead = $h-1;
+$esect = $s + ((($cc-1) & 0x300) >> 2);
+$ecyl = ($cc-1) & 0xff;
+
+# Adjust MBR partition table
+$fstype = 0xEF;
+$pentry = 1;
+
+seek(FILE, 430+16*$pentry, SEEK_SET) or die "$0: $file: $!\n";
+print FILE pack("CCCCCCCCVV", 0x80, $bhead, $bsect, $bcyl, $fstype, $ehead, $esect, $ecyl, $lba, $psize);
+
+# Delete other partition entry from MBR-partition-table
+seek(FILE, 430+16*2, SEEK_SET) or die "$0: $file: $!\n";
+print FILE "\0" x 16;
+
+# Done...
+close(PART);
+close(FILE);
+
+exit 0;