]> git.lizzy.rs Git - plan9front.git/blob - sys/lib/dist/mkfile
/sys/lib/dist/mkfile: test for .git directory
[plan9front.git] / sys / lib / dist / mkfile
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=1885 # 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 fixup4cd.dat start4cd.elf bcm2711-rpi-4-b.dtb LICENCE.broadcom)
57         kernel=/n/src9/$objtype/^(9pi3 9pi4)
58         > /env/config.txt {
59                 echo '[pi4]'
60                 echo 'kernel=9pi4'
61                 echo 'arm_64bit=1'
62                 echo '[pi3]'
63                 echo 'kernel=9pi3'
64                 echo 'arm_64bit=1'
65                 echo '[all]'
66                 echo 'gpu_mem=16'
67                 echo 'core_freq=250'
68                 echo 'enable_uart=1'
69                 echo 'boot_delay=1'
70         }
71         > /env/cmdline.txt {
72                 echo 'console=0'
73         }
74         fatfiles=(/env/config.txt /env/cmdline.txt $bootcode $kernel)
75         mb=1885 # storage vendors idea of 2GB
76         mk $target.$pid.disk
77         mv $target.$pid.disk $target
78         }
79
80 %.zynq.img:
81         @{
82         objtype=arm
83         kernel=/n/src9/$objtype/9zynq
84         echo 'bootfile='^`{basename $kernel} > /env/plan9.ini
85         fatfiles=(/env/plan9.ini $kernel)
86         mb=1885 # storage vendors idea of 2GB
87         mk $target.$pid.disk
88         mv $target.$pid.disk $target
89         }
90
91 %.pc.iso:D:     $proto /n/src9/sys/lib/sysconfig/proto/9bootproto $kernel
92         @{rfork n
93         mk binds
94         {grep -v '^bootfile=' /n/src9/cfg/plan9.ini
95         echo 'bootfile='^`{echo $kernel | sed 's!^/n/src9!!'}} > /env/plan9.ini
96         bind /env/plan9.ini /n/src9/cfg/plan9.ini
97         disk/mk9660 -c9j -B 386/9bootiso -E 386/efiboot.fat \
98                 -p <{cat $proto /n/src9/sys/lib/sysconfig/proto/9bootproto} \
99                 -s /n/src9 -v 'Plan 9 Front ('^$objtype^')' $target
100         if(test -r /n/src9/386/9boothyb){
101                 dd -if /dev/zero -bs 2048 -count 1024 >> $target
102                 disk/partfs -m /n/partfs $target
103                 disk=/n/partfs/sdXX
104                 disk/mbr -m /n/src9/386/mbr $disk/data
105                 @{echo a p1 '$-1' '$'
106                         echo t p1 ESP
107                         echo A p1
108                         echo w
109                         echo q} | disk/fdisk -b $disk/data
110                 disk/format -b /n/src9/386/pbs -xd -t hard $disk/esp
111                 s = esp.$pid
112                 dossrv -f $disk/esp $s
113                 mount -c /srv/$s /n/esp
114                 cp /n/src9/386/9boothyb /n/esp/9bootfat
115                 mkdir /n/esp/efi
116                 mkdir /n/esp/efi/boot
117                 cp /n/src9/386/boot*.efi /n/esp/efi/boot
118                 unmount /n/esp
119                 rm -f /srv/$s
120         }}
121
122 %.disk:D:       $proto $fatfiles
123         @{rfork n
124         mk binds
125         rm -f $target
126         dd -if /dev/zero -of $target -bs 1048576 -oseek $mb -count 1
127         s=`{basename $target}
128         disk/partfs -m /n/$s $target
129         d=/n/$s/sdXX
130         disk/mbr $d/data
131         if(~ $target *.pi.img.* *.pi3.img.*){
132                 {
133                         echo 'a p1 . .+100M'
134                         echo 't p1 FAT32'
135                         echo 'a p2 . $'
136                         echo 't p2 PLAN9'
137                         echo 'A p1'
138                         echo 'p'
139                         echo 'w'
140                         echo 'q'
141                 } | disk/fdisk -b $d/data
142                 disk/prep -bw -a^(nvram fs) $d/plan9
143                 disk/format -d $d/dos $fatfiles
144         }
145         if not {
146                 disk/fdisk -baw $d/data
147                 disk/prep -bw -a^(9fat nvram fs) $d/plan9
148                 disk/format -d -r 2 $d/9fat $fatfiles
149         }
150         hjfs -f $d/fs -n $s -S -r
151         {
152                 echo echo on
153                 echo create /dist sys sys 775 d
154                 echo create /usr sys sys 775 d
155                 user=glenda
156                 echo newuser $user
157                 echo newuser adm +$user
158                 echo newuser sys +$user
159                 echo newuser upas +$user
160                 echo echo off
161                 sleep 1
162         } >> /srv/$s.cmd
163         mount -N -c /srv/$s /n/newfs
164         disk/mkfs -z 4096 -U -s /n/src9 -d /n/newfs $proto
165         echo sync >> /srv/$s.cmd
166         echo halt >> /srv/$s.cmd
167         while(test -e /srv/$s.cmd) sleep 1
168         exit ''
169         }
170
171 binds:V:
172         test -d /n/src9/.git && bind /n/src9 /n/src9/dist/plan9front
173         bind cfg /n/src9/cfg
174         bind mail/lib /n/src9/mail/lib
175         bind ndb /n/src9/lib/ndb
176         bind -a adm/timezone /n/src9/adm/timezone
177         aux/stub -d /n/src9/usr
178         bind usr /n/src9/usr