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

Kim Mik kimmik999999 at yahoo.co.uk
Sun Jan 10 06:57:40 PST 2010


> On 01/09/2010 06:38 AM, Kim Mik wrote:
> > $ git log -p
> > commit d8c5e94803fa01f0d52475a50b69681ad3135700
> > Author: Gert Hulselmans
> > 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
> >
>
> Hmmm... there really isn't a huge reason not to do this unconditionally,
> at least unless it's known to cause problems.  It would be better, of
> course, if grldr used the standard DS:SI, but it doesn't, so oh well.
>
> It's the same thing with io.sys, which wants BL set -- it doesn't break
> anything else, so we just do it unconditionally.
>
> (Of course, there is the oddball issue of what happens on a
> nonconventional partition format, but that's not an issue for chain.c as
> currently written.)
>
>     -hpa


Here is the unconditional patch.
I switched to yahoo classic so hopefully TABs aren't replaced with spaces anymore. I attached the patch in an attachment too.

Some info of a Grub4dos developer (Tinybit):
  GRLDR can be loaded at any address with alignment 16(i.e., a possible
  segment base address). Generally you want to load it at 0000:7C00, or at
  2000:0000. Of course you never load it at 0000:0000 or similar.

  Before jumping to the entry point at the very beginning of GRLDR, you
  should setup DL=(BIOS drive) and DH=(partition number). For partition
  numbers, 0 - 3 are primary, 4 - 0xFE are logical. (DH=0xFF) stands for
  whole drive(unpartitioned). DH will later be passed to
  install_partition(the third byte, from bit 16 to bit 23).

http://www.boot-land.net/forums/index.php?showtopic=8457&st=20&start=20 post #22


Gert Hulselmans


commit aef446feea33f86b65b49d3bd090d2e7201b34bf
Author: Gert Hulselmans <kimmik999999 at yahoo.co.uk>
Date:   Sun Jan 10 15:09:37 2010 +0100

    chain.c32: Add support for passing partition number to grldr
   
    grldr of Grub4dos wants the partition number in DH:
      0xff: whole drive (default)
      0-3:  primary partitions
      4-*:  logical partitions

diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 5fca2d3..bfc6dd7 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -782,9 +782,20 @@ int main(int argc, char *argv[])

     whichpart = 0;        /* Default */

-    if (partition)
+    /* grldr of Grub4dos wants the partition number in DH:
+     0xff: whole drive (default)
+     0-3:  primary partitions
+     4-*:  logical partitions
+     */
+    regs.edx.b[1] = 0xff;
+
+    if (partition) {
    whichpart = strtoul(partition, NULL, 0);

+    /* grldr of Grub4dos wants the partition number in DH. */
+    regs.edx.b[1] = whichpart -1;
+    }
+
     if (!(drive & 0x80) && whichpart) {
    error("Warning: Partitions of floppy devices may not work\n");
     }


      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: chain-grldr2.diff
Type: text/x-patch
Size: 1085 bytes
Desc: not available
URL: <http://www.zytor.com/pipermail/syslinux/attachments/20100110/c79c6f7c/attachment.bin>


More information about the Syslinux mailing list