raspberry pi


it should be possible to chain load a plan9 image and hook the pi into the local grid automatically. perhaps a modified `netboot` program could serve up the appropriate files over tftp and replace dnsmasq in the guide below. ideally `netboot` could run as a service on the gridboot machine alongside the nfs server and provide boot services to linux and 9front hosts.


the gridhub machine should serve hubfs and optionally inferno with the inferno registry

hub -b gridhub

copy the hubrc

cp plan9ants/cfg/hubrc /rc/bin/hubrc


change `plan9.ini` to boot into the hubserver

hubserver={{ name or dialstring }}
registry={{ dialstring of inferno registry }} #optional


rimport -a hubserver /srv
mount -c /srv/gridhub /n/hubfs
cat antsdir/scripts/gridcpurc >>/n/hubfs/remotesysname0

pxe boot

client config

this section applies ONLY to the ORIGINAL rpi 3b; if you are using the 3b+, then ignore this section and skip to the server section below.

instruct the rpi to enable network boot.

echo program_usb_boot_mode=1 >> /boot/config.txt

reboot and check that the One Time Programmable (OTP) memory has been programmed.

vcgencmd otp_dump | grep 17:

remove the `program_usb_boot_mode` line from `/boot/config.txt`.

server config

copy the rootfs from your own root directory.

mkdir -p /nfs/rootfs-linux-$client_hostname
# install rsync
rsync -xa --progress --exclude /nfs / /nfs/rootfs-linux-$client_hostname

create new ssh keys for the new rootfs

cd /nfs/rootfs-linux-$client_hostname
mount --bind /dev dev
mount --bind /sys sys
mount --bind /proc proc
chroot .
rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
umount dev sys proc

change your network settings to give the server a static ip, then configure dnsmasq

# dnsmasq.conf
dhcp-range={{ broadcast_address }},proxy
pxe-service=0,"Raspberry Pi Boot"

now create a `/tftboot` directory and copy the boot files.

mkdir /tftpboot
chmod 777 /tftpboot
cp -r /boot/* /tftpboot

start `dnsmasq` and set up an `nfs` root.

# install nfs-kernel-server
echo "/nfs/linux-rootfs-$client_hostname *(rw,sync,no_subtree_check,no_root_squash)" >> /etc/exports
echo "/tftpboot *(rw,sync,no_subtree_check,no_root_squash)" >> /etc/exports

restart `rpi-bind` and `nfs-server`. edit /tftpboot/cmdline.txt and from root= onwards, and replace it with:

root=/dev/nfs nfsroot=$server_ip:/nfs/linux-rootfs-$client_hostname,vers=4.1,proto=tcp rw ip=dhcp rootwait elevator=deadline

You should substitute the ip address here with the ip address you have noted down. also remove any part of the command line starting with `init=`.

finally, edit `/nfs/client1/etc/fstab` and remove the `/dev/mmcblk0p1` and `p2` lines (only proc should be left). Then, add the boot partition:

echo "$server_ip:/tftpboot /boot nfs defaults,vers=4.1,proto=tcp 0 0" >> /nfs/linux-rootfs-$client_hostname/etc/fstab

see also

Alpine Linux netboot

Network boot your Raspberry Pi