2 * This is a simple init for shared rootfs guests. It brings up critical
3 * mountpoints and then launches /bin/sh.
11 static int run_process(char *filename
)
13 char *new_argv
[] = { filename
, NULL
};
14 char *new_env
[] = { NULL
};
16 return execve(filename
, new_argv
, new_env
);
19 static void do_mounts(void)
21 mount("hostfs", "/host", "9p", MS_RDONLY
, "trans=virtio,version=9p2000.L");
22 mount("", "/sys", "sysfs", 0, NULL
);
23 mount("proc", "/proc", "proc", 0, NULL
);
24 mount("devtmpfs", "/dev", "devtmpfs", 0, NULL
);
27 int main(int argc
, char *argv
[])
33 puts("Starting '/bin/sh'...");
35 run_process("/bin/sh");
37 printf("Init failed: %s\n", strerror(errno
));