shithub: riscv

Download patch

ref: cd47b3e9d4fb11eec4a17434291d3c70811c19ea
parent: 41a4cd88ebc57a05b03b18a13aeedfcc7b546a19
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Sun Aug 28 16:37:20 EDT 2011

bootrc: prefer 9660 filesystem as default on cdboot, restart factotum, delay for usb

--- a/sys/src/9/boot/bootrc
+++ b/sys/src/9/boot/bootrc
@@ -15,13 +15,12 @@
 # usualy better than 1970
 cat '#r/rtc' >/dev/time >[2]/dev/null
 
-# reparse #ec variables, move to #e
+# reparse variables
 for(i in `{ls -Qp '#ec'}){
 	switch($i){
-	case '*'* e820
+	case '*'* 
 		# ignore these
 	case *
-		cat '#ec/'^$i >'#e/'^$i
 		$i=`{echo $$i}
 	}
 }
@@ -81,22 +80,23 @@
 	$mp(1) $ma
 
 	# authentication agent
-	if(! test -f /srv/factotum){
-		x=(/boot/factotum -sfactotum)
-		if(~ $service cpu){
-			x=($x -S)
-			if(~ -k $ff)
-				x=($x -k)
-		}
-		if not
-			x=($x -u)
-		if(! ~ $#authaddr 0)
-			x=($x -a $authaddr)
-		if(! ~ $#debugfactotum 0)
-			x=($x -p)
-		must $x
+	if(test -f /srv/factotum){
+		rm -f /srv/factotum
+		user=`{cat /dev/hostowner}
 	}
-	if not user=`{cat /dev/hostowner}
+	x=(/boot/factotum -sfactotum)
+	if(~ $service cpu){
+		x=($x -S)
+		if(~ -k $ff)
+			x=($x -k)
+	}
+	if not
+		x=($x -u)
+	if(! ~ $#authaddr 0)
+		x=($x -a $authaddr)
+	if(! ~ $#debugfactotum 0)
+		x=($x -p)
+	must $x
 
 	# connect method
 	$mp(2) $ma
--- a/sys/src/9/boot/local.rc
+++ b/sys/src/9/boot/local.rc
@@ -1,7 +1,20 @@
 #!/bin/rc
 
+fn showlocaldev {
+	echo $1'	' $2
+	if(~ $#bootargs 0){
+		if(! ~ $#cdboot 0){
+			if(~ $2 9660)
+				bootargs=local!$1
+		}
+		if not {
+			if(! ~ $2 '' dos)
+				bootargs=local!$1
+		}
+	}
+}
+
 fn showlocaldevs{
-	echo local devices found:
 	for(d in /dev/sd*) if(test -r $d/ctl){
 		q=`{sed 's,(inquiry|geometry),\
 \1,g' $d/ctl | grep inquiry}
@@ -11,13 +24,10 @@
 			switch($i){
 			case ctl raw log
 				;
-			case 9fat plan9 nvram
+			case plan9 nvram swap
 				echo $p
 			case *
-				t=`{fstype $p}
-				if(~ $#bootargs 0 && ! ~ $t '')
-					bootargs=local!$p
-				echo $p $t
+				showlocaldev $p `{fstype $p}
 			}
 		}
 	}
@@ -25,11 +35,7 @@
 		echo $d':'
 		for(p in $d/*.^(iso kfs paq)) if(test -f $p){
 			t=`{fstype $p}
-			if(! ~ $t ''){
-				if(~ $#bootargs 0)
-					bootargs=local!$p
-				echo $p $t
-			}
+			~ $#t 0 || showlocaldev $p $t
 		}
 	}
 }
--- a/sys/src/9/boot/nusbrc
+++ b/sys/src/9/boot/nusbrc
@@ -36,3 +36,7 @@
 }
 
 bind -a '#σ/usb' /dev
+
+# wait for devices getting activated
+sleep 3
+
--- a/sys/src/9/port/bootfs.proto
+++ b/sys/src/9/port/bootfs.proto
@@ -27,6 +27,7 @@
 		rc
 		rm
 		sed
+		sleep
 		srv
 		test
 		unmount