Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/usr.sbin/sysinst Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/31185be2b9ab
branches:  netbsd-9
changeset: 460431:31185be2b9ab
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Oct 23 05:58:13 2019 +0000

description:
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.

diffstat:

 usr.sbin/sysinst/disks.c |  24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r 2d9043f23814 -r 31185be2b9ab usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c  Mon Oct 21 20:25:52 2019 +0000
+++ b/usr.sbin/sysinst/disks.c  Wed Oct 23 05:58:13 2019 +0000
@@ -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 @@
 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:



Home | Main Index | Thread Index | Old Index