NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: install/38604: sysinst does not proviede default root mount point
The following reply was made to PR install/38604; it has been noted by GNATS.
From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: install/38604: sysinst does not proviede default root mount point
Date: Thu, 15 May 2008 10:38:02 +0200
--y0ulUmNC+osPPQO6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
This patch fixes it for me (and also the differences between the mbr partition
offset and the disklabel). I'm not sure this is the right way to fix it though.
Another option would be to disable the "use existing partitions" option if
there have not been any (but this part is hard to detect, since the kernel
makes up the disklabel for us and does not leave any hints apparently that
it is not an on-disk label).
Martin
--y0ulUmNC+osPPQO6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch
? sysinst.log
Index: bsddisklabel.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/bsddisklabel.c,v
retrieving revision 1.44
diff -u -p -r1.44 bsddisklabel.c
--- bsddisklabel.c 23 Jan 2008 23:15:37 -0000 1.44
+++ bsddisklabel.c 15 May 2008 08:29:36 -0000
@@ -519,7 +519,7 @@ make_bsd_partitions(void)
int partstart;
int part_raw, part_bsd;
int ptend;
- int no_swap = 0;
+ int no_swap = 0, valid_part = -1;
partinfo *p;
/*
@@ -615,6 +615,33 @@ make_bsd_partitions(void)
bsdlabel[PART_REST].pi_size = ptstart;
#endif
+ if (layoutkind == 4) {
+ /*
+ * If 'oldlabel' is a default label created by the kernel it
+ * will have exactly one valid partition besides raw_part
+ * which covers the whole disk - but might lie outside the
+ * mbr partition we (by now) have offset by a few sectors.
+ * Check for this and and fix ut up.
+ */
+ valid_part = -1;
+ for (i = 0; i < maxpart; i++) {
+ if (i == part_raw)
+ continue;
+ if (oldlabel[i].pi_size > 0 &&
PI_ISBSDFS(&oldlabel[i])) {
+ if (valid_part >= 0) {
+ /* nope, not the default case */
+ valid_part = -1;
+ break;
+ }
+ valid_part = i;
+ }
+ }
+ if (valid_part >= 0 && oldlabel[valid_part].pi_offset <
ptstart) {
+ oldlabel[valid_part].pi_offset = ptstart;
+ oldlabel[valid_part].pi_size -= ptstart;
+ }
+ }
+
/*
* Save any partitions that are outside the area we are
* going to use.
@@ -629,8 +656,15 @@ make_bsd_partitions(void)
if (p->pi_fstype == FS_UNUSED || p->pi_size == 0)
continue;
if (layoutkind == 4) {
- if (PI_ISBSDFS(p))
+ if (PI_ISBSDFS(p)) {
p->pi_flags |= PIF_MOUNT;
+ if (layoutkind == 4 && i == valid_part) {
+ int fstype = p->pi_fstype;
+ p->pi_fstype = 0;
+ strcpy(p->pi_mount, "/");
+ set_ptype(p, fstype, PIF_NEWFS);
+ }
+ }
} else {
if (p->pi_offset < ptstart + ptsize &&
p->pi_offset + p->pi_size > ptstart)
@@ -642,10 +676,7 @@ make_bsd_partitions(void)
bsdlabel[i] = oldlabel[i];
}
- if (layoutkind == 4) {
- /* XXX Check we have a sensible layout */
- ;
- } else
+ if (layoutkind != 4)
get_ptn_sizes(partstart, ptend - partstart, no_swap);
/*
--y0ulUmNC+osPPQO6--
Home |
Main Index |
Thread Index |
Old Index