summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/boot/bootrc19
-rwxr-xr-xsys/src/9/boot/local.rc31
2 files changed, 20 insertions, 30 deletions
diff --git a/sys/src/9/boot/bootrc b/sys/src/9/boot/bootrc
index dabc77aca..21af98811 100644
--- a/sys/src/9/boot/bootrc
+++ b/sys/src/9/boot/bootrc
@@ -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}
}
diff --git a/sys/src/9/boot/local.rc b/sys/src/9/boot/local.rc
index 5ba6378c0..dd35a2f33 100755
--- a/sys/src/9/boot/local.rc
+++ b/sys/src/9/boot/local.rc
@@ -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
}