]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/boot/boot.c
621c70da92a089cc3f63d197781212c03aca7a73
[plan9front.git] / sys / src / 9 / boot / boot.c
1 #include <u.h>
2 #include <libc.h>
3 #include <auth.h>
4 #include <fcall.h>
5 #include "../boot/boot.h"
6
7 void
8 main(int argc, char *argv[])
9 {
10         char cputype[64];
11         char buf[32];
12
13         fmtinstall('r', errfmt);
14
15         bind("#c", "/dev", MREPL);
16         open("/dev/cons", OREAD);
17         open("/dev/cons", OWRITE);
18         open("/dev/cons", OWRITE);
19         /*
20          * init will reinitialize its namespace.
21          * #ec gets us plan9.ini settings (*var variables).
22          */
23         bind("#ec", "/env", MREPL);
24         bind("#e", "/env", MBEFORE|MCREATE);
25         bind("#s", "/srv", MREPL|MCREATE);
26         bind("#σ", "/shr", MREPL);
27
28         if(Debug){
29                 int i;
30
31                 print("argc=%d\n", argc);
32                 for(i = 0; i < argc; i++)
33                         print("%p %s ", argv[i], argv[i]);
34                 print("\n");
35         }
36         USED(argc);
37
38         readfile("#e/cputype", cputype, sizeof(cputype));
39
40         /* setup the boot namespace */
41         bind("/boot", "/bin", MAFTER);
42         run("/bin/paqfs", "-qa", "-c", "8", "-m" "/root", "/boot/bootfs.paq", nil);
43         bind("/root", "/", MAFTER);
44         snprint(buf, sizeof(buf), "/%s/bin", cputype);
45         bind(buf, "/bin", MAFTER);
46         bind("/rc/bin", "/bin", MAFTER);
47         exec("/bin/bootrc", argv);
48 }