]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/boot/boot.c
nusb: change usbevent format, put nusbrc in bootfs
[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 boot(int argc, char *argv[])
9 {
10         char cputype[64];
11         char buf[32];
12
13         fmtinstall('r', errfmt);
14
15         bind("#c", "/dev", MBEFORE);
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
27         if(Debug){
28                 int i;
29
30                 print("argc=%d\n", argc);
31                 for(i = 0; i < argc; i++)
32                         print("%lux %s ", (ulong)argv[i], argv[i]);
33                 print("\n");
34         }
35
36         readfile("#e/cputype", cputype, sizeof(cputype));
37         setenv("bootdisk", bootdisk, 0);
38
39         /* setup the boot namespace */
40         bind("/boot", "/bin", MAFTER);
41         run("/bin/paqfs", "-q", "-c", "8", "-m" "/root", "/boot/bootfs.paq", nil);
42         bind("/root", "/", MAFTER);
43         snprint(buf, sizeof(buf), "/%s/bin", cputype);
44         bind(buf, "/bin", MAFTER);
45         bind("/rc/bin", "/bin", MAFTER);
46         exec("/bin/bootrc", argv);
47 }