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