Makefile revision 64933
1# $FreeBSD: head/release/Makefile 64933 2000-08-22 09:43:12Z jkh $ 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 TZ=GMT 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 TZ=GMT 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 touch ftp.1 629 630# 631# --==## Setup a suitable cdrom-area ##==-- 632# 633cdrom.1: 634 @echo "Setting up CDROM distribution area" 635 @mkdir -p ${CD_DISC1} ${CD_DISC2} 636 @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1} 637 @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1} 638 @ln -f ${RD}/kernels/MFSKERNEL.boot ${CD_DISC1}/kernel 639 @for i in ${DISTRIBUTIONS} ; \ 640 do \ 641 if [ -d ${RD}/trees/$${i} ] ; then \ 642 chflags -R noschg ${RD}/trees/$${i} || true ; \ 643 ( cd ${RD}/trees/$${i} && \ 644 find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \ 645 fi \ 646 done 647 @rm -f ${CD_DISC2}/.profile 648 @cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile 649 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf 650 @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf 651 @for i in ${DIST_DOCS}; do \ 652 if [ -f ${.CURDIR}/texts/$${i} ]; then \ 653 cp ${.CURDIR}/texts/$${i} ${CD_DISC1}; \ 654 fi; \ 655 if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \ 656 echo "=== Platform specifics for ${MACHINE_ARCH}" >> ${CD_DISC1}/$${i}; \ 657 cat ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} >> ${CD_DISC1}/$${i}; \ 658 fi; \ 659 done 660.if ${MACHINE_ARCH} == "alpha" 661 @echo "Setting up Alpha CD disc1 for booting" 662 @cp -Rp ${RD}/image.boot/boot ${CD_DISC1} 663 @ln -f ${CD_DISC2}/boot/cdboot ${CD_DISC1}/boot 664 @ln -f ${CD_DISC1}/boot/loader.rc ${CD_DISC2}/boot 665 @ln -f ${CD_DISC1}/kernel ${CD_DISC2}/kernel 666.endif 667.if !defined(NOPORTS) 668 @-rm -rf /usr/ports/distfiles/* 669 @mkdir -p ${CD_DISC1}/ports && \ 670 tar --exclude CVS -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \ 671 cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \ 672 && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5) 673.endif 674 touch cdrom.1 675 676doc.1: 677 @echo "Making docs..." 678 @for i in ${DOCPORTS}; do \ 679 cd /usr/ports/$$i && make all install clean JADETEX=no FORCE_PKG_REGISTER=yes; \ 680 done 681 @cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/bin/usr/share/doc 682 touch doc.1 683 684# Various "subroutine" and other supporting targets. 685 686# RD= 687# SD= 688# TD= 689# ARG= 690doTARBALL: 691.if !defined(SD) 692 @echo "SD undefined in doTARBALL" && exit 1 693.endif 694.if !defined(TD) 695 @echo "TB undefined in doTARBALL" && exit 1 696.endif 697.if !defined(ARG) 698 @echo "ARG undefined in doTARBALL" && exit 1 699.endif 700 @rm -rf ${RD}/dists/${TD}/${TN}* 701 @mkdir -p ${RD}/dists/${TD} 702 @( cd ${SD} && \ 703 tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \ 704 echo rolling ${TD}/$$tn tarball &&\ 705 tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \ 706 ${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \ 707 sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \ 708 ${RD}/dists/${TD}/$$tn.inf && \ 709 if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \ 710 cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \ 711 fi && \ 712 if [ "${SD}" != "/usr/src" ]; then \ 713 mtree -c -i -p ${SD}/${ARG} \ 714 -k gname,md5digest,mode,nlink,uname,size,link,type \ 715 > ${RD}/dists/${TD}/$$tn.mtree ; \ 716 else \ 717 true; \ 718 fi; \ 719 (cd ${RD}/dists/${TD}; \ 720 rm -f CHECKSUM.MD5; \ 721 md5 * > CHECKSUM.MD5) \ 722 ) 723 724doRELEASE: release.1 release.2 ${DOCREL} release.3 release.4 release.5 \ 725 release.6 release.7 release.8 release.9 726 @cd ${.CURDIR} && ${MAKE} ${EXTRAS} 727 @echo "Release done" 728 729floppies: 730 @cd ${.CURDIR} && ${MAKE} boot.flp 731 @cd ${.CURDIR} && ${MAKE} fixit.flp 732 @cd ${RD} && find floppies -print | cpio -dumpl ${FD} 733 734boot.flp: 735 @rm -f release.4 release.8 736 @cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot 737 738fixit.flp: 739 @rm -f release.4 release.9 740 @cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit 741 742write_mfs_in_kernel: ${.CURDIR}/write_mfs_in_kernel.c 743 ${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c 744 745installCRUNCH: 746.if !defined(CRUNCH) 747 @echo "CRUNCH undefined in installCRUNCH" && exit 1 748.endif 749.if !defined(DIR) 750 @echo "DIR undefined in installCRUNCH" && exit 1 751.endif 752.if !defined(ZIP) 753 @echo "ZIP undefined in installCRUNCH" && exit 1 754.endif 755 @if ${ZIP} ; then \ 756 gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \ 757 else \ 758 ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \ 759 fi 760 @chmod 555 ${DIR}/${CRUNCH}_crunch 761 @if [ -f ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf ] ; then \ 762 for i in `crunchgen -l ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf` ; do \ 763 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ 764 done \ 765 else \ 766 for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \ 767 ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ 768 done \ 769 fi 770 771# 772# --==## Compile a kernel by name ${KERNEL} ##==-- 773# 774# We don't erase the sys/compile/${KERNEL} directory, since somebody 775# may want to reuse it (release.8 presently) 776# 777doKERNEL: 778 @rm -f ${RD}/kernels/${KERNEL} 779 @cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL} 780 @cd ${.CURDIR}/../sys/compile/${KERNEL} && \ 781 make kernel-depend && \ 782 make ${KERNEL_FLAGS} ${KERNEL} && \ 783 make kernel-reinstall DESTDIR=${RD}/kernels && \ 784 [ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \ 785 cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels 786 787# 788# --==## Put a filesystem into a BOOTMFS kernel ##==-- 789# 790doMFSKERN: 791 @echo "Running doMFSKERN for ${FSIMAGE}" 792 @rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE} 793 @cd ${.CURDIR}/../sys/${MACHINE}/conf && \ 794 sh ${.CURDIR}/scripts/dokern.sh ${FDSIZE} < ${KERNCONF} > BOOTMFS && \ 795 [ -r ${KERNCONF}.hints ] && cp ${KERNCONF}.hints BOOTMFS.hints 796.if ${MACHINE_ARCH} == "i386" 797 @echo "options INTRO_USERCONFIG" >> \ 798 ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS 799.endif 800.if defined(FDSIZE) && ${FDSIZE} == "BIG" 801 @echo "options MD_ROOT_SIZE=`cat mfsroot.size`" >> \ 802 ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS 803.endif 804 @cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS 805 @rm -rf ${RD}/image.${FSIMAGE} 806 @mkdir ${RD}/image.${FSIMAGE} 807 @cd ${RD}/kernels && \ 808 chflags noschg BOOTMFS && \ 809 strip BOOTMFS && \ 810 cp BOOTMFS BOOTMFS.${FSIMAGE} && \ 811 [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints 812 mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel 813 @echo "Setting up /boot directory for ${FSIMAGE} floppy" 814 @mkdir -p ${RD}/image.${FSIMAGE}/boot 815 @cp /boot/boot[12] /boot/loader ${RD}/image.${FSIMAGE}/boot 816 @[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \ 817 sed -e '/^hint/s/^/set /' -e '/^#/d' \ 818 ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \ 819 ${RD}/image.${FSIMAGE}/boot/device.hints && \ 820 echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc 821.if !defined(FDSIZE) || ${FDSIZE} != "BIG" 822 @echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 823 @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 824 @echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 825 @echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 826 @echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 827.endif 828 @echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 829 @echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc 830.if ${MACHINE_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT} 831 @echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config 832.endif 833.if defined(FDSIZE) && ${FDSIZE} == "BIG" 834 @echo "Writing MFS image into kernel for ${FSIMAGE} floppy" 835 @./write_mfs_in_kernel ${RD}/image.${FSIMAGE}/kernel mfsroot 836 @cp ${RD}/image.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE} 837.endif 838 @gzip -9v ${RD}/image.${FSIMAGE}/kernel 839 @rm -f ${RD}/floppies/${FSIMAGE}.flp 840.if defined(FDSIZE) && ${FDSIZE} == "BIG" 841 sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \ 842 ${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \ 843 ${BOOTINODE} ${BIGBOOTLABEL} 844.elif defined(FDSIZE) && ${FDSIZE} == "SMALL" 845 sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \ 846 ${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \ 847 ${BOOTINODE} ${SMALLBOOTLABEL} 848.else 849 sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \ 850 ${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \ 851 ${BOOTINODE} ${BOOTLABEL} 852.endif 853 @echo "Created ${RD}/floppies/${FSIMAGE}.flp" 854 855.include <bsd.prog.mk> 856