[syslinux] [PATCH] chain.c32: add menu support to grub loader
Gert Hulselmans
gerth at zytor.com
Wed Jun 30 16:20:49 PDT 2010
Paul Bolle wrote:
> Allow the grub loader to (optionally) support using a GRUB menu file.
> For example
> chain fs grub=stage2,grub.conf
>
> will load GRUB's stage2 and pass the (absolute) path to the file
> "grub.conf" in the Syslinux filesystem to GRUB's stage2. The path is
> passed to stage2 in GRUB's device/partition syntax (eg, "(hd0,1)/foo").
> Note that we don't check whether the menu file actually exists in the
> Syslinux filesystem. GRUB will do the right thing if the file doesn't
> exist and will just fall back to its prompt.
> + if (path && opt.grubmenu) {
> + char partition[5]; /* maximum is ",100" and up! */
> + int len;
> +
> + if (whichpart > 1)
> + sprintf(partition, ",%d", whichpart - 1);
> + else
> + partition[0] = '\0';
> + sprintf(path, "(%cd%d%s)/",
> + drive & 0x80 ? 'h': 'f',
> + (drive & 0x7),
> + partition);
> + len = strlen(path);
> + strncpy (path + len, opt.grubmenu, 89 - len);
Why do you add (drivenumber,partition) to the config file name?
When the user adds the drivenumber and partition to its config filename
itself:
chain.c32 hd0,3 grub=/boot/grub/stage2,(hd1,10)/anotherconf.lst
you get a "bad" configfilename: (hd0,2)/(hd1,10)/anotherconf.lst
In my patch, grub will search on the correct drive and partition
automatically, when you just use /anotherconf.lst.
GRUB just searches its config file on the drive (passed via DL) and
partition (install_partition). You don't need to add the right drive and
partition to the config filename yourself.
- Gert Hulselmans
More information about the Syslinux
mailing list