shithub: riscv

Download patch

ref: 6a4063e245592aab98098deee062adde166f128b
parent: 09a848d825a600a2fe67ce37192a11fbf9f3685f
parent: 012dec1119fe41b59bf4f498c835aa7ec2e269f2
author: ment <[email protected]>
date: Sat Apr 30 12:52:50 EDT 2011

merge

--- a/sys/src/9/boot/bootrc
+++ b/sys/src/9/boot/bootrc
@@ -59,6 +59,7 @@
 mt=()
 . /rc/lib/tcp.rc
 . /rc/lib/local.rc
+. /rc/lib/usb.rc
 
 fn main{
 	mp=()
@@ -146,6 +147,7 @@
 for(i in I l`{seq 0 3})
 	bind -qa '#'$i /net
 
+configusb	# run partfs on usb disks
 configlocal	# add partitions and binds
 
 while(){
--- /dev/null
+++ b/sys/src/9/boot/usb.rc
@@ -1,0 +1,24 @@
+fn configusb{
+	for(c in /dev/sdU*[0-9]){
+		d=`{echo $c | sed 's,^/dev/(.*),\1p,g'}
+		if(! test -d /dev/$d)
+			disk/partfs -d $d $c/data
+	}
+}
+
+fn connectusb{
+	m=/mnt/usb
+	if(! test -r $1)
+		fatal device $1 does not exist
+	if(! test -r $1/dos)
+		fatal device $1 does not have dos partition
+	mkdir -p $m
+	dossrv -r -f $1/dos usb
+	mount /srv/usb $m
+	if(! test -r $m/9front.iso)
+		fatal $m/9front.iso not found
+	{9660srv -s -f $m/9front.iso &} <[0=1] | echo 0 >/srv/boot
+}
+
+musb=(configusb connectusb)
+mt=(musb $mt)
--- a/sys/src/9/port/bootfs.proto
+++ b/sys/src/9/port/bootfs.proto
@@ -10,6 +10,7 @@
 			fdisk
 			kfs
 			prep
+			partfs
 		dossrv
 		echo
 		cwfs64x
@@ -19,6 +20,7 @@
 		ip
 			ipconfig
 		ls
+		mkdir
 		mount
 		ramfs
 		rc
@@ -38,6 +40,7 @@
 		rcmain
 		local.rc 555 sys sys ../boot/local.rc
 		tcp.rc 555 sys sys ../boot/tcp.rc
+		usb.rc 555 sys sys ../boot/usb.rc
 	bin
 		fstype
 		diskparts