From 9c04a1cb6bd4f8c71fae15c56be4c2185429198b Mon Sep 17 00:00:00 2001 From: Antonio Huete Date: Sat, 9 Jan 2010 21:13:21 +0100 Subject: [PATCH] vkernel - Enable vfs.root.mountfrom environment variable, so you can specify different boot devices for the vkernel. --- sys/platform/vkernel/platform/init.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sys/platform/vkernel/platform/init.c b/sys/platform/vkernel/platform/init.c index f2fabd1..8bf3641 100644 --- a/sys/platform/vkernel/platform/init.c +++ b/sys/platform/vkernel/platform/init.c @@ -716,11 +716,24 @@ static void init_disk(char *diskExp[], int diskFileNum, enum vkdisk_type type) { - int i; + int i; + int bootset = 0; + char *mountfrom; if (diskFileNum == 0) return; + /* Check whether we specified a device to boot from + * with the environment variable vfs.root.mountfrom, + * and if so set it as the first boot device. Secondary + * boot devices are separated by ; for compatibility. + */ + if ((mountfrom = kgetenv("vfs.root.mountfrom")) != NULL) { + rootdevnames[0] = mountfrom; + rootdevnames[1] = "ufs:vkd0s0a;ufs:vkd0s1a"; + bootset++; + } + for(i=0; i < diskFileNum; i++){ char *fname; fname = diskExp[i]; @@ -758,7 +771,7 @@ init_disk(char *diskExp[], int diskFileNum, enum vkdisk_type type) info->type = type; memcpy(info->fname, fname, l); - if (DiskNum == 0) { + if (DiskNum == 0 && !bootset) { if (type == VKD_CD) { rootdevnames[0] = "cd9660:vcd0a"; } else if (type == VKD_DISK) { -- 1.6.4