shithub: misc

ref: bb85d99a02ba60bebcd8509fb1bfec8476ef0047
dir: /9legacy/rpi4_usb_installation_example/

View raw version
Installation example in a usb disk using
http://9p.io/sources/contrib/miller/9pi.img.gz as host.

First apply usb_uas_and_close_ep.diff
on the host if you have problems with your usb disk or you are going
to connect and disconnect usb devices several times (e.g. using a kvm switch).

; partfs /dev/sdU0.0/data
; diskparts /dev/sdXX
; disk/fdisk /dev/sdXX/data
>>> a p1 0 15
>>> t p1 FAT32
>>> a p2 . $
>>> w
>>> q

; disk/format -r 2 -d /dev/sdXX/dos 
; disk/prep /dev/sdXX/plan9
no plan9 partition table found
  empty                    0 3518582819    (3518582819 sectors, 1.63 TB)
>>> a nvram 2 3
>>> a fossil . .+4G
>>> a arenas0 . .+59G
>>> a isect0 . .+3093300k
>>> a other . $
>>> p
  empty                    0 2             (2 sectors, 1.00 KB)
  nvram                    2 3             (1 sectors, 512 B )
  fossil                   3 8388611       (8388608 sectors, 4.00 GB)
  arenas0            8388611 132120579     (123731968 sectors, 59.00 GB)
  isect0           132120579 138307179     (6186600 sectors, 2.95 GB)
  other            138307179 7813550115    (7675242936 sectors, 3.57 TB)

# No bloom filter for now.

; fossil/flfmt /dev/sdXX/fossil
; fossil/flfmt /dev/sdXX/other

; cat flconf
srv -p fscons
srv fossil
fsys main config /dev/sdXX/fossil
fsys other config /dev/sdXX/other
fsys main open -AW
fsys other open -AWV
fsys main

; fossil/conf -w /dev/sdXX/fossil flconf
; fossil/fossil -m 20 -f /dev/sdXX/fossil -c 'srv -AWP fossil.new'  -c 'srv -p fscons.new'
; mount -c /srv/fossil.new /n/fossil.new

; venti/fmtarenas arenas0 /dev/sdXX/arenas0
; venti/fmtisect isect0 /dev/sdC0/isect0
; cat vtconf
index main
isect /dev/sdXX/isect0
arenas /dev/sdXX/arenas0
httpaddr tcp!*!80

; venti/fmtindex vtconf
; venti/conf -w /dev/sdXX/arenas0 <vtconf

; hget http://ftp.osuosl.org/pub/plan9/history/plan9-4e-latest.iso.bz2 | bunzip2 > plan9-4e-latest.iso
; 9660srv
; mount /srv/9660 /n/iso plan9-4e-latest.iso
; echo uname upas :upas >>/srv/fscons.new
; disk/mkfs -a -s /n/iso /n/iso/dist/replica/plan9.proto | disk/mkext -ud /n/fossil.new

; mv /n/fossil.new/sys/src/9/pc/etherm10g2k.i /n/fossil.new/sys/src/9/pc/etherm10g2k.h
; mv /n/fossil.new/sys/src/9/pc/etherm10g4k.i /n/fossil.new/sys/src/9/pc/etherm10g4k.h
; sed 's/(etherm10g[24]k).i/\1.h/' /n/fossil.new/sys/src/9/pc/etherm10g.c >/tmp/etherm10g.c; mv /tmp/etherm10g.c /n/fossil.new/sys/src/9/pc/etherm10g.c
; mv /n/fossil.new/sys/src/9/pc/uartaxp.i /n/fossil.new/sys/src/9/pc/uartaxp.h
; sed 's/(uartaxp).i/\1.h/' /n/fossil.new/sys/src/9/pc/uartaxp.c >/tmp/uartaxp.c; mv /tmp/uartaxp.c /n/fossil.new/sys/src/9/pc/uartaxp.c
; sed 's/(sd53c8xx).i/\1.h/' /n/fossil.new/sys/src/9/pcboot/bootmkfile >/tmp/bootmkfile; mv /tmp/bootmkfile /n/fossil.new/sys/src/9/pcboot/bootmkfile
; mv /n/fossil.new/sys/src/9/pc/sd53c8xx.i /n/fossil.new/sys/src/9/pc/sd53c8xx.h

; cd /n/fossil.new

; for(i in `{hget http://shithub.us/ph/misc/HEAD/9legacy/9legacylist/raw | grep -v '^#'}){echo applying $i; hget http://www.9legacy.org/9legacy/patch/$i | ape/patch --no-backup-if-mismatch -p1; echo}

; rm -r /sys/src/liboventi

; for(i in `{hget http://shithub.us/ph/misc/HEAD/9legacy/list/raw | grep -v '^#'}){echo applying $i; hget http://shithub.us/ph/misc/HEAD/9legacy/$i/raw | ape/patch --no-backup-if-mismatch -p1; echo}

; touch (386 arm mips power sparc spim sys)^/include/ape/_apetypes.h
; mkdir /n/fossil.new/sys/lib/firmware
; for(i in brcmfmac43430-sdio.bin brcmfmac43430-sdio.txt brcmfmac43455-sdio.bin brcmfmac43455-sdio.clm_blob brcmfmac43455-sdio.txt){hget https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm/$i >/n/fossil.new/sys/lib/firmware/$i}

; bind -c /n/fossil.new/sys /sys/
; bind -c /n/fossil.new/amd64 /amd64
; bind -c /n/fossil.new/mips64 /mips64
; cd /sys/src
; mk clean
; mk all

# If you know a better way to do this I'm interested.
; dircp /arm/bin /n/fossil.new/arm/bin
; bind -c /n/fossil.new/arm /arm
; mk install

; cd 9/bcm
; hget -o bootusb.rc http://shithub.us/ph/misc/HEAD/9legacy/bootusb.rc/raw
; hget -o pi4rc http://shithub.us/ph/misc/HEAD/9legacy/pi4rc/raw
; mk CONF=pi4rc

; diskparts /dev/sdM0
; dossrv
; mount -c /srv/dos /n/dos /dev/sdM0/dos
; mount -c /srv/dos /n/ndos /dev/sdXX/dos
; dircp /n/dos /n/ndos
; cp s9pi4rc 9pi4rc /n/dos/

Edit cmdline.txt to something like this:
nobootprompt=local ifconfig= venti=tcp!127.1!17034 bootargs=local!#/dev/sdXX/fossil nvram=/dev/sdXX/nvram

And config.txt:
[...]
[pi4]
kernel=9pi4rc
[...]

You should now be able to boot from your usb disk.