1 /*
2 * IMPORTANT! DO NOT ADD LIBRARY CALLS TO THIS FILE.
3 * The entire text image must fit on one page
4 * (and there's no data segment, so any read/write data must be on the stack).
5 */
6
7 #include <u.h>
8 #include <libc.h>
9
10 char cons[] = "#c/cons";
11 char boot[] = "/boot/boot";
12 char dev[] = "/dev";
13 char c[] = "#c";
14 char e[] = "#e";
15 char ec[] = "#ec";
16 char s[] = "#s";
17 char srv[] = "/srv";
18 char env[] = "/env";
19
20 void
startboot(char * argv0,char ** argv)21 startboot(char *argv0, char **argv)
22 {
23 char buf[200]; /* keep this fairly large to capture error details */
24
25 /* in case boot is a shell script */
26 open(cons, OREAD);
27 open(cons, OWRITE);
28 open(cons, OWRITE);
29 bind(c, dev, MAFTER);
30 bind(ec, env, MAFTER);
31 bind(e, env, MCREATE|MAFTER);
32 bind(s, srv, MREPL|MCREATE);
33
34 USED(argv0);
35 exec(boot, argv);
36
37 rerrstr(buf, sizeof buf);
38 buf[sizeof buf - 1] = '\0';
39 _exits(buf);
40 }
41