vkernel, vkd and vcd boot order

Clement Martin cma at alunys.com
Sun Aug 19 19:33:01 PDT 2007


On Sun, Aug 19, 2007 at 05:13:18PM -0700, Matthew Dillon wrote:
>     Not bad.  How would you like to do it a slightly different way?  Instead
>     of adding a new option, patch the program so it does what the man page
>     originally thought it did.  Just detect which option (-r or -c) is
>     specified first with a little logic in the code and implement your -b
>     equivalent internally.
> 
> 						-Matt
 
  Good idea, it should do what the man page says.
  So it will. :)
  
-- 
Clement Martin

--- init.c.orig	2007-08-19 18:46:53.000000000 +0200
+++ init.c	2007-08-20 04:03:30.000000000 +0200
@@ -138,6 +138,7 @@
 	int netifFileNum = 0;
 	int diskFileNum = 0;
 	int cdFileNum = 0;
+	int bootOnDisk = 0;
 	int c;
 	int i;
 	int n;
@@ -198,6 +199,8 @@
 		case 'r':
 			if (diskFileNum + cdFileNum < VKDISK_MAX)
 				diskFile[diskFileNum++] = strdup(optarg);
+				if (cdFileNum == 0) 
+					bootOnDisk = 1;
 			break;
 		case 'c':
 			if (diskFileNum + cdFileNum < VKDISK_MAX)
@@ -284,8 +287,13 @@
 	init_vkernel();
 	setrealcpu();
 	init_kqueue();
-	init_disk(diskFile, diskFileNum, VKD_DISK);
-	init_disk(cdFile, cdFileNum, VKD_CD);
+	if(bootOnDisk == 1) {
+			init_disk(cdFile, cdFileNum, VKD_CD);
+			init_disk(diskFile, diskFileNum, VKD_DISK);
+	} else {
+			init_disk(diskFile, diskFileNum, VKD_DISK);
+			init_disk(cdFile, cdFileNum, VKD_CD);
+	}
 	init_netif(netifFile, netifFileNum);
 	init_exceptions();
 	mi_startup();




More information about the Kernel mailing list