This is very similar to booting from RAID1, except we only
try the first chunk in the set.
Tested with qemu-system-x86_64, using two disk images (-hda and
-hdb parameters, and "-cdrom cd52.iso -boot d" to boot from cdrom).
The softraid disk must be created manually during installation.
At the "install/upgrade/shell" prompt, answer !, then:
# cd /dev/; sh MAKEDEV wd1 sd0
# fdisk -iy wd0; fdisk -iy wd1
# disklabel -E wd0 # create a single huge 'd' partition of type RAID
# disklabel -E wd1 # create a single huge 'd' partition of type RAID
# bioctl -cc -l/dev/wd0d,/dev/wd1d softraid0
# exit
Proceed with the install as usual, answering "Which disk is the
root disk?" with sd0.
Reboot from disk after install ("-boot c" with qemu).
The system will boot from the first chunk and use sd0 as root disk.
ok?
Index: biosdev.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/biosdev.c,v
retrieving revision 1.17
diff -u -p -r1.17 biosdev.c
--- biosdev.c 11 Jan 2012 14:47:02 -0000 1.17
+++ biosdev.c 16 Sep 2012 09:53:22 -0000
@@ -749,7 +749,7 @@ sr_strategy(struct sr_boot_volume *bv, i
void *buf, size_t *rsize)
{
struct diskinfo *sr_dip, *dip;
- struct sr_boot_chunk *bc;
+ struct sr_boot_chunk *bc = NULL;
/* We only support read-only softraid. */
if (rw != F_READ)
@@ -761,14 +761,20 @@ sr_strategy(struct sr_boot_volume *bv, i
if (bv->sbv_level == 0) {
return ENOTSUP;
- } else if (bv->sbv_level == 1) {
+ } else if (bv->sbv_level == 1 || bv->sbv_level == 'c') {
/* Select first online chunk. */
- SLIST_FOREACH(bc, &bv->sbv_chunks, sbc_link)
- if (bc->sbc_state == BIOC_SDONLINE)
- break;
- if (bc == NULL)
- return EIO;
+ if (bv->sbv_level == 1) {
+ SLIST_FOREACH(bc, &bv->sbv_chunks, sbc_link)
+ if (bc->sbc_state == BIOC_SDONLINE)
+ break;
+ if (bc == NULL)
+ return EIO;
+ } else if (bv->sbv_level == 'c') {
+ bc = SLIST_FIRST(&bv->sbv_chunks);
+ if (bc == NULL || bc->sbc_state != BIOC_SDONLINE)
+ return EIO;
+ }
dip = (struct diskinfo *)bc->sbc_diskinfo;
dip->bsddev = bc->sbc_mm;
Index: dev_i386.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/dev_i386.c,v
retrieving revision 1.10
diff -u -p -r1.10 dev_i386.c
--- dev_i386.c 19 Mar 2012 15:20:16 -0000 1.10
+++ dev_i386.c 16 Sep 2012 09:14:58 -0000
@@ -112,8 +112,8 @@ devboot(dev_t bootdev, char *p)
* softraid volume.
*/
SLIST_FOREACH(bv, &sr_volumes, sbv_link) {
- /* For now we only support booting from RAID 1 volumes. */
- if (bv->sbv_level != 1)
+ /* We only support booting from RAID1/CONCAT volumes. */
+ if (bv->sbv_level != 1 && bv->sbv_level != 'c')
continue;
if (bv->sbv_flags & BIOC_SCBOOTABLE)
SLIST_FOREACH(bc, &bv->sbv_chunks, sbc_link)