1# $FreeBSD$ 2# 3# make release CHROOTDIR=/some/dir BUILDNAME=somename [ RELEASETAG=tag ] 4# 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 9# (default is HEAD). 10# 11# Please note: the vn driver must also be compiled into your kernel, 12# otherwise the target 'release.8' and possibly others will fail. 13# 14# Set these, release builder! 15# 16# Fixed version: 17#BUILDNAME=4.0-RELEASE 18# 19# Automatic SNAP versioning: 20DATE != date +%Y%m%d 21BASE = 4.0 22BUILDNAME?=${BASE}-${DATE}-SNAP 23# 24#CHROOTDIR=/junk/release 25# If this is a -stable snapshot, then set 26#RELEASETAG=RELENG_3 27# 28# Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we 29# are building an official release. Otherwise, we are building for 30# a branch. 31.if defined(RELEASETAG) 32ISRELEASE!= expr ${RELEASETAG} : '^RELENG_.*_RELEASE$$' || true 33.if ${ISRELEASE} != 0 34# Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees. 35AUXRELEASETAG!= echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//' 36.endif 37.endif 38 39KERNCONF=GENERIC 40 41# If you are using a local CVS repository with components stored in 42# non-standard modules, override these on the make commandline or 43# in the environment. 44RELEASESRCMODULE?= src 45RELEASEDOCMODULE?= doc 46RELEASEPORTSMODULE?= ports 47 48# Unless set elsewhere, indicate the object format we'll be using. 49OBJFORMAT?= elf 50 51# Uncomment this to disable the doc.1 target. It is also an ERROR 52# to set NOPORTS and not set NODOC since docs depend on ports. 53#NODOC= YES 54#NOPORTS= YES 55# Comment the following if you want the release documentation to be 56# in English only. 57ALLLANG= yes 58DOCPORTS= textproc/docproj 59# Set this to wherever the distfiles required by ${DOCPORTS} live. 60DISTFILES?= ${.CURDIR}/../../ports/distfiles 61 62DIST_DOCS= ABOUT.TXT ERRATA.TXT LAYOUT.TXT README.TXT HARDWARE.TXT \ 63 RELNOTES.TXT TROUBLE.TXT UPGRADE.TXT INSTALL.TXT 64 65# Things which without too much trouble can be considered variables 66# BIN_DISTS are special in that they get full /etc installation sets. 67# 68COMPAT_DISTS?= compat1x compat20 compat21 compat22 compat3x 69OTHER_DISTS?= manpages catpages games proflibs dict info doc 70CRYPTO_DISTS?= crypto krb4 krb5 71BIN_DISTS?= bin 72DISTRIBUTIONS?= ${BIN_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} 73KERNELS?= GENERIC 74 75# Extra source tarballs; each argument is a pair of source dir and 76# distribution name. The dist name should not exceed 7 characters 77# (another "s" for "source" will be prepended). 78EXTRA_SRC+= usr.sbin/sendmail/cf smailcf 79 80BOOT1= etc/protocols etc/defaults/rc.conf 81 82# mountpoint for filesystems. 83MNT= /mnt 84 85# Various floppy image parameters. 86# 87BOOTSIZE= 1440 88FIXITSIZE= 1440 89MFSSIZE= 2880 90BIGBOOTSIZE= 2880 91BOOTINODE= 80000 92MFSINODE= 8000 93FIXITINODE= 4000 94BOOTLABEL= fd1440 95FIXITLABEL= fd1440 96BIGBOOTLABEL= minimum2 97MFSLABEL= minimum2 98 99# overrides. 100.if ${MACHINE_ARCH} == "alpha" 101FIXITSIZE= 2880 102FIXITLABEL= minimum2 103.endif 104 105ZIPNSPLIT= gzip --no-name -9 -c | split -b 240640 - 106 107 108VNDEVICE?= vn0 109 110# Things which may get you into trouble if you change them 111MTREEFILES= ${.CURDIR}/../etc/mtree 112_R= /R 113RD= ${_R}/stage 114FD= ${_R}/ftp 115CD= ${_R}/cdrom 116CD_DISC1= ${CD}/disc1 117CD_DISC2= ${CD}/disc2 118 119# Where the bootstrap ports (see DOCPORTS) get installed. 120LOCALDIR= /usr/local/bin 121 122# ${BOOTSTRAPDIR} is for those utilities that refer to the hosting 123# environment, rather than the target environment. This is specifically 124# intended for kernel-dependent utilities that are used during the build. 125# 126# ${BOOTSTRAPDIR} is actually being used by prepending it to the normal 127# ${PATH}. Thus, it's also available to outside utilities like doFS.sh. 128BOOTSTRAPDIR= /bootstrap 129# 130# The mount subsystem has been changed between 2.2 and 3.0 by the 131# Lite2 import. 132BOOTSTRAPUTILS= /sbin/mount /sbin/umount 133# 134# 3.0 cpio tries to reference lchown(2) which is not available in 2.2 135BOOTSTRAPUTILS+= /usr/bin/cpio 136 137.if !defined(CRUNCH_TARGETS) 138CRUNCH_TARGETS= boot fixit 139.endif 140 141.if ${MACHINE_ARCH} == "i386" 142# Make both PC-card boot.flp and plain boot.flp 143EXTRAS= floppies cdrom.1 ftp.1 144.else 145EXTRAS= cdrom.1 ftp.1 146.endif 147 148.if !defined(NODOC) 149DOCREL= doc.1 150.endif 151 152rerelease release: 153.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT) 154 @echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false 155.endif 156.if make(release) 157.if exists(${CHROOTDIR}) 158# The first command will fail on a handful of files that have their schg 159# flags set. But it greatly speeds up the next two commands. 160 -rm -rf ${CHROOTDIR} 2>/dev/null 161 -chflags -R noschg ${CHROOTDIR}/. 162 -rm -rf ${CHROOTDIR} 163.endif 164 mkdir -p ${CHROOTDIR} 165 cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR} 166 cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR} 167 if [ -f /etc/resolv.conf ]; then \ 168 cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \ 169 fi 170 cd ${.CURDIR}/.. && ${MAKE} installworld DESTDIR=${CHROOTDIR} NOMAN=1 171 mkdir ${CHROOTDIR}/${BOOTSTRAPDIR} 172 for i in ${BOOTSTRAPUTILS} ; do \ 173 cp -p ${CHROOTDIR}$$i ${CHROOTDIR}/${BOOTSTRAPDIR} ; \ 174 done 175.if !defined(RELEASETAG) 176 cd ${CHROOTDIR}/usr && rm -rf src && \ 177 cvs -R -d ${CVSROOT} co -P ${RELEASESRCMODULE} 178.else 179 cd ${CHROOTDIR}/usr && rm -rf src && \ 180 cvs -R -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE} 181.endif 182.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES}) 183 cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES} 184.endif 185.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT}) 186 cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT} 187.endif 188.if !defined(NOPORTS) 189.if defined(AUXRELEASETAG) 190 cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${AUXRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && make readmes PORTSDIR=${CHROOTDIR}/usr/ports 191.else 192 cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && make readmes PORTSDIR=${CHROOTDIR}/usr/ports 193.endif 194.endif 195.if !defined(NODOC) 196.if defined(AUXRELEASETAG) 197 cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P -r ${AUXRELEASETAG} ${RELEASEDOCMODULE} 198.else 199 cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P ${RELEASEDOCMODULE} 200.endif 201 if [ -d ${DISTFILES}/ ]; then \ 202 cp -rp ${DISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \ 203 fi 204.endif 205.endif 206.if make(rerelease) 207.if !defined(RELEASENOUPDATE) 208.if !defined(RELEASETAG) 209 cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d 210.else 211 cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -r ${RELEASETAG} 212.endif 213.if !defined(NOPORTS) 214 cd ${CHROOTDIR}/usr/ports && cvs -R -q update -P -d 215.endif 216.if !defined(NODOC) 217 cd ${CHROOTDIR}/usr/doc && cvs -R -q update -P -d 218.endif 219.endif 220.endif 221 # Add version information to those things that need it. 222 ( cd ${CHROOTDIR}/usr/src/sys/conf && \ 223 mv newvers.sh foo && \ 224 sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && rm foo ) 225 echo OBJFORMAT=${OBJFORMAT} > ${CHROOTDIR}/etc/objformat 226 -test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release 227 echo "#!/bin/sh" > ${CHROOTDIR}/mk 228 echo "set -ex" >> ${CHROOTDIR}/mk 229 echo "_RELTARGET=\$${1:-doRELEASE}" >> ${CHROOTDIR}/mk 230 echo "export CFLAGS='-O -pipe'" >> ${CHROOTDIR}/mk 231 echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk 232 echo "export BUILDNAME=${BUILDNAME}" >> ${CHROOTDIR}/mk 233 echo "export VNDEVICE=${VNDEVICE}" >> ${CHROOTDIR}/mk 234 echo "export OBJFORMAT=${OBJFORMAT}" >> ${CHROOTDIR}/mk 235.if defined(RELEASETAG) 236 echo "export RELEASETAG=${RELEASETAG}" >> ${CHROOTDIR}/mk 237.endif 238.if defined(NOPORTS) 239 echo "export NOPORTS=${NOPORTS}" >> ${CHROOTDIR}/mk 240.endif 241.if defined(NODOC) 242 echo "export NODOC=${NODOC}" >> ${CHROOTDIR}/mk 243.endif 244.if defined(ALLLANG) 245 echo "export ALLLANG=${ALLLANG}" >> ${CHROOTDIR}/mk 246.else 247 echo "export DOC_LANG=en_US.ISO_8859-1" >> ${CHROOTDIR}/mk 248.endif 249.if defined(NOSRC) 250 echo "export NOSRC=${NOSRC}" >> ${CHROOTDIR}/mk 251.endif 252.if defined(NOSHARED) 253 echo "export NOSHARED=${NOSHARED}" >> ${CHROOTDIR}/mk 254.endif 255.if defined(USA_RESIDENT) 256 echo "export USA_RESIDENT=${USA_RESIDENT}" >> ${CHROOTDIR}/mk 257.endif 258.if defined(BOOT_CONFIG) 259 echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk 260.endif 261 # Don't remove this, or the build will fall over! 262 echo "export RELEASEDIR=${_R}" >> ${CHROOTDIR}/mk 263 echo "export PATH=${BOOTSTRAPDIR}:$${PATH}:${LOCALDIR}" >> ${CHROOTDIR}/mk 264 echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk 265 echo " cd /usr/src" >> ${CHROOTDIR}/mk 266.if make(release) 267 echo " (cd etc; make distrib-dirs distribution)" >> ${CHROOTDIR}/mk 268 echo " make world && \\" >> ${CHROOTDIR}/mk 269.endif 270.if make(rerelease) 271 echo " make all install && \\" >> ${CHROOTDIR}/mk 272.endif 273 echo " touch /tmp/.world_done" >> ${CHROOTDIR}/mk 274 echo "fi" >> ${CHROOTDIR}/mk 275 echo "cd /usr/src/release/sysinstall" >> ${CHROOTDIR}/mk 276 echo "make obj" >> ${CHROOTDIR}/mk 277 echo "cd /usr/src/release" >> ${CHROOTDIR}/mk 278 echo "make \$${_RELTARGET}" >> ${CHROOTDIR}/mk 279 echo "echo make ${.TARGET} Finished" >> ${CHROOTDIR}/mk 280 chmod 755 ${CHROOTDIR}/mk 281 chroot ${CHROOTDIR} /mk 282 283clean: 284 rm -rf boot_crunch ${.OBJDIR}/boot_crunch.conf release.[0-9] 285 286# Clean out ${_R} and make the directory structure. 287release.1: 288 mkdir -p ${_R} 289 -rm -rf ${_R}/* 2> /dev/null 290 -chflags -R noschg ${_R}/. 291 rm -rf ${_R}/* 292 mkdir ${RD} 293 mkdir ${RD}/floppies 294 mkdir ${RD}/trees 295 mkdir ${RD}/dists 296 mkdir ${RD}/kernels 297 for i in ${DISTRIBUTIONS} ; do \ 298 mkdir ${RD}/trees/$$i && \ 299 mkdir ${RD}/dists/$$i && \ 300 mtree -deU -f ${MTREEFILES}/BSD.root.dist \ 301 -p ${RD}/trees/$$i > /dev/null && \ 302 mtree -deU -f ${MTREEFILES}/BSD.usr.dist \ 303 -p ${RD}/trees/$$i/usr > /dev/null && \ 304 mtree -deU -f ${MTREEFILES}/BSD.include.dist \ 305 -p ${RD}/trees/$$i/usr/include > /dev/null && \ 306 mtree -deU -f ${MTREEFILES}/BSD.var.dist \ 307 -p ${RD}/trees/$$i/var > /dev/null ; \ 308 done 309 touch release.1 310 311# Install the system into the various distributions. 312release.2: 313 cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin 314 cd ${.CURDIR}/.. && make distribute DISTDIR=${RD}/trees 315.if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS) 316 cd ${.CURDIR}/../kerberosIV && ( \ 317 make bootstrap &&\ 318 make obj all help-distribute DISTDIR=${RD}/trees &&\ 319 make kprog \ 320 ) 321.endif 322.if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS) 323 cd ${.CURDIR}/../kerberos5 && ( \ 324 make bootstrap &&\ 325 make obj all help-distribute DISTDIR=${RD}/trees &&\ 326 make kprog \ 327 ) 328.endif 329 -chflags -R noschg ${RD}/trees 330 touch release.2 331 332# Make and install the generic kernel(s). 333release.3: 334.for kernel in ${KERNELS} 335 rm -f ${RD}/kernels/${kernel} 336 rm -rf ${.CURDIR}/../sys/compile/${kernel} 337 cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=${kernel} 338 rm -rf ${.CURDIR}/../sys/compile/${kernel} 339 ln -f ${RD}/kernels/${kernel} ${RD}/trees/bin/kernel.${kernel} 340.endfor 341 touch release.3 342 343# Make and install the three crunched binaries which live on the floppies. 344# You are not supposed to like this :-) 345# 346# NB: the "RELEASE_BUILD_FIXIT" magic prevents vi from including the 347# Tcl and Perl APIs. See also /usr/src/usr.bin/vi/Makefile. 348release.4: 349 @mkdir -p /stand 350 cp ${.CURDIR}/boot_crunch.conf.generic ${.OBJDIR}/boot_crunch.conf 351 cd ${.CURDIR}/sysinstall && make obj depend all install 352 rm -rf ${RD}/crunch 353 mkdir -p ${RD}/crunch 354 export RELEASE_BUILD_FIXIT=noway ; \ 355 for j in ${CRUNCH_TARGETS} ; do \ 356 rm -rf $${j}_crunch && \ 357 mkdir $${j}_crunch && \ 358 ( cd $${j}_crunch && \ 359 ( ( [ -f ${.CURDIR}/$${j}_crunch.conf ] && \ 360 crunchgen ${.CURDIR}/$${j}_crunch.conf ) || \ 361 ( [ -f ${.OBJDIR}/$${j}_crunch.conf ] && \ 362 crunchgen ${.OBJDIR}/$${j}_crunch.conf ) ) && \ 363 ${MAKE} -DRELEASE_CRUNCH -f $${j}_crunch.mk subclean all \ 364 NOCRYPT=yes "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \ 365 mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \ 366 true || { rm -rf $${j}_crunch ; false ; } ; \ 367 done 368 touch release.4 369 370# 371# --==## Fix up the distributions. ##==-- 372# 373release.5: 374 # Handle some grief caused by the munition braindeadness. 375 for i in sbin/init bin/ed usr.sbin/ppp usr.sbin/pppd ; do \ 376 ( cd ${.CURDIR}/../$$i; \ 377 make -DNOCRYPT clean all distribute DISTDIR=${RD}/trees ) ; \ 378 done 379 380 # Create any "synthetic dists" now. 381 @for i in ${DISTRIBUTIONS}; do \ 382 if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \ 383 echo -n "Running $$i dist creation script... "; \ 384 env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \ 385 echo "Done."; \ 386 fi \ 387 done \ 388 389 # Create symlinks for the MD5-based crypt lib, too. The 390 # automatically created links still point to the DES stuff, 391 # which went into its own distribution. 392 for i in ${RD}/trees/bin/usr/lib/libscrypt* ; do \ 393 c=`echo $$i | sed -e 's/libscrypt/libcrypt/'` ; \ 394 rm -f $$c ; \ 395 ln -s `basename $$i` $$c ; \ 396 done 397 398 # Remove all the directories we don't need. 399 -cd ${RD}/trees && \ 400 find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir 401 touch release.5 402 403# 404# --==## Package up the tarballs from assembled trees ##==-- 405# 406release.6: 407 rm -rf ${RD}/dists 408 mkdir -p ${RD}/dists 409 @for i in ${DISTRIBUTIONS} ; \ 410 do \ 411 if [ -d ${RD}/trees/$${i} ] ; then \ 412 cd ${.CURDIR} && $(MAKE) doTARBALL \ 413 SD=${RD}/trees/$${i} \ 414 TN=$$i TD=$$i ARG="." && \ 415 echo "$${i} distribution is finished."; \ 416 fi ; \ 417 done 418 # More munition braindeadness. 419 ( cd ${RD}/dists && \ 420 if [ -f krb4/krb4.aa ] ; then mv krb4/* crypto && rmdir krb4 ; fi ) 421 ( cd ${RD}/dists && \ 422 if [ -f krb5/krb5.aa ] ; then mv krb5/* crypto && rmdir krb5 ; fi ) 423 touch release.6 424 425 426# 427# --==## Make source dists ##==-- 428# 429release.7: 430.if !defined(NOSRC) 431 @cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \ 432 TD=src TN=sbase ARG="[A-Z]*" 433 @for i in `cd /usr/src && echo [a-z]*` ; do \ 434 if [ -d /usr/src/$$i ] ; then \ 435 cd ${.CURDIR} && $(MAKE) doTARBALL \ 436 TN=`echo s$$i | tr -d '.' | \ 437 sed -e 's/usr/u/' \ 438 -e 's/kerberosIV/krb4/' \ 439 -e 's/kerberos5/krb5/'` \ 440 SD=/usr/src TD=src ARG="$$i" ; \ 441 fi ; \ 442 done 443.if defined(EXTRA_SRC) 444 @set ${EXTRA_SRC} && \ 445 while [ $$# -ge 2 ] ; do \ 446 if [ -d /usr/src/$$1 ] ; then \ 447 cd ${.CURDIR} && $(MAKE) doTARBALL \ 448 SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \ 449 fi && shift && shift ; \ 450 done 451.endif 452 if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \ 453 if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \ 454 if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \ 455 if [ -f skrb4.aa ] ; then mv skrb4.* ../crypto ; fi && \ 456 if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; ) ; fi 457 @echo "src distribution is finished." 458.endif 459 touch release.7 460 461# Complete the bootfd 462# 463# Now, just to get this picture down once and for all: 464# 465# +------------------------------------------------------------------------+ 466# |boot.flp | 467# +-----+-----+------------------------------------------------------------+ 468# |boot1|boot2|floppy filesystem "bootfd" | 469# +-----+-----+-+--------------------------------------------------------+-+ 470# |kernel | 471# +------------+-----------------------------------------+-+ 472# |mfs filesystem "mfsfd" | 473# +-----------------------------------------+ 474# 475 476release.8: write_mfs_in_kernel 477 rm -rf ${RD}/mfsfd 478 mkdir ${RD}/mfsfd 479 cd ${RD}/mfsfd && \ 480 mkdir -p etc/defaults dev mnt stand/help 481 @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \ 482 DIR=${RD}/mfsfd/stand ZIP=false 483 ( cd ${RD}/trees/bin/dev && \ 484 ls console tty bpf0 ttyv0 ttyv1 ttyv2 ttyv3 null zero card0 card1 card2 card3 | \ 485 cpio -dump ${RD}/mfsfd/dev ) 486 ( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] ) 487 ( cd ${RD}/mfsfd && mkdir -p bin sbin && ln -s /stand/sh bin/sh ) 488 cp /sbin/dhclient-script ${RD}/mfsfd/sbin 489 cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf 490 cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand 491 echo "nameserver 42/tcp name" > ${RD}/mfsfd/stand/etc/services 492 echo "ftp 21/tcp" >> ${RD}/mfsfd/stand/etc/services 493 echo "domain 53/tcp nameserver" >> ${RD}/mfsfd/stand/etc/services 494 echo "domain 53/udp nameserver" >> ${RD}/mfsfd/stand/etc/services 495 echo "cmd 514/tcp shell" >> ${RD}/mfsfd/stand/etc/services 496 gzip -9c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz 497 @for i in README.TXT RELNOTES.TXT INSTALL.TXT UPGRADE.TXT HARDWARE.TXT; do \ 498 if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \ 499 gzip -9c ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} > ${RD}/mfsfd/stand/help/$${i}.gz; \ 500 else \ 501 gzip -9c ${.CURDIR}/texts/$${i} > ${RD}/mfsfd/stand/help/$${i}.gz; \ 502 fi; \ 503 done 504 -test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd 505 @mkdir -p ${RD}/mfsfd/boot 506 @cp /boot/boot* ${RD}/mfsfd/boot 507 @cp /boot/loader.help ${RD}/mfsfd/boot 508 @echo "Making the regular boot floppy." 509 @tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \ 510 tar xf - -C ${RD}/mfsfd/stand 511 @echo "Compressing doc files..." 512 @gzip -9 ${RD}/mfsfd/stand/help/*.hlp 513 sh -e ${.CURDIR}/scripts/doFS.sh -s mfsroot ${RD} ${MNT} \ 514 ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL} 515 @gzip -9vc mfsroot > mfsroot.gz 516 @sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \ 517 ${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL} 518 @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern 519 @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot BIGBOOT=YES 520 @rm mfsroot mfsroot.gz mfsroot.size 521 @echo "Regular and MFS boot floppies made." 522 touch release.8 523 524# 525# --==## Create a fixit floppy ##==-- 526# 527release.9: 528 @echo "Making fixit floppy." 529 @rm -rf ${RD}/fixitfd 530 @mkdir ${RD}/fixitfd 531 @cd ${RD}/fixitfd && \ 532 mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \ 533 usr/share/misc 534 @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \ 535 DIR=${RD}/fixitfd/stand ZIP=false 536 @( cd ${RD}/fixitfd/dev && \ 537 sed -e '/^PATH/s/^/#/' ${RD}/trees/bin/dev/MAKEDEV > MAKEDEV && \ 538 chmod 755 MAKEDEV && \ 539 sh MAKEDEV fixit ) 540 @cp ${RD}/trees/bin/etc/spwd.db ${RD}/trees/bin/etc/group \ 541 ${RD}/trees/bin/etc/protocols ${RD}/fixitfd/etc 542 @cp ${RD}/trees/bin/usr/share/misc/scsi_modes \ 543 ${RD}/fixitfd/usr/share/misc 544 @cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile 545 @cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services 546 @cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar 547 @chmod 555 ${RD}/fixitfd/stand/tar 548 @sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/fixit.flp ${RD} \ 549 ${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL} 550# Do our last minute floppies directory setup in a convenient place. 551 @cp ${.CURDIR}/texts/FLOPPIES.TXT ${RD}/floppies/README.TXT 552 @(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5) 553 touch release.9 554 555# 556# --==## Setup a suitable ftp-area ##==-- 557# 558ftp.1: 559 @echo "Setting up FTP distribution area" 560 @mkdir -p ${FD} 561 -@ln -s . ${FD}/${BUILDNAME} 562 @cd ${RD} && find floppies -print | cpio -dumpl ${FD} 563 @cd ${RD}/dists && find . -print | cpio -dumpl ${FD} 564 @for i in ${DIST_DOCS}; do \ 565 if [ -f ${.CURDIR}/texts/$${i} ]; then \ 566 cp ${.CURDIR}/texts/$${i} ${FD}; \ 567 fi; \ 568 if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \ 569 echo "=== Platform specifics for ${MACHINE_ARCH}" >> ${FD}/$${i}; \ 570 cat ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} >> ${FD}/$${i}; \ 571 fi; \ 572 done 573 @echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf 574.if !defined(NOPORTS) 575 @tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD} 576.endif 577 578# 579# --==## Setup a suitable cdrom-area ##==-- 580# 581cdrom.1: 582 @echo "Setting up CDROM distribution area" 583 @mkdir -p ${CD_DISC1} ${CD_DISC2} 584 @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1} 585 @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1} 586 @ln -f ${RD}/kernels/MFSKERNEL.boot ${CD_DISC1}/kernel 587 @for i in ${DISTRIBUTIONS} ; \ 588 do \ 589 if [ -d ${RD}/trees/$${i} ] ; then \ 590 chflags -R noschg ${RD}/trees/$${i} || true ; \ 591 ( cd ${RD}/trees/$${i} && \ 592 find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \ 593 fi \ 594 done 595 @rm -f ${CD_DISC2}/.profile 596 @cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile 597 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf 598 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf 599 @for i in ${DIST_DOCS}; do \ 600 if [ -f ${.CURDIR}/texts/$${i} ]; then \ 601 cp ${.CURDIR}/texts/$${i} ${CD_DISC1}; \ 602 fi; \ 603 if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \ 604 echo "=== Platform specifics for ${MACHINE_ARCH}" >> ${CD_DISC1}/$${i}; \ 605 cat ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} >> ${CD_DISC1}/$${i}; \ 606 fi; \ 607 done 608.if ${MACHINE_ARCH} == "alpha" 609 @echo "Setting up Alpha CD disc1 for booting" 610 @cp -Rp ${RD}/image.boot/boot ${CD_DISC1} 611 @ln -f ${CD_DISC2}/boot/cdboot ${CD_DISC1}/boot 612 @ln -f ${CD_DISC1}/boot/loader.rc ${CD_DISC2}/boot 613 @ln -f ${CD_DISC1}/kernel ${CD_DISC2}/kernel 614.endif 615.if !defined(NOPORTS) 616 @-rm -rf /usr/ports/distfiles/* 617 @mkdir -p ${CD_DISC1}/ports && \ 618 tar --exclude CVS -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \ 619 cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \ 620 && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5) 621.endif 622 623doc.1: 624 @echo "Making docs..." 625 @for i in ${DOCPORTS}; do \ 626 cd /usr/ports/$$i && make all install clean JADETEX=no FORCE_PKG_REGISTER=yes; \ 627 done 628 @cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/bin/usr/share/doc 629 touch doc.1 630 631# Various "subroutine" and other supporting targets. 632 633# RD= 634# SD= 635# TD= 636# ARG= 637doTARBALL: 638.if !defined(SD) 639 @echo "SD undefined in doTARBALL" && exit 1 640.endif 641.if !defined(TD) 642 @echo "TB undefined in doTARBALL" && exit 1 643.endif 644.if !defined(ARG) 645 @echo "ARG undefined in doTARBALL" && exit 1 646.endif 647 @rm -rf ${RD}/dists/${TD}/${TN}* 648 @mkdir -p ${RD}/dists/${TD} 649 @( cd ${SD} && \ 650 tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \ 651 echo rolling ${TD}/$$tn tarball &&\ 652 tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \ 653 ${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \ 654 sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \ 655 ${RD}/dists/${TD}/$$tn.inf && \ 656 if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \ 657 cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \ 658 fi && \ 659 if [ "${SD}" != "/usr/src" ]; then \ 660 mtree -c -i -p ${SD}/${ARG} \ 661 -k gname,md5digest,mode,nlink,uname,size,link,type \ 662 > ${RD}/dists/${TD}/$$tn.mtree ; \ 663 else \ 664 true; \ 665 fi; \ 666 (cd ${RD}/dists/${TD}; \ 667 rm -f CHECKSUM.MD5; \ 668 md5 * > CHECKSUM.MD5) \ 669 ) 670 671doRELEASE: release.1 release.2 ${DOCREL} release.3 release.4 release.5 \ 672 release.6 release.7 release.8 release.9 673 @cd ${.CURDIR} && ${MAKE} ${EXTRAS} 674 @echo "Release done" 675 676floppies: 677 @cd ${.CURDIR} && ${MAKE} boot.flp 678 @cd ${.CURDIR} && ${MAKE} fixit.flp 679 @cd ${RD} && find floppies -print | cpio -dumpl ${FD} 680 681boot.flp: 682 @rm -f release.4 release.8 683 @cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot 684 685fixit.flp: 686 @rm -f release.4 release.9 687 @cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit 688 689write_mfs_in_kernel: ${.CURDIR}/write_mfs_in_kernel.c 690 ${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c 691 692installCRUNCH: 693.if !defined(CRUNCH) 694 @echo "CRUNCH undefined in installCRUNCH" && exit 1 695.endif 696.if !defined(DIR) 697 @echo "DIR undefined in installCRUNCH" && exit 1 698.endif 699.if !defined(ZIP) 700 @echo "ZIP undefined in installCRUNCH" && exit 1 701.endif 702 @if ${ZIP} ; then \ 703 gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \ 704 else \ 705 ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \ 706 fi 707 @chmod 555 ${DIR}/${CRUNCH}_crunch 708 @if [ -f ${.OBJDIR}/${CRUNCH}_crunch.conf ] ; then \ 709 for i in `crunchgen -l ${.OBJDIR}/${CRUNCH}_crunch.conf` ; do \ 710 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ 711 done \ 712 else \ 713 for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \ 714 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ 715 done \ 716 fi 717 718# 719# --==## Compile a kernel by name ${KERNEL} ##==-- 720# 721# We don't erase the sys/compile/${KERNEL} directory, since somebody 722# may want to reuse it (release.8 presently) 723# 724doKERNEL: 725 @rm -f ${RD}/kernels/${KERNEL} 726 @cd ${.CURDIR}/../sys/${MACHINE_ARCH}/conf && config ${KERNEL} 727 @cd ${.CURDIR}/../sys/compile/${KERNEL} && \ 728 make depend && \ 729 make ${KERNEL} && \ 730 strip --strip-debug ${KERNEL} && \ 731 cp ${KERNEL} ${RD}/kernels/${KERNEL} 732 733# 734# --==## Put a filesystem into a BOOTMFS kernel ##==-- 735# 736doMFSKERN: 737 @echo "Running doMFSKERN for ${FSIMAGE}" 738 @rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE} 739 @cd ${.CURDIR}/../sys/${MACHINE_ARCH}/conf && \ 740 sh ${.CURDIR}/scripts/dokern.sh ${BIGBOOT} < ${KERNCONF} > BOOTMFS 741.if ${MACHINE_ARCH} == "i386" 742 @echo "options INTRO_USERCONFIG" >> ${.CURDIR}/../sys/i386/conf/BOOTMFS 743.endif 744.if defined(BIGBOOT) 745 @echo "options \"MD_ROOT_SIZE=`cat mfsroot.size`\"" >> \ 746 ${.CURDIR}/../sys/${MACHINE_ARCH}/conf/BOOTMFS 747.endif 748 @cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS 749 @rm -rf ${RD}/image.${FSIMAGE} 750 @mkdir ${RD}/image.${FSIMAGE} 751 @strip ${RD}/kernels/BOOTMFS 752 @cp ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE} 753 mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel 754 @echo "Setting up /boot directory for ${FSIMAGE} floppy" 755 @mkdir -p ${RD}/image.${FSIMAGE}/boot 756 @cp /boot/boot[12] /boot/loader ${RD}/image.${FSIMAGE}/boot 757.if !defined(BIGBOOT) 758 @echo "load /kernel" > ${RD}/image.${FSIMAGE}/boot/loader.rc 759 @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 760 @echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 761 @echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 762 @echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 763.endif 764 @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 765 @echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 766 @touch ${RD}/image.${FSIMAGE}/boot/loader.config 767.if ${MACHINE_ARCH} == "i386" 768 @echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config 769.endif 770.if defined(BIGBOOT) 771 @echo "Writing MFS image into kernel for ${FSIMAGE} floppy" 772 @./write_mfs_in_kernel ${RD}/image.${FSIMAGE}/kernel mfsroot 773 @cp ${RD}/image.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE} 774.endif 775 @gzip -9v ${RD}/image.${FSIMAGE}/kernel 776 @touch ${RD}/image.${FSIMAGE}/kernel.config 777 @rm -f ${RD}/floppies/${FSIMAGE}.flp 778.if defined(BIGBOOT) 779 sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \ 780 ${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \ 781 ${BOOTINODE} ${BIGBOOTLABEL} 782.else 783 sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \ 784 ${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \ 785 ${BOOTINODE} ${BOOTLABEL} 786.endif 787 @echo "Created ${RD}/floppies/${FSIMAGE}.flp" 788 789.include <bsd.prog.mk> 790