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