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