Commit | Line | Data |
---|---|---|
9b29c40a | 1 | ######################################################################### |
e79a303f | 2 | # ENHANCEMENTS # |
9b29c40a MD |
3 | ######################################################################### |
4 | ||
aac6f66e | 5 | # Optional targets may be specified which set make variables which enhance |
9b29c40a MD |
6 | # the build in various ways. |
7 | # | |
632d862b | 8 | gui nopkgs binpkgs: |
9b29c40a | 9 | |
9b29c40a | 10 | ######################################################################### |
083f5c48 | 11 | # SETUP # |
9b29c40a MD |
12 | ######################################################################### |
13 | ||
0f8dfe63 AL |
14 | SRCDIR= ${.CURDIR}/.. |
15 | ||
bd0ab7aa | 16 | DPORTS_PATH?= /usr/dports |
a291abfb | 17 | ISODIR?= /usr/obj/release |
3fff415b | 18 | ISOROOT?= ${ISODIR}/root |
8126e4ef AL |
19 | GITURL_SRC?= git://git.dragonflybsd.org/dragonfly.git |
20 | GITURL_DPORTS?= git://mirror-master.dragonflybsd.org/dports.git | |
834a1306 | 21 | NREL_MAKE_JOBS?= $$(sysctl -n hw.ncpu) |
9758d73a SW |
22 | .if !defined(NOFSCHG) |
23 | MTREE_FSCHG= -i | |
24 | .endif | |
8a6aa092 | 25 | WORLD_VERSION!= ${AWK} '/^\#define[[:blank:]]__DragonFly_version/ {print $$3}' < /usr/include/sys/param.h |
bfe20b28 | 26 | |
0f8dfe63 | 27 | GITREV!= sh ${SRCDIR}/tools/gitrev.sh |
9d8dda4a | 28 | |
3ac64890 AL |
29 | # The label/name of the disklabel64(5) slice in the ".img" file. This is |
30 | # used to identify the USB device with DragonFly installation image, avoiding | |
31 | # hardcoding the USB device name (e.g., "da8"). | |
32 | # | |
9d8dda4a AL |
33 | # This label is also used as the volume ID of the ".iso" file. |
34 | # | |
35 | LABEL?= DragonFly_${GITREV} | |
3ac64890 | 36 | |
083f5c48 AL |
37 | CHROOT_CMD?= /usr/sbin/chroot ${ISOROOT} sh -c |
38 | ||
39 | ISOFILE?= ${ISODIR}/dfly.iso | |
40 | IMGFILE?= ${ISODIR}/dfly.img | |
41 | IMGMNT?= ${ISODIR}/mnt | |
42 | ||
165b1c14 | 43 | .if !make(nopkgs) |
8abe78a1 | 44 | # User may specify extra packages in addition to the defaults |
95b64753 | 45 | # |
c36c5990 | 46 | DPORTS_EXTRA_PACKAGES?= |
8abe78a1 | 47 | |
c36c5990 SW |
48 | # dports packages to be built and installed on the release ISO |
49 | # | |
71832315 | 50 | DPORTS_PACKAGES?= security/ca_root_nss \ |
d25c1efd | 51 | devel/git-lite \ |
0e561611 | 52 | dns/bind-tools \ |
20d2e8bd | 53 | net/isc-dhcp44-server \ |
8abe78a1 | 54 | sysutils/cdrtools \ |
44c4f44a | 55 | ${DPORTS_EXTRA_PACKAGES} |
fbc26094 | 56 | |
c36c5990 | 57 | # dports options to use when building packages |
fbc26094 | 58 | # |
7392a6b4 | 59 | DPORTS_OPTIONS+= -DBATCH -DBUILDING_NRELEASE_DPORTS |
d25c1efd | 60 | DPORTS_OPTIONS+= dns_bind-tools_UNSET=PYTHON |
165b1c14 | 61 | .endif |
8188de86 MD |
62 | |
63 | # Specify which root skeletons are required, and let the user include | |
e2dbfa0b | 64 | # their own. They are copied into ISODIR during the `customizeiso' |
8188de86 MD |
65 | # target; each overwrites the last. |
66 | # | |
8f51ac0b | 67 | REQ_ROOTSKELS= ${.CURDIR}/root |
cc224c64 JS |
68 | ROOTSKELS?= ${REQ_ROOTSKELS} |
69 | ||
255a0279 | 70 | .if make(gui) |
3f279b9e | 71 | ISOFILE?= ${ISODIR}/dfly-gui.iso |
b9c3e754 | 72 | IMGFILE?= ${ISODIR}/dfly-gui.img |
88821fa4 | 73 | |
083f5c48 | 74 | .if !make(nopkgs) |
0e176309 MD |
75 | # NOTE: order important, do not sort package list |
76 | # | |
255a0279 MN |
77 | DPORTS_PACKAGES+= x11/xorg \ |
78 | x11-wm/fluxbox \ | |
79 | x11-wm/fvwm \ | |
30e27f66 | 80 | www/firefox \ |
255a0279 | 81 | graphics/xpdf \ |
fbc26094 SW |
82 | shells/zsh \ |
83 | editors/emacs \ | |
84 | editors/vim \ | |
255a0279 | 85 | irc/irssi \ |
fbc26094 SW |
86 | lang/perl5 \ |
87 | editors/nano \ | |
88 | shells/bash \ | |
255a0279 | 89 | devel/ctags \ |
fbc26094 SW |
90 | archivers/zip \ |
91 | security/sudo \ | |
255a0279 MN |
92 | www/links \ |
93 | ftp/wget \ | |
94 | x11-fonts/terminus-font \ | |
fbc26094 | 95 | net/rsync \ |
255a0279 MN |
96 | x11-clocks/asclock \ |
97 | sysutils/screen | |
88821fa4 MD |
98 | .endif |
99 | ||
3f279b9e | 100 | ROOTSKELS+= ${.CURDIR}/gui |
0f8dfe63 | 101 | .endif # make(gui) |
3f279b9e | 102 | |
632d862b AL |
103 | # one port may have multiple binary packages (e.g., Python flavors) or have a |
104 | # different name that may not be found by pkg(8), therefore, allow to specify | |
105 | # the exact binary package name for a port by setting 'PKG_<port>=<pkg-name>'. | |
106 | # | |
107 | .for PORT in ${DPORTS_PACKAGES} | |
108 | .if defined(PKG_${PORT}) | |
109 | PACKAGES+= ${PKG_${PORT}} | |
110 | .else | |
111 | PACKAGES+= ${PORT} | |
112 | .endif | |
113 | .endfor | |
114 | ||
8188de86 | 115 | ######################################################################### |
e79a303f | 116 | # BASE ISO TARGETS # |
8188de86 MD |
117 | ######################################################################### |
118 | ||
7ebbae99 | 119 | release: check clean buildworld1 buildkernel1 \ |
3f84c424 | 120 | buildiso pkgs customizeiso srcs mkiso mkimg |
8188de86 | 121 | |
7ebbae99 | 122 | quickrel: check clean buildworld2 buildkernel2 \ |
3f84c424 | 123 | buildiso pkgs customizeiso srcs mkiso mkimg |
2e3f8f38 | 124 | |
03e2a3c5 | 125 | realquickrel: check clean \ |
3f84c424 | 126 | buildiso pkgs customizeiso srcs mkiso mkimg |
6ca9a59c | 127 | |
3f84c424 | 128 | restartpkgs: check pkgs customizeiso srcs mkiso mkimg |
5af45f85 | 129 | |
9b29c40a MD |
130 | quick: quickrel |
131 | ||
132 | realquick: realquickrel | |
133 | ||
134 | ######################################################################### | |
083f5c48 | 135 | # CORE SUPPORT TARGETS # |
9b29c40a MD |
136 | ######################################################################### |
137 | ||
d2582113 | 138 | check: |
c36c5990 | 139 | .if !exists(/usr/local/bin/mkisofs) && !exists(/usr/pkg/bin/mkisofs) |
0936984e MD |
140 | @echo |
141 | @echo "Your machine does not have cdrtools installed. You can install it with:" | |
218b6b69 | 142 | @echo " pkg install cdrtools" |
0936984e | 143 | .endif |
f8c0334e AHJ |
144 | |
145 | .if make(nopkgs) | |
146 | @echo Not building packages. | |
147 | .elif make(binpkgs) | |
148 | @echo Using binary packages from a mirror. | |
149 | .else | |
aa3eeb12 SW |
150 | @if [ ! -d ${DPORTS_PATH} ]; then \ |
151 | echo "${DPORTS_PATH} does not exist."; \ | |
152 | echo ""; \ | |
153 | echo "Please set DPORTS_PATH to the dports tree that shall be used for"; \ | |
154 | echo "package building. The default is /usr/dports. See the Makefile in"; \ | |
155 | echo "/usr if you are unfamiliar with dports."; \ | |
156 | /usr/bin/false; \ | |
f8c0334e AHJ |
157 | else \ |
158 | echo "Using ${DPORTS_PATH} as the dports tree."; \ | |
aa3eeb12 | 159 | fi |
f8c0334e AHJ |
160 | .endif |
161 | ||
c36c5990 | 162 | .if !exists(/usr/local/bin/mkisofs) && !exists(/usr/pkg/bin/mkisofs) |
3da8e88f | 163 | @/usr/bin/false |
fbc26094 | 164 | .endif |
2e3f8f38 | 165 | |
588a679c | 166 | buildworld1 buildworld2: |
0f8dfe63 AL |
167 | ( cd ${SRCDIR}; \ |
168 | ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ | |
834a1306 | 169 | make -j ${NREL_MAKE_JOBS} -DWANT_INSTALLER \ |
0f8dfe63 | 170 | ${.TARGET:C/build(.*)2/quick\1/:C/1//} ) |
6ca9a59c | 171 | |
588a679c | 172 | buildkernel1 buildkernel2: |
0f8dfe63 AL |
173 | ( cd ${SRCDIR}; \ |
174 | ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ | |
834a1306 | 175 | make -j ${NREL_MAKE_JOBS} \ |
0f8dfe63 | 176 | ${.TARGET:C/build(.*)2/quick\1/:C/1//} ) |
6ca9a59c | 177 | |
2b43b38c | 178 | # Unconditionally clean out ${ISOROOT} so a previous img build |
92b0ebb9 MD |
179 | # does not blow up a future quick iso build |
180 | # | |
6ca9a59c | 181 | buildiso: |
92b0ebb9 MD |
182 | -chflags -R noschg ${ISOROOT} |
183 | rm -rf ${ISOROOT} | |
184 | mkdir -p ${ISOROOT} | |
0f8dfe63 AL |
185 | ( cd ${SRCDIR}; \ |
186 | make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld ) | |
8f5a7f62 AL |
187 | # Do not mess with any /usr/obj directories not related to |
188 | # buildworld, buildkernel, or nrelease. | |
0f8dfe63 | 189 | ( cd ${SRCDIR}/etc && \ |
8f5a7f62 AL |
190 | tmpdir=`mktemp -d -t nrelease` && \ |
191 | MAKEOBJDIRPREFIX=$${tmpdir} \ | |
0f8dfe63 | 192 | make -m ${SRCDIR}/share/mk \ |
8f5a7f62 AL |
193 | DESTDIR=${ISOROOT} distribution && \ |
194 | rm -rf $${tmpdir} ) | |
0f8dfe63 | 195 | ( cd ${SRCDIR}; make DESTDIR=${ISOROOT} reinstallkernel ) |
91856cf5 | 196 | rm -rf ${ISOROOT}/boot/kernel.old |
1c9d98d0 | 197 | ln -sf kernel ${ISOROOT}/boot/kernel/kernel.BOOTP |
0f8dfe63 | 198 | mtree ${MTREE_FSCHG} -deU -f ${SRCDIR}/etc/mtree/BSD.var.dist \ |
9758d73a | 199 | -p ${ISOROOT}/var |
1968392d | 200 | ${CHROOT_CMD} "rcrestart ldconfig" |
8188de86 | 201 | |
699b6cdc AL |
202 | # The GUI build includes the full system source (~500 MB) and the full |
203 | # dports tree (~250 MB). The nominal release build only includes the | |
204 | # kernel source (~30 MB). | |
19d86faa | 205 | # |
e2dbfa0b | 206 | srcs: |
699b6cdc AL |
207 | rm -rf ${ISOROOT}/usr/dports |
208 | rm -f ${ISOROOT}/usr/src-sys.tar.bz2 | |
e2dbfa0b | 209 | .if !defined(WITHOUT_SRCS) |
255a0279 | 210 | .if make(gui) |
699b6cdc AL |
211 | ( cd ${ISOROOT}/usr && \ |
212 | make dports-create-shallow GITURL_DPORTS=${GITURL_DPORTS} ) | |
213 | ( cd ${ISOROOT}/usr && \ | |
214 | make src-create-shallow GITURL_SRC=${GITURL_SRC} ) | |
c19c746b | 215 | .else |
0f8dfe63 | 216 | ( cd ${SRCDIR} && \ |
699b6cdc | 217 | tar --exclude .git -s '/^\./src/' -cf - \ |
c488485f | 218 | ./Makefile ./Makefile.inc1 ./sys \ |
219 | ./share/syscons/fonts | \ | |
699b6cdc | 220 | bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 ) |
c19c746b | 221 | .endif |
66b79064 | 222 | .endif |
19d86faa | 223 | |
1968392d | 224 | # Customize the ISO by copying rootskels in reverse priority order. |
5af45f85 | 225 | # |
3f84c424 AL |
226 | # NOTE: Perform this target *after* the 'pkgs' target, because the latter |
227 | # can make changes to '/etc' (e.g., new users/groups/shells). | |
228 | # | |
8188de86 | 229 | customizeiso: |
3f84c424 AL |
230 | pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd |
231 | cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd | |
232 | ||
5af45f85 | 233 | # Copy the rootskels. Allow sources to be owned by someone other |
3cf4b4a1 | 234 | # than root (as is common when checked out via git). |
5af45f85 | 235 | # |
8188de86 MD |
236 | .for ROOTSKEL in ${ROOTSKELS} |
237 | cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT} | |
5af45f85 MD |
238 | @test -O ${.CURDIR} || echo "chowning copied files to root:wheel" |
239 | @test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel)) | |
8188de86 | 240 | .endfor |
04e94b32 | 241 | |
04e94b32 AL |
242 | pw -V ${ISOROOT}/etc useradd installer -o -u 0 -g 0 \ |
243 | -c "DragonFly Installer" -d /root -s /usr/sbin/installer | |
244 | ${CHROOT_CMD} "chpass -p '' root" | |
245 | ${CHROOT_CMD} "chpass -p '' installer" | |
246 | ||
4fba3387 CP |
247 | .for UPGRADE_ITEM in Makefile \ |
248 | etc.${MACHINE_ARCH} \ | |
4fba3387 CP |
249 | rc.d/Makefile \ |
250 | periodic/Makefile \ | |
251 | periodic/daily/Makefile \ | |
252 | periodic/security/Makefile \ | |
253 | periodic/weekly/Makefile \ | |
254 | periodic/monthly/Makefile | |
0f8dfe63 | 255 | cp -R ${SRCDIR}/etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM} |
20585f87 | 256 | .endfor |
1968392d | 257 | |
632d862b | 258 | # Install packages by using pkg(8) or building from dports. |
1968392d AL |
259 | # |
260 | pkgs: | |
165b1c14 | 261 | .if !empty(DPORTS_PACKAGES) |
1c9d98d0 | 262 | cp /etc/resolv.conf ${ISOROOT}/etc |
3e82f71a | 263 | -cp /etc/ssl/cert.pem ${ISOROOT}/etc/ssl |
1968392d AL |
264 | -@umount ${ISOROOT}/dev |
265 | mount_null /dev ${ISOROOT}/dev | |
266 | ||
632d862b AL |
267 | .if make(binpkgs) |
268 | ${CHROOT_CMD} "cd /usr && make pkg-bootstrap-force" | |
269 | ${CHROOT_CMD} "pkg update" | |
270 | .for PKG in ${PACKAGES} | |
271 | @${CHROOT_CMD} "pkg search --exact --search name ${PKG}" || \ | |
272 | ${CHROOT_CMD} "pkg search --exact --search origin ${PKG}" || \ | |
273 | { \ | |
274 | echo "ERROR: Cannot find the package for port '${PKG}'!"; \ | |
c2dc3938 | 275 | echo "-----> Use 'PKG_${PKG}=<pkg-name>' to specify the package name."; \ |
632d862b AL |
276 | false; \ |
277 | } | |
278 | .endfor | |
279 | ${CHROOT_CMD} "pkg install --yes ${PACKAGES}" | |
280 | ||
281 | .else # !make(binpkgs) | |
5e885f07 | 282 | -@umount ${ISOROOT}/usr/distfiles |
2f36664e | 283 | -@umount ${ISOROOT}/usr/dports |
2f36664e | 284 | rm -rf ${ISOROOT}/usr/obj/dports |
1968392d | 285 | |
2f36664e | 286 | mkdir -p ${ISOROOT}/usr/dports |
5e885f07 | 287 | mkdir -p ${ISOROOT}/usr/distfiles |
1968392d AL |
288 | |
289 | # Mount /usr/dports read-only for safety, else a failed umount | |
290 | # and our rm -rf will do bad things. | |
2f36664e | 291 | mount_null -o ro ${DPORTS_PATH} ${ISOROOT}/usr/dports |
1968392d AL |
292 | |
293 | # Make sure /usr/distfiles is writable | |
c36c5990 SW |
294 | cp /etc/shells ${ISOROOT}/usr/distfiles/.test > /dev/null 2>&1 \ |
295 | || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/distfiles | |
1968392d | 296 | |
2f36664e | 297 | .for PKG in ${DPORTS_PACKAGES} |
333a466d AL |
298 | .if make(restartpkgs) |
299 | ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} deinstall" | |
300 | .endif | |
d25c1efd | 301 | ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} install" |
2f36664e SW |
302 | .endfor |
303 | .for PKG in ${DPORTS_PACKAGES} | |
c36c5990 | 304 | ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} clean" |
8188de86 | 305 | .endfor |
1968392d | 306 | |
22e9b157 | 307 | ${CHROOT_CMD} "pkg autoremove --yes" |
1968392d | 308 | |
5e885f07 | 309 | -umount ${ISOROOT}/usr/distfiles |
2f36664e | 310 | umount ${ISOROOT}/usr/dports |
1968392d | 311 | |
5e885f07 | 312 | rm -rf ${ISOROOT}/usr/dports |
5e885f07 | 313 | rm -rf ${ISOROOT}/usr/distfiles |
1968392d | 314 | rm -rf ${ISOROOT}/usr/obj/dports |
632d862b | 315 | .endif # make(binpkgs) |
1968392d | 316 | |
2db6e812 AL |
317 | ${CHROOT_CMD} "pkg clean --yes --all" |
318 | ||
1968392d | 319 | # Update the locate(8) and whatis(1) databases, allow ISODIR |
b34d3b9b | 320 | # to be on tmpfs (fails to create locate database then) |
2f36664e | 321 | # |
b34d3b9b | 322 | -${CHROOT_CMD} /etc/periodic/weekly/310.locate |
1968392d AL |
323 | -${CHROOT_CMD} /etc/periodic/weekly/320.whatis |
324 | ||
31d5c88c | 325 | umount ${ISOROOT}/dev |
1968392d AL |
326 | rm -f ${ISOROOT}/etc/resolv.conf |
327 | ||
a4527c0f AL |
328 | .if exists(${ISOROOT}/usr/local/etc) |
329 | echo "dummy /usr/local/etc tmpfs rw,-C 0 0" >> ${ISOROOT}/etc/fstab | |
330 | .endif | |
a4527c0f | 331 | .endif # !empty(DPORTS_PACKAGES) |
d68fa6c5 | 332 | |
6ca9a59c | 333 | mkiso: |
2c776168 | 334 | .if ${WORLD_VERSION} < 600106 |
5fa778d7 SW |
335 | if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi |
336 | -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ | |
337 | vnconfig -u `cat ${ISODIR}/vn.which`; fi | |
338 | newfs_msdos -C 400k -F 12 -L EFI -m 0xf8 ${ISOROOT}/boot/efiboot.img | |
339 | vnconfig -l | grep "not in use" | head -n 1 | \ | |
340 | cut -f 1 -d: > ${ISODIR}/vn.which | |
fc3c0f63 | 341 | vnconfig -e `cat ${ISODIR}/vn.which` ${ISOROOT}/boot/efiboot.img |
5fa778d7 SW |
342 | mount_msdos /dev/`cat ${ISODIR}/vn.which` ${IMGMNT} |
343 | mkdir -p ${IMGMNT}/EFI/BOOT | |
344 | cp ${ISOROOT}/boot/loader.efi ${IMGMNT}/EFI/BOOT/BOOTX64.EFI | |
345 | umount ${IMGMNT} | |
2c776168 SW |
346 | .else |
347 | ( tmpdir=`mktemp -d -t nrelease` && mkdir -p "$${tmpdir}/EFI/BOOT" && \ | |
348 | cp ${ISOROOT}/boot/loader.efi $${tmpdir}/EFI/BOOT/BOOTX64.EFI && \ | |
349 | makefs -t msdos -o fat_type=12 -o sectors_per_cluster=1 \ | |
350 | -o volume_label=EFI -o media_descriptor=248 -s 400k \ | |
351 | ${ISOROOT}/boot/efiboot.img $${tmpdir} && \ | |
352 | rm -rf $${tmpdir} ) | |
353 | .endif | |
5fa778d7 | 354 | ( cd ${ISOROOT}; mkisofs -R -J -o ${ISOFILE} \ |
9d8dda4a AL |
355 | -b boot/cdboot -no-emul-boot \ |
356 | -eltorito-alt-boot -eltorito-platform efi \ | |
357 | -eltorito-boot boot/efiboot.img -no-emul-boot \ | |
358 | -V ${LABEL:C/(^.{32}).*/\1/} . ) # cut label to <= 32 characters | |
5fa778d7 | 359 | rm -f ${ISOROOT}/boot/efiboot.img |
b9c3e754 MN |
360 | |
361 | mkimg: | |
60b68cbb | 362 | if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi |
9a122c9a MD |
363 | -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ |
364 | vnconfig -u `cat ${ISODIR}/vn.which`; fi | |
8c441895 | 365 | rm -f ${IMGFILE} |
fe70af21 MD |
366 | .ifdef IMGSIZE |
367 | @echo "STEP: use an image size of ${IMGSIZE} 512-byte sectors" | |
8c441895 AL |
368 | sz=`bc -e "((${IMGSIZE}) * 512)" -equit`; \ |
369 | truncate -s $${sz} ${IMGFILE} | |
370 | .elifdef IMGSIZE_MB | |
371 | @echo "STEP: use an image size of ${IMGSIZE_MB} MB" | |
372 | truncate -s ${IMGSIZE_MB}M ${IMGFILE} | |
fe70af21 | 373 | .else |
3342e40a MD |
374 | @echo "STEP: Determine required image size in 1GB steps" |
375 | @echo " Leave ~600MB of unused space" | |
60b68cbb | 376 | sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \ |
3342e40a | 377 | sz=`bc -e "(($${sz}) * 1.15 + 999999 + 600000) / 1000000" -equit | \ |
fe70af21 | 378 | cut -f1 -d.`; \ |
c843f8b0 | 379 | sz=`bc -e "(($${sz}) * 953)" -equit | cut -f1 -d.`; \ |
8c441895 | 380 | truncate -s $${sz}M ${IMGFILE} |
fe70af21 | 381 | .endif |
9a122c9a MD |
382 | @echo "STEP: determine free vn device" |
383 | vnconfig -l | grep "not in use" | head -n 1 | \ | |
384 | cut -f 1 -d: > ${ISODIR}/vn.which | |
fc3c0f63 | 385 | vnconfig -e `cat ${ISODIR}/vn.which` ${IMGFILE} |
5fa778d7 | 386 | @echo "STEP: set up legacy MBR" |
cc3c231b | 387 | fdisk -b ${ISOROOT}/boot/mbr -IB `cat ${ISODIR}/vn.which` |
5fa778d7 SW |
388 | fdisk -s `cat ${ISODIR}/vn.which` >${ISODIR}/fdisk.dat |
389 | awk '(NR==1){printf("g c%s h%s s%s\n", $$2, $$4, $$6);}' \ | |
390 | ${ISODIR}/fdisk.dat >${ISODIR}/fdisk.conf | |
391 | echo "p 1 239 63 257985" >>${ISODIR}/fdisk.conf | |
7d89978d | 392 | awk '($$1=="1:"){printf("p 2 108 258048 %lu\n", $$3 - 258528);}' \ |
5fa778d7 SW |
393 | ${ISODIR}/fdisk.dat >>${ISODIR}/fdisk.conf |
394 | echo "a 2" >>${ISODIR}/fdisk.conf | |
395 | fdisk -iv -f ${ISODIR}/fdisk.conf `cat ${ISODIR}/vn.which` | |
396 | rm ${ISODIR}/fdisk.conf ${ISODIR}/fdisk.dat | |
397 | newfs_msdos -F 32 -c 2 -L EFI -m 0xf8 `cat ${ISODIR}/vn.which`s1 | |
398 | mount_msdos /dev/`cat ${ISODIR}/vn.which`s1 ${IMGMNT} | |
399 | mkdir -p ${IMGMNT}/EFI/BOOT | |
400 | cp ${ISOROOT}/boot/boot1.efi ${IMGMNT}/EFI/BOOT/BOOTX64.EFI | |
401 | umount ${IMGMNT} | |
9a122c9a | 402 | @echo "STEP: write standard disklabel" |
5fa778d7 | 403 | disklabel -w -r `cat ${ISODIR}/vn.which`s2 auto |
9a122c9a | 404 | @echo "STEP: read disklabel back" |
5fa778d7 | 405 | disklabel -r `cat ${ISODIR}/vn.which`s2 > ${IMGFILE}.label |
3ac64890 AL |
406 | @echo "STEP: set disklabel name" |
407 | echo "label: ${LABEL}" >> ${IMGFILE}.label | |
ea8f7c44 | 408 | @echo "STEP: add slice partition" |
3ac64890 | 409 | echo "a: * * 4.2BSD" >> ${IMGFILE}.label; |
9a122c9a | 410 | @echo "STEP: write modified disklabel back" |
5fa778d7 | 411 | disklabel -R -r `cat ${ISODIR}/vn.which`s2 ${IMGFILE}.label |
9a122c9a | 412 | rm ${IMGFILE}.label |
cc3c231b MD |
413 | disklabel -B -b ${ISOROOT}/boot/boot1_64 -s ${ISOROOT}/boot/boot2_64 \ |
414 | `cat ${ISODIR}/vn.which`s2 | |
5fa778d7 SW |
415 | newfs /dev/`cat ${ISODIR}/vn.which`s2a |
416 | mount /dev/`cat ${ISODIR}/vn.which`s2a ${IMGMNT} | |
9a122c9a MD |
417 | cpdup ${ISOROOT} ${IMGMNT} |
418 | @echo "STEP: fixup ${IMGMNT}/etc/fstab" | |
3ac64890 | 419 | echo "/dev/part-by-label/${LABEL}.a / ufs rw,noatime 0 1" > ${IMGMNT}/etc/fstab |
3342e40a MD |
420 | echo "dummy /tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab |
421 | echo "dummy /var/tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab | |
d4c25c30 | 422 | echo "dummy /var/run tmpfs rw,-C 0 0" >> ${IMGMNT}/etc/fstab |
3342e40a | 423 | echo "dummy /usr/obj tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab |
9a122c9a MD |
424 | echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab |
425 | @echo "STEP: fixup ${IMGMNT}/boot/loader.conf" | |
426 | -fgrep -v kernel_options ${IMGMNT}/boot/loader.conf > ${IMGMNT}/boot/loader.conf.new | |
3ac64890 | 427 | echo 'vfs.root.mountfrom="ufs:part-by-label/${LABEL}.a"' >> ${IMGMNT}/boot/loader.conf.new |
9a122c9a | 428 | mv ${IMGMNT}/boot/loader.conf.new ${IMGMNT}/boot/loader.conf |
2cc9c7f7 AHJ |
429 | @echo "STEP: create /firstboot" |
430 | touch ${IMGMNT}/firstboot | |
9a122c9a MD |
431 | @echo "STEP: cleanup" |
432 | df ${IMGMNT} | |
836f3129 MD |
433 | sync |
434 | sleep 1 | |
9a122c9a MD |
435 | umount ${IMGMNT} |
436 | vnconfig -u `cat ${ISODIR}/vn.which` | |
437 | rm -f ${ISODIR}/vn.which | |
60b68cbb | 438 | rmdir ${IMGMNT} |
a4911276 | 439 | @echo "STEP: done, image files are in ${ISODIR}" |
b9c3e754 | 440 | |
6ca9a59c | 441 | clean: |
836f3129 MD |
442 | sync |
443 | sleep 1 | |
5e885f07 | 444 | -umount ${ISOROOT}/usr/distfiles > /dev/null 2>&1 |
2f36664e | 445 | -umount ${ISOROOT}/usr/dports > /dev/null 2>&1 |
9a122c9a MD |
446 | -umount ${ISOROOT}/dev > /dev/null 2>&1 |
447 | -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ | |
448 | vnconfig -u `cat ${ISODIR}/vn.which`; fi | |
6ca9a59c | 449 | if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi |
c19c746b | 450 | rm -rf ${ISOROOT} |
9a122c9a | 451 | rm -f ${ISODIR}/.didbootstrap ${ISODIR}/vn.which |
6ca9a59c MD |
452 | |
453 | realclean: clean | |
c19c746b MD |
454 | rm -rf ${ISODIR}/packages |
455 | rm -rf ${ISODIR}/distfiles | |
6ca9a59c | 456 | |
dade4a2e AL |
457 | .MAIN: help |
458 | help: | |
8126e4ef AL |
459 | @echo "Targets:" |
460 | @echo " release - full build from scratch" | |
461 | @echo " quick - attempt to do an incremental rebuild" | |
462 | @echo " realquick - attempt to restart after world & kernel" | |
463 | @echo " restartpkgs - attempt to restart at the pkg building stage" | |
aac6f66e AL |
464 | @echo "" |
465 | @echo "Optional targets:" | |
466 | @echo " nopkgs - do not install any packages" | |
632d862b | 467 | @echo " binpkgs - use binary packages with pkg(8)" |
aac6f66e | 468 | @echo " gui - do a GUI release" |
8abe78a1 | 469 | @echo "" |
8126e4ef AL |
470 | @echo "Variables:" |
471 | @echo " DPORTS_EXTRA_PACKAGES: add additional packages" | |
472 | @echo " GITURL_SRC: override the Git URL to source repository" | |
473 | @echo " GITURL_DPORTS: override the Git URL to dports repository" | |
474 | @echo " IMGSIZE: override the size of .img (in 512-byte sectors)" | |
8c441895 | 475 | @echo " IMGSIZE_MB: override the size of .img (in units of MB)" |
834a1306 | 476 | @echo " NREL_MAKE_JOBS: override the default value (sysctl hw.ncpu)" |
632d862b AL |
477 | @echo " PKG_<port>: specify the package name for port <port>" |
478 | @echo " WITHOUT_SRCS: do not package source code if set" | |
aac6f66e | 479 | @echo "" |
588a679c | 480 | |
e2dbfa0b | 481 | .PHONY: release quickrel realquickrel |
9b29c40a | 482 | .PHONY: quick realquick |
e2dbfa0b | 483 | .PHONY: check buildworld1 buildworld2 |
31d5c88c | 484 | .PHONY: buildkernel1 buildkernel2 buildiso customizeiso mkiso mkimg |
1968392d | 485 | .PHONY: clean realclean help all srcs pkgs |