gptboot parse error

John Hay jhay at meraka.org.za
Mon Aug 10 13:05:52 UTC 2009


Hi,

When experimenting with gptboot to boot different partitions, I found
that its parse() function was broken. Using 'p' to seperate the units
from the partition did not work, neither did a ','.

Here is a fix to make it work with 'p' like it is suggested in main().
Any comments? Should we try to get it in before 8.0?

This allows me to use boot.config to select different partitions to boot
from. Something like "ad(0p3)/boot/loader" for instance.

John
-- 
John Hay -- jhay at meraka.csir.co.za / jhay at FreeBSD.org

Index: gptboot.c
===================================================================
RCS file: /home/ncvs/src/sys/boot/i386/gptboot/gptboot.c,v
retrieving revision 1.86.2.3
diff -u -r1.86.2.3 gptboot.c
--- gptboot.c	15 Aug 2008 19:31:12 -0000	1.86.2.3
+++ gptboot.c	7 Aug 2009 10:27:09 -0000
@@ -466,16 +466,13 @@
 		dsk.type = i;
 		arg += 3;
 		dsk.unit = *arg - '0';
-		if (arg[1] != ',' || dsk.unit > 9)
+		if (arg[1] != 'p' || dsk.unit > 9)
 		    return -1;
 		arg += 2;
-		dsk.part = -1;
-		if (arg[1] == ',') {
-		    dsk.part = *arg - '0';
-		    if (dsk.part < 1 || dsk.part > 9)
-			return -1;
-		    arg += 2;
-		}
+		dsk.part = *arg - '0';
+		if (dsk.part < 1 || dsk.part > 9)
+		    return -1;
+		arg++;
 		if (arg[0] != ')')
 		    return -1;
 		arg++;


More information about the freebsd-current mailing list