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 \ 78255a0279SMichael Neumann x11-wm/fluxbox \ 79255a0279SMichael Neumann x11-wm/fvwm \ 8030e27f66SMatthew Dillon www/firefox \ 81255a0279SMichael Neumann graphics/xpdf \ 82fbc26094SSascha Wildner shells/zsh \ 83fbc26094SSascha Wildner editors/emacs \ 84fbc26094SSascha Wildner editors/vim \ 85255a0279SMichael Neumann irc/irssi \ 86fbc26094SSascha Wildner lang/perl5 \ 87fbc26094SSascha Wildner editors/nano \ 88fbc26094SSascha Wildner shells/bash \ 89255a0279SMichael Neumann devel/ctags \ 90fbc26094SSascha Wildner archivers/zip \ 91fbc26094SSascha Wildner security/sudo \ 92255a0279SMichael Neumann www/links \ 93255a0279SMichael Neumann ftp/wget \ 94255a0279SMichael Neumann x11-fonts/terminus-font \ 95fbc26094SSascha Wildner net/rsync \ 96255a0279SMichael Neumann x11-clocks/asclock \ 97255a0279SMichael Neumann sysutils/screen 9888821fa4SMatthew Dillon.endif 9988821fa4SMatthew Dillon 100bfe20b28SSascha WildnerROOTSKELS+= ${.CURDIR}/gui 1010f8dfe63SAaron LI.endif # make(gui) 102bfe20b28SSascha Wildner 103632d862bSAaron LI# one port may have multiple binary packages (e.g., Python flavors) or have a 104632d862bSAaron LI# different name that may not be found by pkg(8), therefore, allow to specify 105632d862bSAaron LI# the exact binary package name for a port by setting 'PKG_<port>=<pkg-name>'. 106632d862bSAaron LI# 107632d862bSAaron LI.for PORT in ${DPORTS_PACKAGES} 108632d862bSAaron LI.if defined(PKG_${PORT}) 109632d862bSAaron LIPACKAGES+= ${PKG_${PORT}} 110632d862bSAaron LI.else 111632d862bSAaron LIPACKAGES+= ${PORT} 112632d862bSAaron LI.endif 113632d862bSAaron LI.endfor 114632d862bSAaron LI 1158188de86SMatthew Dillon######################################################################### 1168188de86SMatthew Dillon# BASE ISO TARGETS # 1178188de86SMatthew Dillon######################################################################### 1186ca9a59cSMatthew Dillon 1197ebbae99SSascha Wildnerrelease: check clean buildworld1 buildkernel1 \ 1203f84c424SAaron LI buildiso pkgs customizeiso srcs mkiso mkimg 1216ca9a59cSMatthew Dillon 1227ebbae99SSascha Wildnerquickrel: check clean buildworld2 buildkernel2 \ 1233f84c424SAaron LI buildiso pkgs customizeiso srcs mkiso mkimg 1248188de86SMatthew Dillon 12503e2a3c5SSascha Wildnerrealquickrel: check clean \ 1263f84c424SAaron LI buildiso pkgs customizeiso srcs mkiso mkimg 1276ca9a59cSMatthew Dillon 1283f84c424SAaron LIrestartpkgs: check pkgs customizeiso srcs mkiso mkimg 1295af45f85SMatthew Dillon 1309b29c40aSMatthew Dillonquick: quickrel 1319b29c40aSMatthew Dillon 1329b29c40aSMatthew Dillonrealquick: realquickrel 1339b29c40aSMatthew Dillon 1349b29c40aSMatthew Dillon######################################################################### 1359b29c40aSMatthew Dillon# CORE SUPPORT TARGETS # 1369b29c40aSMatthew Dillon######################################################################### 1379b29c40aSMatthew Dillon 138d2582113SChris Presseycheck: 139c36c5990SSascha Wildner.if !exists(/usr/local/bin/mkisofs) && !exists(/usr/pkg/bin/mkisofs) 1400936984eSMatthew Dillon @echo 1410936984eSMatthew Dillon @echo "Your machine does not have cdrtools installed. You can install it with:" 142218b6b69SMarkus Pfeiffer @echo " pkg install cdrtools" 1430936984eSMatthew Dillon.endif 144f8c0334eSAntonio Huete Jimenez 145f8c0334eSAntonio Huete Jimenez.if make(nopkgs) 146f8c0334eSAntonio Huete Jimenez @echo Not building packages. 147f8c0334eSAntonio Huete Jimenez.elif make(binpkgs) 148f8c0334eSAntonio Huete Jimenez @echo Using binary packages from a mirror. 149f8c0334eSAntonio Huete Jimenez.else 150aa3eeb12SSascha Wildner @if [ ! -d ${DPORTS_PATH} ]; then \ 151aa3eeb12SSascha Wildner echo "${DPORTS_PATH} does not exist."; \ 152aa3eeb12SSascha Wildner echo ""; \ 153aa3eeb12SSascha Wildner echo "Please set DPORTS_PATH to the dports tree that shall be used for"; \ 154aa3eeb12SSascha Wildner echo "package building. The default is /usr/dports. See the Makefile in"; \ 155aa3eeb12SSascha Wildner echo "/usr if you are unfamiliar with dports."; \ 156aa3eeb12SSascha Wildner /usr/bin/false; \ 157f8c0334eSAntonio Huete Jimenez else \ 158f8c0334eSAntonio Huete Jimenez echo "Using ${DPORTS_PATH} as the dports tree."; \ 159aa3eeb12SSascha Wildner fi 160f8c0334eSAntonio Huete Jimenez.endif 161f8c0334eSAntonio Huete Jimenez 162c36c5990SSascha Wildner.if !exists(/usr/local/bin/mkisofs) && !exists(/usr/pkg/bin/mkisofs) 1633da8e88fSJohn Marino @/usr/bin/false 164fbc26094SSascha Wildner.endif 1652e3f8f38SMatthew Dillon 166588a679cSSimon Schubertbuildworld1 buildworld2: 1670f8dfe63SAaron LI ( cd ${SRCDIR}; \ 1683fff415bSSascha Wildner ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ 169834a1306SMatthew Dillon make -j ${NREL_MAKE_JOBS} -DWANT_INSTALLER \ 1700f8dfe63SAaron LI ${.TARGET:C/build(.*)2/quick\1/:C/1//} ) 1716ca9a59cSMatthew Dillon 172588a679cSSimon Schubertbuildkernel1 buildkernel2: 1730f8dfe63SAaron LI ( cd ${SRCDIR}; \ 174448b21e7SSimon Schubert ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ 175834a1306SMatthew Dillon make -j ${NREL_MAKE_JOBS} \ 1760f8dfe63SAaron LI ${.TARGET:C/build(.*)2/quick\1/:C/1//} ) 1776ca9a59cSMatthew Dillon 1782b43b38cSSascha Wildner# Unconditionally clean out ${ISOROOT} so a previous img build 17992b0ebb9SMatthew Dillon# does not blow up a future quick iso build 18092b0ebb9SMatthew Dillon# 1816ca9a59cSMatthew Dillonbuildiso: 18292b0ebb9SMatthew Dillon -chflags -R noschg ${ISOROOT} 18392b0ebb9SMatthew Dillon rm -rf ${ISOROOT} 18492b0ebb9SMatthew Dillon mkdir -p ${ISOROOT} 1850f8dfe63SAaron LI ( cd ${SRCDIR}; \ 1860f8dfe63SAaron LI make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld ) 1878f5a7f62SAaron LI # Do not mess with any /usr/obj directories not related to 1888f5a7f62SAaron LI # buildworld, buildkernel, or nrelease. 1890f8dfe63SAaron LI ( cd ${SRCDIR}/etc && \ 1908f5a7f62SAaron LI tmpdir=`mktemp -d -t nrelease` && \ 1918f5a7f62SAaron LI MAKEOBJDIRPREFIX=$${tmpdir} \ 1920f8dfe63SAaron LI make -m ${SRCDIR}/share/mk \ 1938f5a7f62SAaron LI DESTDIR=${ISOROOT} distribution && \ 1948f5a7f62SAaron LI rm -rf $${tmpdir} ) 1950f8dfe63SAaron LI ( cd ${SRCDIR}; make DESTDIR=${ISOROOT} reinstallkernel ) 19691856cf5SSascha Wildner rm -rf ${ISOROOT}/boot/kernel.old 1971c9d98d0SAntonio Huete Jimenez ln -sf kernel ${ISOROOT}/boot/kernel/kernel.BOOTP 1980f8dfe63SAaron LI mtree ${MTREE_FSCHG} -deU -f ${SRCDIR}/etc/mtree/BSD.var.dist \ 1999758d73aSSascha Wildner -p ${ISOROOT}/var 2001968392dSAaron LI ${CHROOT_CMD} "rcrestart ldconfig" 2018188de86SMatthew Dillon 202699b6cdcSAaron LI# The GUI build includes the full system source (~500 MB) and the full 203699b6cdcSAaron LI# dports tree (~250 MB). The nominal release build only includes the 204699b6cdcSAaron LI# kernel source (~30 MB). 20519d86faaSMatthew Dillon# 206e2dbfa0bSThomas Nikolajsensrcs: 207699b6cdcSAaron LI rm -rf ${ISOROOT}/usr/dports 208699b6cdcSAaron LI rm -f ${ISOROOT}/usr/src-sys.tar.bz2 209e2dbfa0bSThomas Nikolajsen.if !defined(WITHOUT_SRCS) 210255a0279SMichael Neumann.if make(gui) 211699b6cdcSAaron LI ( cd ${ISOROOT}/usr && \ 212699b6cdcSAaron LI make dports-create-shallow GITURL_DPORTS=${GITURL_DPORTS} ) 213699b6cdcSAaron LI ( cd ${ISOROOT}/usr && \ 214699b6cdcSAaron LI make src-create-shallow GITURL_SRC=${GITURL_SRC} ) 215c19c746bSMatthew Dillon.else 2160f8dfe63SAaron LI ( cd ${SRCDIR} && \ 217699b6cdcSAaron LI tar --exclude .git -s '/^\./src/' -cf - \ 218c488485fSzrj ./Makefile ./Makefile.inc1 ./sys \ 219c488485fSzrj ./share/syscons/fonts | \ 220699b6cdcSAaron LI bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 ) 221c19c746bSMatthew Dillon.endif 22266b79064SMatthew Dillon.endif 22319d86faaSMatthew Dillon 2241968392dSAaron LI# Customize the ISO by copying rootskels in reverse priority order. 2255af45f85SMatthew Dillon# 2263f84c424SAaron LI# NOTE: Perform this target *after* the 'pkgs' target, because the latter 2273f84c424SAaron LI# can make changes to '/etc' (e.g., new users/groups/shells). 2283f84c424SAaron LI# 2298188de86SMatthew Dilloncustomizeiso: 2303f84c424SAaron LI pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd 2313f84c424SAaron LI cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd 2323f84c424SAaron LI 2335af45f85SMatthew Dillon # Copy the rootskels. Allow sources to be owned by someone other 2343cf4b4a1SSascha Wildner # than root (as is common when checked out via git). 2355af45f85SMatthew Dillon # 2368188de86SMatthew Dillon.for ROOTSKEL in ${ROOTSKELS} 2378188de86SMatthew Dillon cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT} 2385af45f85SMatthew Dillon @test -O ${.CURDIR} || echo "chowning copied files to root:wheel" 2395af45f85SMatthew Dillon @test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel)) 2408188de86SMatthew Dillon.endfor 24104e94b32SAaron LI 24204e94b32SAaron LI pw -V ${ISOROOT}/etc useradd installer -o -u 0 -g 0 \ 24304e94b32SAaron LI -c "DragonFly Installer" -d /root -s /usr/sbin/installer 24404e94b32SAaron LI ${CHROOT_CMD} "chpass -p '' root" 24504e94b32SAaron LI ${CHROOT_CMD} "chpass -p '' installer" 24604e94b32SAaron LI 2474fba3387SChris Pressey.for UPGRADE_ITEM in Makefile \ 2484fba3387SChris Pressey etc.${MACHINE_ARCH} \ 2494fba3387SChris Pressey rc.d/Makefile \ 2504fba3387SChris Pressey periodic/Makefile \ 2514fba3387SChris Pressey periodic/daily/Makefile \ 2524fba3387SChris Pressey periodic/security/Makefile \ 2534fba3387SChris Pressey periodic/weekly/Makefile \ 2544fba3387SChris Pressey periodic/monthly/Makefile 2550f8dfe63SAaron LI cp -R ${SRCDIR}/etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM} 2564fba3387SChris Pressey.endfor 2571968392dSAaron LI 258632d862bSAaron LI# Install packages by using pkg(8) or building from dports. 2598abe78a1SMatthew Dillon# 2601968392dSAaron LIpkgs: 261165b1c14SSascha Wildner.if !empty(DPORTS_PACKAGES) 2621c9d98d0SAntonio Huete Jimenez cp /etc/resolv.conf ${ISOROOT}/etc 2633e82f71aSAaron LI -cp /etc/ssl/cert.pem ${ISOROOT}/etc/ssl 2641968392dSAaron LI -@umount ${ISOROOT}/dev 2651968392dSAaron LI mount_null /dev ${ISOROOT}/dev 2661968392dSAaron LI 267632d862bSAaron LI.if make(binpkgs) 268632d862bSAaron LI ${CHROOT_CMD} "cd /usr && make pkg-bootstrap-force" 269632d862bSAaron LI ${CHROOT_CMD} "pkg update" 270632d862bSAaron LI.for PKG in ${PACKAGES} 271632d862bSAaron LI @${CHROOT_CMD} "pkg search --exact --search name ${PKG}" || \ 272632d862bSAaron LI ${CHROOT_CMD} "pkg search --exact --search origin ${PKG}" || \ 273632d862bSAaron LI { \ 274632d862bSAaron LI echo "ERROR: Cannot find the package for port '${PKG}'!"; \ 275c2dc3938SAaron LI echo "-----> Use 'PKG_${PKG}=<pkg-name>' to specify the package name."; \ 276632d862bSAaron LI false; \ 277632d862bSAaron LI } 278632d862bSAaron LI.endfor 279632d862bSAaron LI ${CHROOT_CMD} "pkg install --yes ${PACKAGES}" 280632d862bSAaron LI 281632d862bSAaron LI.else # !make(binpkgs) 2825e885f07SSascha Wildner -@umount ${ISOROOT}/usr/distfiles 2832f36664eSSascha Wildner -@umount ${ISOROOT}/usr/dports 2842f36664eSSascha Wildner rm -rf ${ISOROOT}/usr/obj/dports 2851968392dSAaron LI 2862f36664eSSascha Wildner mkdir -p ${ISOROOT}/usr/dports 2875e885f07SSascha Wildner mkdir -p ${ISOROOT}/usr/distfiles 2881968392dSAaron LI 2891968392dSAaron LI # Mount /usr/dports read-only for safety, else a failed umount 2901968392dSAaron LI # and our rm -rf will do bad things. 2912f36664eSSascha Wildner mount_null -o ro ${DPORTS_PATH} ${ISOROOT}/usr/dports 2921968392dSAaron LI 2931968392dSAaron LI # Make sure /usr/distfiles is writable 294c36c5990SSascha Wildner cp /etc/shells ${ISOROOT}/usr/distfiles/.test > /dev/null 2>&1 \ 295c36c5990SSascha Wildner || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/distfiles 2961968392dSAaron LI 297c36c5990SSascha Wildner.for PKG in ${DPORTS_PACKAGES} 298333a466dSAaron LI.if make(restartpkgs) 299333a466dSAaron LI ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} deinstall" 300333a466dSAaron LI.endif 301d25c1efdSSascha Wildner ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} install" 30220585f87SMatthew Dillon.endfor 3032f36664eSSascha Wildner.for PKG in ${DPORTS_PACKAGES} 304c36c5990SSascha Wildner ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} clean" 3052f36664eSSascha Wildner.endfor 3061968392dSAaron LI 30722e9b157SAaron LI ${CHROOT_CMD} "pkg autoremove --yes" 3081968392dSAaron LI 3095e885f07SSascha Wildner -umount ${ISOROOT}/usr/distfiles 3102f36664eSSascha Wildner umount ${ISOROOT}/usr/dports 3111968392dSAaron LI 3125e885f07SSascha Wildner rm -rf ${ISOROOT}/usr/dports 3135e885f07SSascha Wildner rm -rf ${ISOROOT}/usr/distfiles 3141968392dSAaron LI rm -rf ${ISOROOT}/usr/obj/dports 315632d862bSAaron LI.endif # make(binpkgs) 3161968392dSAaron LI 3172db6e812SAaron LI ${CHROOT_CMD} "pkg clean --yes --all" 3182db6e812SAaron LI 3191968392dSAaron LI # Update the locate(8) and whatis(1) databases, allow ISODIR 320b34d3b9bSzrj # to be on tmpfs (fails to create locate database then) 3212f36664eSSascha Wildner # 322b34d3b9bSzrj -${CHROOT_CMD} /etc/periodic/weekly/310.locate 3231968392dSAaron LI -${CHROOT_CMD} /etc/periodic/weekly/320.whatis 3241968392dSAaron LI 32531d5c88cSSascha Wildner umount ${ISOROOT}/dev 3261968392dSAaron LI rm -f ${ISOROOT}/etc/resolv.conf 3271968392dSAaron LI 328a4527c0fSAaron LI.if exists(${ISOROOT}/usr/local/etc) 329a4527c0fSAaron LI echo "dummy /usr/local/etc tmpfs rw,-C 0 0" >> ${ISOROOT}/etc/fstab 330a4527c0fSAaron LI.endif 331a4527c0fSAaron LI.endif # !empty(DPORTS_PACKAGES) 3328398ca17SSascha Wildner 3336ca9a59cSMatthew Dillonmkiso: 3342c776168SSascha Wildner.if ${WORLD_VERSION} < 600106 3355fa778d7SSascha Wildner if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi 3365fa778d7SSascha Wildner -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 3375fa778d7SSascha Wildner vnconfig -u `cat ${ISODIR}/vn.which`; fi 3385fa778d7SSascha Wildner newfs_msdos -C 400k -F 12 -L EFI -m 0xf8 ${ISOROOT}/boot/efiboot.img 3395fa778d7SSascha Wildner vnconfig -l | grep "not in use" | head -n 1 | \ 3405fa778d7SSascha Wildner cut -f 1 -d: > ${ISODIR}/vn.which 341fc3c0f63SSascha Wildner vnconfig -e `cat ${ISODIR}/vn.which` ${ISOROOT}/boot/efiboot.img 3425fa778d7SSascha Wildner mount_msdos /dev/`cat ${ISODIR}/vn.which` ${IMGMNT} 3435fa778d7SSascha Wildner mkdir -p ${IMGMNT}/EFI/BOOT 3445fa778d7SSascha Wildner cp ${ISOROOT}/boot/loader.efi ${IMGMNT}/EFI/BOOT/BOOTX64.EFI 3455fa778d7SSascha Wildner umount ${IMGMNT} 3462c776168SSascha Wildner.else 3472c776168SSascha Wildner ( tmpdir=`mktemp -d -t nrelease` && mkdir -p "$${tmpdir}/EFI/BOOT" && \ 3482c776168SSascha Wildner cp ${ISOROOT}/boot/loader.efi $${tmpdir}/EFI/BOOT/BOOTX64.EFI && \ 3492c776168SSascha Wildner makefs -t msdos -o fat_type=12 -o sectors_per_cluster=1 \ 3502c776168SSascha Wildner -o volume_label=EFI -o media_descriptor=248 -s 400k \ 3512c776168SSascha Wildner ${ISOROOT}/boot/efiboot.img $${tmpdir} && \ 3522c776168SSascha Wildner rm -rf $${tmpdir} ) 3532c776168SSascha Wildner.endif 3545fa778d7SSascha Wildner ( cd ${ISOROOT}; mkisofs -R -J -o ${ISOFILE} \ 3555fa778d7SSascha Wildner -b boot/cdboot -no-emul-boot \ 3569d8dda4aSAaron LI -eltorito-alt-boot -eltorito-platform efi \ 3579d8dda4aSAaron LI -eltorito-boot boot/efiboot.img -no-emul-boot \ 3589d8dda4aSAaron LI -V ${LABEL:C/(^.{32}).*/\1/} . ) # cut label to <= 32 characters 3595fa778d7SSascha Wildner rm -f ${ISOROOT}/boot/efiboot.img 360b9c3e754SMichael Neumann 361b9c3e754SMichael Neumannmkimg: 36260b68cbbSMichael Neumann if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi 3639a122c9aSMatthew Dillon -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 3649a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which`; fi 365*8c441895SAaron LI rm -f ${IMGFILE} 366fe70af21SMatthew Dillon.ifdef IMGSIZE 367fe70af21SMatthew Dillon @echo "STEP: use an image size of ${IMGSIZE} 512-byte sectors" 368*8c441895SAaron LI sz=`bc -e "((${IMGSIZE}) * 512)" -equit`; \ 369*8c441895SAaron LI truncate -s $${sz} ${IMGFILE} 370*8c441895SAaron LI.elifdef IMGSIZE_MB 371*8c441895SAaron LI @echo "STEP: use an image size of ${IMGSIZE_MB} MB" 372*8c441895SAaron LI truncate -s ${IMGSIZE_MB}M ${IMGFILE} 373fe70af21SMatthew Dillon.else 3743342e40aSMatthew Dillon @echo "STEP: Determine required image size in 1GB steps" 3753342e40aSMatthew Dillon @echo " Leave ~600MB of unused space" 37660b68cbbSMichael Neumann sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \ 3773342e40aSMatthew Dillon sz=`bc -e "(($${sz}) * 1.15 + 999999 + 600000) / 1000000" -equit | \ 378fe70af21SMatthew Dillon cut -f1 -d.`; \ 379c843f8b0SMatthew Dillon sz=`bc -e "(($${sz}) * 953)" -equit | cut -f1 -d.`; \ 380*8c441895SAaron LI truncate -s $${sz}M ${IMGFILE} 381fe70af21SMatthew Dillon.endif 3829a122c9aSMatthew Dillon @echo "STEP: determine free vn device" 3839a122c9aSMatthew Dillon vnconfig -l | grep "not in use" | head -n 1 | \ 3849a122c9aSMatthew Dillon cut -f 1 -d: > ${ISODIR}/vn.which 385fc3c0f63SSascha Wildner vnconfig -e `cat ${ISODIR}/vn.which` ${IMGFILE} 3865fa778d7SSascha Wildner @echo "STEP: set up legacy MBR" 387cc3c231bSMatthew Dillon fdisk -b ${ISOROOT}/boot/mbr -IB `cat ${ISODIR}/vn.which` 3885fa778d7SSascha Wildner fdisk -s `cat ${ISODIR}/vn.which` >${ISODIR}/fdisk.dat 3895fa778d7SSascha Wildner awk '(NR==1){printf("g c%s h%s s%s\n", $$2, $$4, $$6);}' \ 3905fa778d7SSascha Wildner ${ISODIR}/fdisk.dat >${ISODIR}/fdisk.conf 3915fa778d7SSascha Wildner echo "p 1 239 63 257985" >>${ISODIR}/fdisk.conf 3927d89978dSSascha Wildner awk '($$1=="1:"){printf("p 2 108 258048 %lu\n", $$3 - 258528);}' \ 3935fa778d7SSascha Wildner ${ISODIR}/fdisk.dat >>${ISODIR}/fdisk.conf 3945fa778d7SSascha Wildner echo "a 2" >>${ISODIR}/fdisk.conf 3955fa778d7SSascha Wildner fdisk -iv -f ${ISODIR}/fdisk.conf `cat ${ISODIR}/vn.which` 3965fa778d7SSascha Wildner rm ${ISODIR}/fdisk.conf ${ISODIR}/fdisk.dat 3975fa778d7SSascha Wildner newfs_msdos -F 32 -c 2 -L EFI -m 0xf8 `cat ${ISODIR}/vn.which`s1 3985fa778d7SSascha Wildner mount_msdos /dev/`cat ${ISODIR}/vn.which`s1 ${IMGMNT} 3995fa778d7SSascha Wildner mkdir -p ${IMGMNT}/EFI/BOOT 4005fa778d7SSascha Wildner cp ${ISOROOT}/boot/boot1.efi ${IMGMNT}/EFI/BOOT/BOOTX64.EFI 4015fa778d7SSascha Wildner umount ${IMGMNT} 4029a122c9aSMatthew Dillon @echo "STEP: write standard disklabel" 4035fa778d7SSascha Wildner disklabel -w -r `cat ${ISODIR}/vn.which`s2 auto 4049a122c9aSMatthew Dillon @echo "STEP: read disklabel back" 4055fa778d7SSascha Wildner disklabel -r `cat ${ISODIR}/vn.which`s2 > ${IMGFILE}.label 4063ac64890SAaron LI @echo "STEP: set disklabel name" 4073ac64890SAaron LI echo "label: ${LABEL}" >> ${IMGFILE}.label 408ea8f7c44SSascha Wildner @echo "STEP: add slice partition" 4093ac64890SAaron LI echo "a: * * 4.2BSD" >> ${IMGFILE}.label; 4109a122c9aSMatthew Dillon @echo "STEP: write modified disklabel back" 4115fa778d7SSascha Wildner disklabel -R -r `cat ${ISODIR}/vn.which`s2 ${IMGFILE}.label 4129a122c9aSMatthew Dillon rm ${IMGFILE}.label 413cc3c231bSMatthew Dillon disklabel -B -b ${ISOROOT}/boot/boot1_64 -s ${ISOROOT}/boot/boot2_64 \ 414cc3c231bSMatthew Dillon `cat ${ISODIR}/vn.which`s2 4155fa778d7SSascha Wildner newfs /dev/`cat ${ISODIR}/vn.which`s2a 4165fa778d7SSascha Wildner mount /dev/`cat ${ISODIR}/vn.which`s2a ${IMGMNT} 4179a122c9aSMatthew Dillon cpdup ${ISOROOT} ${IMGMNT} 4189a122c9aSMatthew Dillon @echo "STEP: fixup ${IMGMNT}/etc/fstab" 4193ac64890SAaron LI echo "/dev/part-by-label/${LABEL}.a / ufs rw,noatime 0 1" > ${IMGMNT}/etc/fstab 4203342e40aSMatthew Dillon echo "dummy /tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 4213342e40aSMatthew Dillon echo "dummy /var/tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 422d4c25c30SSascha Wildner echo "dummy /var/run tmpfs rw,-C 0 0" >> ${IMGMNT}/etc/fstab 4233342e40aSMatthew Dillon echo "dummy /usr/obj tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 4249a122c9aSMatthew Dillon echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab 4259a122c9aSMatthew Dillon @echo "STEP: fixup ${IMGMNT}/boot/loader.conf" 4269a122c9aSMatthew Dillon -fgrep -v kernel_options ${IMGMNT}/boot/loader.conf > ${IMGMNT}/boot/loader.conf.new 4273ac64890SAaron LI echo 'vfs.root.mountfrom="ufs:part-by-label/${LABEL}.a"' >> ${IMGMNT}/boot/loader.conf.new 4289a122c9aSMatthew Dillon mv ${IMGMNT}/boot/loader.conf.new ${IMGMNT}/boot/loader.conf 4292cc9c7f7SAntonio Huete Jimenez @echo "STEP: create /firstboot" 4302cc9c7f7SAntonio Huete Jimenez touch ${IMGMNT}/firstboot 4319a122c9aSMatthew Dillon @echo "STEP: cleanup" 4329a122c9aSMatthew Dillon df ${IMGMNT} 433836f3129SMatthew Dillon sync 434836f3129SMatthew Dillon sleep 1 4359a122c9aSMatthew Dillon umount ${IMGMNT} 4369a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which` 4379a122c9aSMatthew Dillon rm -f ${ISODIR}/vn.which 43860b68cbbSMichael Neumann rmdir ${IMGMNT} 439a4911276SMatthew Dillon @echo "STEP: done, image files are in ${ISODIR}" 440b9c3e754SMichael Neumann 4416ca9a59cSMatthew Dillonclean: 442836f3129SMatthew Dillon sync 443836f3129SMatthew Dillon sleep 1 4445e885f07SSascha Wildner -umount ${ISOROOT}/usr/distfiles > /dev/null 2>&1 4452f36664eSSascha Wildner -umount ${ISOROOT}/usr/dports > /dev/null 2>&1 4469a122c9aSMatthew Dillon -umount ${ISOROOT}/dev > /dev/null 2>&1 4479a122c9aSMatthew Dillon -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 4489a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which`; fi 4496ca9a59cSMatthew Dillon if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi 450c19c746bSMatthew Dillon rm -rf ${ISOROOT} 4519a122c9aSMatthew Dillon rm -f ${ISODIR}/.didbootstrap ${ISODIR}/vn.which 4526ca9a59cSMatthew Dillon 4536ca9a59cSMatthew Dillonrealclean: clean 454c19c746bSMatthew Dillon rm -rf ${ISODIR}/packages 455c19c746bSMatthew Dillon rm -rf ${ISODIR}/distfiles 4566ca9a59cSMatthew Dillon 457dade4a2eSAaron LI.MAIN: help 458dade4a2eSAaron LIhelp: 4598126e4efSAaron LI @echo "Targets:" 4608126e4efSAaron LI @echo " release - full build from scratch" 4618126e4efSAaron LI @echo " quick - attempt to do an incremental rebuild" 4628126e4efSAaron LI @echo " realquick - attempt to restart after world & kernel" 4638126e4efSAaron LI @echo " restartpkgs - attempt to restart at the pkg building stage" 464aac6f66eSAaron LI @echo "" 465aac6f66eSAaron LI @echo "Optional targets:" 466aac6f66eSAaron LI @echo " nopkgs - do not install any packages" 467632d862bSAaron LI @echo " binpkgs - use binary packages with pkg(8)" 468aac6f66eSAaron LI @echo " gui - do a GUI release" 4698abe78a1SMatthew Dillon @echo "" 4708126e4efSAaron LI @echo "Variables:" 4718126e4efSAaron LI @echo " DPORTS_EXTRA_PACKAGES: add additional packages" 4728126e4efSAaron LI @echo " GITURL_SRC: override the Git URL to source repository" 4738126e4efSAaron LI @echo " GITURL_DPORTS: override the Git URL to dports repository" 4748126e4efSAaron LI @echo " IMGSIZE: override the size of .img (in 512-byte sectors)" 475*8c441895SAaron LI @echo " IMGSIZE_MB: override the size of .img (in units of MB)" 476834a1306SMatthew Dillon @echo " NREL_MAKE_JOBS: override the default value (sysctl hw.ncpu)" 477632d862bSAaron LI @echo " PKG_<port>: specify the package name for port <port>" 478632d862bSAaron LI @echo " WITHOUT_SRCS: do not package source code if set" 479aac6f66eSAaron LI @echo "" 480588a679cSSimon Schubert 481e2dbfa0bSThomas Nikolajsen.PHONY: release quickrel realquickrel 4829b29c40aSMatthew Dillon.PHONY: quick realquick 483e2dbfa0bSThomas Nikolajsen.PHONY: check buildworld1 buildworld2 48431d5c88cSSascha Wildner.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mkiso mkimg 4851968392dSAaron LI.PHONY: clean realclean help all srcs pkgs 486