cluster - Major kernel component work (diskiocom, xdisk, kdmsg)
[dragonfly.git] / nrelease / Makefile
CommitLineData
9b29c40a
MD
1#########################################################################
2# ENHANCEMENTS #
3#########################################################################
4
f4ec1279 5# New method e.g. 'make gui release'. A series of enhancement
9b29c40a
MD
6# targes may be specified which set make variables which enhance
7# the build in various ways.
8#
1a8bb5eb
MD
9# img is now the default (produces both the .iso and .img)
10#
88821fa4 11gui installer img nopkgs:
9b29c40a 12
9b29c40a
MD
13#########################################################################
14# SETUP #
15#########################################################################
16
3fff415b
SW
17ISODIR?= /usr/release
18ISOROOT?= ${ISODIR}/root
19OBJSYS= ${.OBJDIR}/../sys
fe70af21 20GITHOST?= git.dragonflybsd.org
3fff415b 21
5cb6cda9 22MAKE_JOBS?= $$(sysctl -n hw.ncpu)
bfe20b28 23
b2b3ffcd
SS
24# temporary until everybody has converted to x86_64
25.if ${MACHINE_ARCH} == "amd64"
26MACHINE_ARCH= x86_64
3da8e88f
JM
27.if defined(.PARSEDIR)
28.export MACHINE_ARCH
29.else
30# LEGACY MAKE - REMOVE FOR DFLY 3.6
b2b3ffcd
SS
31.makeenv MACHINE_ARCH
32.endif
3da8e88f 33.endif
b2b3ffcd 34
702a95cc
SS
35# XXX makeshift fix to build the right kernel for the (target) architecture
36# We should configure this in the platform files somehow
37.if ${MACHINE_ARCH} == "i386"
91856cf5 38KERNCONF ?= GENERIC
702a95cc 39.else
91856cf5 40KERNCONF ?= X86_64_GENERIC
702a95cc 41.endif
6ca9a59c 42
cc224c64 43PKGSRC_PREFIX?= /usr/pkg
bce110a5 44PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
95b64753 45PKGBIN_PKG_DELETE?= ${PKGSRC_PREFIX}/sbin/pkg_delete
c791834f 46PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin
bce110a5
MD
47PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
48PKGSRC_PKG_PATH?= ${ISODIR}/packages
bce110a5 49
cc55a235
SS
50# We use env -i in the chroot, so that environment variables won't
51# disturb any (pkgsrc) build. This has happened for TARGET_ARCH,
52# which is used by gmake in completely different context.
e2dbfa0b 53#
cc55a235
SS
54CHROOT_CMD?= env -i CCVER=${CCVER:Q} /usr/sbin/chroot ${ISOROOT} sh -c
55
8abe78a1 56# User may specify extra packages in addition to the defaults
95b64753 57#
8abe78a1
MD
58PKGSRC_EXTRA_PACKAGES?=
59
60# Pkgsrc packages to be built and installed on the release ISO
61#
62PKGSRC_PACKAGES?= pkgtools/pkg_leaves \
63 pkgtools/pkg_tarup \
b2c6ab6c 64 pkgtools/pkgin \
8abe78a1 65 devel/scmgit \
57b52550 66 net/bind96 \
fbc26094
SW
67 net/isc-dhcp4 \
68 net/isc-dhcpd4 \
8abe78a1 69 sysutils/cdrtools \
796fd273 70 net/csup \
8abe78a1 71 ${PKGSRC_EXTRA_PACKAGES}
fbc26094
SW
72
73# pkgsrc options to use when building packages
74#
3fff415b
SW
75PKGSRC_OPTIONS+= MAKE_JOBS=${MAKE_JOBS}
76PKGSRC_OPTIONS+= WRKOBJDIR=/usr/pkgobj
9ecb41e5 77PKGSRC_OPTIONS+= PKG_DEFAULT_OPTIONS='dri inet6'
fbc26094 78.if !make(gui)
1f8639a7 79PKGSRC_OPTIONS+= PKG_OPTIONS.scmgit='-python'
fbc26094 80.endif
8188de86 81
95b64753
MD
82# Even though buildiso wipes the packages, our check target has to run
83# first and old packages (listed as they appear in pkg_info) must be
84# cleaned out in order for the pkg_add -n test we use in the check target
85# to operate properly.
86#
fbc26094
SW
87OLD_PKGSRC_PACKAGES?= cdrtools-2.01.01.27nb1 \
88 cdrecord-2.00.3nb2 \
89 bootstrap-kit-20070205 \
90 dfuibe_installer-1.1.6 \
91 gettext-lib-0.14.5 \
92 dfuibe_installer-1.1.7nb1 \
93 dfuife_curses-1.5 \
94 gettext-lib-0.14.6 \
95 gettext-tools-0.14.6nb1 \
96 libaura-3.1 \
97 libdfui-4.2 \
98 libinstaller-5.1 \
99 bootstrap-kit-20080211 \
100 cdrtools-ossdvd-2.01.1.36nb2 \
101 isc-dhcp-base-4.0.0 \
102 isc-dhcp-server-4.0.0
95b64753 103
8188de86 104# Specify which root skeletons are required, and let the user include
e2dbfa0b 105# their own. They are copied into ISODIR during the `customizeiso'
8188de86
MD
106# target; each overwrites the last.
107#
8f51ac0b 108REQ_ROOTSKELS= ${.CURDIR}/root
cc224c64
JS
109ROOTSKELS?= ${REQ_ROOTSKELS}
110
c843f8b0
MD
111# LIST OF PACKAGES NOT INCLUDED DUE TO BUILD ISSUES:
112# chat/pidgin textproc/enchant dependency is broken
113# x11/rxvt-unicode broken configure
114# net/nmap tries to access openssl/md2.h which does not
115# exist.
116# sysutils/idesk dying on link __sync_fetch_and_add_4
117#
fbc26094 118.if make(gui)
3f279b9e 119ISOFILE?= ${ISODIR}/dfly-gui.iso
b9c3e754 120IMGFILE?= ${ISODIR}/dfly-gui.img
88821fa4 121
0e176309
MD
122# NOTE: order important, do not sort package list
123#
124# Apps we want in the gui build but which have problems building:
125# chat/xchat link error on x86-64, something about ___progname
126#
127#
88821fa4 128.if !make(nopkgs)
0e176309 129PKGSRC_PACKAGES+= meta-pkgs/modular-xorg-libs \
0936984e 130 meta-pkgs/modular-xorg-fonts \
0e176309
MD
131 meta-pkgs/modular-xorg-apps \
132 meta-pkgs/modular-xorg-drivers \
133 x11/libXinerama \
fbc26094 134 wm/fluxbox \
0936984e 135 wm/fvwm \
30e27f66 136 www/firefox \
fbc26094
SW
137 print/xpdf \
138 shells/zsh \
139 editors/emacs \
140 editors/vim \
fbc26094 141 chat/irssi \
0936984e 142 x11/modular-xorg-server \
fbc26094
SW
143 x11/eterm \
144 lang/perl5 \
145 editors/nano \
146 shells/bash \
147 devel/exctags \
148 archivers/zip \
149 security/sudo \
150 www/links-gui \
fbc26094
SW
151 net/wget \
152 fonts/terminus-font \
153 net/rsync \
0936984e 154 time/asclock \
1f8639a7
SW
155 misc/screen \
156 devel/scmgit-gitk
88821fa4
MD
157.endif
158
3f279b9e
SW
159ROOTSKELS+= ${.CURDIR}/gui
160.endif
161
3f279b9e 162ISOFILE ?= ${ISODIR}/dfly.iso
b9c3e754
MN
163IMGFILE ?= ${ISODIR}/dfly.img
164
60b68cbb 165IMGMNT ?= ${ISODIR}/mnt
a2f841ed
MD
166
167# USB umass now probes starting at da8, so the usb stick is
168# probably sitting on da8.
169#
9a122c9a 170IMGUSBDEV ?= da8
3f279b9e 171
5b22b655
MD
172# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
173# the additional '/nrelease' manually, as a safety measure.
174#
175NRLOBJDIR?= /usr/obj
176
8188de86
MD
177#########################################################################
178# BASE ISO TARGETS #
179#########################################################################
180
7ebbae99 181release: check clean buildworld1 buildkernel1 \
31d5c88c 182 buildiso srcs customizeiso mkiso mkimg
8188de86 183
7ebbae99 184quickrel: check clean buildworld2 buildkernel2 \
31d5c88c 185 buildiso srcs customizeiso mkiso mkimg
2e3f8f38 186
03e2a3c5 187realquickrel: check clean \
31d5c88c 188 buildiso srcs customizeiso mkiso mkimg
6ca9a59c 189
31d5c88c 190restartpkgs: check customizeiso mkiso mkimg
5af45f85 191
9b29c40a
MD
192quick: quickrel
193
194realquick: realquickrel
195
5af45f85 196
9b29c40a
MD
197#########################################################################
198# CORE SUPPORT TARGETS #
199#########################################################################
200
d2582113 201check:
0936984e
MD
202.if !exists(${PKGBIN_PKG_ADMIN})
203 @echo "You never bootstrapped pkgsrc on your machine. You can install it with:"
204 @echo " make pkgsrc_bootstrap"
205.endif
0936984e
MD
206.if !exists (${PKGBIN_MKISOFS})
207 @echo
208 @echo "Your machine does not have cdrtools installed. You can install it with:"
209 @echo " make pkgsrc_cdrecord"
0a1628e7 210.endif
fbc26094
SW
211.if !defined(PKGSRC_PATH)
212 @echo "Please set PKGSRC_PATH to the pkgsrc tree that shall be used for"
5af45f85
MD
213 @echo "package building. For example /usr/pkgsrc. See the Makefile"
214 @echo "in /usr if you are unfamiliar with pkgsrc."
0936984e 215.endif
0936984e 216.if !exists (${PKGBIN_MKISOFS})
3da8e88f 217 @/usr/bin/false
0936984e
MD
218.endif
219.if !defined(PKGSRC_PATH)
3da8e88f 220 @/usr/bin/false
fbc26094 221.endif
2e3f8f38 222
588a679c 223buildworld1 buildworld2:
3fff415b
SW
224 cd ${.CURDIR}/..; \
225 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
226 make -j ${MAKE_JOBS} -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//}
6ca9a59c 227
588a679c
SS
228buildkernel1 buildkernel2:
229 cd ${.CURDIR}/..; \
588a679c 230 for kernconf in ${KERNCONF}; do \
448b21e7 231 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
3fff415b 232 make -j ${MAKE_JOBS} ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
ee7f6ff2 233 KERNCONF=$${kernconf}; \
588a679c 234 done
6ca9a59c 235
5b22b655
MD
236# note that we do not want to mess with any /usr/obj directories not related
237# to buildworld, buildkernel, or nrelease, so we must supply the proper
238# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
239# buildkernel mechanism.
240#
92b0ebb9
MD
241# Unconditionally clean out /usr/release/root so a previous img build
242# does not blow up a future quick iso build
243#
fe70af21
MD
244# We install with INSTALLSTRIPPEDMODULES to make things fit into the ISO.
245# We leave the kernel's debug variables intact.
246#
6ca9a59c 247buildiso:
92b0ebb9
MD
248 -rm -rf ${ISOROOT}
249 -chflags -R noschg ${ISOROOT}
250 rm -rf ${ISOROOT}
251 mkdir -p ${ISOROOT}
5b22b655 252 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
f4ec1279 253 ( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld )
ab64cf06
SS
254 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
255 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
21aa02d0 256 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
588a679c 257 cd ${.CURDIR}/..; \
588a679c 258 for kernconf in ${KERNCONF}; do \
91856cf5 259 make DESTDIR=${ISOROOT} installkernel KERNCONF=$${kernconf}; \
588a679c 260 done
91856cf5
SW
261 rm -rf ${ISOROOT}/boot/kernel.old
262 ln -s kernel ${ISOROOT}/boot/kernel/kernel.BOOTP
9e5f57ba 263 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
6ca9a59c
MD
264 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
265 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86 266
fe70af21
MD
267# The GUI build includes the pkgsrc tree (~1G+) while the nominal release
268# build does not.
269#
270# The GUI build includes full sources while the nominal release build
271# only includes kernel sources (~27MB).
19d86faa 272#
e2dbfa0b
TN
273srcs:
274.if !defined(WITHOUT_SRCS)
c19c746b 275.if make(gui)
3342e40a
MD
276 rm -f ${ISOROOT}/usr/src-sys.tgz
277 rm -f ${ISOROOT}/usr/src-sys.tar.bz2
278 cd ${ISOROOT}/usr && make pkgsrc-create-repo GITHOST=${GITHOST}
c59cfa66
SW
279 # NOTE: Adding the git gc --aggressive helps by significantly
280 # reducing the disk space required.
281 #
282 cd ${ISOROOT}/usr/pkgsrc && git gc --aggressive
3342e40a 283 cd ${ISOROOT}/usr && make src-create-repo GITHOST=${GITHOST}
c19c746b 284.else
e2dbfa0b 285 rm -f ${ISOROOT}/usr/src-sys.tgz
fe70af21 286 rm -f ${ISOROOT}/usr/src-sys.tar.bz2
cacf78aa 287 cd ${.CURDIR}/.. && tar --exclude .git -s '/^\./src/' \
fe70af21
MD
288 -cf - ./Makefile ./Makefile.inc1 ./sys | \
289 bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2
c19c746b 290.endif
66b79064 291.endif
19d86faa 292
5af45f85
MD
293# Customize the ISO by copying rootskels in reverse priority order,
294# building packages, and doing other post-install tasks.
295#
8188de86 296customizeiso:
5af45f85 297 # Copy the rootskels. Allow sources to be owned by someone other
3cf4b4a1 298 # than root (as is common when checked out via git).
5af45f85 299 #
8188de86
MD
300.for ROOTSKEL in ${ROOTSKELS}
301 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
5af45f85
MD
302 @test -O ${.CURDIR} || echo "chowning copied files to root:wheel"
303 @test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel))
8188de86 304.endfor
7249926b 305 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
4fba3387
CP
306.for UPGRADE_ITEM in Makefile \
307 etc.${MACHINE_ARCH} \
4fba3387
CP
308 rc.d/Makefile \
309 periodic/Makefile \
310 periodic/daily/Makefile \
311 periodic/security/Makefile \
312 periodic/weekly/Makefile \
313 periodic/monthly/Makefile
314 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
20585f87 315.endfor
8abe78a1
MD
316 #
317 # Setup some things & mount pkgsrc tree. Use defensive umounts and
318 # rm -rf's to allow restarts. Allow /usr/pkgsrc to be read-only.
319 #
320 # If we did not get past the bootstrap we clean out the entire
321 # /usr/pkg infrastructure. Otherwise we attempt to pick up where
322 # we left off.
323 #
fbc26094 324 cp -p /etc/resolv.conf ${ISOROOT}/etc
cc55a235 325 ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
8abe78a1
MD
326 -@umount ${ISOROOT}/usr/pkgsrc/distfiles
327 -@umount ${ISOROOT}/usr/pkgsrc
45e80934 328 -@umount ${ISOROOT}/dev
8abe78a1
MD
329 mkdir -p ${ISODIR}/distfiles
330 rm -rf ${ISOROOT}/usr/pkgobj
8abe78a1 331 #
1eeae16f
MD
332 # Mount /usr/pkgsrc, make sure /usr/pkgsrc/distfiles is writable.
333 # Make /usr/pkgsrc read-only for safety, else a failed umount and
334 # our rm -rf will do bad things.
8abe78a1
MD
335 #
336 mkdir -p ${ISOROOT}/usr/pkgobj
3aa2328e 337 mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap
8abe78a1 338 mkdir -p ${ISOROOT}/usr/pkgsrc
1eeae16f 339 mount_null -o ro ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc
0c5de895 340 mount_null /dev ${ISOROOT}/dev
5af45f85
MD
341 cp /etc/shells ${ISOROOT}/usr/pkgsrc/distfiles/.test > /dev/null 2>&1 \
342 || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/pkgsrc/distfiles
8abe78a1 343 #
5af45f85 344 # Bootstrap, if not already installed, and add licenses needed
ee3561ee 345 # for the gui release
8abe78a1 346 #
c19c746b
MD
347 test -e ${ISODIR}/.didbootstrap || \
348 rm -rf ${ISOROOT}/usr/pkg ${ISOROOT}/var/db/pkg \
349 ${ISOROOT}/var/db/pkg.refcount
350 test -e ${ISODIR}/.didbootstrap || \
351 ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap; \
bfe02609 352 export share_dir=/usr/pkgobj/bootstrap/work/share; \
1a0dc460 353 env USE_DESTDIR=no ./bootstrap --workdir /usr/pkgobj/bootstrap/work"
c19c746b
MD
354 test -e ${ISODIR}/.didbootstrap || \
355 echo ".ifdef BSD_PKG_MK # added by nrelease" \
ee3561ee 356 >> ${ISOROOT}/usr/pkg/etc/mk.conf
45785050 357 test -e ${ISODIR}/.didbootstrap || \
484de26a 358 echo "PKG_DEFAULT_OPTIONS=dri inet6" \
45785050
SW
359 >> ${ISOROOT}/usr/pkg/etc/mk.conf
360.if make(gui)
c19c746b
MD
361 test -e ${ISODIR}/.didbootstrap || \
362 echo "ACCEPTABLE_LICENSES+=openmotif-license" \
ee3561ee 363 >> ${ISOROOT}/usr/pkg/etc/mk.conf
c19c746b
MD
364 test -e ${ISODIR}/.didbootstrap || \
365 echo "ACCEPTABLE_LICENSES+=vim-license" \
ee3561ee 366 >> ${ISOROOT}/usr/pkg/etc/mk.conf
45785050 367.endif
c19c746b
MD
368 test -e ${ISODIR}/.didbootstrap || \
369 echo ".endif # added by nrelease" \
ee3561ee 370 >> ${ISOROOT}/usr/pkg/etc/mk.conf
c19c746b
MD
371 test -e ${ISODIR}/.didbootstrap || sync
372 test -e ${ISODIR}/.didbootstrap || touch ${ISODIR}/.didbootstrap
8abe78a1
MD
373 #
374 # Build and install packages, skip packages already installed
375 #
bce110a5 376.for PKG in ${PKGSRC_PACKAGES}
8abe78a1 377 ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && \
3fff415b 378 (bmake check > /dev/null 2>&1 || \
1a0dc460 379 env USE_DESTDIR=no bmake ${PKGSRC_OPTIONS} clean build install)"
8188de86 380.endfor
8abe78a1 381 #
31d5c88c
SW
382 # Remove packages which nothing depends on, add a whatis database
383 # for pkgsrc manual pages, create an initial locate database and
384 # clean up
8abe78a1 385 #
cc55a235 386 ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
31d5c88c 387 ${CHROOT_CMD} "makewhatis /usr/pkg/man"
8abe78a1 388 -umount ${ISOROOT}/usr/pkgsrc/distfiles
fbc26094 389 umount ${ISOROOT}/usr/pkgsrc
589a5738 390 rm -rf ${ISOROOT}/usr/pkgobj
fbc26094 391 rm -f ${ISOROOT}/etc/resolv.conf
31d5c88c
SW
392 ${CHROOT_CMD} /etc/periodic/weekly/310.locate
393 umount ${ISOROOT}/dev
c843f8b0 394 #
d68fa6c5
MD
395 # Recopy files that pkgsrc may have updated in /etc into /etc.hdd
396 #
397 cpdup ${ISOROOT}/etc/shells ${ISOROOT}/etc.hdd/shells
398 cpdup ${ISOROOT}/etc/group ${ISOROOT}/etc.hdd/group
399
6ca9a59c 400mkiso:
bce110a5 401 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
74ec6a9d 402 -R -J -o ${ISOFILE} \
64bba8c7 403 -V "DragonFly `${.CURDIR}/../tools/gitrev.sh | cut -c -22`" . )
b9c3e754
MN
404
405mkimg:
60b68cbb 406 if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi
9a122c9a
MD
407 -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \
408 vnconfig -u `cat ${ISODIR}/vn.which`; fi
fe70af21
MD
409.ifdef IMGSIZE
410 @echo "STEP: use an image size of ${IMGSIZE} 512-byte sectors"
411 rm -f ${IMGFILE}
412 sz=`bc -e "((${IMGSIZE}) * 512)" -equit`; truncate -s $${sz} ${IMGFILE}
413.else
3342e40a
MD
414 @echo "STEP: Determine required image size in 1GB steps"
415 @echo " Leave ~600MB of unused space"
60b68cbb 416 sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \
3342e40a 417 sz=`bc -e "(($${sz}) * 1.15 + 999999 + 600000) / 1000000" -equit | \
fe70af21 418 cut -f1 -d.`; \
c843f8b0 419 sz=`bc -e "(($${sz}) * 953)" -equit | cut -f1 -d.`; \
fe70af21
MD
420 rm -f ${IMGFILE}; \
421 truncate -s $${sz}M ${IMGFILE};
422.endif
9a122c9a
MD
423 fdisk -IB -p ${IMGFILE}
424 @echo "STEP: determine free vn device"
425 vnconfig -l | grep "not in use" | head -n 1 | \
426 cut -f 1 -d: > ${ISODIR}/vn.which
427 vnconfig -e -s labels `cat ${ISODIR}/vn.which` ${IMGFILE}
428 @echo "STEP: write standard disklabel"
429 disklabel -w -r `cat ${ISODIR}/vn.which`s1 auto
430 @echo "STEP: read disklabel back"
431 disklabel -r `cat ${ISODIR}/vn.which`s1 > ${IMGFILE}.label
432 @echo "STEP: determine number of sectors of whole disk"
60b68cbb 433 secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`; \
9a122c9a
MD
434 echo " a: $${secs} 0 4.2BSD" >> ${IMGFILE}.label;
435 @echo "STEP: write modified disklabel back"
436 disklabel -R -r `cat ${ISODIR}/vn.which`s1 ${IMGFILE}.label
437 rm ${IMGFILE}.label
438 @echo "STEP: write bootsector"
439 disklabel -B `cat ${ISODIR}/vn.which`s1
440 boot0cfg -B -o noupdate `cat ${ISODIR}/vn.which`
441 newfs /dev/`cat ${ISODIR}/vn.which`s1a
442 mount /dev/`cat ${ISODIR}/vn.which`s1a ${IMGMNT}
443 cpdup ${ISOROOT} ${IMGMNT}
444 @echo "STEP: fixup ${IMGMNT}/etc/fstab"
e36bedaf 445 echo "/dev/${IMGUSBDEV}s1a / ufs rw,noatime 0 1" > ${IMGMNT}/etc/fstab
3342e40a
MD
446 echo "dummy /tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab
447 echo "dummy /var/tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab
448 echo "dummy /var/run tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab
449 echo "dummy /usr/obj tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab
9a122c9a
MD
450 echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab
451 @echo "STEP: fixup ${IMGMNT}/boot/loader.conf"
452 -fgrep -v kernel_options ${IMGMNT}/boot/loader.conf > ${IMGMNT}/boot/loader.conf.new
453 echo 'vfs.root.mountfrom="ufs:${IMGUSBDEV}s1a"' >> ${IMGMNT}/boot/loader.conf.new
454 mv ${IMGMNT}/boot/loader.conf.new ${IMGMNT}/boot/loader.conf
455 @echo "STEP: cleanup"
456 df ${IMGMNT}
457 umount ${IMGMNT}
458 vnconfig -u `cat ${ISODIR}/vn.which`
459 rm -f ${ISODIR}/vn.which
60b68cbb 460 rmdir ${IMGMNT}
9a122c9a 461 @echo "STEP: done"
b9c3e754 462
6ca9a59c 463clean:
c19c746b
MD
464 -umount ${ISOROOT}/usr/pkgsrc/distfiles > /dev/null 2>&1
465 -umount ${ISOROOT}/usr/pkgsrc > /dev/null 2>&1
9a122c9a
MD
466 -umount ${ISOROOT}/dev > /dev/null 2>&1
467 -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \
468 vnconfig -u `cat ${ISODIR}/vn.which`; fi
6ca9a59c 469 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
c19c746b
MD
470 rm -rf ${ISOROOT}
471 rm -rf ${NRLOBJDIR}/nrelease
9a122c9a 472 rm -f ${ISODIR}/.didbootstrap ${ISODIR}/vn.which
6ca9a59c
MD
473
474realclean: clean
3ebedc5e 475 rm -rf ${OBJSYS}/${KERNCONF}
8abe78a1 476 #
bce110a5
MD
477 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
478 # override location.
8abe78a1 479 #
c19c746b
MD
480 rm -rf ${ISODIR}/packages
481 rm -rf ${ISODIR}/distfiles
6ca9a59c 482
bce110a5 483pkgsrc_bootstrap:
0936984e 484 mkdir -p /usr/release/bootstrap
de863bf0
MD
485 (cd ${PKGSRC_PATH}/bootstrap; \
486 export share_dir=/usr/release/bootstrap/share; \
487 ./bootstrap --workdir /usr/release/bootstrap)
bce110a5 488
bce110a5
MD
489pkgsrc_cdrecord:
490.if !exists (${PKGBIN_MKISOFS})
0936984e 491 (cd ${PKGSRC_PATH}/sysutils/cdrtools; bmake clean build install)
bce110a5 492.endif
cc224c64 493
e2dbfa0b 494help all:
5af45f85
MD
495 @echo "make [gui] release - complete build from scratch"
496 @echo "make [gui] quick - attempt to do an incremental rebuild"
497 @echo "make [gui] realquick - attempt to restart after world & kernel"
498 @echo "make [gui] restartpkgs - attempt to restart at the pkg building stage"
8abe78a1 499 @echo ""
fe70af21
MD
500 @echo "PKGSRC_EXTRA_PACKAGES may be used to add additional pkgs"
501 @echo "GITHOST may be used to override git.dragonflybsd.org"
502 @echo "IMGSIZE may be used to override the .img (in 512-byte sectors)"
588a679c 503
e2dbfa0b
TN
504.PHONY: release quickrel realquickrel
505.PHONY: installer
9b29c40a 506.PHONY: quick realquick
e2dbfa0b 507.PHONY: check buildworld1 buildworld2
31d5c88c 508.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mkiso mkimg
796fd273 509.PHONY: clean realclean help all srcs
cc224c64 510
6ca9a59c 511.include <bsd.prog.mk>