I'm talking to nemo about what we should do to partition USB devices.
fwiw, I'm using the attached patch to /sys/src/9/pc/boot
to mount my usb drive as root partition, now.
The rootspec I'm using is "local!/dev/sdXX/fossil".
It relies on adding yet more binaries to the ramdisk: partfs,
fdisk and prep. It calls partfs to get a partitionable device,
then runs fdisk and prep to read the existing partitions and
write them back, forcing partfs to see them. Finally I had
to patch the "local" connect method to not replace the
existing /dev, since thats where /dev/sdXX appears.
oh yah, my simple hack just guesses two possible locations
for the USB disk to appear...
Tim Newsham | www.thenewsh.com/~newsham | thenewsh.blogspot.com
binary files boot/libboot.a8 bootpatch/libboot.a8 differ
diff -c boot/boot.c bootpatch/boot.c
boot/boot.c:306,313 - bootpatch/boot.c:306,318
static char usbd[] = "/boot/usbd";
if(access("#u/usb/ctl", 0) >= 0 && bind("#u", "/dev", MAFTER) >= 0 &&
- access(usbd, AEXIST) >= 0)
+ access(usbd, AEXIST) >= 0) {
run(usbd, nil);
+ run("/boot/partfs", "/dev/sdU4.0/data", nil); // XXX guessing dev here
+ run("/boot/partfs", "/dev/sdU5.0/data", nil); // XXX guessing dev here
+ run("/boot/fdisk", "-w", "/dev/sdXX/data", nil);
+ run("/boot/prep", "-w", "/dev/sdXX/plan9", nil);
+ }
}
static void
diff -c boot/local.c bootpatch/local.c
boot/local.c:260,266 - bootpatch/local.c:260,266
{
int fd;
- if(bind("#c", "/dev", MREPL) < 0)
+ if(bind("#c", "/dev", MAFTER) < 0)
fatal("bind #c");
if(bind("#p", "/proc", MREPL) < 0)
fatal("bind #p");