4 mntgen -s slashn /n && chmod 666 /srv/slashn
5 mntgen -s slashmnt /mnt && chmod 666 /srv/slashmnt
6 mntgen -s mntexport /mnt/exportfs && chmod 666 /srv/mntexport
13 for(i in S f k æ t b m)
16 # bind in an ip interface
17 for(i in I l^(0 1 2 3))
20 # usualy better than 1970
21 cat '#r/rtc' >/dev/time >[2]/dev/null
24 for(i in `{ls -Qp /env}){
26 case '*'* 'fn#'* e820 apm0 apid ifs path pid prompt status ?
43 $* || fatal $"*^': '^$status
54 $1=`{dd -bs 64 -count 1 >[2]/dev/null}
70 if(~ $#nobootprompt 0){
73 ask bootargs ' is (tcp, tls, il, local!device)' $"bootargs
75 if not bootargs=$nobootprompt
77 mn=`{echo $bootargs | sed 's,!, ,'}
87 # authentication agent
88 if(! test -f /srv/factotum){
89 x=(/boot/factotum -n -sfactotum)
97 if(! ~ $#debugfactotum 0)
105 # load keys from secstore if $auth or $secstore is not empty
108 if(! ~ $#$x 0 && test -x /bin/auth/secstore && test -f /mnt/factotum/ctl){
109 x=(auth/secstore -G factotum -s^$$x)
111 $x -n >/mnt/factotum/ctl
112 if(~ $status *readnvram* || ! ~ $service cpu)
113 $x >/mnt/factotum/ctl
119 # insert cfs in the pipeline
120 if(test -x /bin/cfs){
121 if(~ $#bootdisk 1 && ~ $#cfs 0)
123 if(~ $#cfs 1 && ! ~ $cfs off && test -f $cfs){
124 x=(/bin/cfs -s -f $cfs)
127 {$x </srv/boot &} | echo 0 >/srv/cfs
129 mv /srv/cfs /srv/boot
133 # mount and change root in new enviroment and namespace
136 # mount root filesystem
139 must mount -c /srv/boot $rootdir
141 # compile init command
152 # remove enviroment variables
153 rm -f '#e/'^$mt '#e/'? '#e/'?? '#e/fn#'*
155 # remove part of our temporary root
156 /mnt/broot/$cputype/bin/unmount /$cputype/bin /bin
157 /mnt/broot/$cputype/bin/unmount /rc/bin /bin
158 /mnt/broot/$cputype/bin/unmount /
160 # create the name space, mount the root fs
161 /mnt/broot/$cputype/bin/bind / /
162 /mnt/broot/$cputype/bin/mount -ac '#s/boot' /
164 # remove the remaining temporary root
165 /mnt/broot/$cputype/bin/unmount /mnt/broot
170 # keyboard and serial console
171 if(test -x /bin/aux/kbdfs){
175 aux/kbdfs -q -s cons $a
179 if(test -x /bin/nusbrc && ! test -e /env/nousbrc)
185 for(i in /rc/lib/*.rc){
189 # add partitions and binds
192 # boot(8) command line arguments
203 user=`{echo $1 | sed 's,^-u,,g'}
223 if(! ~ $#aa 0 && ~ $#bootargs 0 && ~ $#nobootprompt 0){
231 # subshell doesnt wait on interrupts
232 while(~ $status interrupted){wait}
234 # cleanup so it can be restarted
236 rm -f /srv/^(cfs boot cs dns)