wm: doc

ref: dcfe2d38c6d53dfd6a1bbcf1ec6c5fcdbce8847b
dir: /rpi-p9.ms/

View raw version
Plan 9 Installation for Raspberry Pi Zero WH

WARNING: Make sure to purchase a raspberry pi with GPIO headers pre-soldered.
For the Pi Zero W, it is marked as the Pi Zero WH. If your board does not have
headers, you will need to buy headers and solder them on, or else you will be
unable to connect to the UART for serial debug console.

First, download Richard Miller's Plan 9 image:

https://9p.io/sources/contrib/miller/9pi.img.gz

gunzip the file to get 9pi.img, then use dd to copy this image onto a microSD card.

Next, we need to configure config.txt and cmdline.txt to specify the proper boot
settings. For reference, see
https://www.raspberrypi.com/documentation/computers/config_txt.html.

Mount the microSD card and make a few edits.

In cmdline.txt, add this definition

readparts=1 nobootprompt=local console='0 b115200' ether1=type=4330 nvram='#S/sdM0/nvram'

to the end of the line. This will accomplish several things: it will configure the
serial console, enable the wifi device in the kernel, and specify the location of
nvram.

NOTE: everything must be on a single command line. Multiple lines will not be parsed
correctly in cmdline.txt.

If you do not have a display, you may want to remove the default boot user of glenda
so you get a normal rc prompt. To do so, remove user=glenda from cmdline.txt.

In config.txt, put these lines in the [pi0] block:

enable_uart=1
core_freq=250

You will need a USB to TTL serial cable (see https://www.adafruit.com/product/954).
It must be attached to the correct pins (see https://learn.adafruit.com/raspberry-pi-zero-creation/give-it-life)

Afterwards, if the machine to which the USB cable is connected is running Linux,
you might run a command such as:

$ sudo screen /dev/ttyUSB0 115200

Afterwards, you should see output like the following:

Plan 9 from Bell Labs
board rev: 0x9000c1 firmware rev: 1648128071
vcore reports memory = 0x1f000000
cpu0: 1000MHz ARM 1176JZF-S
clocks: CPU 1000000000 core 250000000 UART 48000000 EMMC 200000000
fp: 16 registers,  simd
fp: arm arch VFPv2; rev 5
#l0: usb: 100Mbps port 0x0 irq -1: 000000000000
#u/usb/ep1.0: dwcotg: port 0X0 irq 9
496M memory: 52M kernel data, 444M user, 1926M swap
user[none]: pi

At this point, it's recommended to continue configuration as pi, since
pi is hostowner:

time...
fossil(#S/sdM0/fossil)...version...
init: starting /bin/rc
Can't cd /usr/pi: '/usr/pi' does not exist
lib/profile: rc: .: can't open: '/bin/lib' file does not exist
init: rc exit status: rc 31: error

init: starting /bin/rc
%