isohybrid: verify we have a hybrid-compatible isolinux.bin
authorH. Peter Anvin <hpa@zytor.com>
Mon, 8 Sep 2008 02:23:31 +0000 (19:23 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 8 Sep 2008 02:23:31 +0000 (19:23 -0700)
Verify that the PXE boot loader is a hybrid-compatible isolinux.bin by
looking for the hybrid boot signature, otherwise print an error
message.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
utils/isohybrid.in

index 1dcdf10..25c7927 100644 (file)
@@ -76,6 +76,14 @@ if ($de_boot != 0x88 || $de_media != 0 ||
     die "$0: $file: unexpected boot catalog parameters\n";
 }
 
+# Now $de_lba should contain the CD sector number for isolinux.bin
+seek(FILE, $de_lba*2048+0x40, SEEK_SET) or die "$0: $file: $!\n";
+read(FILE, $ibsig, 4);
+if ($ibsig ne "\xfb\xc0\x78\x70") {
+    die "$0: $file: bootloader is missing isolinux.bin hybrid signature\n".
+       "Note: isolinux-debug.bin does not support hybrid booting\n";
+}
+
 # Get the total size of the image
 (@imgstat = stat(FILE)) or die "$0: $file: $!\n";
 $imgsize = $imgstat[7];
@@ -96,10 +104,9 @@ if ($c > 1024) {
     $cc = $c;
 }
 
-# Now $de_lba should contain the CD sector number for isolinux.bin
+# Print the MBR and partition table
 seek(FILE, 0, SEEK_SET) or die "$0: $file: $!\n";
 
-# Print the MBR and partition table
 $mbr = '';
 while ( $line = <DATA> ) {
     chomp $line;