vkernel, vkd and vcd boot order
Clement Martin
cma at alunys.com
Sun Aug 19 09:56:12 PDT 2007
Hello Again.
> According to the manpage, the first -r or -c image will be the boot
> disk, but here, in whatever order they are, it always tries to boot from
> the virtual cdrom.
To solve this, I added a flag (-b) to choose the type of boot device,
disk or cdrom.
I attach the patch, but be kind, is this the first time I touch a C
source, all I know is sysadmin shell scripting.
Regards,
--
Clement Martin
/(Free|Libre|OpenSource) Software Consultant/
Alunys - Alternative Solutions
135a rue bara cma at alunys.com P: +32.2.790.40.00
1070 Brussels http://www.alunys.com F: +32.2.790.40.01
Helpdesk: helpdesk at alunys.com P: +32.2.790.40.09
--- init.c.orig 2007-08-19 18:46:53.000000000 +0200
+++ init.c 2007-08-19 18:24:58.000000000 +0200
@@ -138,6 +138,7 @@
int netifFileNum = 0;
int diskFileNum = 0;
int cdFileNum = 0;
+ int bootOnDisk = 0;
int c;
int i;
int n;
@@ -165,7 +166,7 @@
real_ncpus_size = sizeof(real_ncpus);
sysctlbyname("hw.ncpu", &real_ncpus, &real_ncpus_size, NULL, 0);
- while ((c = getopt(ac, av, "c:svl:m:n:r:e:i:p:I:U")) != -1) {
+ while ((c = getopt(ac, av, "b:c:svl:m:n:r:e:i:p:I:U")) != -1) {
switch(c) {
case 'e':
/*
@@ -195,6 +196,14 @@
if (netifFileNum < VKNETIF_MAX)
netifFile[netifFileNum++] = strdup(optarg);
break;
+ case 'b':
+ if (strncmp("disk", optarg, 4) == 0)
+ bootOnDisk = 1;
+ else if (strncmp("cdrom", optarg, 5) == 0)
+ bootOnDisk = 0;
+ else
+ usage("Bad boot device, must be disk or cdrom");
+ break;
case 'r':
if (diskFileNum + cdFileNum < VKDISK_MAX)
diskFile[diskFileNum++] = strdup(optarg);
@@ -284,8 +293,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 Users
mailing list