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