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