aboutsummaryrefslogtreecommitdiffstats
path: root/com32/modules
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-01-10 12:36:30 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-01-10 12:36:30 -0800
commit58e9e6510952e7c558b68e6d90e9fbd30156ba83 (patch)
treec4f72b4170d7af878521f573660364c4709d8169 /com32/modules
parent91334030e93d5d0a60a178e214140054dfc5d69c (diff)
downloadsyslinux.git-58e9e6510952e7c558b68e6d90e9fbd30156ba83.tar.gz
syslinux.git-58e9e6510952e7c558b68e6d90e9fbd30156ba83.tar.xz
syslinux.git-58e9e6510952e7c558b68e6d90e9fbd30156ba83.zip
chain.c32: simplify the grub4dos support
Grub4dos (like Grub in general) uses the same partition numbers as Linux (and chain.c32), minus one. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/modules')
-rw-r--r--com32/modules/chain.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 3d192d73..2dd80746 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -781,25 +781,21 @@ int main(int argc, char *argv[])
regs.ebx.b[0] = regs.edx.b[0] = drive;
whichpart = 0; /* Default */
-
- /* 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) {
+ 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");
}
+ /*
+ * grldr of Grub4dos wants the partition number in DH:
+ * -1: whole drive (default)
+ * 0-3: primary partitions
+ * 4-*: logical partitions
+ */
+ regs.edx.b[1] = whichpart-1;
+
/* Get the disk geometry and disk access setup */
if (get_disk_params(drive)) {
error("Cannot get disk parameters\n");