boot(8): kfs support

This commit is contained in:
cinap_lenrek 2011-04-18 06:33:38 +00:00
parent e1f905846a
commit a455c61024
2 changed files with 20 additions and 30 deletions

View file

@ -31,6 +31,13 @@ fn must {
$* || fatal $"*^': '^$status
}
fn devinit{
bind -qa '#c' /dev
bind -qa '#S' /dev
bind -qa '#f' /dev
bind -qa '#k' /dev
bind -qa '#æ' /dev
}
fn usbinit{
if(test -e '#u'){
@ -134,9 +141,11 @@ fn main{
# connect to the root file system
$mp($connect)
mount -c /srv/boot /root
if(~ $pcload 1)
must mount -c /srv/boot /root
if(~ $pcload 1){
echo reboot /root/$kern >/dev/reboot
fatal kernel load failed: $kern
}
swapproc
@ -166,10 +175,14 @@ fn main{
exec $init
}
bind -q '#p' /proc
devinit
usbinit # set up usb keyboard, mouse, and disk, if any
configlocal # add partitions and binds
kbmap
configlocal # add partitions and binds
while(){
@{rfork n; main}
}

View file

@ -1,16 +1,5 @@
#!/bin/rc
cddevs=()
# fill cddevs with cd or dvd devices
fn findcds{
for(dev in /dev/sd*){
x=`{sed '/([Cc][Dd]|[Dd][Vv][Dd])/!d' $dev/ctl >[2]/dev/null}
if(! ~ $#x 0)
cddevs=($cddevs $dev)
}
}
fn configlocal{
disk=`{echo $methodarg | sed 's,(.*)!.*,\1,g'}
fstype=`{echo $disk | sed 's,.*/(.*)$,\1,g'}
@ -23,30 +12,18 @@ fn configlocal{
if(~ $#kern 0 || ! ~ $#bootfile 0)
kern=`{echo $bootfile | sed 's,.*!(.*)$,\1,g'}
}
bind -a '#c' /dev >/dev/null >[2=1]
bind '#p' /proc >[2=1] >/dev/null >[2=1]
bind -a '#S' /dev >/dev/null >[2=1]
bind -a '#f' /dev >/dev/null >[2=1]
bind -a '#k' /dev >/dev/null >[2=1]
bind -a '#æ' /dev >/dev/null >[2=1]
diskparts
findcds
}
fn connectlocal{
rm -f /srv/boot
switch($fstype){
case fs
connectlocalkfs
case fscache fsworm
case kfs fs
must disk/kfs -n boot -f $disk^/$fstype
case cwfs fscache fsworm w0 w1 w2 w3
must cwfs64x -n boot -f $disk^/$fstype
case data
# test for cd/dvd
x=`{sed '/([Cc][Dd]|[Dd][Vv][Dd])/!d' $disk^/ctl}
if(! ~ $#x 0)
must 9660srv -f $disk^/$fstype boot >/dev/null >[2=1]
must 9660srv -f $disk^/$fstype boot
case *
fatal unknown partition $fstype
}