Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Feb 2001 13:47:07 +0900 (JST)
From:      HASEGAWA Tomoki <thasegawa@mta.biglobe.ne.jp>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   i386/24997: /boot/loader cannot handle extended dos partitions
Message-ID:  <20010211.134707.59464862.thasegawa@mta.biglobe.ne.jp>

next in thread | raw e-mail | index | archive | help

>Number:         24997
>Category:       i386
>Synopsis:       /boot/loader cannot handle extended dos partitions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 10 21:00:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     HASEGAWA Tomoki
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
>Environment:
FreeBSD 4.2-STABLE(2001/02/10) i386
FreeBSD 5.0-CURRENT(2001/02/10) i386

>Description:
/boot/loader cannot handle extended dos partitions in ide disks (except slice 5(eg disk0s5)).
I cannot boot with root partition /dev/ad0s9a.


devices in FreeBSD      corresponding disk name in /boot/loader
/dev/ad0s5           -> disk0s5
/dev/ad0s6           -> disk0s7
/dev/ad0s7 or higher -> cannot handle

>How-To-Repeat:
make extended dos partitions and use 'lsdev' command in the /boot/loader command line.

>Fix:

I referred to sys/kern/subr_diskmbr.c and revised sys/boot/i386/libi386/biosdisk.c. The patch is following.

Index: biosdisk.c
===================================================================
RCS file: /home/ncvs/src/sys/boot/i386/libi386/biosdisk.c,v
retrieving revision 1.26.2.6
diff -u -r1.26.2.6 biosdisk.c
--- biosdisk.c	2000/12/28 13:10:47	1.26.2.6
+++ biosdisk.c	2001/02/10 05:59:00
@@ -132,7 +132,7 @@
 static int	bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev);
 static void	bd_closedisk(struct open_disk *od);
 static int	bd_bestslice(struct open_disk *od);
-static void	bd_checkextended(struct open_disk *od, int slicenum);
+static void	bd_checkextended(struct open_disk *od, int slicenum, int basenum);
 
 /*
  * Translate between BIOS device numbers and our private unit numbers.
@@ -512,7 +512,7 @@
       sizeof(struct dos_partition) * NDOSPART);
     od->od_nslices = 4;			/* extended slices start here */
     for (i = 0; i < NDOSPART; i++)
-        bd_checkextended(od, i);
+        bd_checkextended(od, i, i);
     od->od_flags |= BD_PARTTABOK;
     dptr = &od->od_slicetab[0];
 
@@ -624,12 +624,12 @@
 }
 
 static void
-bd_checkextended(struct open_disk *od, int slicenum)
+bd_checkextended(struct open_disk *od, int slicenum, int basenum)
 {
 	char	buf[BIOSDISK_SECSIZE];
 	struct dos_partition *dp;
 	u_int base;
-	int i, start, end;
+	int i, start;
 
 	dp = &od->od_slicetab[slicenum];
 	start = od->od_nslices;
@@ -651,17 +651,21 @@
 			continue;
 		if (od->od_nslices == MAX_SLICES)
 			goto done;
-		dp->dp_start += base;
-		bcopy(dp, &od->od_slicetab[od->od_nslices], sizeof(*dp));
-		od->od_nslices++;
+		if (dp->dp_typ == DOSPTYP_EXT) {
+			dp->dp_start += od->od_slicetab[basenum].dp_start;;
+			bcopy(dp, &od->od_slicetab[od->od_nslices], sizeof(*dp));
+		} else {
+			dp->dp_start += base;
+			bcopy(dp, &od->od_slicetab[od->od_nslices], sizeof(*dp));
+			od->od_nslices++;
+		}
 	}
-	end = od->od_nslices;
 
 	/*
 	 * now, recursively check the slices we just added
 	 */
-	for (i = start; i < end; i++)
-		bd_checkextended(od, i);
+	for (i = start; i < start + NDOSPART; i++) 
+		bd_checkextended(od, i, basenum);
 done:
 	return;
 }


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010211.134707.59464862.thasegawa>