Diff below changes setroot() such that if bootduid is initialized (by
MD code) it tries to find a disk with a matching DUID. If it finds
such a disk, it will use that disk as the root device.
Perhaps it should only do this if bootdv == NULL?
Thoughts? ok?
Index: subr_disk.c
===================================================================
RCS file: /cvs/src/sys/kern/subr_disk.c,v
retrieving revision 1.223
diff -u -p -r1.223 subr_disk.c
--- subr_disk.c 8 Feb 2016 22:12:51 -0000 1.223
+++ subr_disk.c 19 May 2016 11:50:47 -0000
@@ -1455,6 +1455,13 @@ setroot(struct device *bootdv, int part,
break;
if (dk && (dk->dk_flags & DKF_LABELVALID))
bcopy(dk->dk_label->d_uid, bootduid, sizeof(bootduid));
+ } else {
+ TAILQ_FOREACH(dk, &disklist, dk_link)
+ if (memcmp(dk->dk_label->d_uid, bootduid,
+ sizeof(bootduid)) == 0)
+ break;
+ if (dk && (dk->dk_flags & DKF_LABELVALID))
+ bootdv = dk->dk_device;
}
bcopy(bootduid, rootduid, sizeof(rootduid));