changelog shortlog tags branches changeset files revisions annotate raw help

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

changeset 7107: 0e435b158257
parent: ff28f1376a7a
child: b52531f0e5af
author: cinap_lenrek@felloff.net
date: Sat, 30 Mar 2019 05:50:14 +0100
permissions: -rw-r--r--
description: dist/mkfile: aux/stub -d /n/src9/usr to avoid overbinding /usr in case /n/src9 an / alias

when /n/src9 is an alias for / (bind / /n/src9), then the bind
from /sys/lib/dist/usr on /n/src9/usr would also overbind
/usr and potentially make the build target file inaccessible.

the solution is to run aux/stub -d /n/src9/usr.

this works as aux/stub mounts itself on /n/src9, so the bind
for /n/src9/usr will not override /usr in the root filesystem
but the stub directory from aux/stub.
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  }
43  > /env/cmdline.txt {
44  echo 'console=0'
45  }
46  fatfiles=(/env/config.txt /env/cmdline.txt $bootcode $kernels)
47  mb=1919 # storage vendors idea of 2GB
48  mk $target.$pid.disk
49  mv $target.$pid.disk $target
50  }
51 
52 %.zynq.img:
53  @{
54  objtype=arm
55  kernel=/n/src9/$objtype/9zynq
56  echo 'bootfile='^`{basename $kernel} > /env/plan9.ini
57  fatfiles=(/env/plan9.ini $kernel)
58  mb=1919 # storage vendors idea of 2GB
59  mk $target.$pid.disk
60  mv $target.$pid.disk $target
61  }
62 
63 %.pc.iso:D: $proto /n/src9/sys/lib/sysconfig/proto/9bootproto $kernel
64  @{rfork n
65  mk binds
66  {grep -v '^bootfile=' /n/src9/cfg/plan9.ini
67  echo 'bootfile='^`{echo $kernel | sed 's!^/n/src9!!'}} > /env/plan9.ini
68  bind /env/plan9.ini /n/src9/cfg/plan9.ini
69  disk/mk9660 -c9j -B 386/9bootiso -E 386/efiboot.fat \
70  -p <{cat $proto /n/src9/sys/lib/sysconfig/proto/9bootproto} \
71  -s /n/src9 -v 'Plan 9 Front ('^$objtype^')' $target
72  if(test -r /n/src9/386/9boothyb){
73  dd -if /dev/zero -bs 2048 -count 1024 >> $target
74  disk/partfs -m /n/partfs $target
75  disk=/n/partfs/sdXX
76  disk/mbr -m /n/src9/386/mbr $disk/data
77  @{echo a p1 '$-1' '$'
78  echo t p1 ESP
79  echo A p1
80  echo w
81  echo q} | disk/fdisk -b $disk/data
82  disk/format -b /n/src9/386/pbs -xd -t hard $disk/esp
83  s = esp.$pid
84  dossrv -f $disk/esp $s
85  mount -c /srv/$s /n/esp
86  cp /n/src9/386/9boothyb /n/esp/9bootfat
87  mkdir /n/esp/efi
88  mkdir /n/esp/efi/boot
89  cp /n/src9/386/boot*.efi /n/esp/efi/boot
90  unmount /n/esp
91  rm -f /srv/$s
92  }}
93 
94 %.disk:D: $proto $fatfiles
95  @{rfork n
96  mk binds
97  rm -f $target
98  dd -if /dev/zero -of $target -bs 1048576 -oseek $mb -count 1
99  s=`{basename $target}
100  disk/partfs -m /n/$s $target
101  d=/n/$s/sdXX
102  disk/mbr $d/data
103  if(~ $target *.pi.img.*){
104  {
105  echo 'a p1 . .+100M'
106  echo 't p1 FAT32'
107  echo 'a p2 . $'
108  echo 't p2 PLAN9'
109  echo 'A p1'
110  echo 'p'
111  echo 'w'
112  echo 'q'
113  } | disk/fdisk -b $d/data
114  disk/prep -bw -a^(nvram fs) $d/plan9
115  disk/format -d $d/dos $fatfiles
116  }
117  if not {
118  disk/fdisk -baw $d/data
119  disk/prep -bw -a^(9fat nvram fs) $d/plan9
120  disk/format -d -r 2 $d/9fat $fatfiles
121  }
122  hjfs -f $d/fs -n $s -S -r
123  {
124  echo echo on
125  echo create /dist sys sys 775 d
126  echo create /usr sys sys 775 d
127  user=glenda
128  echo newuser $user
129  echo newuser adm +$user
130  echo newuser sys +$user
131  echo newuser upas +$user
132  echo echo off
133  sleep 1
134  } >> /srv/$s.cmd
135  mount -N -c /srv/$s /n/newfs
136  disk/mkfs -z 4096 -U -s /n/src9 -d /n/newfs $proto
137  echo sync >> /srv/$s.cmd
138  echo halt >> /srv/$s.cmd
139  while(test -e /srv/$s.cmd) sleep 1
140  exit ''
141  }
142 
143 binds:V:
144  test -d /n/src9/.hg && bind /n/src9 /n/src9/dist/plan9front
145  bind cfg /n/src9/cfg
146  bind mail/lib /n/src9/mail/lib
147  bind ndb /n/src9/lib/ndb
148  bind -a adm/timezone /n/src9/adm/timezone
149  aux/stub -d /n/src9/usr
150  bind usr /n/src9/usr