- else { /* Child (qemu). */
- char vmchannel[256];
- char logfile[256];
- char append[256];
-
- /* Set up the full command line. Do this in the subprocess so we
- * don't need to worry about cleaning up.
- */
- g->cmdline[0] = (char *) qemu;
-
- g->cmdline =
- realloc (g->cmdline, sizeof (char *) * (g->cmdline_size + 16));
- if (g->cmdline == NULL) {
- perror ("realloc");
- _exit (1);
- }
-
- /* Construct the -net channel parameter for qemu. */
- snprintf (vmchannel, sizeof vmchannel,
- "channel,%d:unix:%s,server,nowait", VMCHANNEL_PORT, unixsock);
-
- /* Linux kernel command line. */
- snprintf (append, sizeof append,
- "console=ttyS0 guestfs=%s:%d", VMCHANNEL_ADDR, VMCHANNEL_PORT);
-
- /* XXX -m */
-
- g->cmdline[g->cmdline_size ] = "-kernel";
- g->cmdline[g->cmdline_size+ 1] = (char *) kernel;
- g->cmdline[g->cmdline_size+ 2] = "-initrd";
- g->cmdline[g->cmdline_size+ 3] = (char *) initrd;
- g->cmdline[g->cmdline_size+ 4] = "-append";
- g->cmdline[g->cmdline_size+ 5] = append;
- g->cmdline[g->cmdline_size+ 6] = "-nographic";
- g->cmdline[g->cmdline_size+ 7] = "-serial";
- g->cmdline[g->cmdline_size+ 8] = "stdio";
- g->cmdline[g->cmdline_size+ 9] = "-net";
- g->cmdline[g->cmdline_size+10] = vmchannel;
- g->cmdline[g->cmdline_size+11] = "-net";
- g->cmdline[g->cmdline_size+12] = "user,vlan=0";
- g->cmdline[g->cmdline_size+13] = "-net";
- g->cmdline[g->cmdline_size+14] = "nic,vlan=0";
- g->cmdline[g->cmdline_size+15] = NULL;
-
- if (g->verbose) {
- fprintf (stderr, "Running %s", qemu);
- for (i = 0; g->cmdline[i]; ++i)
- fprintf (stderr, " %s", g->cmdline[i]);
- fprintf (stderr, "\n");
- }