Module Name:    src
Committed By:   msaitoh
Date:           Wed Oct 23 05:58:13 UTC 2019

Modified Files:
        src/usr.sbin/sysinst [netbsd-9]: disks.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #362):
        usr.sbin/sysinst/disks.c: revision 1.52
Remove a hardcoded assumption that for BIOS boot we always will have
the first partition as root - in mixed EFI/BIOS setups this might not
be true (and in general the user is free to define arbitrary orders).
Pointed out by Robert Nestor.


To generate a diff of this commit:
cvs rdiff -u -r1.44.2.6 -r1.44.2.7 src/usr.sbin/sysinst/disks.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.44.2.6 src/usr.sbin/sysinst/disks.c:1.44.2.7
--- src/usr.sbin/sysinst/disks.c:1.44.2.6	Fri Aug  9 06:21:00 2019
+++ src/usr.sbin/sysinst/disks.c	Wed Oct 23 05:58:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.44.2.6 2019/08/09 06:21:00 msaitoh Exp $ */
+/*	$NetBSD: disks.c,v 1.44.2.7 2019/10/23 05:58:13 msaitoh Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1928,12 +1928,30 @@ check_swap(const char *disk, int remove_
 char *
 bootxx_name(struct install_partition_desc *install)
 {
-	int fstype;
+	size_t i;
+	int fstype = -1;
 	const char *bootxxname;
 	char *bootxx;
 
+	/* find a partition to be mounted as / */
+	for (i = 0; i < install->num; i++) {
+		if ((install->infos[i].instflags & PUIINST_MOUNT)
+		    && strcmp(install->infos[i].mount, "/") == 0) {
+			fstype = install->infos[i].fs_type;
+			break;
+		}
+	}
+	if (fstype < 0) {
+		/* not found? take first root type partition instead */
+		for (i = 0; i < install->num; i++) {
+			if (install->infos[i].type == PT_root) {
+				fstype = install->infos[i].fs_type;
+				break;
+			}
+		}
+	}
+
 	/* check we have boot code for the root partition type */
-	fstype = install->infos[0].fs_type;
 	switch (fstype) {
 #if defined(BOOTXX_FFSV1) || defined(BOOTXX_FFSV2)
 	case FS_BSDFFS:

Reply via email to