]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/boot/boot.c
etheriwl: implement 4965 firmware bootstrap (untested)
[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         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("%lux %s ", (ulong)argv[i], argv[i]);
34                 print("\n");
35         }
36         USED(argc);
37
38         readfile("#e/cputype", cputype, sizeof(cputype));
39         setenv("bootdisk", bootdisk, 0);
40
41         /* setup the boot namespace */
42         bind("/boot", "/bin", MAFTER);
43         run("/bin/paqfs", "-q", "-c", "8", "-m" "/root", "/boot/bootfs.paq", nil);
44         bind("/root", "/", MAFTER);
45         snprint(buf, sizeof(buf), "/%s/bin", cputype);
46         bind(buf, "/bin", MAFTER);
47         bind("/rc/bin", "/bin", MAFTER);
48         exec("/bin/bootrc", argv);
49 }