shithub: riscv

Download patch

ref: 07506870120ed7d705da18b3a0c314cf3de1f9ce
parent: 96cc3eb2ee989163e02129b8fc1f7aa581c7fd40
author: cinap_lenrek <[email protected]>
date: Wed Dec 5 08:53:34 EST 2012

move usb ethernet in bootfs.paq

--- a/rc/bin/nusbrc
+++ b/rc/bin/nusbrc
@@ -4,9 +4,6 @@
 	exit
 if(! bind -a '#u' /dev)
 	exit
-
-mkdir -p -m 700 '#σc/usbnet'
-
 @{
 	rfork ne
 	fn attach {
@@ -16,7 +13,8 @@
 		case *02
 			# serial and ethernet
 			nusb/serial $1
-			nusb/ether $1
+			# handled /sys/src/9/boot/nusbrc
+			# nusb/ether $1
 		case *03
 			# handled /sys/src/9/boot/nusbrc
 			# nusb/kb $1
@@ -28,13 +26,10 @@
 		}
 	}
 	fn detach {
-		switch($4){
-		case *02
-			rm -f '#σ/usbnet/'^$1.*
-		}
+		# handled /sys/src/9/boot/nusbrc
 	}
 	rc < '#σ/usb/usbevent' &
 }
 
-bind -a '#σ/usb' /dev
-bind -a '#σ/usbnet' /net
+bind -qa '#σ/usb' /dev
+bind -qa '#σ/usbnet' /net
--- a/sys/src/9/boot/local.rc
+++ b/sys/src/9/boot/local.rc
@@ -49,22 +49,27 @@
 }
 
 fn connectlocal{
-	if(test -f $1)
-		t=`{fstype $1}
-	if not {
-		t=$1; shift
+	if(~ $#* 0){
+		echo local method needs an argument
 	}
-	switch($t){
-	case ''
-		fatal unknown fstype $1
-	case 9660
-		bootfs 9660srv $*
-	case dos
-		bootfs dossrv $*
-	case kfs
-		bootfs disk/kfs $*
-	case *
-		bootfs $t $*
+	if not {
+		if(test -f $1)
+			t=`{fstype $1}
+		if not {
+			t=$1; shift
+		}
+		switch($t){
+		case ''
+			fatal unknown fstype $1
+		case 9660
+			bootfs 9660srv $*
+		case dos
+			bootfs dossrv $*
+		case kfs
+			bootfs disk/kfs $*
+		case *
+			bootfs $t $*
+		}
 	}
 }
 
--- a/sys/src/9/boot/nusbrc
+++ b/sys/src/9/boot/nusbrc
@@ -1,7 +1,10 @@
 #!/bin/rc
 if(! bind -a '#u' /dev)
 	exit
-mkdir -m 0700 '#σc/usb'
+
+mkdir -p -m 700 '#σc/usb'
+mkdir -p -m 700 '#σc/usbnet'
+
 if(! nusb/usbd)
 	exit
 
@@ -11,6 +14,8 @@
 		switch($4){
 		case *03
 			nusb/kb $1 &
+		case *02
+			nusb/ether $1 &
 		case *08
 			@{
 				rfork ne
@@ -26,13 +31,18 @@
 					}
 				}
 			} &
+		case *
+			if(~ $2 0424 && ~ $3 ec00){
+				# raspberry pi ethernet
+				nusb/ether $1 &
+			}
 		}
 	}
 	fn detach {
-		rm -rf '#σc/usb/'^$1.* '#σc/sdU'^$1.*
+		rm -rf '#σc/usb/'^$1.* '#σc/sdU'^$1.* '#σc/usbnet/'^$1.*
 	}
 	rc < '#σ/usb/usbevent' &
 }
 
 bind -a '#σ/usb' /dev
-
+bind -a '#σ/usbnet' /net
--- a/sys/src/9/port/bootfs.proto
+++ b/sys/src/9/port/bootfs.proto
@@ -34,6 +34,7 @@
 		unmount
 		nusb
 			usbd
+			ether
 			disk
 			kb
 		xd