[syslinux:master] chain.c32: add grldr= command for Grub4dos
syslinux-bot for Kim Mik
kimmik999999 at yahoo.co.uk
Sun Jan 10 12:39:06 PST 2010
Commit-ID: 91334030e93d5d0a60a178e214140054dfc5d69c
Gitweb: http://syslinux.zytor.com/commit/91334030e93d5d0a60a178e214140054dfc5d69c
Author: Kim Mik <kimmik999999 at yahoo.co.uk>
AuthorDate: Sun, 10 Jan 2010 14:57:40 +0000
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Sun, 10 Jan 2010 12:33:16 -0800
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.
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
---
com32/modules/chain.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index da64707..3d192d7 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 partiton number in DH. */
+ 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-commits
mailing list