[syslinux] [PATCH] mboot: set boot device

Sebastian Herbszt herbszt at gmx.de
Fri Jul 16 03:28:25 PDT 2010


H. Peter Anvin wrote:
> On 07/15/2010 05:10 AM, Sebastian Herbszt wrote:
>> H. Peter Anvin wrote:
>>> Isolinux boots in no-emulation (zero offset) *or* in hybrid mode, the
>>> latter of which can use a partition!
>> 
>> What about the following approach?
>> 
>> Set boot device if
>> * SYSLINUX_FS_PXELINUX or
>> * SYSLINUX_FS_ISOLINUX and cd_mode == 0 /* El Torito */ or
>> * SYSLINUX_FS_SYSLINUX and drive_number < 0x80 /* floppy */
>> 
>> As soon as some partition detection code appears we will also handle
>> those cases
>> * SYSLINUX_FS_ISOLINUX and cd_mode != 0 /* Hybrid */
>> * SYSLINUX_FS_SYSLINUX and drive_number >= 0x80 /* hard disk */
>> 
> 
> There is no point in hard-coding assumptions on cd_mode or drive number.
> Just look for a zero offset in the non-pxelinux case.
> 
> -hpa

I think this might be it.

Sebastian

diff --git a/com32/mboot/mboot.c b/com32/mboot/mboot.c
index 35450e0..2aaeead 100644
--- a/com32/mboot/mboot.c
+++ b/com32/mboot/mboot.c
@@ -234,6 +234,20 @@ int main(int argc, char *argv[])
     mboot_apm();
     mboot_syslinux_info();

+    /* Set boot device info */
+    const union syslinux_derivative_info *sdi;
+    sdi = syslinux_derivative_info();
+    if (sdi->c.filesystem == SYSLINUX_FS_PXELINUX) {
+        mbinfo.boot_device = (0x20 << 24) | 0xffffff; /* NETWORK_DRIVE */
+        mbinfo.flags |= MB_INFO_BOOTDEV;
+    } else if (sdi->c.filesystem == SYSLINUX_FS_ISOLINUX ||
+               sdi->c.filesystem == SYSLINUX_FS_SYSLINUX) {
+        if (!*sdi->disk.partoffset) {
+            mbinfo.boot_device = (sdi->disk.drive_number << 24) | 0xffffff;
+            mbinfo.flags |= MB_INFO_BOOTDEV;
+        }
+    }
+
     if (opt.solaris)
        mboot_solaris_dhcp_hack();





More information about the Syslinux mailing list