boot and namespace cleanup

This commit is contained in:
cinap_lenrek 2011-05-10 09:14:30 +00:00
parent 6063ab829f
commit 2febff5948
7 changed files with 33 additions and 60 deletions

View file

@ -10,11 +10,12 @@ bind -c #e /env
bind #p /proc bind #p /proc
bind -c #s /srv bind -c #s /srv
bind -a #¤ /dev bind -a #¤ /dev
bind -a #S /dev
# userspace devices
mount -qb /srv/cons /dev
# mount points # mount points
mount -a /srv/slashn /n mount -a /srv/slashn /n
mount -b /srv/cons /dev
# authentication # authentication
mount -a /srv/factotum /mnt mount -a /srv/factotum /mnt

View file

@ -71,7 +71,7 @@ if(test -e /cfg/$sysname/cpustart)
# mode of /proc/*/ctl is inherited across rfork, and sets modes on # mode of /proc/*/ctl is inherited across rfork, and sets modes on
# other /proc files, such as note, so let listen be killed. # other /proc files, such as note, so let listen be killed.
dontkill '^(ipconfig|factotum|mntgen|venti|fossil|cs|dns|reboot)$' dontkill '^(ipconfig|factotum|mntgen|venti|kfs|cwfs.*|cs|dns|reboot)$'
# echo `{date} $sysname >>/sys/log/boot # echo `{date} $sysname >>/sys/log/boot
exit '' exit ''

View file

@ -5,10 +5,11 @@
# return addresses, even local ones # return addresses, even local ones
site=EXAMPLE site=EXAMPLE
# replace FILESERVER with the name of your file server # replace FILESERVER with the name of your file server
# here we start with kfs, your local disk file system # here we start with cwfs, your local disk file system
fileserver=kfs fileserver=cwfs
# replace FACEDOM with the local domain to be used in the faces database # replace FACEDOM with the local domain to be used in the faces database
facedom=FACEDOM facedom=FACEDOM
for(i in m i P S t) for(i in m i P S t u)
bind -a '#'^$i /dev >/dev/null >[2=1] bind -a '#'^$i /dev >/dev/null >[2=1]
mount -qa /srv/usb /dev

View file

@ -5,11 +5,13 @@ NDBFILE=/lib/ndb/local
mntgen -s slashn && chmod 666 /srv/slashn mntgen -s slashn && chmod 666 /srv/slashn
# bind all likely devices (#S was bound in boot) # bind all likely devices
for(i in f t m v L P u U '$' Σ κ) for(i in S f k t m i v L P u U '$' Σ κ)
/bin/bind -a '#'^$i /dev >/dev/null >[2=1] bind -a '#'^$i /dev >/dev/null >[2=1]
rm -f /env/i rm -f /env/i
mount -qa /srv/usb /dev
# set up any partitions # set up any partitions
diskparts diskparts
@ -110,8 +112,7 @@ if(! ~ $"vgasize '' text none){
} }
rm -f '/env/fn#ask' rm -f '/env/fn#ask'
usbstart
if (test -f /dev/apm) if (test -f /dev/apm)
aux/apm aux/apm
dontkill '^(ipconfig|factotum|mntgen|fossil|kfs|cwfs|cs|dns|listen|reboot)$' dontkill '^(ipconfig|factotum|mntgen|fossil|kfs|cwfs.*|cs|dns|listen|reboot)$'

View file

@ -1,12 +0,0 @@
#!/bin/rc
# usbstart - start appropriate usb flavour
if(test -r '#u'/usb) {
if(! test -r /dev/usb)
bind -a '#u' /dev
# /boot/boot may have started usbd, which starts all usb drivers
if(test -f /srv/usb)
mount -a /srv/usb /dev
if not
usb/usbd
}
exit ''

View file

@ -2,39 +2,19 @@
bind -q '#p' /proc bind -q '#p' /proc
if(test -e '#b' && ! test -e /dev/kbd){ for(i in S f k æ t){
bind -a '#b' /dev bind -a '#'^$i /dev >/dev/null >[2=1]
aux/kbdfs -s cons
exec /rc/bin/bootrc </dev/cons >/dev/cons >[2]/dev/cons
} }
bind -qa '#S' /dev for(i in init user nvram rootdir bootargs nobootprompt sysname \
bind -qa '#f' /dev debugfactotum fs fsaddr auth authaddr){
bind -qa '#k' /dev a=$$i
bind -qa '#æ' /dev $i=()
rm -f '#e'/$i '#ec'/$i /env/$i
fn set {
a=$$1
$1=()
rm -f '#e'/$1 '#ec'/$1 /env/$1
if(! ~ $#a 0) if(! ~ $#a 0)
$1=$a $i=$a
} }
# convert plan9.ini variables
set init
set user
set nvram
set rootdir
set bootargs
set nobootprompt
set sysname
set debugfactotum
set fs
set fsaddr
set auth
set authaddr
fn fatal { fn fatal {
echo $* echo $*
exit $"* exit $"*
@ -138,15 +118,14 @@ fn main{
exec $init exec $init
} }
if(test -e '#u'){ if(test -e '#b' && test -x /bin/aux/kbdfs){
bind -a '#u' /dev bind -a '#b' /dev
usb/usbd aux/kbdfs -s cons
} }
if(! ~ $#kbmap 0){ if(test -e '#u' && test -x /bin/usb/usbd){
bind -a '#κ' /dev bind -a '#u' /dev
if(test -r $"kbmap) usb/usbd
cat $"kbmap >/dev/kbmap
} }
# bind in an ip interface # bind in an ip interface
@ -163,4 +142,4 @@ while(){
nobootprompt=() nobootprompt=()
user=() user=()
rm -f /srv/boot /srv/slashn /srv/cs /srv/dns rm -f /srv/boot /srv/slashn /srv/cs /srv/dns
} } </dev/cons >/dev/cons >[2]/dev/cons

View file

@ -1085,7 +1085,10 @@ elevate(void)
} }
/* get higher than normal priority */ /* get higher than normal priority */
fprint(fd, "pri 16"); fprint(fd, "pri 16\n");
/* always present in physical memory */
fprint(fd, "noswap\n");
/* dont let anybody kill us */ /* dont let anybody kill us */
if(d = dirfstat(fd)){ if(d = dirfstat(fd)){