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# 8aac6f66eSAaron LIgui nopkgs: 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 215cb6cda9SSascha WildnerMAKE_JOBS?= $$(sysctl -n hw.ncpu) 229758d73aSSascha Wildner.if !defined(NOFSCHG) 239758d73aSSascha WildnerMTREE_FSCHG= -i 249758d73aSSascha Wildner.endif 253fff415bSSascha Wildner 260f8dfe63SAaron LIGITREV!= sh ${SRCDIR}/tools/gitrev.sh 279d8dda4aSAaron LI 283ac64890SAaron LI# The label/name of the disklabel64(5) slice in the ".img" file. This is 293ac64890SAaron LI# used to identify the USB device with DragonFly installation image, avoiding 303ac64890SAaron LI# hardcoding the USB device name (e.g., "da8"). 313ac64890SAaron LI# 329d8dda4aSAaron LI# This label is also used as the volume ID of the ".iso" file. 339d8dda4aSAaron LI# 349d8dda4aSAaron LILABEL?= DragonFly_${GITREV} 353ac64890SAaron LI 36c36c5990SSascha WildnerCHROOT_CMD?= /usr/sbin/chroot ${ISOROOT} sh -c 37cc55a235SSimon Schubert 38083f5c48SAaron LIISOFILE?= ${ISODIR}/dfly.iso 39083f5c48SAaron LIIMGFILE?= ${ISODIR}/dfly.img 40083f5c48SAaron LIIMGMNT?= ${ISODIR}/mnt 41083f5c48SAaron LI 42165b1c14SSascha Wildner.if !make(nopkgs) 438abe78a1SMatthew Dillon# User may specify extra packages in addition to the defaults 4495b64753SMatthew Dillon# 45c36c5990SSascha WildnerDPORTS_EXTRA_PACKAGES?= 46fbc26094SSascha Wildner 472f36664eSSascha Wildner# dports packages to be built and installed on the release ISO 482f36664eSSascha Wildner# 4971832315SSascha WildnerDPORTS_PACKAGES?= security/ca_root_nss \ 50d25c1efdSSascha Wildner devel/git-lite \ 510e561611SJustin C. Sherrill dns/bind-tools \ 5220d2e8bdSAntonio Huete Jimenez net/isc-dhcp44-server \ 53c36c5990SSascha Wildner sysutils/cdrtools \ 54bcd3ea29SMatthew Dillon security/wpa_supplicant \ 5544c4f44aSSascha Wildner ${DPORTS_EXTRA_PACKAGES} 56c36c5990SSascha Wildner 57c36c5990SSascha Wildner# dports options to use when building packages 58c36c5990SSascha Wildner# 59c36c5990SSascha WildnerDPORTS_OPTIONS+= -DBATCH 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 1038188de86SMatthew Dillon######################################################################### 1048188de86SMatthew Dillon# BASE ISO TARGETS # 1058188de86SMatthew Dillon######################################################################### 1066ca9a59cSMatthew Dillon 1077ebbae99SSascha Wildnerrelease: check clean buildworld1 buildkernel1 \ 1081968392dSAaron LI buildiso customizeiso pkgs srcs mkiso mkimg 1096ca9a59cSMatthew Dillon 1107ebbae99SSascha Wildnerquickrel: check clean buildworld2 buildkernel2 \ 1111968392dSAaron LI buildiso customizeiso pkgs srcs mkiso mkimg 1128188de86SMatthew Dillon 11303e2a3c5SSascha Wildnerrealquickrel: check clean \ 1141968392dSAaron LI buildiso customizeiso pkgs srcs mkiso mkimg 1156ca9a59cSMatthew Dillon 1161968392dSAaron LIrestartpkgs: check pkgs srcs mkiso mkimg 1175af45f85SMatthew Dillon 1189b29c40aSMatthew Dillonquick: quickrel 1199b29c40aSMatthew Dillon 1209b29c40aSMatthew Dillonrealquick: realquickrel 1219b29c40aSMatthew Dillon 1229b29c40aSMatthew Dillon######################################################################### 1239b29c40aSMatthew Dillon# CORE SUPPORT TARGETS # 1249b29c40aSMatthew Dillon######################################################################### 1259b29c40aSMatthew Dillon 126d2582113SChris Presseycheck: 127c36c5990SSascha Wildner.if !exists(/usr/local/bin/mkisofs) && !exists(/usr/pkg/bin/mkisofs) 1280936984eSMatthew Dillon @echo 1290936984eSMatthew Dillon @echo "Your machine does not have cdrtools installed. You can install it with:" 130218b6b69SMarkus Pfeiffer @echo " pkg install cdrtools" 1310936984eSMatthew Dillon.endif 132aa3eeb12SSascha Wildner @if [ ! -d ${DPORTS_PATH} ]; then \ 133aa3eeb12SSascha Wildner echo "${DPORTS_PATH} does not exist."; \ 134aa3eeb12SSascha Wildner echo ""; \ 135aa3eeb12SSascha Wildner echo "Please set DPORTS_PATH to the dports tree that shall be used for"; \ 136aa3eeb12SSascha Wildner echo "package building. The default is /usr/dports. See the Makefile in"; \ 137aa3eeb12SSascha Wildner echo "/usr if you are unfamiliar with dports."; \ 138aa3eeb12SSascha Wildner /usr/bin/false; \ 139aa3eeb12SSascha Wildner fi 140c36c5990SSascha Wildner.if !exists(/usr/local/bin/mkisofs) && !exists(/usr/pkg/bin/mkisofs) 1413da8e88fSJohn Marino @/usr/bin/false 142fbc26094SSascha Wildner.endif 143aa3eeb12SSascha Wildner @echo "Using ${DPORTS_PATH} as the dports tree." 1442e3f8f38SMatthew Dillon 145588a679cSSimon Schubertbuildworld1 buildworld2: 1460f8dfe63SAaron LI ( cd ${SRCDIR}; \ 1473fff415bSSascha Wildner ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ 1480f8dfe63SAaron LI make -j ${MAKE_JOBS} -DWANT_INSTALLER \ 1490f8dfe63SAaron LI ${.TARGET:C/build(.*)2/quick\1/:C/1//} ) 1506ca9a59cSMatthew Dillon 151588a679cSSimon Schubertbuildkernel1 buildkernel2: 1520f8dfe63SAaron LI ( cd ${SRCDIR}; \ 153448b21e7SSimon Schubert ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \ 1540f8dfe63SAaron LI make -j ${MAKE_JOBS} \ 1550f8dfe63SAaron LI ${.TARGET:C/build(.*)2/quick\1/:C/1//} ) 1566ca9a59cSMatthew Dillon 1572b43b38cSSascha Wildner# Unconditionally clean out ${ISOROOT} so a previous img build 15892b0ebb9SMatthew Dillon# does not blow up a future quick iso build 15992b0ebb9SMatthew Dillon# 1606ca9a59cSMatthew Dillonbuildiso: 16192b0ebb9SMatthew Dillon -chflags -R noschg ${ISOROOT} 16292b0ebb9SMatthew Dillon rm -rf ${ISOROOT} 16392b0ebb9SMatthew Dillon mkdir -p ${ISOROOT} 1640f8dfe63SAaron LI ( cd ${SRCDIR}; \ 1650f8dfe63SAaron LI make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld ) 1668f5a7f62SAaron LI # Do not mess with any /usr/obj directories not related to 1678f5a7f62SAaron LI # buildworld, buildkernel, or nrelease. 1680f8dfe63SAaron LI ( cd ${SRCDIR}/etc && \ 1698f5a7f62SAaron LI tmpdir=`mktemp -d -t nrelease` && \ 1708f5a7f62SAaron LI MAKEOBJDIRPREFIX=$${tmpdir} \ 1710f8dfe63SAaron LI make -m ${SRCDIR}/share/mk \ 1728f5a7f62SAaron LI DESTDIR=${ISOROOT} distribution && \ 1738f5a7f62SAaron LI rm -rf $${tmpdir} ) 17421aa02d0SChris Pressey cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd 1750f8dfe63SAaron LI ( cd ${SRCDIR}; make DESTDIR=${ISOROOT} reinstallkernel ) 17691856cf5SSascha Wildner rm -rf ${ISOROOT}/boot/kernel.old 1771c9d98d0SAntonio Huete Jimenez ln -sf kernel ${ISOROOT}/boot/kernel/kernel.BOOTP 1780f8dfe63SAaron LI mtree ${MTREE_FSCHG} -deU -f ${SRCDIR}/etc/mtree/BSD.var.dist \ 1799758d73aSSascha Wildner -p ${ISOROOT}/var 1806ca9a59cSMatthew Dillon dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev 1811968392dSAaron LI ${CHROOT_CMD} "rcrestart ldconfig" 1828188de86SMatthew Dillon 183699b6cdcSAaron LI# The GUI build includes the full system source (~500 MB) and the full 184699b6cdcSAaron LI# dports tree (~250 MB). The nominal release build only includes the 185699b6cdcSAaron LI# kernel source (~30 MB). 18619d86faaSMatthew Dillon# 187e2dbfa0bSThomas Nikolajsensrcs: 188699b6cdcSAaron LI rm -rf ${ISOROOT}/usr/dports 189699b6cdcSAaron LI rm -f ${ISOROOT}/usr/src-sys.tar.bz2 190e2dbfa0bSThomas Nikolajsen.if !defined(WITHOUT_SRCS) 191255a0279SMichael Neumann.if make(gui) 192699b6cdcSAaron LI ( cd ${ISOROOT}/usr && \ 193699b6cdcSAaron LI make dports-create-shallow GITURL_DPORTS=${GITURL_DPORTS} ) 194699b6cdcSAaron LI ( cd ${ISOROOT}/usr && \ 195699b6cdcSAaron LI make src-create-shallow GITURL_SRC=${GITURL_SRC} ) 196c19c746bSMatthew Dillon.else 1970f8dfe63SAaron LI ( cd ${SRCDIR} && \ 198699b6cdcSAaron LI tar --exclude .git -s '/^\./src/' -cf - \ 199699b6cdcSAaron LI ./Makefile ./Makefile.inc1 ./sys | \ 200699b6cdcSAaron LI bzip2 -9 > ${ISOROOT}/usr/src-sys.tar.bz2 ) 201c19c746bSMatthew Dillon.endif 20266b79064SMatthew Dillon.endif 20319d86faaSMatthew Dillon 2041968392dSAaron LI# Customize the ISO by copying rootskels in reverse priority order. 2055af45f85SMatthew Dillon# 2068188de86SMatthew Dilloncustomizeiso: 2075af45f85SMatthew Dillon # Copy the rootskels. Allow sources to be owned by someone other 2083cf4b4a1SSascha Wildner # than root (as is common when checked out via git). 2095af45f85SMatthew Dillon # 2108188de86SMatthew Dillon.for ROOTSKEL in ${ROOTSKELS} 2118188de86SMatthew Dillon cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT} 2125af45f85SMatthew Dillon @test -O ${.CURDIR} || echo "chowning copied files to root:wheel" 2135af45f85SMatthew Dillon @test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel)) 2148188de86SMatthew Dillon.endfor 2157249926bSMatthew Dillon pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd 2164fba3387SChris Pressey.for UPGRADE_ITEM in Makefile \ 2174fba3387SChris Pressey etc.${MACHINE_ARCH} \ 2184fba3387SChris Pressey rc.d/Makefile \ 2194fba3387SChris Pressey periodic/Makefile \ 2204fba3387SChris Pressey periodic/daily/Makefile \ 2214fba3387SChris Pressey periodic/security/Makefile \ 2224fba3387SChris Pressey periodic/weekly/Makefile \ 2234fba3387SChris Pressey periodic/monthly/Makefile 2240f8dfe63SAaron LI cp -R ${SRCDIR}/etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM} 2254fba3387SChris Pressey.endfor 2261968392dSAaron LI 2271968392dSAaron LI# Install packages by building from dports. 2288abe78a1SMatthew Dillon# 2291968392dSAaron LIpkgs: 230165b1c14SSascha Wildner.if !empty(DPORTS_PACKAGES) 2311c9d98d0SAntonio Huete Jimenez cp /etc/resolv.conf ${ISOROOT}/etc 2321968392dSAaron LI -@umount ${ISOROOT}/dev 2331968392dSAaron LI mount_null /dev ${ISOROOT}/dev 2341968392dSAaron LI 2355e885f07SSascha Wildner -@umount ${ISOROOT}/usr/distfiles 2362f36664eSSascha Wildner -@umount ${ISOROOT}/usr/dports 2372f36664eSSascha Wildner rm -rf ${ISOROOT}/usr/obj/dports 2381968392dSAaron LI 2392f36664eSSascha Wildner mkdir -p ${ISOROOT}/usr/dports 2405e885f07SSascha Wildner mkdir -p ${ISOROOT}/usr/distfiles 2411968392dSAaron LI 2421968392dSAaron LI # Mount /usr/dports read-only for safety, else a failed umount 2431968392dSAaron LI # and our rm -rf will do bad things. 2442f36664eSSascha Wildner mount_null -o ro ${DPORTS_PATH} ${ISOROOT}/usr/dports 2451968392dSAaron LI 2461968392dSAaron LI # Make sure /usr/distfiles is writable 247c36c5990SSascha Wildner cp /etc/shells ${ISOROOT}/usr/distfiles/.test > /dev/null 2>&1 \ 248c36c5990SSascha Wildner || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/distfiles 2491968392dSAaron LI 250c36c5990SSascha Wildner.for PKG in ${DPORTS_PACKAGES} 251*333a466dSAaron LI.if make(restartpkgs) 252*333a466dSAaron LI ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} deinstall" 253*333a466dSAaron LI.endif 254d25c1efdSSascha Wildner ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} install" 25520585f87SMatthew Dillon.endfor 2562f36664eSSascha Wildner.for PKG in ${DPORTS_PACKAGES} 257c36c5990SSascha Wildner ${CHROOT_CMD} "cd /usr/dports/${PKG} && make ${DPORTS_OPTIONS} clean" 2582f36664eSSascha Wildner.endfor 2591968392dSAaron LI 2602f36664eSSascha Wildner ${CHROOT_CMD} "yes | pkg autoremove" 2611968392dSAaron LI 2625e885f07SSascha Wildner -umount ${ISOROOT}/usr/distfiles 2632f36664eSSascha Wildner umount ${ISOROOT}/usr/dports 2641968392dSAaron LI 2655e885f07SSascha Wildner rm -rf ${ISOROOT}/usr/dports 2665e885f07SSascha Wildner rm -rf ${ISOROOT}/usr/distfiles 2671968392dSAaron LI rm -rf ${ISOROOT}/usr/obj/dports 2681968392dSAaron LI 2691968392dSAaron LI # Update the locate(8) and whatis(1) databases, allow ISODIR 270b34d3b9bSzrj # to be on tmpfs (fails to create locate database then) 2712f36664eSSascha Wildner # 272b34d3b9bSzrj -${CHROOT_CMD} /etc/periodic/weekly/310.locate 2731968392dSAaron LI -${CHROOT_CMD} /etc/periodic/weekly/320.whatis 2741968392dSAaron LI 27531d5c88cSSascha Wildner umount ${ISOROOT}/dev 2761968392dSAaron LI rm -f ${ISOROOT}/etc/resolv.conf 2771968392dSAaron LI 27844c4f44aSSascha Wildner # Recopy files that dports may have updated in /etc into /etc.hdd 279d68fa6c5SMatthew Dillon # 280d68fa6c5SMatthew Dillon cpdup ${ISOROOT}/etc/shells ${ISOROOT}/etc.hdd/shells 281d68fa6c5SMatthew Dillon cpdup ${ISOROOT}/etc/group ${ISOROOT}/etc.hdd/group 2821968392dSAaron LI.endif 2838398ca17SSascha Wildner 2846ca9a59cSMatthew Dillonmkiso: 2855fa778d7SSascha Wildner if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi 2865fa778d7SSascha Wildner -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 2875fa778d7SSascha Wildner vnconfig -u `cat ${ISODIR}/vn.which`; fi 2885fa778d7SSascha Wildner newfs_msdos -C 400k -F 12 -L EFI -m 0xf8 ${ISOROOT}/boot/efiboot.img 2895fa778d7SSascha Wildner vnconfig -l | grep "not in use" | head -n 1 | \ 2905fa778d7SSascha Wildner cut -f 1 -d: > ${ISODIR}/vn.which 2915fa778d7SSascha Wildner vnconfig -e -s labels `cat ${ISODIR}/vn.which` ${ISOROOT}/boot/efiboot.img 2925fa778d7SSascha Wildner mount_msdos /dev/`cat ${ISODIR}/vn.which` ${IMGMNT} 2935fa778d7SSascha Wildner mkdir -p ${IMGMNT}/EFI/BOOT 2945fa778d7SSascha Wildner cp ${ISOROOT}/boot/loader.efi ${IMGMNT}/EFI/BOOT/BOOTX64.EFI 2955fa778d7SSascha Wildner umount ${IMGMNT} 2965fa778d7SSascha Wildner ( cd ${ISOROOT}; mkisofs -R -J -o ${ISOFILE} \ 2975fa778d7SSascha Wildner -b boot/cdboot -no-emul-boot \ 2989d8dda4aSAaron LI -eltorito-alt-boot -eltorito-platform efi \ 2999d8dda4aSAaron LI -eltorito-boot boot/efiboot.img -no-emul-boot \ 3009d8dda4aSAaron LI -V ${LABEL:C/(^.{32}).*/\1/} . ) # cut label to <= 32 characters 3015fa778d7SSascha Wildner rm -f ${ISOROOT}/boot/efiboot.img 302b9c3e754SMichael Neumann 303b9c3e754SMichael Neumannmkimg: 30460b68cbbSMichael Neumann if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi 3059a122c9aSMatthew Dillon -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 3069a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which`; fi 307fe70af21SMatthew Dillon.ifdef IMGSIZE 308fe70af21SMatthew Dillon @echo "STEP: use an image size of ${IMGSIZE} 512-byte sectors" 309fe70af21SMatthew Dillon rm -f ${IMGFILE} 310fe70af21SMatthew Dillon sz=`bc -e "((${IMGSIZE}) * 512)" -equit`; truncate -s $${sz} ${IMGFILE} 311fe70af21SMatthew Dillon.else 3123342e40aSMatthew Dillon @echo "STEP: Determine required image size in 1GB steps" 3133342e40aSMatthew Dillon @echo " Leave ~600MB of unused space" 31460b68cbbSMichael Neumann sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \ 3153342e40aSMatthew Dillon sz=`bc -e "(($${sz}) * 1.15 + 999999 + 600000) / 1000000" -equit | \ 316fe70af21SMatthew Dillon cut -f1 -d.`; \ 317c843f8b0SMatthew Dillon sz=`bc -e "(($${sz}) * 953)" -equit | cut -f1 -d.`; \ 318fe70af21SMatthew Dillon rm -f ${IMGFILE}; \ 319fe70af21SMatthew Dillon truncate -s $${sz}M ${IMGFILE}; 320fe70af21SMatthew Dillon.endif 3219a122c9aSMatthew Dillon @echo "STEP: determine free vn device" 3229a122c9aSMatthew Dillon vnconfig -l | grep "not in use" | head -n 1 | \ 3239a122c9aSMatthew Dillon cut -f 1 -d: > ${ISODIR}/vn.which 3249a122c9aSMatthew Dillon vnconfig -e -s labels `cat ${ISODIR}/vn.which` ${IMGFILE} 3255fa778d7SSascha Wildner @echo "STEP: set up legacy MBR" 326cc3c231bSMatthew Dillon fdisk -b ${ISOROOT}/boot/mbr -IB `cat ${ISODIR}/vn.which` 3275fa778d7SSascha Wildner fdisk -s `cat ${ISODIR}/vn.which` >${ISODIR}/fdisk.dat 3285fa778d7SSascha Wildner awk '(NR==1){printf("g c%s h%s s%s\n", $$2, $$4, $$6);}' \ 3295fa778d7SSascha Wildner ${ISODIR}/fdisk.dat >${ISODIR}/fdisk.conf 3305fa778d7SSascha Wildner echo "p 1 239 63 257985" >>${ISODIR}/fdisk.conf 3315fa778d7SSascha Wildner awk '($$1=="1:"){printf("p 2 165 258048 %lu\n", $$3 - 258528);}' \ 3325fa778d7SSascha Wildner ${ISODIR}/fdisk.dat >>${ISODIR}/fdisk.conf 3335fa778d7SSascha Wildner echo "a 2" >>${ISODIR}/fdisk.conf 3345fa778d7SSascha Wildner fdisk -iv -f ${ISODIR}/fdisk.conf `cat ${ISODIR}/vn.which` 3355fa778d7SSascha Wildner rm ${ISODIR}/fdisk.conf ${ISODIR}/fdisk.dat 3365fa778d7SSascha Wildner newfs_msdos -F 32 -c 2 -L EFI -m 0xf8 `cat ${ISODIR}/vn.which`s1 3375fa778d7SSascha Wildner mount_msdos /dev/`cat ${ISODIR}/vn.which`s1 ${IMGMNT} 3385fa778d7SSascha Wildner mkdir -p ${IMGMNT}/EFI/BOOT 3395fa778d7SSascha Wildner cp ${ISOROOT}/boot/boot1.efi ${IMGMNT}/EFI/BOOT/BOOTX64.EFI 3405fa778d7SSascha Wildner umount ${IMGMNT} 3419a122c9aSMatthew Dillon @echo "STEP: write standard disklabel" 3425fa778d7SSascha Wildner disklabel -w -r `cat ${ISODIR}/vn.which`s2 auto 3439a122c9aSMatthew Dillon @echo "STEP: read disklabel back" 3445fa778d7SSascha Wildner disklabel -r `cat ${ISODIR}/vn.which`s2 > ${IMGFILE}.label 3453ac64890SAaron LI @echo "STEP: set disklabel name" 3463ac64890SAaron LI echo "label: ${LABEL}" >> ${IMGFILE}.label 3473ac64890SAaron LI @echo "STEP: add slice parition" 3483ac64890SAaron LI echo "a: * * 4.2BSD" >> ${IMGFILE}.label; 3499a122c9aSMatthew Dillon @echo "STEP: write modified disklabel back" 3505fa778d7SSascha Wildner disklabel -R -r `cat ${ISODIR}/vn.which`s2 ${IMGFILE}.label 3519a122c9aSMatthew Dillon rm ${IMGFILE}.label 352cc3c231bSMatthew Dillon disklabel -B -b ${ISOROOT}/boot/boot1_64 -s ${ISOROOT}/boot/boot2_64 \ 353cc3c231bSMatthew Dillon `cat ${ISODIR}/vn.which`s2 3545fa778d7SSascha Wildner newfs /dev/`cat ${ISODIR}/vn.which`s2a 3555fa778d7SSascha Wildner mount /dev/`cat ${ISODIR}/vn.which`s2a ${IMGMNT} 3569a122c9aSMatthew Dillon cpdup ${ISOROOT} ${IMGMNT} 3579a122c9aSMatthew Dillon @echo "STEP: fixup ${IMGMNT}/etc/fstab" 3583ac64890SAaron LI echo "/dev/part-by-label/${LABEL}.a / ufs rw,noatime 0 1" > ${IMGMNT}/etc/fstab 3593342e40aSMatthew Dillon echo "dummy /tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 3603342e40aSMatthew Dillon echo "dummy /var/tmp tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 361d4c25c30SSascha Wildner echo "dummy /var/run tmpfs rw,-C 0 0" >> ${IMGMNT}/etc/fstab 3623342e40aSMatthew Dillon echo "dummy /usr/obj tmpfs rw 0 0" >> ${IMGMNT}/etc/fstab 3639a122c9aSMatthew Dillon echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab 3649a122c9aSMatthew Dillon @echo "STEP: fixup ${IMGMNT}/boot/loader.conf" 3659a122c9aSMatthew Dillon -fgrep -v kernel_options ${IMGMNT}/boot/loader.conf > ${IMGMNT}/boot/loader.conf.new 3663ac64890SAaron LI echo 'vfs.root.mountfrom="ufs:part-by-label/${LABEL}.a"' >> ${IMGMNT}/boot/loader.conf.new 3679a122c9aSMatthew Dillon mv ${IMGMNT}/boot/loader.conf.new ${IMGMNT}/boot/loader.conf 3689a122c9aSMatthew Dillon @echo "STEP: cleanup" 3699a122c9aSMatthew Dillon df ${IMGMNT} 370836f3129SMatthew Dillon sync 371836f3129SMatthew Dillon sleep 1 3729a122c9aSMatthew Dillon umount ${IMGMNT} 3739a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which` 3749a122c9aSMatthew Dillon rm -f ${ISODIR}/vn.which 37560b68cbbSMichael Neumann rmdir ${IMGMNT} 376a4911276SMatthew Dillon @echo "STEP: done, image files are in ${ISODIR}" 377b9c3e754SMichael Neumann 3786ca9a59cSMatthew Dillonclean: 379836f3129SMatthew Dillon sync 380836f3129SMatthew Dillon sleep 1 3815e885f07SSascha Wildner -umount ${ISOROOT}/usr/distfiles > /dev/null 2>&1 3822f36664eSSascha Wildner -umount ${ISOROOT}/usr/dports > /dev/null 2>&1 3839a122c9aSMatthew Dillon -umount ${ISOROOT}/dev > /dev/null 2>&1 3849a122c9aSMatthew Dillon -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \ 3859a122c9aSMatthew Dillon vnconfig -u `cat ${ISODIR}/vn.which`; fi 3866ca9a59cSMatthew Dillon if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi 387c19c746bSMatthew Dillon rm -rf ${ISOROOT} 3889a122c9aSMatthew Dillon rm -f ${ISODIR}/.didbootstrap ${ISODIR}/vn.which 3896ca9a59cSMatthew Dillon 3906ca9a59cSMatthew Dillonrealclean: clean 391c19c746bSMatthew Dillon rm -rf ${ISODIR}/packages 392c19c746bSMatthew Dillon rm -rf ${ISODIR}/distfiles 3936ca9a59cSMatthew Dillon 394e2dbfa0bSThomas Nikolajsenhelp all: 3958126e4efSAaron LI @echo "Targets:" 3968126e4efSAaron LI @echo " release - full build from scratch" 3978126e4efSAaron LI @echo " quick - attempt to do an incremental rebuild" 3988126e4efSAaron LI @echo " realquick - attempt to restart after world & kernel" 3998126e4efSAaron LI @echo " restartpkgs - attempt to restart at the pkg building stage" 400aac6f66eSAaron LI @echo "" 401aac6f66eSAaron LI @echo "Optional targets:" 402aac6f66eSAaron LI @echo " nopkgs - do not install any packages" 403aac6f66eSAaron LI @echo " gui - do a GUI release" 4048abe78a1SMatthew Dillon @echo "" 4058126e4efSAaron LI @echo "Variables:" 4068126e4efSAaron LI @echo " DPORTS_EXTRA_PACKAGES: add additional packages" 4078126e4efSAaron LI @echo " GITURL_SRC: override the Git URL to source repository" 4088126e4efSAaron LI @echo " GITURL_DPORTS: override the Git URL to dports repository" 4098126e4efSAaron LI @echo " IMGSIZE: override the size of .img (in 512-byte sectors)" 4108126e4efSAaron LI @echo " MAKE_JOBS: override the default value (sysctl hw.ncpu)" 411aac6f66eSAaron LI @echo "" 412588a679cSSimon Schubert 413e2dbfa0bSThomas Nikolajsen.PHONY: release quickrel realquickrel 4149b29c40aSMatthew Dillon.PHONY: quick realquick 415e2dbfa0bSThomas Nikolajsen.PHONY: check buildworld1 buildworld2 41631d5c88cSSascha Wildner.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mkiso mkimg 4171968392dSAaron LI.PHONY: clean realclean help all srcs pkgs 418