shithub: riscv

Download patch

ref: 50850cf4b93d0a1b3a543a260c367dbf5f3209c1
parent: 10f680c5baf1cec1ba630bb63e6fc022bf9d26ad
author: cinap_lenrek <[email protected]>
date: Fri Sep 4 23:29:17 EDT 2015

dist/mkfile: add target for the aijuboard *.zynq.img

this generates a disk image (to be written to usb or
sdmmc card) containing 9fat partition with kernel and
a hjfs filesystem partition with the 9front distribution.

this could be easily extended to generate raspberry pi
images as well, but i have no hardware to test.

--- a/sys/lib/dist/mkfile
+++ b/sys/lib/dist/mkfile
@@ -2,10 +2,8 @@
 iso=/tmp/9front.iso
 
 cd:V:	$iso
-	
 
-%.iso:  $proto
-	@{rfork n
+binds:V:
 	bind cfg /n/src9/cfg
 	bind mail/lib /n/src9/mail/lib
 	bind ndb /n/src9/lib/ndb
@@ -12,5 +10,53 @@
 	bind -a adm/timezone /n/src9/adm/timezone
 	bind usr /n/src9/usr
 	bind /n/src9 /n/src9/dist/plan9front
+
+%.iso:  $proto
+	@{rfork n
+	mk binds
 	disk/mk9660 -c9j -B 386/9bootiso -E 386/efiboot.fat -p $proto -s /n/src9 -v 'Plan 9 Front' $target
+	}
+
+%.zynq.img:
+	@{
+	objtype=arm
+	kernel=/n/src9/$objtype/9zynq
+	echo 'bootfile='^`{basename $kernel} > /env/plan9.ini
+	fatfiles=(/env/plan9.ini $kernel)
+	mb=1919	# storage vendors idea of 2GB
+	mk $target.$pid.disk
+	mv $target.$pid.disk $target
+	}
+
+%.disk:D:	$proto $fatfiles
+	@{rfork n
+	mk binds
+	rm -f $target
+	dd -if /dev/zero -of $target -bs 1048576 -oseek $mb -count 1
+	s=`{basename $target}
+	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
+	hjfs -f $d/fs -n $s -S -r
+	{
+		echo echo on
+		echo create /dist sys sys 775 d
+		echo create /usr sys sys 775 d
+		user=glenda
+		echo newuser $user
+		echo newuser adm +$user
+		echo newuser sys +$user
+		echo newuser upas +$user
+		echo echo off
+		sleep 1
+	} >> /srv/$s.cmd
+	mount -N -c /srv/$s /n/newfs
+	disk/mkfs -z 4096 -U -s /n/src9 -d /n/newfs $proto
+	echo sync >> /srv/$s.cmd
+	echo halt >> /srv/$s.cmd
+	while(test -e /srv/$s.cmd) sleep 1
+	exit ''
 	}