Hello. I am new here. I am running the Dec 22 9legacy on a machine, and now want to create a bootable USB on it. The USB is for a raspberry pi 4 4GB, acting as a standalone auth only. But booting the pi always results in the error - boot: can't connect to file server: '/boot/kfs' does not exist I searched the mailing list for solutions, but had no luck. To make my bootable usb, I used following script. ; cat mkusb #!/bin/rc iso=$home/tmp/9legacy.iso #disk=/tmp/9legacy.rpi disk=/dev/sdU0.0/data sd=sdXX dev=/dev/$sd data=$dev/data dos=$dev/dos plan9=$dev/plan9 nvram=$dev/nvram fossil=$dev/fossil test -f /srv/9660 || 9660srv mount /srv/9660 /n/cd $iso # partition the SD card | USB image dd -if /dev/zero -of $disk -bs 512 -count 1 disk/partfs $disk disk/mbr $data {echo a p1 0 8; echo t p1 FAT32; echo a p2 8 '$'; echo w} | disk/fdisk -b $data {echo a nvram 2551 2552; echo a fossil 2552 '$'; echo w} | disk/prep -b $plan9 # format and populate the dos partition disk/format -b /386/pbs -df $dos rm -f /srv/dos.rpi dossrv -f $dos dos.rpi mount -c /srv/dos.rpi /n/dos cp /arm/9pi4 /n/dos # copy pi specific startup files dircp $home/tmp/rpi4 /n/dos # format the fossil partition fossil/flfmt -y $fossil fossil/conf -w $fossil <<XXX fsys main config /dev/sdXX/fossil fsys main open -Va XXX rm /srv/fscons.rpi /srv/fossil.rpi fossil/fossil -f /dev/sdXX/fossil -c 'srv -p fscons.rpi' -c 'srv -AWP fossil.rpi' echo uname upas :upas >>/srv/fscons.rpi mount -c /srv/fossil.rpi /n/fossil.rpi # copy the Plan 9 tree from cd to fossil, without 386 or amd64 binaries for (d in 386 amd64) { bind /n/cd/mips/bin /n/cd/$d/bin bind /n/cd/mips/lib /n/cd/$d/lib bind /n/cd/acme/bin/mips /n/cd/acme/bin/$d for (f in /n/cd/$d/9*) bind /dev/null $f } disk/mkfs -a -s /n/cd /n/cd/dist/replica/plan9.proto | disk/mkext -ud /n/fossil.rpi echo users -w >>/srv/fscons.rpi echo fsys main create /active/usr/glenda/bin/arm glenda glenda d775 >>/srv/fscons.rpi echo fsys main sync >>/srv/fscons.rpi ; ls -p tmp/rpi4 bcm2711-rpi-4-b.dtb bcm2711-rpi-400.dtb bcm2711-rpi-cm4.dtb bcm2711-rpi-cm4s.dtb bootcode.bin cmdline.txt config.txt fixup.dat fixup4.dat fixup4cd.dat fixup_cd.dat licence.broadcom overlays start.elf start4.elf start4cd.elf start_cd.elf ; cat tmp/rpi4/cmdline.txt readparts=1 bootargs=local!#S/sdXX/fossil nobootprompt=local nvram=#S/sdXX/nvram user=glenda ; cat tmp/rpi4/config.txt [pi4] kernel=9pi4 core_freq=250 device_tree= enable_gic=1 start_file=start4cd.elf fixup_file=fixup4cd.dat cmdline=cmdline.txt [all] gpu_mem=16 Modified the last part of the pi4 mk file; ; cat /sys/src/9/bcm/pi4 . . boot boot #S/sdXX/ local tcp bootdir boot$CONF.out boot /arm/bin/ip/ipconfig /arm/bin/auth/factotum /arm/bin/fossil/fossil /arm/bin/usb/usbd /arm/bin/disk/partfs /arm/bin/disk/fdisk /arm/bin/disk/prep What I am missing? -marco ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T4cb044b1eee98e3e-Mdd439d50e580852cbaa676d8 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
marco@germteig.com: > I am running the Dec 22 9legacy on a machine, and now want to create a bootable USB on it. > The USB is for a raspberry pi 4 4GB, acting as a standalone auth only. When you say "bootable USB", do you want to boot the pi4 without an SD card, and just a USB drive? If you're happy to have both SD card and USB drive, you can use the SD card to hold a DOS partition (with bootable kernel and cmdline.txt) and a fsconfig partition (to hold a partition configuration for a /dev/fs device (see fs(3)) which maps the USB drive. This is what I do to set up a pi4 file server with fossil on a SSD drive. My pi4 kernel config doesn't have partfs, fdisk and prep in the bootdir section, and does have fs in the dev section. The cmdline.txt is readparts=1 nvram=#S/sdM0/nvram fsconfig=#S/sdM0/fscfg bootargs=local!/dev/sdXX/fossil and the fscfg partition on the SD card looks like this (the fsdev: first line seems to be undocumented) fsdev: part sdXX/nvram /dev/sdU0.0/data 2096640 512 part sdXX/fossil /dev/sdU0.0/data 2097152 8192000000 part sdXX/swap /dev/sdU0.0/data 8194097152 2048000000 ... plus some other partitions for venti, etc I use the fs(3) device because I haven't been able to get partfs(8) to work at boot time. I think there may be a bug in /sys/src/9/boot where an extra re-mount is missed out. If you want to boot the pi4 completely from a USB drive, with no SD card present (I've never tried this), you'll need an alternative place for a fs(3) configuration (maybe in the built-in bootdir in the kernel?), or the boot code will need tweaking to get the partfs(8) partitions re-mounted at the right time. ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T4cb044b1eee98e3e-Mc9962f736d0b6ee6e0c0ad7b Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
> When you say "bootable USB", do you want to boot the pi4 without an > SD card, and just a USB drive? I tried USB only; no SD card. Unfortunately, I don’t have any SD card laying around, so I will try to get the USB only booting first. But many thanks for the fs(3) hint. I’m looking into it. -marco ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T4cb044b1eee98e3e-M8aab2364f577b660682923ee Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
> But many thanks for the fs(3) hint. I’m looking into it. Apologies. To configure a usb disk using fs(3) at boot time, you need this change to /sys/src/9/boot/local.c which hasn't gone into the 9legacy tree yet: /sys/src/9/boot/local.c:277,286 - local.c:277,286 if(bind("#p", "/proc", MREPL) < 0) fatal("bind #p"); bind("#S", "/dev", MAFTER); - bind("#k", "/dev", MAFTER); bind("#u", "/dev", MAFTER); bind("#æ", "/dev", MAFTER); mountusbparts(); /* make partfs partitions visible again */ + bind("#k", "/dev", MAFTER); /* /dev/fs config might refer to usb disks */ if((fd = connectlocalfossil()) < 0) fd = connectlocalkfs(); ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T4cb044b1eee98e3e-M9b4ad2b3c2c1e1add529e1eb Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
I said: > If you want to boot the pi4 completely from a USB drive, with no > SD card present (I've never tried this), you'll need an alternative > place for a fs(3) configuration (maybe in the built-in bootdir in > the kernel?), or the boot code will need tweaking to get the partfs(8) > partitions re-mounted at the right time. I've done a bit of experimenting, and did manage to boot a pi4 with only a usb drive and no SD card. It turns out that you can use the first part of the mbr sector on the usb drive to store the fs(3) configuration, ie fsconfig=/dev/sdU0.0/data in cmdline.txt -- as long as you don't have so many partitions that the config text overlaps the DOS partition information in the mbr (at offset 0x1be), the pi4 bootrom code will happily boot from the usb drive. I wouldn't suggest that PC users try this - a PC bios might be more strict about what's in the mbr. Booting without an SD card seems to have some rough edges. You get irritating error messages when startup procedures include /dev/sdM0 in the list of disks to look at, and the reboot(8) command doesn't work because the usb disk interface probably needs some soft-reset to be done before the pi bootrom can initialise it again. Even if you are primarily using a usb drive, booting from SD (or netbooting?) might still be preferable. ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T4cb044b1eee98e3e-M9a9b0a67789e2b67bf4b0cdd Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Okey, I will try netbooting it instead. Many thanks Richard. -marco ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T4cb044b1eee98e3e-Mcabe0043d665d3cc49981810 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription