diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2022-12-12 20:45:34 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2022-12-12 20:45:34 +0000 |
commit | e2509e7653a9845c7901e297e5c0da679322eee5 (patch) | |
tree | bea0dbceaa21602b81cb1062415cc9f7fb006cab /sys/src/9 | |
parent | 0b7f6f27b215c5cfa680d2b70d13806706386f3f (diff) |
bootrc: let /boot/boot run in a more natural namespace
Mount /fd, /proc, /srv and /shr in initcode
and open /dev/cons instead of #c/cons.
This way, /boot/boot could theoretically be a rc-script
and there is less reliance on magic device characters.
Diffstat (limited to 'sys/src/9')
-rwxr-xr-x | sys/src/9/boot/bootrc | 3 | ||||
-rw-r--r-- | sys/src/9/port/initcode.c | 21 |
2 files changed, 15 insertions, 9 deletions
diff --git a/sys/src/9/boot/bootrc b/sys/src/9/boot/bootrc index 49a936381..7e18d3421 100755 --- a/sys/src/9/boot/bootrc +++ b/sys/src/9/boot/bootrc @@ -8,9 +8,6 @@ mntgen -s mntexport /mnt/exportfs && chmod 666 /srv/mntexport bind /root /mnt/broot unmount /root -bind -q '#σ' /shr -bind -q '#d' /fd -bind -q '#p' /proc for(i in ¶ P S f æ t b m) bind -qa '#'^$i /dev diff --git a/sys/src/9/port/initcode.c b/sys/src/9/port/initcode.c index d9251829a..77b4507e6 100644 --- a/sys/src/9/port/initcode.c +++ b/sys/src/9/port/initcode.c @@ -7,29 +7,38 @@ #include <u.h> #include <libc.h> -char cons[] = "#c/cons"; +char cons[] = "/dev/cons"; char boot[] = "/boot/boot"; char dev[] = "/dev"; char c[] = "#c"; +char d[] = "#d"; char e[] = "#e"; char ec[] = "#ec"; +char p[] = "#p"; char s[] = "#s"; -char srv[] = "/srv"; +char σ[] = "#σ"; char env[] = "/env"; +char fd[] = "/fd"; +char proc[] = "/proc"; +char srv[] = "/srv"; +char shr[] = "/shr"; void startboot(char*, char **argv) { char buf[200]; /* keep this fairly large to capture error details */ - /* in case boot is a shell script */ - open(cons, OREAD); - open(cons, OWRITE); - open(cons, OWRITE); bind(c, dev, MAFTER); + bind(d, fd, MREPL); bind(ec, env, MAFTER); bind(e, env, MCREATE|MAFTER); + bind(p, proc, MREPL); bind(s, srv, MREPL|MCREATE); + bind(σ, shr, MREPL); + + open(cons, OREAD); + open(cons, OWRITE); + open(cons, OWRITE); exec(boot, argv); |