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