3 # make release CHROOTDIR=/some/dir BUILDNAME=somename [ RELEASETAG=tag ]
5 # Where "/some/dir" is the pathname of a directory on a some
6 # filesystem with at least 1000MB of free space, "somename" is what
7 # you want the release to call itself and, optionally, which CVS "tag"
8 # name should be used when checking out the sources to build the release
11 # Please note: the vn driver must also be compiled into your kernel,
12 # otherwise the target 'release.8' and possibly others will fail.
14 # Set these, release builder!
17 #BUILDNAME=5.0-RELEASE
19 # Automatic SNAP versioning:
22 BUILDNAME?=${BASE}-${DATE}-SNAP
24 #CHROOTDIR=/junk/release
25 # If this is a -stable snapshot, then set
28 # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
29 # are building an official release. Otherwise, we are building for
31 .if defined(RELEASETAG)
32 ISRELEASE!= expr ${RELEASETAG} : '^RELENG_.*_RELEASE$$' || true
34 # Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
35 AUXRELEASETAG!= echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
36 DOCRELEASETAG?= ${AUXRELEASETAG}
37 PORTSRELEASETAG?= ${AUXRELEASETAG}
43 # If you want to pass flags to the world build such as -j X, use
44 # WORLD_FLAGS. Similarly, you can specify make flags for kernel
45 # builds via KERNEL_FLAGS.
49 # If you are using a local CVS repository with components stored in
50 # non-standard modules, override these on the make commandline or
52 RELEASESRCMODULE?= src
53 RELEASEDOCMODULE?= doc
54 RELEASEPORTSMODULE?= ports
56 # Unless set elsewhere, indicate the object format we'll be using.
59 # Uncomment this to disable the doc.1 target. It is also an ERROR
60 # to set NOPORTS and not set NODOC since docs depend on ports.
63 # Set ALLLANG=no if you want the release documentation to be
66 DOCPORTS= textproc/docproj
67 # Set this to wherever the distfiles required by ${DOCPORTS} live.
68 DOCDISTFILES?= ${.CURDIR}/../../ports/distfiles
69 # Set this to 1 if you want -P to be used for automatic keyboard detection
70 # on the boot floppy. WARNING: Breaks on some Athlon (K7) motherboards.
71 AUTO_KEYBOARD_DETECT?= 0
74 DIST_DOCS= ABOUT.TXT ERRATA.TXT LAYOUT.TXT README.TXT HARDWARE.TXT \
75 RELNOTES.TXT TROUBLE.TXT UPGRADE.TXT INSTALL.TXT
77 # Things which without too much trouble can be considered variables
78 # BIN_DISTS are special in that they get full /etc installation sets.
80 COMPAT_DISTS?= compat1x compat20 compat21 compat22 compat3x
81 OTHER_DISTS?= manpages catpages games proflibs dict info doc
82 CRYPTO_DISTS?= crypto krb4 krb5
84 DISTRIBUTIONS?= ${BIN_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
87 BOOT1= etc/protocols etc/defaults/rc.conf
89 # mountpoint for filesystems.
92 # Various floppy image parameters.
95 .if ${MACHINE_ARCH} == "i386"
96 .if ${MACHINE} == "pc98"
104 SMALLBOOTLABEL= fd1200
119 BIGBOOTLABEL= minimum2
121 .elif ${MACHINE_ARCH} == "alpha"
132 BIGBOOTLABEL= minimum2
135 ZIPNSPLIT= gzip --no-name -9 -c | split -b 240640 -
140 # Things which may get you into trouble if you change them
141 MTREEFILES= ${.CURDIR}/../etc/mtree
146 CD_DISC1= ${CD}/disc1
147 CD_DISC2= ${CD}/disc2
149 # Where the bootstrap ports (see DOCPORTS) get installed.
150 LOCALDIR= /usr/local/bin
152 # ${BOOTSTRAPDIR} is for those utilities that refer to the hosting
153 # environment, rather than the target environment. This is specifically
154 # intended for kernel-dependent utilities that are used during the build.
156 # ${BOOTSTRAPDIR} is actually being used by prepending it to the normal
157 # ${PATH}. Thus, it's also available to outside utilities like doFS.sh.
158 BOOTSTRAPDIR= /bootstrap
160 # The mount subsystem has been changed between 2.2 and 3.0 by the
162 BOOTSTRAPUTILS= /sbin/mount /sbin/umount
164 # 3.0 cpio tries to reference lchown(2) which is not available in 2.2
165 BOOTSTRAPUTILS+= /usr/bin/cpio
167 .if !defined(CRUNCH_TARGETS)
168 CRUNCH_TARGETS= boot fixit
171 .if ${MACHINE} == "pc98"
174 EXTRAS= cdrom.1 ftp.1
181 .if !defined(NOPORTREADMES)
182 MAKEREADMES= make readmes PORTSDIR=${CHROOTDIR}/usr/ports
188 .if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
189 @echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
191 .if defined(NOPORTS) && !defined(NODOC)
192 @echo "Ports are required for building the docs. Either set NODOC or"
193 @echo "unset NOPORTS!"
196 -vnconfig 2>/dev/null
198 .if exists(${CHROOTDIR})
199 # The first command will fail on a handful of files that have their schg
200 # flags set. But it greatly speeds up the next two commands.
201 -rm -rf ${CHROOTDIR} 2>/dev/null
202 -chflags -R noschg ${CHROOTDIR}/.
205 mkdir -p ${CHROOTDIR}
206 @echo ">>> make release started on `LC_TIME=C TZ=GMT date`"
207 cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
208 cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
209 if [ -f /etc/resolv.conf ]; then \
210 cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
212 cd ${.CURDIR}/.. && ${MAKE} installworld DESTDIR=${CHROOTDIR} NOMAN=1
213 mkdir ${CHROOTDIR}/${BOOTSTRAPDIR}
214 for i in ${BOOTSTRAPUTILS} ; do \
215 cp -p ${CHROOTDIR}$$i ${CHROOTDIR}/${BOOTSTRAPDIR} ; \
217 .if !defined(RELEASETAG)
218 cd ${CHROOTDIR}/usr && rm -rf src && \
219 cvs -R -d ${CVSROOT} co -P ${RELEASESRCMODULE}
221 cd ${CHROOTDIR}/usr && rm -rf src && \
222 cvs -R -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE}
224 .if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
225 cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
227 .if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
228 cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
230 .if !defined(NOPORTS)
231 .if defined(PORTSRELEASETAG)
232 cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
234 cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
238 .if defined(DOCRELEASETAG)
239 cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
241 cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P ${RELEASEDOCMODULE}
243 if [ -d ${DOCDISTFILES}/ ]; then \
244 cp -rp ${DOCDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
249 .if !defined(RELEASENOUPDATE)
250 .if !defined(RELEASETAG)
251 cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d
253 cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -r ${RELEASETAG}
255 .if !defined(NOPORTS)
256 cd ${CHROOTDIR}/usr/ports && cvs -R -q update -P -d
259 cd ${CHROOTDIR}/usr/doc && cvs -R -q update -P -d
263 # Add version information to those things that need it.
264 ( cd ${CHROOTDIR}/usr/src/sys/conf && \
265 mv newvers.sh foo && \
266 sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && rm foo )
267 echo OBJFORMAT=${OBJFORMAT} > ${CHROOTDIR}/etc/objformat
268 -test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
269 echo "#!/bin/sh" > ${CHROOTDIR}/mk
270 echo "set -ex" >> ${CHROOTDIR}/mk
271 echo "_RELTARGET=\$${1:-doRELEASE}" >> ${CHROOTDIR}/mk
272 echo "export CFLAGS='-O -pipe'" >> ${CHROOTDIR}/mk
273 echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk
274 echo "export BUILDNAME=${BUILDNAME}" >> ${CHROOTDIR}/mk
275 echo "export VNDEVICE=${VNDEVICE}" >> ${CHROOTDIR}/mk
276 echo "export OBJFORMAT=${OBJFORMAT}" >> ${CHROOTDIR}/mk
277 .if defined(RELEASETAG)
278 echo "export RELEASETAG=${RELEASETAG}" >> ${CHROOTDIR}/mk
281 echo "export NOPORTS=${NOPORTS}" >> ${CHROOTDIR}/mk
284 echo "export NODOC=${NODOC}" >> ${CHROOTDIR}/mk
286 .if defined(ALLLANG) && ${ALLLANG} != "NO" && ${ALLLANG} != "no"
287 echo "export ALLLANG=${ALLLANG}" >> ${CHROOTDIR}/mk
289 echo "export DOC_LANG=en_US.ISO_8859-1" >> ${CHROOTDIR}/mk
292 echo "export NOSRC=${NOSRC}" >> ${CHROOTDIR}/mk
294 .if defined(NOSHARED)
295 echo "export NOSHARED=${NOSHARED}" >> ${CHROOTDIR}/mk
297 .if defined(USA_RESIDENT)
298 echo "export USA_RESIDENT=${USA_RESIDENT}" >> ${CHROOTDIR}/mk
300 .if defined(BOOT_CONFIG)
301 echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk
303 .if defined(KERNEL_FLAGS)
304 echo "export KERNEL_FLAGS=\"${KERNEL_FLAGS}\"" >> ${CHROOTDIR}/mk
306 # Don't remove this, or the build will fall over!
307 echo "export RELEASEDIR=${_R}" >> ${CHROOTDIR}/mk
308 echo "export PATH=${BOOTSTRAPDIR}:$${PATH}:${LOCALDIR}" >> ${CHROOTDIR}/mk
309 echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk
310 echo " cd /usr/src" >> ${CHROOTDIR}/mk
312 echo " (cd etc; make distrib-dirs distribution)" >> ${CHROOTDIR}/mk
313 echo " make ${WORLD_FLAGS} world && \\" >> ${CHROOTDIR}/mk
316 echo " make ${WORLD_FLAGS} all install && \\" >> ${CHROOTDIR}/mk
318 echo " touch /tmp/.world_done" >> ${CHROOTDIR}/mk
319 echo "fi" >> ${CHROOTDIR}/mk
320 echo "cd /usr/src/release/sysinstall" >> ${CHROOTDIR}/mk
321 echo "make obj" >> ${CHROOTDIR}/mk
322 echo "cd /usr/src/release" >> ${CHROOTDIR}/mk
323 echo "make \$${_RELTARGET}" >> ${CHROOTDIR}/mk
324 echo "echo \">>> make ${.TARGET} finished on \`LC_TIME=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
325 chmod 755 ${CHROOTDIR}/mk
326 chroot ${CHROOTDIR} /mk
329 rm -rf boot_crunch release.[0-9]
331 # Clean out ${_R} and make the directory structure.
334 -rm -rf ${_R}/* 2> /dev/null
335 -chflags -R noschg ${_R}/.
342 for i in ${DISTRIBUTIONS} ; do \
343 mkdir ${RD}/trees/$$i && \
344 mkdir ${RD}/dists/$$i && \
345 mtree -deU -f ${MTREEFILES}/BSD.root.dist \
346 -p ${RD}/trees/$$i > /dev/null && \
347 mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
348 -p ${RD}/trees/$$i/usr > /dev/null && \
349 mtree -deU -f ${MTREEFILES}/BSD.include.dist \
350 -p ${RD}/trees/$$i/usr/include > /dev/null && \
351 mtree -deU -f ${MTREEFILES}/BSD.var.dist \
352 -p ${RD}/trees/$$i/var > /dev/null ; \
356 # Install the system into the various distributions.
358 cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
359 cd ${.CURDIR}/.. && make distribworld DISTDIR=${RD}/trees
360 .if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
361 cd ${.CURDIR}/../kerberosIV && ( \
363 make obj all help-distribute DISTDIR=${RD}/trees &&\
367 .if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
368 cd ${.CURDIR}/../kerberos5 && ( \
370 make obj all help-distribute DISTDIR=${RD}/trees &&\
374 -chflags -R noschg ${RD}/trees
377 # Make and install the generic kernel(s).
379 .for kernel in ${KERNELS}
380 -chflags -R noschg ${RD}/kernels/${kernel}
381 rm -rf ${RD}/kernels/${kernel}
382 rm -rf ${.CURDIR}/../sys/compile/${kernel}
383 cd ${.CURDIR} && ${MAKE} doSTDKERNEL KERNEL=${kernel} KODIR=/${kernel}
384 rm -rf ${.CURDIR}/../sys/compile/${kernel}
385 -mkdir ${RD}/trees/bin/boot/${kernel}
386 cp -p ${RD}/kernels/${kernel}/kernel ${RD}/trees/bin/boot/${kernel}
388 # Install a standard boot kernel+modules
389 mkdir -p ${RD}/trees/bin/boot/kernel
390 cp -Rp ${RD}/kernels/GENERIC/* ${RD}/trees/bin/boot/kernel
393 # Make and install the three crunched binaries which live on the floppies.
394 # You are not supposed to like this :-)
396 # NB: the "RELEASE_BUILD_FIXIT" magic prevents vi from including the
397 # Tcl and Perl APIs. See also /usr/src/usr.bin/vi/Makefile.
398 # It also prevents ls linking against termcap by disabling color support.
399 # See /usr/src/bin/ls/Makefile.
402 cd ${.CURDIR}/sysinstall && make obj depend all install
404 mkdir -p ${RD}/crunch
405 export RELEASE_BUILD_FIXIT=noway ; \
406 for j in ${CRUNCH_TARGETS} ; do \
407 rm -rf $${j}_crunch && \
408 mkdir $${j}_crunch && \
409 ( cd $${j}_crunch && \
410 ( ( [ -f ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ] && \
411 crunchgen ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ) || \
412 ( crunchgen ${.CURDIR}/$${j}_crunch.conf ) ) && \
413 ${MAKE} -DRELEASE_CRUNCH -f $${j}_crunch.mk subclean all \
414 NOCRYPT=yes "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \
415 mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
416 true || { rm -rf $${j}_crunch ; false ; } ; \
421 # --==## Fix up the distributions. ##==--
424 # Handle some grief caused by the munition braindeadness.
425 for i in sbin/init bin/ed usr.sbin/ppp usr.sbin/pppd usr.sbin/sendmail usr.sbin/tcpdump/tcpdump ; do \
426 ( cd ${.CURDIR}/../$$i; \
427 make -DNOCRYPT clean all distribute DISTDIR=${RD}/trees ) ; \
430 # Create any "synthetic dists" now.
431 @for i in ${DISTRIBUTIONS}; do \
432 if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
433 echo -n "Running $$i dist creation script... "; \
434 env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
439 # Create symlinks for the MD5-based crypt lib, too. The
440 # automatically created links still point to the DES stuff,
441 # which went into its own distribution.
442 for i in ${RD}/trees/bin/usr/lib/libscrypt* ; do \
443 c=`echo $$i | sed -e 's/libscrypt/libcrypt/'` ; \
445 ln -s `basename $$i` $$c ; \
448 # Remove all the directories we don't need.
450 find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
454 # --==## Package up the tarballs from assembled trees ##==--
459 @for i in ${DISTRIBUTIONS} ; \
461 if [ -d ${RD}/trees/$${i} ] ; then \
462 cd ${.CURDIR} && $(MAKE) doTARBALL \
463 SD=${RD}/trees/$${i} \
464 TN=$$i TD=$$i ARG="." && \
465 echo "$${i} distribution is finished."; \
468 # More munition braindeadness.
469 ( cd ${RD}/dists && \
470 if [ -f krb4/krb4.aa ] ; then mv krb4/* crypto && rmdir krb4 ; fi )
471 ( cd ${RD}/dists && \
472 if [ -f krb5/krb5.aa ] ; then mv krb5/* crypto && rmdir krb5 ; fi )
477 # --==## Make source dists ##==--
481 @cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
482 TD=src TN=sbase ARG="[A-Z]*"
483 @for i in `cd /usr/src && echo [a-z]*` ; do \
484 if [ -d /usr/src/$$i ] ; then \
485 cd ${.CURDIR} && $(MAKE) doTARBALL \
486 TN=`echo s$$i | tr -d '.' | \
488 -e 's/kerberosIV/krb4/' \
489 -e 's/kerberos5/krb5/'` \
490 SD=/usr/src TD=src ARG="$$i" ; \
493 .if defined(EXTRA_SRC)
494 @set ${EXTRA_SRC} && \
495 while [ $$# -ge 2 ] ; do \
496 if [ -d /usr/src/$$1 ] ; then \
497 cd ${.CURDIR} && $(MAKE) doTARBALL \
498 SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
499 fi && shift && shift ; \
502 if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
503 if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
504 if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
505 if [ -f skrb4.aa ] ; then mv skrb4.* ../crypto ; fi && \
506 if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; ) ; fi
507 @echo "src distribution is finished."
511 # Complete the bootfd
513 # Now, just to get this picture down once and for all:
515 # +------------------------------------------------------------------------+
517 # +-----+-----+------------------------------------------------------------+
518 # |boot1|boot2|floppy filesystem "bootfd" |
519 # +-----+-----+-+--------------------------------------------------------+-+
521 # +------------+-----------------------------------------+-+
522 # |mfs filesystem "mfsfd" |
523 # +-----------------------------------------+
526 release.8: write_mfs_in_kernel
530 mkdir -p etc/defaults dev mnt stand/help
531 @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
532 DIR=${RD}/mfsfd/stand ZIP=false
533 ( cd ${RD}/trees/bin/dev && \
534 ls console tty bpf0 ttyv0 ttyv1 ttyv2 ttyv3 null zero card0 card1 card2 card3 usb usb0 uhid0 ums0 ulpt0 ugen0 kbd0 kmem mem | \
535 cpio -dump ${RD}/mfsfd/dev )
536 ( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
537 ( cd ${RD}/mfsfd && \
538 for dir in bin sbin ; do \
539 ln -sf /stand $$dir; \
541 cp /sbin/dhclient-script ${RD}/mfsfd/stand
542 cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf
543 cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
544 cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
545 echo "nameserver 42/tcp name" > ${RD}/mfsfd/stand/etc/services
546 echo "ftp 21/tcp" >> ${RD}/mfsfd/stand/etc/services
547 echo "domain 53/tcp nameserver" >> ${RD}/mfsfd/stand/etc/services
548 echo "domain 53/udp nameserver" >> ${RD}/mfsfd/stand/etc/services
549 echo "cmd 514/tcp shell" >> ${RD}/mfsfd/stand/etc/services
550 gzip -9c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
551 @for i in README.TXT RELNOTES.TXT INSTALL.TXT UPGRADE.TXT HARDWARE.TXT; do \
552 if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \
553 gzip -9c ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} > ${RD}/mfsfd/stand/help/$${i}.gz; \
555 gzip -9c ${.CURDIR}/texts/$${i} > ${RD}/mfsfd/stand/help/$${i}.gz; \
558 -test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
559 @mkdir -p ${RD}/mfsfd/boot
560 @cp /boot/boot* ${RD}/mfsfd/boot
561 @cp /boot/loader.help ${RD}/mfsfd/boot
562 @cd ${.CURDIR} && ${MAKE} createBOOTMFS
563 .if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
564 @cd ${.CURDIR} && ${MAKE} doMODULES KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
566 @echo "Making the regular boot floppy."
567 @tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \
568 tar xf - -C ${RD}/mfsfd/stand
569 @echo "Compressing doc files..."
570 @gzip -9 ${RD}/mfsfd/stand/help/*.hlp
571 .if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
572 @mkdir -p ${RD}/mfsfd/stand/modules
573 @perl ${.CURDIR}/scripts/driver-copy2.pl \
574 ${.CURDIR}/${MACHINE_ARCH}/drivers.conf \
575 ${RD}/kernels ${RD}/mfsfd/stand/modules
577 sh -e ${.CURDIR}/scripts/doFS.sh -s mfsroot ${RD} ${MNT} \
578 ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
579 @gzip -9vc mfsroot > mfsroot.gz
580 .if ${MACHINE} == "pc98"
581 @sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
582 ${RD} ${MNT} ${SMALLBOOTSIZE} mfsroot.gz \
583 ${BOOTINODE} ${SMALLBOOTLABEL}
584 @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
585 @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
587 @sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
588 ${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
589 @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
590 @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
592 @rm mfsroot mfsroot.gz mfsroot.size
593 @echo "Regular and MFS boot floppies made."
597 # --==## Create a fixit floppy ##==--
600 @echo "Making fixit floppy."
601 @rm -rf ${RD}/fixitfd
603 @cd ${RD}/fixitfd && \
604 mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
606 @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
607 DIR=${RD}/fixitfd/stand ZIP=false
608 @( cd ${RD}/fixitfd/dev && \
609 cp ${RD}/trees/bin/dev/MAKEDEV MAKEDEV && \
610 chmod 755 MAKEDEV && \
612 @cp ${RD}/trees/bin/etc/spwd.db ${RD}/trees/bin/etc/group \
613 ${RD}/trees/bin/etc/protocols ${RD}/fixitfd/etc
614 @cp ${RD}/trees/bin/usr/share/misc/scsi_modes \
615 ${RD}/fixitfd/usr/share/misc
616 @cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
617 @cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
618 @cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
619 @chmod 555 ${RD}/fixitfd/stand/tar
620 @sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/fixit.flp ${RD} \
621 ${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
622 # Do our last minute floppies directory setup in a convenient place.
623 @cp ${.CURDIR}/texts/FLOPPIES.TXT ${RD}/floppies/README.TXT
624 @(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
628 # --==## Setup a suitable ftp-area ##==--
631 @echo "Setting up FTP distribution area"
633 -@ln -s . ${FD}/${BUILDNAME}
634 @cd ${RD} && find floppies -print | cpio -dumpl ${FD}
635 @cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
636 @for i in ${DIST_DOCS}; do \
637 if [ -f ${.CURDIR}/texts/$${i} ]; then \
638 cp ${.CURDIR}/texts/$${i} ${FD}; \
640 if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \
641 echo "=== Platform specifics for ${MACHINE_ARCH}" >> ${FD}/$${i}; \
642 cat ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} >> ${FD}/$${i}; \
645 @echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
646 .if !defined(NOPORTS)
647 @tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
652 # --==## Setup a suitable cdrom-area ##==--
655 @echo "Setting up CDROM distribution area"
656 @mkdir -p ${CD_DISC1} ${CD_DISC2}
657 @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
658 @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
659 @ln -f ${RD}/kernels/MFSKERNEL.boot ${CD_DISC1}/kernel
660 @for i in ${DISTRIBUTIONS} ; \
662 if [ -d ${RD}/trees/$${i} ] ; then \
663 chflags -R noschg ${RD}/trees/$${i} || true ; \
664 ( cd ${RD}/trees/$${i} && \
665 find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
668 @rm -f ${CD_DISC2}/.profile
669 @cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
670 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
671 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
672 @for i in ${DIST_DOCS}; do \
673 if [ -f ${.CURDIR}/texts/$${i} ]; then \
674 cp ${.CURDIR}/texts/$${i} ${CD_DISC1}; \
676 if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \
677 echo "=== Platform specifics for ${MACHINE_ARCH}" >> ${CD_DISC1}/$${i}; \
678 cat ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} >> ${CD_DISC1}/$${i}; \
681 .if ${MACHINE_ARCH} == "alpha"
682 @echo "Setting up Alpha CD disc1 for booting"
683 @cp -Rp ${RD}/image.boot/boot ${CD_DISC1}
684 @ln -f ${CD_DISC2}/boot/cdboot ${CD_DISC1}/boot
685 @ln -f ${CD_DISC1}/boot/loader.rc ${CD_DISC2}/boot
686 @ln -f ${CD_DISC1}/kernel ${CD_DISC2}/kernel
688 .if !defined(NOPORTS)
689 @-rm -rf /usr/ports/distfiles/*
690 @mkdir -p ${CD_DISC1}/ports && \
691 tar --exclude CVS -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
692 cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
693 && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
698 @echo "Making docs..."
699 @for i in ${DOCPORTS}; do \
700 cd /usr/ports/$$i && make all install clean JADETEX=no FORCE_PKG_REGISTER=yes; \
702 @cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/bin/usr/share/doc
705 # Various "subroutine" and other supporting targets.
713 @echo "SD undefined in doTARBALL" && exit 1
716 @echo "TB undefined in doTARBALL" && exit 1
719 @echo "ARG undefined in doTARBALL" && exit 1
721 @rm -rf ${RD}/dists/${TD}/${TN}*
722 @mkdir -p ${RD}/dists/${TD}
724 tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
725 echo rolling ${TD}/$$tn tarball &&\
726 tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
727 ${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
728 sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
729 ${RD}/dists/${TD}/$$tn.inf && \
730 if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
731 cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
733 if [ "${SD}" != "/usr/src" ]; then \
734 mtree -c -i -p ${SD}/${ARG} \
735 -k gname,md5digest,mode,nlink,uname,size,link,type \
736 > ${RD}/dists/${TD}/$$tn.mtree ; \
740 (cd ${RD}/dists/${TD}; \
741 rm -f CHECKSUM.MD5; \
742 md5 * > CHECKSUM.MD5) \
745 doRELEASE: release.1 release.2 ${DOCREL} release.3 release.4 release.5 \
746 release.6 release.7 release.8 release.9
747 @cd ${.CURDIR} && ${MAKE} ${EXTRAS}
751 @cd ${.CURDIR} && ${MAKE} boot.flp
752 @cd ${.CURDIR} && ${MAKE} fixit.flp
753 @cd ${RD} && find floppies -print | cpio -dumpl ${FD}
756 @rm -f release.4 release.8
757 @cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot
760 @rm -f release.4 release.9
761 @cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit
763 write_mfs_in_kernel: ${.CURDIR}/write_mfs_in_kernel.c
764 ${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c
768 @echo "CRUNCH undefined in installCRUNCH" && exit 1
771 @echo "DIR undefined in installCRUNCH" && exit 1
774 @echo "ZIP undefined in installCRUNCH" && exit 1
777 gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
779 ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
781 @chmod 555 ${DIR}/${CRUNCH}_crunch
782 @if [ -f ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf ] ; then \
783 for i in `crunchgen -l ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf` ; do \
784 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
787 for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
788 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
793 # --==## BOOTMFS config file ##==--
797 @cd ${.CURDIR}/../sys/${MACHINE}/conf && \
798 sh ${.CURDIR}/scripts/dokern.sh ${FDSIZE} < ${KERNCONF} > BOOTMFS && \
799 [ -r ${KERNCONF}.hints ] && cp ${KERNCONF}.hints BOOTMFS.hints
800 .if ${MACHINE_ARCH} == "i386"
801 @echo "options INTRO_USERCONFIG" >> \
802 ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
804 .if defined(FDSIZE) && ${FDSIZE} == "BIG"
805 @echo "options MD_ROOT_SIZE=`cat mfsroot.size`" >> \
806 ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
808 .if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
809 @perl ${.CURDIR}/scripts/driver-remove.pl \
810 ${.CURDIR}/${MACHINE_ARCH}/drivers.conf \
811 ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
815 # --==## Compile a kernel by name ${KERNEL} ##==--
817 # We don't erase the sys/compile/${KERNEL} directory, since somebody
818 # may want to reuse it (release.8 presently)
821 @rm -f ${RD}/kernels/${KERNEL}
822 @cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
823 @cd ${.CURDIR}/../sys/compile/${KERNEL} && \
824 make kernel-depend && \
825 make ${KERNEL_FLAGS} ${KERNEL_KO} && \
826 make kernel-reinstall DESTDIR=${RD}/kernels && \
827 [ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
828 cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
831 @rm -f ${RD}/kernels/*.ko
832 @cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
833 @cd ${.CURDIR}/../sys/compile/${KERNEL} && \
834 make kernel-depend && \
835 make ${KERNEL_FLAGS} modules && \
836 make modules-reinstall DESTDIR=${RD}/kernels && \
839 @rm -f ${RD}/kernels/${KERNEL}
840 @cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
841 @cd ${.CURDIR}/../sys/compile/${KERNEL} && \
843 make ${KERNEL_FLAGS} KERNEL=${kernel} && \
844 make KERNEL=${kernel} DESTDIR=${RD}/kernels install && \
845 [ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
846 cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
849 # --==## Put a filesystem into a BOOTMFS kernel ##==--
852 @echo "Running doMFSKERN for ${FSIMAGE}"
853 @rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE}
854 @cd ${.CURDIR} && ${MAKE} createBOOTMFS
855 @cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
856 @rm -rf ${RD}/image.${FSIMAGE}
857 @mkdir ${RD}/image.${FSIMAGE}
858 @cd ${RD}/kernels && \
859 (chflags noschg BOOTMFS || true) && \
861 cp BOOTMFS BOOTMFS.${FSIMAGE} && \
862 [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
863 mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
864 @echo "Setting up /boot directory for ${FSIMAGE} floppy"
865 @mkdir -p ${RD}/image.${FSIMAGE}/boot
866 @cp /boot/loader ${RD}/image.${FSIMAGE}/boot
867 @[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
868 sed -e '/^hint/s/^/set /' -e '/^#/d' \
869 ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
870 ${RD}/image.${FSIMAGE}/boot/device.hints && \
871 echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
872 @echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
873 .if !defined(FDSIZE) || ${FDSIZE} != "BIG"
874 @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
875 @echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
876 @echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
877 @echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
879 @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
880 @echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
881 .if ${MACHINE_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
882 @echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
884 .if defined(FDSIZE) && ${FDSIZE} == "BIG"
885 @echo "Writing MFS image into kernel for ${FSIMAGE} floppy"
886 @./write_mfs_in_kernel ${RD}/image.${FSIMAGE}/kernel mfsroot
887 @cp ${RD}/image.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE}
889 @gzip -9v ${RD}/image.${FSIMAGE}/kernel
890 @rm -f ${RD}/floppies/${FSIMAGE}.flp
891 .if defined(FDSIZE) && ${FDSIZE} == "BIG"
892 sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
893 ${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
894 ${BOOTINODE} ${BIGBOOTLABEL}
895 .elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
896 sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
897 ${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
898 ${BOOTINODE} ${SMALLBOOTLABEL}
900 sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
901 ${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
902 ${BOOTINODE} ${BOOTLABEL}
904 @echo "Created ${RD}/floppies/${FSIMAGE}.flp"
906 .include <bsd.prog.mk>