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