changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > plan9front / sys/lib/dist/mkfile

changeset 7211: b52531f0e5af
parent: 0e435b158257
child: 64a00b5fab8c
author: cinap_lenrek@felloff.net
date: Mon, 06 May 2019 18:29:09 +0200
permissions: -rw-r--r--
description: dist/mkfile: add *.pi3.img target for ARM64 raspberry pi3
1 proto=/n/src9/sys/lib/sysconfig/proto/distproto
2 
3 cd:V: /tmp/9front.386.iso.gz
4 
5 %.gz:D: %
6  gzip -9 < $prereq > $target
7 
8 %.386.iso:
9  @{
10  objtype=386
11  kernel=/n/src9/$objtype/9pc
12  mk $target.$pid.pc.iso
13  mv $target.$pid.pc.iso $target
14  }
15 
16 %.amd64.iso:
17  @{
18  objtype=amd64
19  kernel=/n/src9/$objtype/9pc64
20  mk $target.$pid.pc.iso
21  mv $target.$pid.pc.iso $target
22  }
23 
24 %.pi.img:
25  @{
26  objtype=arm
27  bootcode=/sys/src/boot/bcm/^(bootcode.bin fixup_cd.dat start_cd.elf LICENCE.broadcom)
28  kernels=/n/src9/$objtype/^(9pi 9pi2)
29  > /env/config.txt {
30  echo '[pi0]'
31  echo 'kernel=9pi'
32  echo '[pi1]'
33  echo 'kernel=9pi'
34  echo '[pi2]'
35  echo 'kernel=9pi2'
36  echo '[pi3]'
37  echo 'kernel=9pi2'
38  echo 'core_freq=250'
39  echo '[all]'
40  echo 'gpu_mem=16'
41  echo 'enable_uart=1'
42  echo 'boot_delay=1'
43  }
44  > /env/cmdline.txt {
45  echo 'console=0'
46  }
47  fatfiles=(/env/config.txt /env/cmdline.txt $bootcode $kernels)
48  mb=1919 # storage vendors idea of 2GB
49  mk $target.$pid.disk
50  mv $target.$pid.disk $target
51  }
52 
53 %.pi3.img:
54  @{
55  objtype=arm64
56  bootcode=/sys/src/boot/bcm/^(bootcode.bin fixup_cd.dat start_cd.elf LICENCE.broadcom)
57  kernel=/n/src9/$objtype/9pi3
58  > /env/config.txt {
59  echo '[pi3]'
60  echo 'kernel=9pi3'
61  echo 'arm_64bit=1'
62  echo 'core_freq=250'
63  echo '[all]'
64  echo 'gpu_mem=16'
65  echo 'enable_uart=1'
66  echo 'boot_delay=1'
67  }
68  > /env/cmdline.txt {
69  echo 'console=0'
70  }
71  fatfiles=(/env/config.txt /env/cmdline.txt $bootcode $kernel)
72  mb=1919 # storage vendors idea of 2GB
73  mk $target.$pid.disk
74  mv $target.$pid.disk $target
75  }
76 
77 %.zynq.img:
78  @{
79  objtype=arm
80  kernel=/n/src9/$objtype/9zynq
81  echo 'bootfile='^`{basename $kernel} > /env/plan9.ini
82  fatfiles=(/env/plan9.ini $kernel)
83  mb=1919 # storage vendors idea of 2GB
84  mk $target.$pid.disk
85  mv $target.$pid.disk $target
86  }
87 
88 %.pc.iso:D: $proto /n/src9/sys/lib/sysconfig/proto/9bootproto $kernel
89  @{rfork n
90  mk binds
91  {grep -v '^bootfile=' /n/src9/cfg/plan9.ini
92  echo 'bootfile='^`{echo $kernel | sed 's!^/n/src9!!'}} > /env/plan9.ini
93  bind /env/plan9.ini /n/src9/cfg/plan9.ini
94  disk/mk9660 -c9j -B 386/9bootiso -E 386/efiboot.fat \
95  -p <{cat $proto /n/src9/sys/lib/sysconfig/proto/9bootproto} \
96  -s /n/src9 -v 'Plan 9 Front ('^$objtype^')' $target
97  if(test -r /n/src9/386/9boothyb){
98  dd -if /dev/zero -bs 2048 -count 1024 >> $target
99  disk/partfs -m /n/partfs $target
100  disk=/n/partfs/sdXX
101  disk/mbr -m /n/src9/386/mbr $disk/data
102  @{echo a p1 '$-1' '$'
103  echo t p1 ESP
104  echo A p1
105  echo w
106  echo q} | disk/fdisk -b $disk/data
107  disk/format -b /n/src9/386/pbs -xd -t hard $disk/esp
108  s = esp.$pid
109  dossrv -f $disk/esp $s
110  mount -c /srv/$s /n/esp
111  cp /n/src9/386/9boothyb /n/esp/9bootfat
112  mkdir /n/esp/efi
113  mkdir /n/esp/efi/boot
114  cp /n/src9/386/boot*.efi /n/esp/efi/boot
115  unmount /n/esp
116  rm -f /srv/$s
117  }}
118 
119 %.disk:D: $proto $fatfiles
120  @{rfork n
121  mk binds
122  rm -f $target
123  dd -if /dev/zero -of $target -bs 1048576 -oseek $mb -count 1
124  s=`{basename $target}
125  disk/partfs -m /n/$s $target
126  d=/n/$s/sdXX
127  disk/mbr $d/data
128  if(~ $target *.pi.img.* *.pi3.img.*){
129  {
130  echo 'a p1 . .+100M'
131  echo 't p1 FAT32'
132  echo 'a p2 . $'
133  echo 't p2 PLAN9'
134  echo 'A p1'
135  echo 'p'
136  echo 'w'
137  echo 'q'
138  } | disk/fdisk -b $d/data
139  disk/prep -bw -a^(nvram fs) $d/plan9
140  disk/format -d $d/dos $fatfiles
141  }
142  if not {
143  disk/fdisk -baw $d/data
144  disk/prep -bw -a^(9fat nvram fs) $d/plan9
145  disk/format -d -r 2 $d/9fat $fatfiles
146  }
147  hjfs -f $d/fs -n $s -S -r
148  {
149  echo echo on
150  echo create /dist sys sys 775 d
151  echo create /usr sys sys 775 d
152  user=glenda
153  echo newuser $user
154  echo newuser adm +$user
155  echo newuser sys +$user
156  echo newuser upas +$user
157  echo echo off
158  sleep 1
159  } >> /srv/$s.cmd
160  mount -N -c /srv/$s /n/newfs
161  disk/mkfs -z 4096 -U -s /n/src9 -d /n/newfs $proto
162  echo sync >> /srv/$s.cmd
163  echo halt >> /srv/$s.cmd
164  while(test -e /srv/$s.cmd) sleep 1
165  exit ''
166  }
167 
168 binds:V:
169  test -d /n/src9/.hg && bind /n/src9 /n/src9/dist/plan9front
170  bind cfg /n/src9/cfg
171  bind mail/lib /n/src9/mail/lib
172  bind ndb /n/src9/lib/ndb
173  bind -a adm/timezone /n/src9/adm/timezone
174  aux/stub -d /n/src9/usr
175  bind usr /n/src9/usr