[syslinux] chain.c32 add grldr= command for Grub4dos

Kim Mik kimmik999999 at yahoo.co.uk
Sat Jan 9 06:38:31 PST 2010


$ git log -p
commit d8c5e94803fa01f0d52475a50b69681ad3135700
Author: Gert Hulselmans <kimmik999999 at yahoo.co.uk>
Date:   Sat Jan 9 15:30:49 2010 +0100

    chain.c32: Add grldr= command for Grub4dos
    
    grldr of Grub4dos wants the partition number in DH:
      0xff: whole drive
      0-3:  primary partitions
      4-*:  logical partitions

diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 5fca2d3..73f37c5 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -52,6 +52,9 @@
  *      used with Recovery Console of Windows NT/2K/XP..
  *      same as ntldr=<loader> & "cmdcons\0" written to memory address 0000:7C
  *
+ * grldr=<loader>:
+ *      used with grldr of Grub4dos
+ *
  * freedos=<loader>:
  *     equivalent to -seg 0x60 -file <loader>, used with FreeDOS kernel.sys.
  *
@@ -90,6 +93,7 @@ static struct options {
     uint16_t seg;
     bool isolinux;
     bool cmldr;
+    bool grldr;
     bool swap;
     bool hide;
 } opt;
@@ -700,6 +704,9 @@ int main(int argc, char *argv[])
            opt.seg = 0x2000;    /* CMLDR wants this address */
            opt.loadfile = argv[i] + 6;
            opt.cmldr = true;
+       } else if (!strncmp(argv[i], "grldr=", 6)) {
+           opt.loadfile = argv[i] + 6;
+           opt.grldr = true;
        } else if (!strncmp(argv[i], "freedos=", 8)) {
            opt.seg = 0x60;     /* FREEDOS wants this address */
            opt.loadfile = argv[i] + 8;
@@ -737,6 +744,7 @@ int main(int argc, char *argv[])
                 "         isolinux=<loader>  load another version of ISOLINUX\
                 "         ntldr=<loader>     load Windows NTLDR, SETUPLDR.BIN 
                 "         cmldr=<loader>     load Recovery Console of Windows 
+                "         grldr=<loader>     load grldr of Grub4dos\n"
                 "         freedos=<loader>   load FreeDOS kernel.sys\n"
                 "         msdos=<loader>     load MS-DOS io.sys\n"
                 "         pcdos=<loader>     load PC-DOS ibmbio.com\n"
@@ -780,11 +788,24 @@ int main(int argc, char *argv[])
     /* DOS kernels want the drive number in BL instead of DL.  Indulge them. *
     regs.ebx.b[0] = regs.edx.b[0] = drive;
 
+    /* grldr of Grub4dos wants the partition number in DH:
+        0xff: whole drive
+        0-3:  primary partitions
+        4-*:  logical partitions
+     */
+    if (opt.grldr)
+       regs.edx.b[1] = 0xff;
+
     whichpart = 0;             /* Default */
 
-    if (partition)
+    if (partition) {
        whichpart = strtoul(partition, NULL, 0);
 
+       /* grldr of Grub4dos wants the partiton number in DH. */
+       if (opt.grldr)
+           regs.edx.b[1] = whichpart -1;
+    }
+
     if (!(drive & 0x80) && whichpart) {
        error("Warning: Partitions of floppy devices may not work\n");
     }



      




More information about the Syslinux mailing list