19b29c40aSMatthew Dillon######################################################################### 29b29c40aSMatthew Dillon# ENHANCEMENTS # 39b29c40aSMatthew Dillon######################################################################### 49b29c40aSMatthew Dillon 5aac6f66eSAaron LI# Optional targets may be specified which set make variables which enhance 69b29c40aSMatthew Dillon# the build in various ways. 79b29c40aSMatthew Dillon# 8632d862bSAaron LIgui nopkgs binpkgs: 99b29c40aSMatthew Dillon 109b29c40aSMatthew Dillon######################################################################### 119b29c40aSMatthew Dillon# SETUP # 129b29c40aSMatthew Dillon######################################################################### 139b29c40aSMatthew Dillon 140f8dfe63SAaron LISRCDIR= ${.CURDIR}/.. 150f8dfe63SAaron LI 16bd0ab7aaSMatthew DillonDPORTS_PATH?= /usr/dports 17a291abfbSMatthew DillonISODIR?= /usr/obj/release 185ec00f8aSSascha WildnerISOROOT?= ${ISODIR}/root 198126e4efSAaron LIGITURL_SRC?= git://git.dragonflybsd.org/dragonfly.git 208126e4efSAaron LIGITURL_DPORTS?= git://mirror-master.dragonflybsd.org/dports.git 21834a1306SMatthew DillonNREL_MAKE_JOBS?= $$(sysctl -n hw.ncpu) 229758d73aSSascha Wildner.if !defined(NOFSCHG) 239758d73aSSascha WildnerMTREE_FSCHG= -i 249758d73aSSascha Wildner.endif 258a6aa092SSascha WildnerWORLD_VERSION!= ${AWK} '/^\#define[[:blank:]]__DragonFly_version/ {print $$3}' < /usr/include/sys/param.h 263fff415bSSascha Wildner 270f8dfe63SAaron LIGITREV!= sh ${SRCDIR}/tools/gitrev.sh 289d8dda4aSAaron LI 293ac64890SAaron LI# The label/name of the disklabel64(5) slice in the ".img" file. This is 303ac64890SAaron LI# used to identify the USB device with DragonFly installation image, avoiding 313ac64890SAaron LI# hardcoding the USB device name (e.g., "da8"). 323ac64890SAaron LI# 339d8dda4aSAaron LI# This label is also used as the volume ID of the ".iso" file. 349d8dda4aSAaron LI# 359d8dda4aSAaron LILABEL?= DragonFly_${GITREV} 363ac64890SAaron LI 37c36c5990SSascha WildnerCHROOT_CMD?= /usr/sbin/chroot ${ISOROOT} sh -c 38cc55a235SSimon Schubert 39083f5c48SAaron LIISOFILE?= ${ISODIR}/dfly.iso 40083f5c48SAaron LIIMGFILE?= ${ISODIR}/dfly.img 41083f5c48SAaron LIIMGMNT?= ${ISODIR}/mnt 42083f5c48SAaron LI 43165b1c14SSascha Wildner.if !make(nopkgs) 448abe78a1SMatthew Dillon# User may specify extra packages in addition to the defaults 4595b64753SMatthew Dillon# 46c36c5990SSascha WildnerDPORTS_EXTRA_PACKAGES?= 47fbc26094SSascha Wildner 482f36664eSSascha Wildner# dports packages to be built and installed on the release ISO 492f36664eSSascha Wildner# 5071832315SSascha WildnerDPORTS_PACKAGES?= security/ca_root_nss \ 51d25c1efdSSascha Wildner devel/git-lite \ 520e561611SJustin C. Sherrill dns/bind-tools \ 5320d2e8bdSAntonio Huete Jimenez net/isc-dhcp44-server \ 54c36c5990SSascha Wildner sysutils/cdrtools \ 5544c4f44aSSascha Wildner ${DPORTS_EXTRA_PACKAGES} 56c36c5990SSascha Wildner 57c36c5990SSascha Wildner# dports options to use when building packages 58c36c5990SSascha Wildner# 597392a6b4SSascha WildnerDPORTS_OPTIONS+= -DBATCH -DBUILDING_NRELEASE_DPORTS 60d25c1efdSSascha WildnerDPORTS_OPTIONS+= dns_bind-tools_UNSET=PYTHON 61165b1c14SSascha Wildner.endif 628188de86SMatthew Dillon 638188de86SMatthew Dillon# Specify which root skeletons are required, and let the user include 64e2dbfa0bSThomas Nikolajsen# their own. They are copied into ISODIR during the `customizeiso' 658188de86SMatthew Dillon# target; each overwrites the last. 668188de86SMatthew Dillon# 678f51ac0bSSascha WildnerREQ_ROOTSKELS= ${.CURDIR}/root 68cc224c64SJoerg SonnenbergerROOTSKELS?= ${REQ_ROOTSKELS} 69cc224c64SJoerg Sonnenberger 70255a0279SMichael Neumann.if make(gui) 71bfe20b28SSascha WildnerISOFILE?= ${ISODIR}/dfly-gui.iso 72b9c3e754SMichael NeumannIMGFILE?= ${ISODIR}/dfly-gui.img 7388821fa4SMatthew Dillon 74083f5c48SAaron LI.if !make(nopkgs) 750e176309SMatthew Dillon# NOTE: order important, do not sort package list 760e176309SMatthew Dillon# 77255a0279SMichael NeumannDPORTS_PACKAGES+= x11/xorg \ 78*7eb3d59fSMichael Neumann x11-drivers/xf86-input-libinput \ 79255a0279SMichael Neumann x11-wm/fluxbox \ 80*7eb3d59fSMichael Neumann x11-wm/fvwm3 \ 8130e27f66SMatthew Dillon www/firefox \ 82255a0279SMichael Neumann graphics/xpdf \ 83fbc26094SSascha Wildner shells/zsh \ 84fbc26094SSascha Wildner editors/emacs \ 85fbc26094SSascha Wildner editors/vim \ 86255a0279SMichael Neumann irc/irssi \ 87fbc26094SSascha Wildner lang/perl5 \ 88fbc26094SSascha Wildner editors/nano \ 89fbc26094SSascha Wildner shells/bash \ 90255a0279SMichael Neumann devel/ctags \ 91fbc26094SSascha Wildner archivers/zip \ 92fbc26094SSascha Wildner security/sudo \ 93255a0279SMichael Neumann www/links \ 94255a0279SMichael Neumann ftp/wget \ 95255a0279SMichael Neumann x11-fonts/terminus-font \ 96fbc26094SSascha Wildner net/rsync \ 97255a0279SMichael Neumann x11-clocks/asclock \ 98*7eb3d59fSMichael Neumann sysutils/screen \ 99*7eb3d59fSMichael Neumann sysutils/tmux 100*7eb3d59fSMichael Neumann.endif 101*7eb3d59fSMichael Neumann 102*7eb3d59fSMichael Neumann.if make(binpkgs) 103*7eb3d59fSMichael NeumannPKG_x11-wm/fvwm3?=fvwm3 104*7eb3d59fSMichael NeumannPKG_lang/perl5?=perl5 105*7eb3d59fSMichael Neumann# Only install the console flavor of vim, whereas 106*7eb3d59fSMichael Neumann# "pkg ins editors/vim" would install all flavors. 107*7eb3d59fSMichael NeumannPKG_editors/vim?=vim 10888821fa4SMatthew Dillon.endif 10988821fa4SMatthew Dillon 110bfe20b28SSascha WildnerROOTSKELS+= ${.CURDIR}/gui 1110f8dfe63SAaron LI.endif # make(gui) 112bfe20b28SSascha Wildner 113632d862bSAaron LI# one port may have multiple binary packages (e.g., Python flavors) or have a 114632d862bSAaron LI# different name that may not be found by pkg(8), therefore, allow to specify 115632d862bSAaron LI# the exact binary package name for a port by setting 'PKG_<port>=<pkg-name>'. 116632d862bSAaron LI# 117632d862bSAaron LI.for PORT in ${DPORTS_PACKAGES} 118632d862bSAaron LI.if defined(PKG_${PORT}) 119632d862bSAaron LIPACKAGES+= ${PKG_${PORT}} 120632d862bSAaron LI.else 121632d862bSAaron LIPACKAGES+= ${PORT} 122632d862bSAaron LI.endif 123632d862bSAaron LI.endfor 124632d862bSAaron LI 1258188de86SMatthew Dillon######################################################################### 1268188de86SMatthew Dillon# BASE ISO TARGETS # 1278188de86SMatthew Dillon######################################################################### 1286ca9a59cSMatthew Dillon 1297ebbae99SSascha Wildnerrelease: check clean buildworld1 buildkernel1 \ 1303f84c424SAaron LI buildiso pkgs customizeiso srcs mkiso mkimg 1316ca9a59cSMatthew Dillon 1327ebbae99SSascha Wildnerquickrel: check clean buildworld2 buildkernel2 \ 1333f84c424SAaron LI buildiso pkgs customizeiso srcs mkiso mkimg 1348188de86SMatthew Dillon 13503e2a3c5SSascha Wildnerrealquickrel: check clean \ 1363f84c424SAaron LI buildiso pkgs customizeiso srcs mkiso mkimg 1376ca9a59cSMatthew Dillon 1383f84c424SAaron LIrestartpkgs: check pkgs customizeiso srcs mkiso mkimg 1395af45f85SMatthew Dillon 1409b29c40aSMatthew Dillonquick: quickrel 1419b29c40aSMatthew Dillon 1429b29c40aSMatthew Dillonrealquick: realquickrel 1439b29c40aSMatthew Dillon 1449b29c40aSMatthew Dillon######################################################################### 1459b29c40aSMatthew Dillon# CORE SUPPORT TARGETS # 1469b29c40aSMatthew Dillon######################################################################### 1479b29c40aSMatthew Dillon 148d2582113SChris Presseycheck: 149c36c5990SSascha Wildner.if !exists(/usr/local/bin/mkisofs) && !exists(/usr/pkg/bin/mkisofs) 1500936984eSMatthew Dillon @echo 1510936984eSMatthew Dillon @echo "Your machine does not have cdrtools installed. You can install it with:" 152218b6b69SMarkus Pfeiffer @echo " pkg install cdrtools" 1530936984eSMatthew Dillon.endif 154f8c0334eSAntonio Huete Jimenez 155f8c0334eSAntonio Huete Jimenez.if make(nopkgs) 156f8c0334eSAntonio Huete Jimenez @echo Not building packages. 157f8c0334eSAntonio Huete Jimenez.elif make(binpkgs) 158f8c0334eSAntonio Huete Jimenez @echo Using binary packages from a mirror. 159f8c0334eSAntonio Huete Jimenez.else 160aa3eeb12SSascha Wildner @if [ ! -d ${DPORTS_PATH} ]; then \ 161aa3eeb12SSascha Wildner echo "${DPORTS_PATH} does not exist."; \ 162aa3eeb12SSascha Wildner echo ""; \ 163aa3eeb12SSascha Wildner echo "Please set DPORTS_PATH to the dports tree that shall be used for"; \ 164aa3eeb12SSascha Wildner echo "package building. The default is /usr/dports. See the Makefile in"; \ 165aa3eeb12SSascha Wildner echo "/usr if you are unfamiliar with dports."; \ 166aa3eeb12SSascha Wildner /usr/bin/false; \ 167f8c0334eSAntonio Huete Jimenez else \ 168f8c0334eSAntonio Huete Jimenez echo "Using ${DPORTS_PATH} as the dports tree."; \ 169aa3eeb12SSascha Wildner fi 170f8c0334eSAntonio Huete Jimenez.endif 171f8c0334eSAntonio Huete Jimenez 172c36c5990SSascha Wildner.if !exists(/usr/local/bin/mkisofs) && !exists(/usr/pkg/bin/mkisofs) 1733da8e88fSJohn Marino @/usr/bin/false 174fbc26094SSascha Wildner.endif 1752e3f8f38SMatthew Dillon 176588a679cSSimon Schubertbuildworld1 buildworld2: 1770f8dfe63SAaron LI ( cd ${SRCDIR}; \ 1783fff415bSSascha Wildner ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ 179834a1306SMatthew Dillon make -j ${NREL_MAKE_JOBS} -DWANT_INSTALLER \ 1800f8dfe63SAaron LI ${.TARGET:C/build(.*)2/quick\1/:C/1//} ) 1816ca9a59cSMatthew Dillon 182588a679cSSimon Schubertbuildkernel1 buildkernel2: 1830f8dfe63SAaron LI ( cd ${SRCDIR}; \ 184448b21e7SSimon Schubert ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ 185834a1306SMatthew Dillon make -j ${NREL_MAKE_JOBS} \ 1860f8dfe63SAaron LI ${.TARGET:C/build(.*)2/quick\1/:C/1//} ) 1876ca9a59cSMatthew Dillon 1882b43b38cSSascha Wildner# Unconditionally clean out ${ISOROOT} so a previous img build 18992b0ebb9SMatthew Dillon# does not blow up a future quick iso build 19092b0ebb9SMatthew Dillon# 1916ca9a59cSMatthew Dillonbuildiso: 19292b0ebb9SMatthew Dillon -chflags -R noschg ${ISOROOT} 19392b0ebb9SMatthew Dillon rm -rf ${ISOROOT} 19492b0ebb9SMatthew Dillon mkdir -p ${ISOROOT} 1950f8dfe63SAaron LI ( cd ${SRCDIR}; \ 1960f8dfe63SAaron LI make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld ) 1978f5a7f62SAaron LI # Do not mess with any /usr/obj directories not related to 1988f5a7f62SAaron LI # buildworld, buildkernel, or nrelease. 1990f8dfe63SAaron LI ( cd ${SRCDIR}/etc && \ 2008f5a7f62SAaron LI tmpdir=`mktemp -d -t nrelease` && \ 2018f5a7f62SAaron LI MAKEOBJDIRPREFIX=$${tmpdir} \ 2020f8dfe63SAaron LI make -m ${SRCDIR}/share/mk \ 2038f5a7f62SAaron LI DESTDIR=${ISOROOT} distribution && \ 2048f5a7f62SAaron LI rm -rf $${tmpdir} ) 2050f8dfe63SAaron LI ( cd ${SRCDIR}; make DESTDIR=${ISOROOT} reinstallkernel ) 20691856cf5SSascha Wildner rm -rf ${ISOROOT}/boot/kernel.old 2071c9d98d0SAntonio Huete Jimenez ln -sf kernel ${ISOROOT}/boot/kernel/kernel.BOOTP 2080f8dfe63SAaron LI mtree ${MTREE_FSCHG} -deU -f ${SRCDIR}/etc/mtree/BSD.var.dist \ 2099758d73aSSascha Wildner -p ${ISOROOT}/var 2101968392dSAaron LI ${CHROOT_CMD} "rcrestart ldconfig" 2118188de86SMatthew Dillon 212699b6cdcSAaron LI# The GUI build includes the full system source (~500 MB) and the full 213699b6cdcSAaron LI# dports tree (~250 MB). The nominal release build only includes the 214699b6cdcSAaron LI# kernel source (~30 MB). 21519d86faaSMatthew Dillon# 216e2dbfa0bSThomas Nikolajsensrcs: 217699b6cdcSAaron LI rm -rf ${ISOROOT}/usr/dports 218699b6cdcSAaron LI rm -f ${ISOROOT}/usr/src-sys.tar.bz2 219e2dbfa0bSThomas Nikolajsen.if !defined(WITHOUT_SRCS) 220255a0279SMichael Neumann.if make(gui) 221699b6cdcSAaron LI ( cd ${ISOROOT}/usr && \ 222699b6cdcSAaron LI make dports-create-shallow GITURL_DPORTS=${GITURL_DPORTS} ) 223699b6cdcSAaron LI ( cd ${ISOROOT}/usr && \ 224699b6cdcSAaron LI make src-create-shallow GITURL_SRC=${GITURL_SRC} ) 225c19c746bSMatthew Dillon.else 2260f8dfe63SAaron LI ( cd ${SRCDIR} && \ 227699b6cdcSAaron LI tar --exclude .git -s '/^\./src/' -cf - \ 228c488485fSzrj ./Makefile ./Makefile.inc1 ./sys \ 229c488485fSzrj ./share/syscons/fonts | \ 230699b6cdcSAaron LI bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 ) 231c19c746bSMatthew Dillon.endif 23266b79064SMatthew Dillon.endif 23319d86faaSMatthew Dillon 2341968392dSAaron LI# Customize the ISO by copying rootskels in reverse priority order. 2355af45f85SMatthew Dillon# 2363f84c424SAaron LI# NOTE: Perform this target *after* the 'pkgs' target, because the latter 2373f84c424SAaron LI# can make changes to '/etc' (e.g., new users/groups/shells). 2383f84c424SAaron LI# 2398188de86SMatthew Dilloncustomizeiso: 2403f84c424SAaron LI pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd 2413f84c424SAaron LI cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd 2423f84c424SAaron LI 2435af45f85SMatthew Dillon # Copy the rootskels. Allow sources to be owned by someone other 2443cf4b4a1SSascha Wildner # than root (as is common when checked out via git). 2455af45f85SMatthew Dillon # 2468188de86SMatthew Dillon.for ROOTSKEL in ${ROOTSKELS} 2478188de86SMatthew Dillon cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT} 2485af45f85SMatthew Dillon @test -O ${.CURDIR} || echo "chowning copied files to root:wheel" 2495af45f85SMatthew Dillon @test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel)) 2508188de86SMatthew Dillon.endfor 25104e94b32SAaron LI 25204e94b32SAaron LI pw -V ${ISOROOT}/etc useradd installer -o -u 0 -g 0 \ 25304e94b32SAaron LI -c "DragonFly Installer" -d /root -s /usr/sbin/installer 25404e94b32SAaron LI ${CHROOT_CMD} "chpass -p '' root" 25504e94b32SAaron LI ${CHROOT_CMD} "chpass -p '' installer" 25604e94b32SAaron LI 2574fba3387SChris Pressey.for UPGRADE_ITEM in Makefile \ 2584fba3387SChris Pressey etc.${MACHINE_ARCH} \ 2594fba3387SChris Pressey rc.d/Makefile \ 2604fba3387SChris Pressey periodic/Makefile \ 2614fba3387SChris Pressey periodic/daily/Makefile \ 2624fba3387SChris Pressey periodic/security/Makefile \ 2634fba3387SChris Pressey periodic/weekly/Makefile \ 2644fba3387SChris Pressey periodic/monthly/Makefile 2650f8dfe63SAaron LI cp -R ${SRCDIR}/etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM} 2664fba3387SChris Pressey.endfor 2671968392dSAaron LI 268632d862bSAaron LI# Install packages by using pkg(8) or building from dports. 2698abe78a1SMatthew Dillon# 2701968392dSAaron LIpkgs: 271165b1c14SSascha Wildner.if !empty(DPORTS_PACKAGES) 2721c9d98d0SAntonio Huete Jimenez cp /etc/resolv.conf ${ISOROOT}/etc 2733e82f71aSAaron LI -cp /etc/ssl/cert.pem ${ISOROOT}/etc/ssl 2741968392dSAaron LI -@umount ${ISOROOT}/dev 2751968392dSAaron LI mount_null /dev ${ISOROOT}/dev 2761968392dSAaron LI 277632d862bSAaron LI.if make(binpkgs) 278632d862bSAaron LI ${CHROOT_CMD} "cd /usr && make pkg-bootstrap-force" 279632d862bSAaron LI ${CHROOT_CMD} "pkg update" 280632d862bSAaron LI.for PKG in ${PACKAGES} 281632d862bSAaron LI @${CHROOT_CMD} "pkg search --exact --search name ${PKG}" || \ 282632d862bSAaron LI ${CHROOT_CMD} "pkg search --exact --search origin ${PKG}" || \ 283632d862bSAaron LI { \ 284632d862bSAaron LI echo "ERROR: Cannot find the package for port '${PKG}'!"; \ 285c2dc3938SAaron LI echo "-----> Use 'PKG_${PKG}=<pkg-name>' to specify the package name."; \ 286632d862bSAaron LI false; \ 287632d862bSAaron LI } 288632d862bSAaron LI.endfor 289632d862bSAaron LI ${CHROOT_CMD} "pkg install --yes ${PACKAGES}" 290632d862bSAaron LI 291632d862bSAaron LI.else # !make(binpkgs) 2925e885f07SSascha Wildner -@umount ${ISOROOT}/usr/distfiles 2932f36664eSSascha Wildner -@umount ${ISOROOT}/usr/dports 2942f36664eSSascha Wildner rm -rf ${ISOROOT}/usr/obj/dports 2951968392dSAaron LI 2962f36664eSSascha Wildner mkdir -p ${ISOROOT}/usr/dports 2975e885f07SSascha Wildner mkdir -p ${ISOROOT}/usr/distfiles 2981968392dSAaron LI 2991968392dSAaron LI # Mount /usr/dports read-only for safety, else a failed umount 3001968392dSAaron LI # and our rm -rf will do bad things. 3012f36664eSSascha Wildner mount_null -o ro ${DPORTS_PATH} ${ISOROOT}/usr/dports 3021968392dSAaron LI 3031968392dSAaron LI # Make sure /usr/distfiles is writable 304c36c5990SSascha Wildner cp /etc/shells ${ISOROOT}/usr/distfiles/.test > /dev/null 2>&1 \ 305c36c5990SSascha Wildner || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/distfiles 3061968392dSAaron LI 307c36c5990SSascha Wildner.for PKG in ${DPORTS_PACKAGES} 308333a466dSAaron LI.if make(restartpkgs) 309333a466dSAaron LI ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} deinstall" 310333a466dSAaron LI.endif 311d25c1efdSSascha Wildner ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} install" 31220585f87SMatthew Dillon.endfor 3132f36664eSSascha Wildner.for PKG in ${DPORTS_PACKAGES} 314c36c5990SSascha Wildner ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} clean" 3152f36664eSSascha Wildner.endfor 3161968392dSAaron LI 31722e9b157SAaron LI ${CHROOT_CMD} "pkg autoremove --yes" 3181968392dSAaron LI 3195e885f07SSascha Wildner -umount ${ISOROOT}/usr/distfiles 3202f36664eSSascha Wildner umount ${ISOROOT}/usr/dports 3211968392dSAaron LI 3225e885f07SSascha Wildner rm -rf ${ISOROOT}/usr/dports 3235e885f07SSascha Wildner rm -rf ${ISOROOT}/usr/distfiles 3241968392dSAaron LI rm -rf ${ISOROOT}/usr/obj/dports 325632d862bSAaron LI.endif # make(binpkgs) 3261968392dSAaron LI 3272db6e812SAaron LI ${CHROOT_CMD} "pkg clean --yes --all" 3282db6e812SAaron LI 3291968392dSAaron LI # Update the locate(8) and whatis(1) databases, allow ISODIR 330b34d3b9bSzrj # to be on tmpfs (fails to create locate database then) 3312f36664eSSascha Wildner # 332b34d3b9bSzrj -${CHROOT_CMD} /etc/periodic/weekly/310.locate 3331968392dSAaron LI -${CHROOT_CMD} /etc/periodic/weekly/320.whatis 3341968392dSAaron LI 33531d5c88cSSascha Wildner umount ${ISOROOT}/dev 3361968392dSAaron LI rm -f ${ISOROOT}/etc/resolv.conf 3371968392dSAaron LI 338a4527c0fSAaron LI.if exists(${ISOROOT}/usr/local/etc) 339a4527c0fSAaron LI echo "dummy /usr/local/etc tmpfs rw,-C 0 0" >> ${ISOROOT}/etc/fstab 340a4527c0fSAaron LI.endif 341a4527c0fSAaron LI.endif # !empty(DPORTS_PACKAGES) 3428398ca17SSascha Wildner 3436ca9a59cSMatthew Dillonmkiso: 3442c776168SSascha Wildner.if ${WORLD_VERSION} < 600106 3455fa778d7SSascha Wildner if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi 3465fa778d7SSascha Wildner -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 3475fa778d7SSascha Wildner vnconfig -u `cat ${ISODIR}/vn.which`; fi 3485fa778d7SSascha Wildner newfs_msdos -C 400k -F 12 -L EFI -m 0xf8 ${ISOROOT}/boot/efiboot.img 3495fa778d7SSascha Wildner vnconfig -l | grep "not in use" | head -n 1 | \ 3505fa778d7SSascha Wildner cut -f 1 -d: > ${ISODIR}/vn.which 351fc3c0f63SSascha Wildner vnconfig -e `cat ${ISODIR}/vn.which` ${ISOROOT}/boot/efiboot.img 3525fa778d7SSascha Wildner mount_msdos /dev/`cat ${ISODIR}/vn.which` ${IMGMNT} 3535fa778d7SSascha Wildner mkdir -p ${IMGMNT}/EFI/BOOT 3545fa778d7SSascha Wildner cp ${ISOROOT}/boot/loader.efi ${IMGMNT}/EFI/BOOT/BOOTX64.EFI 3555fa778d7SSascha Wildner umount ${IMGMNT} 3562c776168SSascha Wildner.else 3572c776168SSascha Wildner ( tmpdir=`mktemp -d -t nrelease` && mkdir -p "$${tmpdir}/EFI/BOOT" && \ 3582c776168SSascha Wildner cp ${ISOROOT}/boot/loader.efi $${tmpdir}/EFI/BOOT/BOOTX64.EFI && \ 3592c776168SSascha Wildner makefs -t msdos -o fat_type=12 -o sectors_per_cluster=1 \ 3602c776168SSascha Wildner -o volume_label=EFI -o media_descriptor=248 -s 400k \ 3612c776168SSascha Wildner ${ISOROOT}/boot/efiboot.img $${tmpdir} && \ 3622c776168SSascha Wildner rm -rf $${tmpdir} ) 3632c776168SSascha Wildner.endif 3645fa778d7SSascha Wildner ( cd ${ISOROOT}; mkisofs -R -J -o ${ISOFILE} \ 3655fa778d7SSascha Wildner -b boot/cdboot -no-emul-boot \ 3669d8dda4aSAaron LI -eltorito-alt-boot -eltorito-platform efi \ 3679d8dda4aSAaron LI -eltorito-boot boot/efiboot.img -no-emul-boot \ 3689d8dda4aSAaron LI -V ${LABEL:C/(^.{32}).*/\1/} . ) # cut label to <= 32 characters 3695fa778d7SSascha Wildner rm -f ${ISOROOT}/boot/efiboot.img 370b9c3e754SMichael Neumann 371b9c3e754SMichael Neumannmkimg: 37260b68cbbSMichael Neumann if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi 3739a122c9aSMatthew Dillon -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 3749a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which`; fi 3758c441895SAaron LI rm -f ${IMGFILE} 376fe70af21SMatthew Dillon.ifdef IMGSIZE 377fe70af21SMatthew Dillon @echo "STEP: use an image size of ${IMGSIZE} 512-byte sectors" 3788c441895SAaron LI sz=`bc -e "((${IMGSIZE}) * 512)" -equit`; \ 3798c441895SAaron LI truncate -s $${sz} ${IMGFILE} 3808c441895SAaron LI.elifdef IMGSIZE_MB 3818c441895SAaron LI @echo "STEP: use an image size of ${IMGSIZE_MB} MB" 3828c441895SAaron LI truncate -s ${IMGSIZE_MB}M ${IMGFILE} 383fe70af21SMatthew Dillon.else 3843342e40aSMatthew Dillon @echo "STEP: Determine required image size in 1GB steps" 3853342e40aSMatthew Dillon @echo " Leave ~600MB of unused space" 38660b68cbbSMichael Neumann sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \ 3873342e40aSMatthew Dillon sz=`bc -e "(($${sz}) * 1.15 + 999999 + 600000) / 1000000" -equit | \ 388fe70af21SMatthew Dillon cut -f1 -d.`; \ 389c843f8b0SMatthew Dillon sz=`bc -e "(($${sz}) * 953)" -equit | cut -f1 -d.`; \ 3908c441895SAaron LI truncate -s $${sz}M ${IMGFILE} 391fe70af21SMatthew Dillon.endif 3929a122c9aSMatthew Dillon @echo "STEP: determine free vn device" 3939a122c9aSMatthew Dillon vnconfig -l | grep "not in use" | head -n 1 | \ 3949a122c9aSMatthew Dillon cut -f 1 -d: > ${ISODIR}/vn.which 395fc3c0f63SSascha Wildner vnconfig -e `cat ${ISODIR}/vn.which` ${IMGFILE} 3965fa778d7SSascha Wildner @echo "STEP: set up legacy MBR" 397cc3c231bSMatthew Dillon fdisk -b ${ISOROOT}/boot/mbr -IB `cat ${ISODIR}/vn.which` 3985fa778d7SSascha Wildner fdisk -s `cat ${ISODIR}/vn.which` >${ISODIR}/fdisk.dat 3995fa778d7SSascha Wildner awk '(NR==1){printf("g c%s h%s s%s\n", $$2, $$4, $$6);}' \ 4005fa778d7SSascha Wildner ${ISODIR}/fdisk.dat >${ISODIR}/fdisk.conf 4015fa778d7SSascha Wildner echo "p 1 239 63 257985" >>${ISODIR}/fdisk.conf 4027d89978dSSascha Wildner awk '($$1=="1:"){printf("p 2 108 258048 %lu\n", $$3 - 258528);}' \ 4035fa778d7SSascha Wildner ${ISODIR}/fdisk.dat >>${ISODIR}/fdisk.conf 4045fa778d7SSascha Wildner echo "a 2" >>${ISODIR}/fdisk.conf 4055fa778d7SSascha Wildner fdisk -iv -f ${ISODIR}/fdisk.conf `cat ${ISODIR}/vn.which` 4065fa778d7SSascha Wildner rm ${ISODIR}/fdisk.conf ${ISODIR}/fdisk.dat 4075fa778d7SSascha Wildner newfs_msdos -F 32 -c 2 -L EFI -m 0xf8 `cat ${ISODIR}/vn.which`s1 4085fa778d7SSascha Wildner mount_msdos /dev/`cat ${ISODIR}/vn.which`s1 ${IMGMNT} 4095fa778d7SSascha Wildner mkdir -p ${IMGMNT}/EFI/BOOT 4105fa778d7SSascha Wildner cp ${ISOROOT}/boot/boot1.efi ${IMGMNT}/EFI/BOOT/BOOTX64.EFI 4115fa778d7SSascha Wildner umount ${IMGMNT} 4129a122c9aSMatthew Dillon @echo "STEP: write standard disklabel" 4135fa778d7SSascha Wildner disklabel -w -r `cat ${ISODIR}/vn.which`s2 auto 4149a122c9aSMatthew Dillon @echo "STEP: read disklabel back" 4155fa778d7SSascha Wildner disklabel -r `cat ${ISODIR}/vn.which`s2 > ${IMGFILE}.label 4163ac64890SAaron LI @echo "STEP: set disklabel name" 4173ac64890SAaron LI echo "label: ${LABEL}" >> ${IMGFILE}.label 418ea8f7c44SSascha Wildner @echo "STEP: add slice partition" 4193ac64890SAaron LI echo "a: * * 4.2BSD" >> ${IMGFILE}.label; 4209a122c9aSMatthew Dillon @echo "STEP: write modified disklabel back" 4215fa778d7SSascha Wildner disklabel -R -r `cat ${ISODIR}/vn.which`s2 ${IMGFILE}.label 4229a122c9aSMatthew Dillon rm ${IMGFILE}.label 423cc3c231bSMatthew Dillon disklabel -B -b ${ISOROOT}/boot/boot1_64 -s ${ISOROOT}/boot/boot2_64 \ 424cc3c231bSMatthew Dillon `cat ${ISODIR}/vn.which`s2 4255fa778d7SSascha Wildner newfs /dev/`cat ${ISODIR}/vn.which`s2a 4265fa778d7SSascha Wildner mount /dev/`cat ${ISODIR}/vn.which`s2a ${IMGMNT} 4279a122c9aSMatthew Dillon cpdup ${ISOROOT} ${IMGMNT} 4289a122c9aSMatthew Dillon @echo "STEP: fixup ${IMGMNT}/etc/fstab" 4293ac64890SAaron LI echo "/dev/part-by-label/${LABEL}.a / ufs rw,noatime 0 1" > ${IMGMNT}/etc/fstab 4303342e40aSMatthew Dillon echo "dummy /tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 4313342e40aSMatthew Dillon echo "dummy /var/tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 432d4c25c30SSascha Wildner echo "dummy /var/run tmpfs rw,-C 0 0" >> ${IMGMNT}/etc/fstab 4333342e40aSMatthew Dillon echo "dummy /usr/obj tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 4349a122c9aSMatthew Dillon echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab 4359a122c9aSMatthew Dillon @echo "STEP: fixup ${IMGMNT}/boot/loader.conf" 4369a122c9aSMatthew Dillon -fgrep -v kernel_options ${IMGMNT}/boot/loader.conf > ${IMGMNT}/boot/loader.conf.new 4373ac64890SAaron LI echo 'vfs.root.mountfrom="ufs:part-by-label/${LABEL}.a"' >> ${IMGMNT}/boot/loader.conf.new 4389a122c9aSMatthew Dillon mv ${IMGMNT}/boot/loader.conf.new ${IMGMNT}/boot/loader.conf 4392cc9c7f7SAntonio Huete Jimenez @echo "STEP: create /firstboot" 4402cc9c7f7SAntonio Huete Jimenez touch ${IMGMNT}/firstboot 4419a122c9aSMatthew Dillon @echo "STEP: cleanup" 4429a122c9aSMatthew Dillon df ${IMGMNT} 443836f3129SMatthew Dillon sync 444836f3129SMatthew Dillon sleep 1 4459a122c9aSMatthew Dillon umount ${IMGMNT} 4469a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which` 4479a122c9aSMatthew Dillon rm -f ${ISODIR}/vn.which 44860b68cbbSMichael Neumann rmdir ${IMGMNT} 449a4911276SMatthew Dillon @echo "STEP: done, image files are in ${ISODIR}" 450b9c3e754SMichael Neumann 4516ca9a59cSMatthew Dillonclean: 452836f3129SMatthew Dillon sync 453836f3129SMatthew Dillon sleep 1 4545e885f07SSascha Wildner -umount ${ISOROOT}/usr/distfiles > /dev/null 2>&1 4552f36664eSSascha Wildner -umount ${ISOROOT}/usr/dports > /dev/null 2>&1 4569a122c9aSMatthew Dillon -umount ${ISOROOT}/dev > /dev/null 2>&1 4579a122c9aSMatthew Dillon -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 4589a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which`; fi 4596ca9a59cSMatthew Dillon if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi 460c19c746bSMatthew Dillon rm -rf ${ISOROOT} 4619a122c9aSMatthew Dillon rm -f ${ISODIR}/.didbootstrap ${ISODIR}/vn.which 4626ca9a59cSMatthew Dillon 4636ca9a59cSMatthew Dillonrealclean: clean 464c19c746bSMatthew Dillon rm -rf ${ISODIR}/packages 465c19c746bSMatthew Dillon rm -rf ${ISODIR}/distfiles 4666ca9a59cSMatthew Dillon 467dade4a2eSAaron LI.MAIN: help 468dade4a2eSAaron LIhelp: 4698126e4efSAaron LI @echo "Targets:" 4708126e4efSAaron LI @echo " release - full build from scratch" 4718126e4efSAaron LI @echo " quick - attempt to do an incremental rebuild" 4728126e4efSAaron LI @echo " realquick - attempt to restart after world & kernel" 4738126e4efSAaron LI @echo " restartpkgs - attempt to restart at the pkg building stage" 474aac6f66eSAaron LI @echo "" 475aac6f66eSAaron LI @echo "Optional targets:" 476aac6f66eSAaron LI @echo " nopkgs - do not install any packages" 477632d862bSAaron LI @echo " binpkgs - use binary packages with pkg(8)" 478aac6f66eSAaron LI @echo " gui - do a GUI release" 4798abe78a1SMatthew Dillon @echo "" 4808126e4efSAaron LI @echo "Variables:" 4818126e4efSAaron LI @echo " DPORTS_EXTRA_PACKAGES: add additional packages" 4828126e4efSAaron LI @echo " GITURL_SRC: override the Git URL to source repository" 4838126e4efSAaron LI @echo " GITURL_DPORTS: override the Git URL to dports repository" 4848126e4efSAaron LI @echo " IMGSIZE: override the size of .img (in 512-byte sectors)" 4858c441895SAaron LI @echo " IMGSIZE_MB: override the size of .img (in units of MB)" 486834a1306SMatthew Dillon @echo " NREL_MAKE_JOBS: override the default value (sysctl hw.ncpu)" 487632d862bSAaron LI @echo " PKG_<port>: specify the package name for port <port>" 488632d862bSAaron LI @echo " WITHOUT_SRCS: do not package source code if set" 489aac6f66eSAaron LI @echo "" 490588a679cSSimon Schubert 491e2dbfa0bSThomas Nikolajsen.PHONY: release quickrel realquickrel 4929b29c40aSMatthew Dillon.PHONY: quick realquick 493e2dbfa0bSThomas Nikolajsen.PHONY: check buildworld1 buildworld2 49431d5c88cSSascha Wildner.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mkiso mkimg 4951968392dSAaron LI.PHONY: clean realclean help all srcs pkgs 496