boot: partitioning USB disks, mounting 9front.iso from FAT partition

This commit is contained in:
ment 2011-04-30 16:43:54 +02:00
parent 06db9d4d68
commit 012dec1119
3 changed files with 30 additions and 0 deletions

View file

@ -3,6 +3,7 @@ rfork e
mt=()
. /rc/lib/tcp.rc
. /rc/lib/local.rc
. /rc/lib/usb.rc
fn fatal {
echo $*
@ -55,6 +56,7 @@ fn getmethod{
fn main{
rm -f /srv/boot
rm -f /srv/usb
getmethod
@ -138,6 +140,7 @@ if(! ~ $#kbmap 0){
cat $"kbmap >/dev/kbmap
}
configusb # run partfs on usb disks
configlocal # add partitions and binds
while()@{

24
sys/src/9/boot/usb.rc Normal file
View file

@ -0,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)

View file

@ -10,6 +10,7 @@ $cputype
fdisk
kfs
prep
partfs
dossrv
echo
cwfs64x
@ -19,6 +20,7 @@ $cputype
ip
ipconfig
ls
mkdir
mount
ramfs
rc
@ -38,6 +40,7 @@ rc
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