ref: 012dec1119fe41b59bf4f498c835aa7ec2e269f2
parent: 06db9d4d681e552e0d4803e76becace707a72f12
author: ment <[email protected]>
date: Sat Apr 30 12:43:54 EDT 2011
boot: partitioning USB disks, mounting 9front.iso from FAT partition
--- a/sys/src/9/boot/bootrc
+++ b/sys/src/9/boot/bootrc
@@ -3,6 +3,7 @@
mt=()
. /rc/lib/tcp.rc
. /rc/lib/local.rc
+. /rc/lib/usb.rc
fn fatal {
echo $*
@@ -55,6 +56,7 @@
fn main{
rm -f /srv/boot
+ rm -f /srv/usb
getmethod
@@ -138,6 +140,7 @@
cat $"kbmap >/dev/kbmap
}
+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