[syslinux:master] chain.c32: only pass partition number in DH, when grldr= is used

syslinux-bot for Gert Hulselmans gerth at zytor.com
Sun Jun 27 18:54:12 PDT 2010


Commit-ID:  3a74aa5230b81ef83612d02f7c405915afc5e64b
Gitweb:     http://syslinux.zytor.com/commit/3a74aa5230b81ef83612d02f7c405915afc5e64b
Author:     Gert Hulselmans <gerth at zytor.com>
AuthorDate: Mon, 28 Jun 2010 02:42:58 +0200
Committer:  Shao Miller <shao.miller at yrdsb.edu.on.ca>
CommitDate: Sun, 27 Jun 2010 18:04:28 -0700

chain.c32: only pass partition number in DH, when grldr= is used

Add grldr= as boot parameter, so the partition number is only passed to
grub4dos grldr, when grldr= is used.

Currently the partition number is passed in DH unconditionally.
As consequence, grldr will set its root partition on which is searches its
menu.lst to (hd0), because -1 (whole drive) is passed in DH as root partition:
  chain.c32 file=/grldr

When the conditional check, this problem is solved:
  chain.c32 file=/grldr
Grub4dos will search all partitions for its menu.lst

When you want to set the root partition, use something like the following:
  chain.c32 hd0,2 grldr=/grldr
  chain.c32 fs grldr=/grldr

Signed-off-by: Gert Hulselmans <gerth at zytor.com>


---
 com32/modules/chain.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index c45a8d7..a76d275 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -80,6 +80,10 @@
  *	same as seg=0x800 file=<loader> & jumping to seg 0x820,
  *	used with GRUB stage2 files.
  *
+ * grldr=<loader>
+ *	pass the partition number to GRUB4DOS,
+ *	used with GRUB4DOS' grldr.
+ *
  * swap
  *	if the disk is not fd0/hd0, install a BIOS stub which swaps
  *	the drive numbers.
@@ -119,6 +123,7 @@ static struct options {
     uint16_t seg;
     bool isolinux;
     bool cmldr;
+    bool grldr;
     bool swap;
     bool hide;
     bool sethidden;
@@ -1272,6 +1277,7 @@ Options: file=<loader>      Load and execute file, instead of boot sector\n\
          msdos=<loader>     Load MS-DOS IO.SYS\n\
          pcdos=<loader>     Load PC-DOS IBMBIO.COM\n\
          grub=<loader>      Load GRUB stage2\n\
+         grldr=<loader>     Load GRUB4DOS grldr\n\
          seg=<segment>      Jump to <seg>:0000, instead of 0000:7C00\n\
          swap               Swap drive numbers, if bootdisk is not fd0/hd0\n\
          hide               Hide primary partitions, except selected partition\n\
@@ -1343,6 +1349,9 @@ int main(int argc, char *argv[])
 	    opt.seg = 0x800;	/* stage2 wants this address */
 	    opt.loadfile = argv[i] + 5;
 	    opt.grub = true;
+	} else if (!strncmp(argv[i], "grldr=", 6)) {
+	    opt.loadfile = argv[i] + 6;
+	    opt.grldr = true;
 	} else if (!strcmp(argv[i], "swap")) {
 	    opt.swap = true;
 	} else if (!strcmp(argv[i], "noswap")) {
@@ -1487,7 +1496,8 @@ int main(int argc, char *argv[])
      * 0-3:  primary partitions
      * 4-*:  logical partitions
      */
-    regs.edx.b[1] = whichpart - 1;
+    if (opt.grldr)
+	regs.edx.b[1] = whichpart - 1;
 
     if (opt.hide) {
 	if (whichpart < 1 || whichpart > 4)



More information about the Syslinux-commits mailing list