git: 9front

Download patch

ref: 123810c3db347a2be4c6069e02e7a5fc6c2a0d4d
parent: 0a627f8a4684fac475e4a01b2c7b03e0cf8e6fb5
author: cinap_lenrek <cinap_lenrek@localhost>
date: Mon Apr 18 02:33:38 EDT 2011

boot(8): kfs support

--- a/sys/src/9/boot/bootrc
+++ b/sys/src/9/boot/bootrc
@@ -31,6 +31,13 @@
 	$* || 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 @@
 	# 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,9 +175,13 @@
 	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}
--- 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 @@
 		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
 	}
--