3 #include <lunaix/lunaix.h>
4 #include <lunaix/mount.h>
8 #define must_mount(src, target, fs, opts) \
11 if ((err = mount(src, target, fs, opts))) { \
12 syslog(2, "mount fs %s to %s failed (%d)\n", fs, target, errno); \
18 main(int argc, const char** argv)
26 must_mount(NULL, "/dev", "devfs", 0);
27 must_mount(NULL, "/sys", "twifs", MNT_RO);
28 must_mount(NULL, "/task", "taskfs", MNT_RO);
30 if ((err = open("/dev/tty", 0)) < 0) {
31 syslog(2, "fail to open tty (%d)\n", errno);
35 if ((err = dup(err)) < 0) {
36 syslog(2, "fail to setup tty i/o (%d)\n", errno);
40 if ((err = symlink("/usr", "/mnt/lunaix-os/usr"))) {
41 syslog(2, "symlink /usr:/mnt/lunaix-os/usr (%d)\n", errno);
46 if (!(pid = fork())) {
47 err = execve("/usr/bin/sh", NULL, NULL);
48 printf("fail to execute (%d)\n", errno);
52 waitpid(pid, &err, 0);
54 if (WEXITSTATUS(err)) {
55 printf("shell exit abnormally (%d)", err);