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. 60DOCDISTFILES?= ${.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 ${DOCDISTFILES}/ ]; then \ 202 cp -rp ${DOCDISTFILES} ${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 usb usb0 uhid0 ums0 ulpt0 ugen0 kbd0 | \ 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 cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf 491 cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand 492 echo "nameserver 42/tcp name" > ${RD}/mfsfd/stand/etc/services 493 echo "ftp 21/tcp" >> ${RD}/mfsfd/stand/etc/services 494 echo "domain 53/tcp nameserver" >> ${RD}/mfsfd/stand/etc/services 495 echo "domain 53/udp nameserver" >> ${RD}/mfsfd/stand/etc/services 496 echo "cmd 514/tcp shell" >> ${RD}/mfsfd/stand/etc/services 497 gzip -9c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz 498 @for i in README.TXT RELNOTES.TXT INSTALL.TXT UPGRADE.TXT HARDWARE.TXT; do \ 499 if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \ 500 gzip -9c ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} > ${RD}/mfsfd/stand/help/$${i}.gz; \ 501 else \ 502 gzip -9c ${.CURDIR}/texts/$${i} > ${RD}/mfsfd/stand/help/$${i}.gz; \ 503 fi; \ 504 done 505 -test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd 506 @mkdir -p ${RD}/mfsfd/boot 507 @cp /boot/boot* ${RD}/mfsfd/boot 508 @cp /boot/loader.help ${RD}/mfsfd/boot 509 @echo "Making the regular boot floppy." 510 @tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \ 511 tar xf - -C ${RD}/mfsfd/stand 512 @echo "Compressing doc files..." 513 @gzip -9 ${RD}/mfsfd/stand/help/*.hlp 514 sh -e ${.CURDIR}/scripts/doFS.sh -s mfsroot ${RD} ${MNT} \ 515 ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL} 516 @gzip -9vc mfsroot > mfsroot.gz 517 @sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \ 518 ${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL} 519 @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern 520 @cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot BIGBOOT=YES 521 @rm mfsroot mfsroot.gz mfsroot.size 522 @echo "Regular and MFS boot floppies made." 523 touch release.8 524 525# 526# --==## Create a fixit floppy ##==-- 527# 528release.9: 529 @echo "Making fixit floppy." 530 @rm -rf ${RD}/fixitfd 531 @mkdir ${RD}/fixitfd 532 @cd ${RD}/fixitfd && \ 533 mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \ 534 usr/share/misc 535 @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \ 536 DIR=${RD}/fixitfd/stand ZIP=false 537 @( cd ${RD}/fixitfd/dev && \ 538 sed -e '/^PATH/s/^/#/' ${RD}/trees/bin/dev/MAKEDEV > MAKEDEV && \ 539 chmod 755 MAKEDEV && \ 540 sh MAKEDEV fixit ) 541 @cp ${RD}/trees/bin/etc/spwd.db ${RD}/trees/bin/etc/group \ 542 ${RD}/trees/bin/etc/protocols ${RD}/fixitfd/etc 543 @cp ${RD}/trees/bin/usr/share/misc/scsi_modes \ 544 ${RD}/fixitfd/usr/share/misc 545 @cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile 546 @cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services 547 @cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar 548 @chmod 555 ${RD}/fixitfd/stand/tar 549 @sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/fixit.flp ${RD} \ 550 ${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL} 551# Do our last minute floppies directory setup in a convenient place. 552 @cp ${.CURDIR}/texts/FLOPPIES.TXT ${RD}/floppies/README.TXT 553 @(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5) 554 touch release.9 555 556# 557# --==## Setup a suitable ftp-area ##==-- 558# 559ftp.1: 560 @echo "Setting up FTP distribution area" 561 @mkdir -p ${FD} 562 -@ln -s . ${FD}/${BUILDNAME} 563 @cd ${RD} && find floppies -print | cpio -dumpl ${FD} 564 @cd ${RD}/dists && find . -print | cpio -dumpl ${FD} 565 @for i in ${DIST_DOCS}; do \ 566 if [ -f ${.CURDIR}/texts/$${i} ]; then \ 567 cp ${.CURDIR}/texts/$${i} ${FD}; \ 568 fi; \ 569 if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \ 570 echo "=== Platform specifics for ${MACHINE_ARCH}" >> ${FD}/$${i}; \ 571 cat ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} >> ${FD}/$${i}; \ 572 fi; \ 573 done 574 @echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf 575.if !defined(NOPORTS) 576 @tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD} 577.endif 578 579# 580# --==## Setup a suitable cdrom-area ##==-- 581# 582cdrom.1: 583 @echo "Setting up CDROM distribution area" 584 @mkdir -p ${CD_DISC1} ${CD_DISC2} 585 @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1} 586 @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1} 587 @ln -f ${RD}/kernels/MFSKERNEL.boot ${CD_DISC1}/kernel 588 @for i in ${DISTRIBUTIONS} ; \ 589 do \ 590 if [ -d ${RD}/trees/$${i} ] ; then \ 591 chflags -R noschg ${RD}/trees/$${i} || true ; \ 592 ( cd ${RD}/trees/$${i} && \ 593 find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \ 594 fi \ 595 done 596 @rm -f ${CD_DISC2}/.profile 597 @cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile 598 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf 599 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf 600 @for i in ${DIST_DOCS}; do \ 601 if [ -f ${.CURDIR}/texts/$${i} ]; then \ 602 cp ${.CURDIR}/texts/$${i} ${CD_DISC1}; \ 603 fi; \ 604 if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \ 605 echo "=== Platform specifics for ${MACHINE_ARCH}" >> ${CD_DISC1}/$${i}; \ 606 cat ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} >> ${CD_DISC1}/$${i}; \ 607 fi; \ 608 done 609.if ${MACHINE_ARCH} == "alpha" 610 @echo "Setting up Alpha CD disc1 for booting" 611 @cp -Rp ${RD}/image.boot/boot ${CD_DISC1} 612 @ln -f ${CD_DISC2}/boot/cdboot ${CD_DISC1}/boot 613 @ln -f ${CD_DISC1}/boot/loader.rc ${CD_DISC2}/boot 614 @ln -f ${CD_DISC1}/kernel ${CD_DISC2}/kernel 615.endif 616.if !defined(NOPORTS) 617 @-rm -rf /usr/ports/distfiles/* 618 @mkdir -p ${CD_DISC1}/ports && \ 619 tar --exclude CVS -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \ 620 cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \ 621 && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5) 622.endif 623 624doc.1: 625 @echo "Making docs..." 626 @for i in ${DOCPORTS}; do \ 627 cd /usr/ports/$$i && make all install clean JADETEX=no FORCE_PKG_REGISTER=yes; \ 628 done 629 @cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/bin/usr/share/doc 630 touch doc.1 631 632# Various "subroutine" and other supporting targets. 633 634# RD= 635# SD= 636# TD= 637# ARG= 638doTARBALL: 639.if !defined(SD) 640 @echo "SD undefined in doTARBALL" && exit 1 641.endif 642.if !defined(TD) 643 @echo "TB undefined in doTARBALL" && exit 1 644.endif 645.if !defined(ARG) 646 @echo "ARG undefined in doTARBALL" && exit 1 647.endif 648 @rm -rf ${RD}/dists/${TD}/${TN}* 649 @mkdir -p ${RD}/dists/${TD} 650 @( cd ${SD} && \ 651 tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \ 652 echo rolling ${TD}/$$tn tarball &&\ 653 tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \ 654 ${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \ 655 sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \ 656 ${RD}/dists/${TD}/$$tn.inf && \ 657 if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \ 658 cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \ 659 fi && \ 660 if [ "${SD}" != "/usr/src" ]; then \ 661 mtree -c -i -p ${SD}/${ARG} \ 662 -k gname,md5digest,mode,nlink,uname,size,link,type \ 663 > ${RD}/dists/${TD}/$$tn.mtree ; \ 664 else \ 665 true; \ 666 fi; \ 667 (cd ${RD}/dists/${TD}; \ 668 rm -f CHECKSUM.MD5; \ 669 md5 * > CHECKSUM.MD5) \ 670 ) 671 672doRELEASE: release.1 release.2 ${DOCREL} release.3 release.4 release.5 \ 673 release.6 release.7 release.8 release.9 674 @cd ${.CURDIR} && ${MAKE} ${EXTRAS} 675 @echo "Release done" 676 677floppies: 678 @cd ${.CURDIR} && ${MAKE} boot.flp 679 @cd ${.CURDIR} && ${MAKE} fixit.flp 680 @cd ${RD} && find floppies -print | cpio -dumpl ${FD} 681 682boot.flp: 683 @rm -f release.4 release.8 684 @cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot 685 686fixit.flp: 687 @rm -f release.4 release.9 688 @cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit 689 690write_mfs_in_kernel: ${.CURDIR}/write_mfs_in_kernel.c 691 ${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c 692 693installCRUNCH: 694.if !defined(CRUNCH) 695 @echo "CRUNCH undefined in installCRUNCH" && exit 1 696.endif 697.if !defined(DIR) 698 @echo "DIR undefined in installCRUNCH" && exit 1 699.endif 700.if !defined(ZIP) 701 @echo "ZIP undefined in installCRUNCH" && exit 1 702.endif 703 @if ${ZIP} ; then \ 704 gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \ 705 else \ 706 ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \ 707 fi 708 @chmod 555 ${DIR}/${CRUNCH}_crunch 709 @if [ -f ${.OBJDIR}/${CRUNCH}_crunch.conf ] ; then \ 710 for i in `crunchgen -l ${.OBJDIR}/${CRUNCH}_crunch.conf` ; do \ 711 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ 712 done \ 713 else \ 714 for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \ 715 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ 716 done \ 717 fi 718 719# 720# --==## Compile a kernel by name ${KERNEL} ##==-- 721# 722# We don't erase the sys/compile/${KERNEL} directory, since somebody 723# may want to reuse it (release.8 presently) 724# 725doKERNEL: 726 @rm -f ${RD}/kernels/${KERNEL} 727 @cd ${.CURDIR}/../sys/${MACHINE_ARCH}/conf && config ${KERNEL} 728 @cd ${.CURDIR}/../sys/compile/${KERNEL} && \ 729 make depend && \ 730 make ${KERNEL} && \ 731 strip --strip-debug ${KERNEL} && \ 732 cp ${KERNEL} ${RD}/kernels/${KERNEL} 733 734# 735# --==## Put a filesystem into a BOOTMFS kernel ##==-- 736# 737doMFSKERN: 738 @echo "Running doMFSKERN for ${FSIMAGE}" 739 @rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE} 740 @cd ${.CURDIR}/../sys/${MACHINE_ARCH}/conf && \ 741 sh ${.CURDIR}/scripts/dokern.sh ${BIGBOOT} < ${KERNCONF} > BOOTMFS 742.if ${MACHINE_ARCH} == "i386" 743 @echo "options INTRO_USERCONFIG" >> ${.CURDIR}/../sys/i386/conf/BOOTMFS 744.endif 745.if defined(BIGBOOT) 746 @echo "options \"MD_ROOT_SIZE=`cat mfsroot.size`\"" >> \ 747 ${.CURDIR}/../sys/${MACHINE_ARCH}/conf/BOOTMFS 748.endif 749 @cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS 750 @rm -rf ${RD}/image.${FSIMAGE} 751 @mkdir ${RD}/image.${FSIMAGE} 752 @strip ${RD}/kernels/BOOTMFS 753 @cp ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE} 754 mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel 755 @echo "Setting up /boot directory for ${FSIMAGE} floppy" 756 @mkdir -p ${RD}/image.${FSIMAGE}/boot 757 @cp /boot/boot[12] /boot/loader ${RD}/image.${FSIMAGE}/boot 758.if !defined(BIGBOOT) 759 @echo "load /kernel" > ${RD}/image.${FSIMAGE}/boot/loader.rc 760 @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 761 @echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 762 @echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 763 @echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 764.endif 765 @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 766 @echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 767 @touch ${RD}/image.${FSIMAGE}/boot/loader.config 768.if ${MACHINE_ARCH} == "i386" 769 @echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config 770.endif 771.if defined(BIGBOOT) 772 @echo "Writing MFS image into kernel for ${FSIMAGE} floppy" 773 @./write_mfs_in_kernel ${RD}/image.${FSIMAGE}/kernel mfsroot 774 @cp ${RD}/image.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE} 775.endif 776 @gzip -9v ${RD}/image.${FSIMAGE}/kernel 777 @touch ${RD}/image.${FSIMAGE}/kernel.config 778 @rm -f ${RD}/floppies/${FSIMAGE}.flp 779.if defined(BIGBOOT) 780 sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \ 781 ${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \ 782 ${BOOTINODE} ${BIGBOOTLABEL} 783.else 784 sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \ 785 ${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \ 786 ${BOOTINODE} ${BOOTLABEL} 787.endif 788 @echo "Created ${RD}/floppies/${FSIMAGE}.flp" 789 790.include <bsd.prog.mk> 791