xref: /plan9/sys/src/9/boot/sac.c (revision 41dd6b4775bcffc7275c15aee7294944759a2ea7)
1 #include <u.h>
2 #include <libc.h>
3 #include <../boot/boot.h>
4 
5 /*
6  * HACK - take over from boot since file system is not
7  * available on a pipe
8  */
9 
10 void
configsac(Method * mp)11 configsac(Method *mp)
12 {
13 	int fd;
14 	char cmd[64];
15 
16 	USED(mp);
17 
18 	/*
19 	 *  create the name space, mount the root fs
20 	 */
21 	if(bind("/", "/", MREPL) < 0)
22 		fatal("bind /");
23 	if(bind("#C", "/", MAFTER) < 0)
24 		fatal("bind /");
25 
26 	/* fixed sysname - enables correct namespace file */
27 	fd = open("#c/sysname", OWRITE);
28 	if(fd < 0)
29 		fatal("open sysname");
30 	write(fd, "brick", 5);
31 	close(fd);
32 
33 	fd = open("#c/hostowner", OWRITE);
34 	if(fd < 0)
35 		fatal("open sysname");
36 	write(fd, "brick", 5);
37 	close(fd);
38 
39 	sprint(cmd, "/%s/init", cputype);
40 	print("starting %s\n", cmd);
41 	execl(cmd, "init", "-c", 0);
42 	fatal(cmd);
43 }
44 
45 int
connectsac(void)46 connectsac(void)
47 {
48 	/* does not get here */
49 	return -1;
50 }
51