$ 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"); }
On 01/09/2010 06:38 AM, Kim Mik wrote:> $ 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 >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 -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
> 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.) > > -hpaHere 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>