19b29c40aSMatthew Dillon######################################################################### 29b29c40aSMatthew Dillon# ENHANCEMENTS # 39b29c40aSMatthew Dillon######################################################################### 49b29c40aSMatthew Dillon 5f4ec1279SSascha Wildner# New method e.g. 'make gui release'. A series of enhancement 64931b8b1SSascha Wildner# targets may be specified which set make variables which enhance 79b29c40aSMatthew Dillon# the build in various ways. 89b29c40aSMatthew Dillon# 91a8bb5ebSMatthew Dillon# img is now the default (produces both the .iso and .img) 101a8bb5ebSMatthew Dillon# 1188821fa4SMatthew Dillongui installer img nopkgs: 129b29c40aSMatthew Dillon 139b29c40aSMatthew Dillon######################################################################### 149b29c40aSMatthew Dillon# SETUP # 159b29c40aSMatthew Dillon######################################################################### 169b29c40aSMatthew Dillon 17bd0ab7aaSMatthew DillonDPORTS_PATH?= /usr/dports 18a291abfbSMatthew DillonISODIR?= /usr/obj/release 195ec00f8aSSascha WildnerISOROOT?= ${ISODIR}/root 206ca9a59cSMatthew DillonOBJSYS= ${.OBJDIR}/../sys 218126e4efSAaron LIGITURL_SRC?= git://git.dragonflybsd.org/dragonfly.git 228126e4efSAaron LIGITURL_DPORTS?= git://mirror-master.dragonflybsd.org/dports.git 235cb6cda9SSascha WildnerMAKE_JOBS?= $$(sysctl -n hw.ncpu) 243fff415bSSascha Wildner 25702a95ccSSimon Schubert# XXX makeshift fix to build the right kernel for the (target) architecture 26702a95ccSSimon Schubert# We should configure this in the platform files somehow 27dd7331feSSascha Wildner.if ${MACHINE_ARCH} == "x86_64" 2891856cf5SSascha WildnerKERNCONF ?= X86_64_GENERIC 29702a95ccSSimon Schubert.endif 306ca9a59cSMatthew Dillon 31c36c5990SSascha WildnerCHROOT_CMD?= /usr/sbin/chroot ${ISOROOT} sh -c 32cc55a235SSimon Schubert 33165b1c14SSascha Wildner.if !make(nopkgs) 348abe78a1SMatthew Dillon# User may specify extra packages in addition to the defaults 3595b64753SMatthew Dillon# 36c36c5990SSascha WildnerDPORTS_EXTRA_PACKAGES?= 37fbc26094SSascha Wildner 382f36664eSSascha Wildner# dports packages to be built and installed on the release ISO 392f36664eSSascha Wildner# 40c36c5990SSascha WildnerDPORTS_PACKAGES?= devel/git \ 410e561611SJustin C. Sherrill dns/bind-tools \ 4220d2e8bdSAntonio Huete Jimenez net/isc-dhcp44-server \ 43c36c5990SSascha Wildner sysutils/cdrtools \ 44*bcd3ea29SMatthew Dillon security/wpa_supplicant \ 4544c4f44aSSascha Wildner ${DPORTS_EXTRA_PACKAGES} 46c36c5990SSascha Wildner 47c36c5990SSascha Wildner# dports options to use when building packages 48c36c5990SSascha Wildner# 49c36c5990SSascha WildnerDPORTS_OPTIONS+= -DBATCH 50255a0279SMichael Neumann.if make(gui) 51cd98d260SSascha WildnerDPORTS_OPTIONS.devel_git+= -DWITH_GUI 52255a0279SMichael Neumann.else 53cd98d260SSascha WildnerDPORTS_OPTIONS.devel_git+= -DWITHOUT_CONTRIB -DWITHOUT_PERL 54fbc26094SSascha Wildner.endif 55165b1c14SSascha Wildner.endif 568188de86SMatthew Dillon 578188de86SMatthew Dillon# Specify which root skeletons are required, and let the user include 58e2dbfa0bSThomas Nikolajsen# their own. They are copied into ISODIR during the `customizeiso' 598188de86SMatthew Dillon# target; each overwrites the last. 608188de86SMatthew Dillon# 618f51ac0bSSascha WildnerREQ_ROOTSKELS= ${.CURDIR}/root 62cc224c64SJoerg SonnenbergerROOTSKELS?= ${REQ_ROOTSKELS} 63cc224c64SJoerg Sonnenberger 64255a0279SMichael Neumann.if make(gui) 65c843f8b0SMatthew Dillon# LIST OF PACKAGES NOT INCLUDED DUE TO BUILD ISSUES: 66c843f8b0SMatthew Dillon# chat/pidgin textproc/enchant dependency is broken 67c843f8b0SMatthew Dillon# x11/rxvt-unicode broken configure 68c843f8b0SMatthew Dillon# net/nmap tries to access openssl/md2.h which does not 69c843f8b0SMatthew Dillon# exist. 70c843f8b0SMatthew Dillon# sysutils/idesk dying on link __sync_fetch_and_add_4 71c843f8b0SMatthew Dillon# 72bfe20b28SSascha WildnerISOFILE?= ${ISODIR}/dfly-gui.iso 73b9c3e754SMichael NeumannIMGFILE?= ${ISODIR}/dfly-gui.img 7488821fa4SMatthew Dillon 750e176309SMatthew Dillon# NOTE: order important, do not sort package list 760e176309SMatthew Dillon# 7788821fa4SMatthew Dillon.if !make(nopkgs) 78255a0279SMichael NeumannDPORTS_PACKAGES+= x11/xorg \ 79255a0279SMichael Neumann x11-wm/fluxbox \ 80255a0279SMichael Neumann x11-wm/fvwm \ 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 \ 98255a0279SMichael Neumann sysutils/screen 9988821fa4SMatthew Dillon.endif 10088821fa4SMatthew Dillon 101bfe20b28SSascha WildnerROOTSKELS+= ${.CURDIR}/gui 102bfe20b28SSascha Wildner.endif 103bfe20b28SSascha Wildner 1043f279b9eSSascha WildnerISOFILE ?= ${ISODIR}/dfly.iso 105b9c3e754SMichael NeumannIMGFILE ?= ${ISODIR}/dfly.img 106b9c3e754SMichael Neumann 10760b68cbbSMichael NeumannIMGMNT ?= ${ISODIR}/mnt 108a2f841edSMatthew Dillon 109a2f841edSMatthew Dillon# USB umass now probes starting at da8, so the usb stick is 110a2f841edSMatthew Dillon# probably sitting on da8. 111a2f841edSMatthew Dillon# 1129a122c9aSMatthew DillonIMGUSBDEV ?= da8 1133f279b9eSSascha Wildner 1145b22b655SMatthew Dillon# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add 1155b22b655SMatthew Dillon# the additional '/nrelease' manually, as a safety measure. 1165b22b655SMatthew Dillon# 1175b22b655SMatthew DillonNRLOBJDIR?= /usr/obj 1185b22b655SMatthew Dillon 1198188de86SMatthew Dillon######################################################################### 1208188de86SMatthew Dillon# BASE ISO TARGETS # 1218188de86SMatthew Dillon######################################################################### 1226ca9a59cSMatthew Dillon 1237ebbae99SSascha Wildnerrelease: check clean buildworld1 buildkernel1 \ 12431d5c88cSSascha Wildner buildiso srcs customizeiso mkiso mkimg 1256ca9a59cSMatthew Dillon 1267ebbae99SSascha Wildnerquickrel: check clean buildworld2 buildkernel2 \ 12731d5c88cSSascha Wildner buildiso srcs customizeiso mkiso mkimg 1288188de86SMatthew Dillon 12903e2a3c5SSascha Wildnerrealquickrel: check clean \ 13031d5c88cSSascha Wildner buildiso srcs customizeiso mkiso mkimg 1316ca9a59cSMatthew Dillon 13231d5c88cSSascha Wildnerrestartpkgs: check customizeiso mkiso mkimg 1335af45f85SMatthew Dillon 1349b29c40aSMatthew Dillonquick: quickrel 1359b29c40aSMatthew Dillon 1369b29c40aSMatthew Dillonrealquick: realquickrel 1379b29c40aSMatthew Dillon 1389b29c40aSMatthew Dillon######################################################################### 1399b29c40aSMatthew Dillon# CORE SUPPORT TARGETS # 1409b29c40aSMatthew Dillon######################################################################### 1419b29c40aSMatthew Dillon 142d2582113SChris Presseycheck: 143c36c5990SSascha Wildner.if !exists(/usr/local/bin/mkisofs) && !exists(/usr/pkg/bin/mkisofs) 1440936984eSMatthew Dillon @echo 1450936984eSMatthew Dillon @echo "Your machine does not have cdrtools installed. You can install it with:" 146218b6b69SMarkus Pfeiffer @echo " pkg install cdrtools" 1470936984eSMatthew Dillon.endif 148aa3eeb12SSascha Wildner @if [ ! -d ${DPORTS_PATH} ]; then \ 149aa3eeb12SSascha Wildner echo "${DPORTS_PATH} does not exist."; \ 150aa3eeb12SSascha Wildner echo ""; \ 151aa3eeb12SSascha Wildner echo "Please set DPORTS_PATH to the dports tree that shall be used for"; \ 152aa3eeb12SSascha Wildner echo "package building. The default is /usr/dports. See the Makefile in"; \ 153aa3eeb12SSascha Wildner echo "/usr if you are unfamiliar with dports."; \ 154aa3eeb12SSascha Wildner /usr/bin/false; \ 155aa3eeb12SSascha Wildner fi 156c36c5990SSascha Wildner.if !exists(/usr/local/bin/mkisofs) && !exists(/usr/pkg/bin/mkisofs) 1573da8e88fSJohn Marino @/usr/bin/false 158fbc26094SSascha Wildner.endif 159aa3eeb12SSascha Wildner @echo "Using ${DPORTS_PATH} as the dports tree." 1602e3f8f38SMatthew Dillon 161588a679cSSimon Schubertbuildworld1 buildworld2: 1623fff415bSSascha Wildner cd ${.CURDIR}/..; \ 1633fff415bSSascha Wildner ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ 1643fff415bSSascha Wildner make -j ${MAKE_JOBS} -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//} 1656ca9a59cSMatthew Dillon 166588a679cSSimon Schubertbuildkernel1 buildkernel2: 167588a679cSSimon Schubert cd ${.CURDIR}/..; \ 168588a679cSSimon Schubert for kernconf in ${KERNCONF}; do \ 169448b21e7SSimon Schubert ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ 1703fff415bSSascha Wildner make -j ${MAKE_JOBS} ${.TARGET:C/build(.*)2/quick\1/:C/1//} \ 171ee7f6ff2SSascha Wildner KERNCONF=$${kernconf}; \ 172588a679cSSimon Schubert done 1736ca9a59cSMatthew Dillon 1745b22b655SMatthew Dillon# note that we do not want to mess with any /usr/obj directories not related 1755b22b655SMatthew Dillon# to buildworld, buildkernel, or nrelease, so we must supply the proper 1765b22b655SMatthew Dillon# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and 1775b22b655SMatthew Dillon# buildkernel mechanism. 1785b22b655SMatthew Dillon# 1792b43b38cSSascha Wildner# Unconditionally clean out ${ISOROOT} so a previous img build 18092b0ebb9SMatthew Dillon# does not blow up a future quick iso build 18192b0ebb9SMatthew Dillon# 182fe70af21SMatthew Dillon# We install with INSTALLSTRIPPEDMODULES to make things fit into the ISO. 183fe70af21SMatthew Dillon# We leave the kernel's debug variables intact. 184fe70af21SMatthew Dillon# 1856ca9a59cSMatthew Dillonbuildiso: 18692b0ebb9SMatthew Dillon -chflags -R noschg ${ISOROOT} 18792b0ebb9SMatthew Dillon rm -rf ${ISOROOT} 18892b0ebb9SMatthew Dillon mkdir -p ${ISOROOT} 1895b22b655SMatthew Dillon if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi 190f4ec1279SSascha Wildner ( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld ) 191ab64cf06SSimon Schubert ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \ 192ab64cf06SSimon Schubert make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution ) 19321aa02d0SChris Pressey cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd 194588a679cSSimon Schubert cd ${.CURDIR}/..; \ 195588a679cSSimon Schubert for kernconf in ${KERNCONF}; do \ 1961c9d98d0SAntonio Huete Jimenez make DESTDIR=${ISOROOT} reinstallkernel KERNCONF=$${kernconf}; \ 197588a679cSSimon Schubert done 19891856cf5SSascha Wildner rm -rf ${ISOROOT}/boot/kernel.old 1991c9d98d0SAntonio Huete Jimenez ln -sf kernel ${ISOROOT}/boot/kernel/kernel.BOOTP 200e79a303fSAaron LI ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} initrd ) 2016ca9a59cSMatthew Dillon mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var 2026ca9a59cSMatthew Dillon dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev 2038188de86SMatthew Dillon 204255a0279SMichael Neumann# The GUI build includes the ports tree (~1G+) while the nominal release 205fe70af21SMatthew Dillon# build does not. 206fe70af21SMatthew Dillon# 207fe70af21SMatthew Dillon# The GUI build includes full sources while the nominal release build 208fe70af21SMatthew Dillon# only includes kernel sources (~27MB). 20919d86faaSMatthew Dillon# 210e2dbfa0bSThomas Nikolajsensrcs: 211e2dbfa0bSThomas Nikolajsen.if !defined(WITHOUT_SRCS) 212255a0279SMichael Neumann.if make(gui) 2133342e40aSMatthew Dillon rm -f ${ISOROOT}/usr/src-sys.tgz 2143342e40aSMatthew Dillon rm -f ${ISOROOT}/usr/src-sys.tar.bz2 215165b1c14SSascha Wildner.if !empty(DPORTS_PACKAGES) 2168126e4efSAaron LI cd ${ISOROOT}/usr && make dports-create GITURL_DPORTS=${GITURL_DPORTS} 217c59cfa66SSascha Wildner # NOTE: Adding the git gc --aggressive helps by significantly 218c59cfa66SSascha Wildner # reducing the disk space required. 219c59cfa66SSascha Wildner # 220255a0279SMichael Neumann cd ${ISOROOT}/usr/dports && git gc --aggressive 221165b1c14SSascha Wildner.endif 2228126e4efSAaron LI cd ${ISOROOT}/usr && make src-create-repo GITURL_SRC=${GITURL_SRC} 223255a0279SMichael Neumann # XXX: git gc --aggressive 224c19c746bSMatthew Dillon.else 225e2dbfa0bSThomas Nikolajsen rm -f ${ISOROOT}/usr/src-sys.tgz 226fe70af21SMatthew Dillon rm -f ${ISOROOT}/usr/src-sys.tar.bz2 227cacf78aaSSascha Wildner cd ${.CURDIR}/.. && tar --exclude .git -s '/^\./src/' \ 228cebb579bSMatthew Dillon -cf - ./Makefile ./Makefile.inc1 \ 229cebb579bSMatthew Dillon ./crypto/libressl/include ./sys | \ 230fe70af21SMatthew Dillon bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 231c19c746bSMatthew Dillon.endif 23266b79064SMatthew Dillon.endif 23319d86faaSMatthew Dillon 2345af45f85SMatthew Dillon# Customize the ISO by copying rootskels in reverse priority order, 2355af45f85SMatthew Dillon# building packages, and doing other post-install tasks. 2365af45f85SMatthew Dillon# 2378188de86SMatthew Dilloncustomizeiso: 2385af45f85SMatthew Dillon # Copy the rootskels. Allow sources to be owned by someone other 2393cf4b4a1SSascha Wildner # than root (as is common when checked out via git). 2405af45f85SMatthew Dillon # 2418188de86SMatthew Dillon.for ROOTSKEL in ${ROOTSKELS} 2428188de86SMatthew Dillon cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT} 2435af45f85SMatthew Dillon @test -O ${.CURDIR} || echo "chowning copied files to root:wheel" 2445af45f85SMatthew Dillon @test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel)) 2458188de86SMatthew Dillon.endfor 2467249926bSMatthew Dillon pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd 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 2554fba3387SChris Pressey cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM} 2564fba3387SChris Pressey.endfor 2578abe78a1SMatthew Dillon # 258c36c5990SSascha Wildner # Setup some things & mount dports tree. Use defensive umounts and 259c36c5990SSascha Wildner # rm -rf's to allow restarts. Allow /usr/dports to be read-only. 2608abe78a1SMatthew Dillon # 261165b1c14SSascha Wildner -@umount ${ISOROOT}/dev 262165b1c14SSascha Wildner mount_null /dev ${ISOROOT}/dev 263165b1c14SSascha Wildner.if !empty(DPORTS_PACKAGES) 2641c9d98d0SAntonio Huete Jimenez cp /etc/resolv.conf ${ISOROOT}/etc 2659af692c6SSascha Wildner ${CHROOT_CMD} "ldconfig -elf /lib /usr/lib /usr/lib/gcc*" 2665e885f07SSascha Wildner -@umount ${ISOROOT}/usr/distfiles 2672f36664eSSascha Wildner -@umount ${ISOROOT}/usr/dports 2682f36664eSSascha Wildner rm -rf ${ISOROOT}/usr/obj/dports 2698abe78a1SMatthew Dillon # 270c36c5990SSascha Wildner # Mount /usr/dports, make sure /usr/distfiles is writable. 271c36c5990SSascha Wildner # Make /usr/dports read-only for safety, else a failed umount and 2721eeae16fSMatthew Dillon # our rm -rf will do bad things. 2738abe78a1SMatthew Dillon # 2742f36664eSSascha Wildner mkdir -p ${ISOROOT}/usr/dports 2755e885f07SSascha Wildner mkdir -p ${ISOROOT}/usr/distfiles 2762f36664eSSascha Wildner mount_null -o ro ${DPORTS_PATH} ${ISOROOT}/usr/dports 277c36c5990SSascha Wildner cp /etc/shells ${ISOROOT}/usr/distfiles/.test > /dev/null 2>&1 \ 278c36c5990SSascha Wildner || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/distfiles 2798abe78a1SMatthew Dillon # 2808abe78a1SMatthew Dillon # Build and install packages, skip packages already installed 2818abe78a1SMatthew Dillon # 282c36c5990SSascha Wildner.for PKG in ${DPORTS_PACKAGES} 283c36c5990SSascha Wildner ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} ${DPORTS_OPTIONS.${PKG:S/\//_/g}} install" 28420585f87SMatthew Dillon.endfor 2852f36664eSSascha Wildner.for PKG in ${DPORTS_PACKAGES} 286c36c5990SSascha Wildner ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} clean" 2872f36664eSSascha Wildner.endfor 2888abe78a1SMatthew Dillon # 28931d5c88cSSascha Wildner # Remove packages which nothing depends on, add a whatis database 290c36c5990SSascha Wildner # for dports manual pages, create an initial locate database and 29131d5c88cSSascha Wildner # clean up 2928abe78a1SMatthew Dillon # 2932f36664eSSascha Wildner ${CHROOT_CMD} "yes | pkg autoremove" 294c36c5990SSascha Wildner ${CHROOT_CMD} "makewhatis /usr/local/man" 2955e885f07SSascha Wildner -umount ${ISOROOT}/usr/distfiles 2962f36664eSSascha Wildner umount ${ISOROOT}/usr/dports 2975e885f07SSascha Wildner rm -rf ${ISOROOT}/usr/dports 2982f36664eSSascha Wildner rm -rf ${ISOROOT}/usr/obj/dports 2995e885f07SSascha Wildner rm -rf ${ISOROOT}/usr/distfiles 300fbc26094SSascha Wildner rm -f ${ISOROOT}/etc/resolv.conf 301165b1c14SSascha Wildner.endif 3022f36664eSSascha Wildner # 303b34d3b9bSzrj # Finally, update the locate(8) database, allow ISODIR 304b34d3b9bSzrj # to be on tmpfs (fails to create locate database then) 3052f36664eSSascha Wildner # 306b34d3b9bSzrj -${CHROOT_CMD} /etc/periodic/weekly/310.locate 30731d5c88cSSascha Wildner umount ${ISOROOT}/dev 308d68fa6c5SMatthew Dillon # 30944c4f44aSSascha Wildner # Recopy files that dports may have updated in /etc into /etc.hdd 310d68fa6c5SMatthew Dillon # 311d68fa6c5SMatthew Dillon cpdup ${ISOROOT}/etc/shells ${ISOROOT}/etc.hdd/shells 312d68fa6c5SMatthew Dillon cpdup ${ISOROOT}/etc/group ${ISOROOT}/etc.hdd/group 3138398ca17SSascha Wildner 3146ca9a59cSMatthew Dillonmkiso: 3155fa778d7SSascha Wildner if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi 3165fa778d7SSascha Wildner -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 3175fa778d7SSascha Wildner vnconfig -u `cat ${ISODIR}/vn.which`; fi 3185fa778d7SSascha Wildner newfs_msdos -C 400k -F 12 -L EFI -m 0xf8 ${ISOROOT}/boot/efiboot.img 3195fa778d7SSascha Wildner vnconfig -l | grep "not in use" | head -n 1 | \ 3205fa778d7SSascha Wildner cut -f 1 -d: > ${ISODIR}/vn.which 3215fa778d7SSascha Wildner vnconfig -e -s labels `cat ${ISODIR}/vn.which` ${ISOROOT}/boot/efiboot.img 3225fa778d7SSascha Wildner mount_msdos /dev/`cat ${ISODIR}/vn.which` ${IMGMNT} 3235fa778d7SSascha Wildner mkdir -p ${IMGMNT}/EFI/BOOT 3245fa778d7SSascha Wildner cp ${ISOROOT}/boot/loader.efi ${IMGMNT}/EFI/BOOT/BOOTX64.EFI 3255fa778d7SSascha Wildner umount ${IMGMNT} 3265fa778d7SSascha Wildner ( cd ${ISOROOT}; mkisofs -R -J -o ${ISOFILE} \ 3275fa778d7SSascha Wildner -b boot/cdboot -no-emul-boot \ 3285fa778d7SSascha Wildner -eltorito-alt-boot -eltorito-platform efi -eltorito-boot boot/efiboot.img -no-emul-boot \ 32964bba8c7SSimon Schubert -V "DragonFly `${.CURDIR}/../tools/gitrev.sh | cut -c -22`" . ) 3305fa778d7SSascha Wildner rm -f ${ISOROOT}/boot/efiboot.img 331b9c3e754SMichael Neumann 332b9c3e754SMichael Neumannmkimg: 33360b68cbbSMichael Neumann if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi 3349a122c9aSMatthew Dillon -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 3359a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which`; fi 336fe70af21SMatthew Dillon.ifdef IMGSIZE 337fe70af21SMatthew Dillon @echo "STEP: use an image size of ${IMGSIZE} 512-byte sectors" 338fe70af21SMatthew Dillon rm -f ${IMGFILE} 339fe70af21SMatthew Dillon sz=`bc -e "((${IMGSIZE}) * 512)" -equit`; truncate -s $${sz} ${IMGFILE} 340fe70af21SMatthew Dillon.else 3413342e40aSMatthew Dillon @echo "STEP: Determine required image size in 1GB steps" 3423342e40aSMatthew Dillon @echo " Leave ~600MB of unused space" 34360b68cbbSMichael Neumann sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \ 3443342e40aSMatthew Dillon sz=`bc -e "(($${sz}) * 1.15 + 999999 + 600000) / 1000000" -equit | \ 345fe70af21SMatthew Dillon cut -f1 -d.`; \ 346c843f8b0SMatthew Dillon sz=`bc -e "(($${sz}) * 953)" -equit | cut -f1 -d.`; \ 347fe70af21SMatthew Dillon rm -f ${IMGFILE}; \ 348fe70af21SMatthew Dillon truncate -s $${sz}M ${IMGFILE}; 349fe70af21SMatthew Dillon.endif 3509a122c9aSMatthew Dillon @echo "STEP: determine free vn device" 3519a122c9aSMatthew Dillon vnconfig -l | grep "not in use" | head -n 1 | \ 3529a122c9aSMatthew Dillon cut -f 1 -d: > ${ISODIR}/vn.which 3539a122c9aSMatthew Dillon vnconfig -e -s labels `cat ${ISODIR}/vn.which` ${IMGFILE} 3545fa778d7SSascha Wildner @echo "STEP: set up legacy MBR" 355cc3c231bSMatthew Dillon fdisk -b ${ISOROOT}/boot/mbr -IB `cat ${ISODIR}/vn.which` 3565fa778d7SSascha Wildner fdisk -s `cat ${ISODIR}/vn.which` >${ISODIR}/fdisk.dat 3575fa778d7SSascha Wildner awk '(NR==1){printf("g c%s h%s s%s\n", $$2, $$4, $$6);}' \ 3585fa778d7SSascha Wildner ${ISODIR}/fdisk.dat >${ISODIR}/fdisk.conf 3595fa778d7SSascha Wildner echo "p 1 239 63 257985" >>${ISODIR}/fdisk.conf 3605fa778d7SSascha Wildner awk '($$1=="1:"){printf("p 2 165 258048 %lu\n", $$3 - 258528);}' \ 3615fa778d7SSascha Wildner ${ISODIR}/fdisk.dat >>${ISODIR}/fdisk.conf 3625fa778d7SSascha Wildner echo "a 2" >>${ISODIR}/fdisk.conf 3635fa778d7SSascha Wildner fdisk -iv -f ${ISODIR}/fdisk.conf `cat ${ISODIR}/vn.which` 3645fa778d7SSascha Wildner rm ${ISODIR}/fdisk.conf ${ISODIR}/fdisk.dat 3655fa778d7SSascha Wildner newfs_msdos -F 32 -c 2 -L EFI -m 0xf8 `cat ${ISODIR}/vn.which`s1 3665fa778d7SSascha Wildner mount_msdos /dev/`cat ${ISODIR}/vn.which`s1 ${IMGMNT} 3675fa778d7SSascha Wildner mkdir -p ${IMGMNT}/EFI/BOOT 3685fa778d7SSascha Wildner cp ${ISOROOT}/boot/boot1.efi ${IMGMNT}/EFI/BOOT/BOOTX64.EFI 3695fa778d7SSascha Wildner umount ${IMGMNT} 3709a122c9aSMatthew Dillon @echo "STEP: write standard disklabel" 3715fa778d7SSascha Wildner disklabel -w -r `cat ${ISODIR}/vn.which`s2 auto 3729a122c9aSMatthew Dillon @echo "STEP: read disklabel back" 3735fa778d7SSascha Wildner disklabel -r `cat ${ISODIR}/vn.which`s2 > ${IMGFILE}.label 3749a122c9aSMatthew Dillon @echo "STEP: determine number of sectors of whole disk" 37560b68cbbSMichael Neumann secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`; \ 3769a122c9aSMatthew Dillon echo " a: $${secs} 0 4.2BSD" >> ${IMGFILE}.label; 3779a122c9aSMatthew Dillon @echo "STEP: write modified disklabel back" 3785fa778d7SSascha Wildner disklabel -R -r `cat ${ISODIR}/vn.which`s2 ${IMGFILE}.label 3799a122c9aSMatthew Dillon rm ${IMGFILE}.label 380cc3c231bSMatthew Dillon disklabel -B -b ${ISOROOT}/boot/boot1_64 -s ${ISOROOT}/boot/boot2_64 \ 381cc3c231bSMatthew Dillon `cat ${ISODIR}/vn.which`s2 3825fa778d7SSascha Wildner newfs /dev/`cat ${ISODIR}/vn.which`s2a 3835fa778d7SSascha Wildner mount /dev/`cat ${ISODIR}/vn.which`s2a ${IMGMNT} 3849a122c9aSMatthew Dillon cpdup ${ISOROOT} ${IMGMNT} 3859a122c9aSMatthew Dillon @echo "STEP: fixup ${IMGMNT}/etc/fstab" 3865fa778d7SSascha Wildner echo "/dev/${IMGUSBDEV}s2a / ufs rw,noatime 0 1" > ${IMGMNT}/etc/fstab 3873342e40aSMatthew Dillon echo "dummy /tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 3883342e40aSMatthew Dillon echo "dummy /var/tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 389d4c25c30SSascha Wildner echo "dummy /var/run tmpfs rw,-C 0 0" >> ${IMGMNT}/etc/fstab 3903342e40aSMatthew Dillon echo "dummy /usr/obj tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 3919a122c9aSMatthew Dillon echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab 3929a122c9aSMatthew Dillon @echo "STEP: fixup ${IMGMNT}/boot/loader.conf" 3939a122c9aSMatthew Dillon -fgrep -v kernel_options ${IMGMNT}/boot/loader.conf > ${IMGMNT}/boot/loader.conf.new 3945fa778d7SSascha Wildner echo 'vfs.root.mountfrom="ufs:${IMGUSBDEV}s2a"' >> ${IMGMNT}/boot/loader.conf.new 3959a122c9aSMatthew Dillon mv ${IMGMNT}/boot/loader.conf.new ${IMGMNT}/boot/loader.conf 3969a122c9aSMatthew Dillon @echo "STEP: cleanup" 3979a122c9aSMatthew Dillon df ${IMGMNT} 398836f3129SMatthew Dillon sync 399836f3129SMatthew Dillon sleep 1 4009a122c9aSMatthew Dillon umount ${IMGMNT} 4019a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which` 4029a122c9aSMatthew Dillon rm -f ${ISODIR}/vn.which 40360b68cbbSMichael Neumann rmdir ${IMGMNT} 4049a122c9aSMatthew Dillon @echo "STEP: done" 405b9c3e754SMichael Neumann 4066ca9a59cSMatthew Dillonclean: 407836f3129SMatthew Dillon sync 408836f3129SMatthew Dillon sleep 1 4095e885f07SSascha Wildner -umount ${ISOROOT}/usr/distfiles > /dev/null 2>&1 4102f36664eSSascha Wildner -umount ${ISOROOT}/usr/dports > /dev/null 2>&1 4119a122c9aSMatthew Dillon -umount ${ISOROOT}/dev > /dev/null 2>&1 4129a122c9aSMatthew Dillon -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 4139a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which`; fi 4146ca9a59cSMatthew Dillon if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi 415c19c746bSMatthew Dillon rm -rf ${ISOROOT} 416c19c746bSMatthew Dillon rm -rf ${NRLOBJDIR}/nrelease 4179a122c9aSMatthew Dillon rm -f ${ISODIR}/.didbootstrap ${ISODIR}/vn.which 4186ca9a59cSMatthew Dillon 4196ca9a59cSMatthew Dillonrealclean: clean 4203ebedc5eSMatthew Dillon rm -rf ${OBJSYS}/${KERNCONF} 421c19c746bSMatthew Dillon rm -rf ${ISODIR}/packages 422c19c746bSMatthew Dillon rm -rf ${ISODIR}/distfiles 4236ca9a59cSMatthew Dillon 424e2dbfa0bSThomas Nikolajsenhelp all: 4258126e4efSAaron LI @echo "Targets:" 4268126e4efSAaron LI @echo " release - full build from scratch" 4278126e4efSAaron LI @echo " quick - attempt to do an incremental rebuild" 4288126e4efSAaron LI @echo " realquick - attempt to restart after world & kernel" 4298126e4efSAaron LI @echo " restartpkgs - attempt to restart at the pkg building stage" 4308126e4efSAaron LI @echo "NOTE: Add the optional 'gui' target to do a GUI release" 4318abe78a1SMatthew Dillon @echo "" 4328126e4efSAaron LI @echo "Variables:" 4338126e4efSAaron LI @echo " DPORTS_EXTRA_PACKAGES: add additional packages" 4348126e4efSAaron LI @echo " GITURL_SRC: override the Git URL to source repository" 4358126e4efSAaron LI @echo " GITURL_DPORTS: override the Git URL to dports repository" 4368126e4efSAaron LI @echo " IMGSIZE: override the size of .img (in 512-byte sectors)" 4378126e4efSAaron LI @echo " MAKE_JOBS: override the default value (sysctl hw.ncpu)" 438588a679cSSimon Schubert 439e2dbfa0bSThomas Nikolajsen.PHONY: release quickrel realquickrel 440e2dbfa0bSThomas Nikolajsen.PHONY: installer 4419b29c40aSMatthew Dillon.PHONY: quick realquick 442e2dbfa0bSThomas Nikolajsen.PHONY: check buildworld1 buildworld2 44331d5c88cSSascha Wildner.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mkiso mkimg 444796fd273SYONETANI Tomokazu.PHONY: clean realclean help all srcs 445cc224c64SJoerg Sonnenberger 4466ca9a59cSMatthew Dillon.include <bsd.prog.mk> 447