ref: b65a5a1ca53fc8a10cb584b62978b8487af5138c
parent: f059563b9d53d3e63e2d580ed61868153f24c481
author: cinap_lenrek <[email protected]>
date: Sun Oct 21 20:16:04 EDT 2018
/sys/lib/dist/mkfile: add pi.img target for raspi sdcard image
--- a/sys/lib/dist/mkfile
+++ b/sys/lib/dist/mkfile
@@ -21,6 +21,34 @@
mv $target.$pid.pc.iso $target
}
+%.pi.img:
+ @{
+ objtype=arm
+ bootcode=/sys/src/boot/bcm/^(bootcode.bin fixup_cd.dat start_cd.elf LICENCE.broadcom)
+ kernels=/n/src9/$objtype/^(9pi 9pi2)
+ > /env/config.txt {
+ echo '[pi0]'
+ echo 'kernel=9pi'
+ echo '[pi1]'
+ echo 'kernel=9pi'
+ echo '[pi2]'
+ echo 'kernel=9pi2'
+ echo '[pi3]'
+ echo 'kernel=9pi2'
+ echo 'core_freq=250'
+ echo '[all]'
+ echo 'gpu_mem=16'
+ echo 'enable_uart=1'
+ }
+ > /env/cmdline.txt {
+ echo 'console=0'
+ }
+ fatfiles=(/env/config.txt /env/cmdline.txt $bootcode $kernels)
+ mb=1919 # storage vendors idea of 2GB
+ mk $target.$pid.disk
+ mv $target.$pid.disk $target
+ }
+
%.zynq.img:
@{
objtype=arm
@@ -72,9 +100,25 @@
disk/partfs -m /n/$s $target
d=/n/$s/sdXX
disk/mbr $d/data
- disk/fdisk -baw $d/data
- disk/prep -bw -a^(9fat nvram fs) $d/plan9
- disk/format -d -r 2 $d/9fat $fatfiles
+ if(~ $target *.pi.img.*){
+ {
+ echo 'a p1 . .+100M'
+ echo 't p1 FAT32'
+ echo 'a p2 . $'
+ echo 't p2 PLAN9'
+ echo 'A p1'
+ echo 'p'
+ echo 'w'
+ echo 'q'
+ } | disk/fdisk -b $d/data
+ disk/prep -bw -a^(nvram fs) $d/plan9
+ disk/format -d $d/dos $fatfiles
+ }
+ if not {
+ disk/fdisk -baw $d/data
+ disk/prep -bw -a^(9fat nvram fs) $d/plan9
+ disk/format -d -r 2 $d/9fat $fatfiles
+ }
hjfs -f $d/fs -n $s -S -r
{
echo echo on