1.\" Copyright (c) 2002 Murray Stokely <murray@FreeBSD.org> 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $FreeBSD$ 26.\" 27.Dd March 12, 2002 28.Dt RELEASE 7 29.Os 30.Sh NAME 31.Nm release 32.Nd "release building infrastructure" 33.Sh DESCRIPTION 34.Fx 35provides a complete build environment suitable for users to make 36full releases of the 37.Fx 38operating system. 39All of the tools necessary to build a release are available from the 40CVS repository in 41.Pa src/release . 42A complete release can actually be built with only a single command, 43including the creation of ISO images suitable for burning to CD-ROM, 44installation floppies, and an FTP install directory. 45This command is aptly named 46.Dq Li "make release" . 47.Pp 48Before attempting to build a release, the user is expected to be 49familiar with the contents of 50.Xr build 7 , 51and should have experience upgrading systems from source with 52.Dq Li "make world" . 53The release build process requires that 54.Pa /usr/obj 55be populated with the output of 56.Dq Li "make buildworld" . 57This is necessary so that the object files for a complete system can 58be installed into a clean 59.Xr chroot 8 60environment. 61The release procedure also requires that the 62.Xr md 4 63(memory disk) device driver be present in the kernel 64(either by being compiled in or available as a module). 65.Pp 66This document does not cover source code management, quality 67assurance, or other aspects of the release engineering process. 68.Sh TARGETS 69The release makefile 70.Pq Pa src/release/Makefile 71is fairly abstruse. 72Most developers will only be concerned with the 73.Cm release 74target. 75.\" XXX: Some sort of introduction to this list? All the others have one. 76.Bl -tag -width ".Cm rerelease" 77.It Cm release 78Uses 79.Dq Li "make installworld" 80to install a clean system into a 81.Xr chroot 8 82environment on the file system. 83Checks out the specified version of the source code and then rebuilds 84the entire system in the clean environment with 85.Dq Li "make world" . 86The detailed steps that follow are then executed to package up the 87different distributions, build the installation floppy disks, build 88release documentation, and so on. 89.Pp 90This target must be built as root with the 91.Va kern.securelevel 92sysctl set to \-1 (the default). 93.It Cm rerelease 94Assumes that the output of a release build has been manually modified, 95and performs the minimal number of steps to rebuild the release using 96the intermediate output of the previous 97.Dq Li "make release" . 98.It Cm floppies 99Generate a new set of boot and fixit floppies. 100This will call the 101.Cm release.5 , 102.Cm release.9 , 103.Cm floppies.1 , 104.Cm floppies.2 , 105and 106.Cm floppies.3 107targets to re-generate the floppy images of a previous 108.Dq Li "make release" . 109This is most often used to build custom boot floppies. 110.El 111.Pp 112Targets called by 113.Dq Li "make release" : 114.Bl -tag -width ".Cm fetch-distfiles" 115.It Cm release.1 116Cleans out the 117.Pa ${CHROOTDIR}/R 118directory and uses 119.Xr mtree 8 120to build the directory hierarchy for the system. 121.It Cm release.2 122Installs the system into the distribution directories. 123.It Cm release.3 124Builds and installs into the 125.Dq base 126distribution non-crypto versions of some tools. 127.It Cm release.4 128Makes and installs the 129.Pa GENERIC 130kernel as well as any other kernels listed in 131.Va KERNELS . 132.It Cm release.5 133Uses 134.Xr crunchgen 1 135to build 136.Dq crunched 137binaries to live on the installation floppies. 138.It Cm release.6 139Builds synthetic distributions, and cleans up the previously built 140distribution trees. 141.It Cm release.7 142Creates tarballs of the assembled distribution trees. 143.It Cm release.8 144Makes source distributions. 145.It Cm release.9 146Creates the MFS root file systems. 147.It Cm floppies.1 148Creates the boot and kernel floppies. 149.It Cm floppies.2 150Creates the fixit floppy. 151.It Cm floppies.3 152Finalizes the 153.Pa ${CHROORDIR}/R/ftp/stage/floppies 154staging directory. 155.It Cm ftp.1 156Sets up a suitable area for FTP installations in 157.Pa ${CHROOTDIR}/R/ftp . 158.It Cm cdrom.1 159Sets up a suitable area to build CD-ROM images in 160.Pa ${CHROOTDIR}/R/cdrom . 161.It Cm iso.1 162Builds two ISO images (installation and 163.Dq live 164file system) from the CD-ROM release area 165(disabled by default, see 166.Va MAKE_ISOS 167below). 168.It Cm fetch-distfiles 169Fetches distfiles needed during the release build that are not already in 170.Va RELEASEDISTFILES . 171.It Cm doc.1 172Builds all of the necessary tools to turn the 173.Fx 174Documentation Project source documents (SGML, XML) into HTML 175and text documents that will accompany the release. 176Also, builds and installs the actual user documentation. 177This includes the Handbook, FAQ, articles, and so on. 178.It Cm doc.2 179Builds the release documentation. 180This includes the release notes, 181hardware guide, and installation instructions. 182.El 183.Sh ENVIRONMENT 184Variables that must be specified: 185.Bl -tag -width ".Va BUILDNAME" 186.It Va BUILDNAME 187The name of the release to be built. 188This is used to set the 189.Va RELEASE 190value in 191.Pa sys/conf/newvers.sh , 192which affects the output of 193.Xr uname 1 . 194.It Va CHROOTDIR 195The directory to be used as the 196.Xr chroot 8 197environment for the entire release build. 198.\" XXX: I recommend against hardcoding specific numbers like "2.3" here; 199.\" XXX: perhaps it should be replaced with something to the effect of 200.\" XXX: "we don't know how much space you'll need, but make sure you have 201.\" XXX: at least 3 GB to be safe" (I know i'm still hardcoding a number, 202.\" XXX: but at least it looks less like a decree and more like an estimate. 203This file system should have at least 2.3 gigabytes of free space on the 204i386 architecture. 205.It Va CVSROOT 206The location of the 207.Fx 208CVS repository. 209This path name is in reference to the real system root, 210.Em not 211the root of the 212.Xr chroot 8 213directory tree. 214.El 215.Pp 216Optional variables: 217.Bl -tag -width ".Va NO_PREFETCHDISTFILES" 218.It Va CVSCMDARGS 219Additional arguments for 220.Xr cvs 1 221.Ic checkout 222and 223.Ic update 224commands. 225For example, setting this variable to 226.Dq Li "-D '01/01/2002 00:00:00 GMT'" 227for 228.Dq Li "make release" 229or 230.Dq Li "make rerelease" 231will ask 232.Xr cvs 1 233to check out or update sources as of 00:00:00 GMT, January 1 2002, respectively. 234.It Va DOC_LANG 235The list of languages and encodings the SGML-based documentation 236should be built for. 237If not set, the documentation is built for all available languages. 238.It Va DOCRELEASETAG 239The CVS tag to use when checking out the documentation tree. 240Usually, 241the head of the documentation tree is used by default. 242If 243.Va RELEASETAG 244specifies a release tag, 245then the associated release version is used as the default instead. 246.It Va EXTLOCALDIR 247The directory that will be copied to 248.Pa ${CHROOTDIR}/usr/local . 249.It Va KERNEL_FLAGS 250The contents of this variable are passed to 251.Xr make 1 252when building kernels during the release build. 253For example, setting this variable to 254.Dq Li "-j 4" 255will instruct 256.Xr make 1 257to execute up to four processes at a time. 258.It Va KERNELS 259Specifies a list of additional kernel configurations to compile and 260install into the 261.Dq base 262distribution. 263Each kernel is installed into 264.Pa /boot/<config> 265so that it can be booted from the loader via 266.Dq Li "boot <config>" . 267.It Va LOCAL_PATCHES 268Patch files against 269.Pa /usr/src 270that will be applied in the 271.Xr chroot 8 272environment before the release build begins. 273.It Va PATCH_FLAGS 274Arguments for the 275.Xr patch 1 276command used to apply 277.Va LOCAL_PATCHES 278patch file. 279.It Va LOCAL_SCRIPT 280A script that will be run in the 281.Xr chroot 8 282environment immediately after any local patches are applied. 283.It Va MAKE_ISOS 284If defined, bootable ISO CD-ROM images will be created from the 285contents of the CD-ROM stage directory. 286.It Va DISC1_LABEL 287The label used for the CD-ROM created from the disc1 contents, the 288default label will be 289.Dq Li fbsd_miniinst . 290.It Va DISC1_NAME 291The name used as part of the ISO file name for the CD-ROM created from 292the disc1 contents, the default will be 293.Dq Li miniinst . 294.It Va DISC2_LABEL 295The label used for the CD-ROM created from the disc2 contents, the 296default label will be 297.Dq Li fbsd_livefs . 298.It Va DISC2_NAME 299The name used as part of the ISO file name for the CD-ROM created from 300the disc2 contents, the default will be 301.Dq Li disc2 . 302.It Va NOCDROM 303If defined, the CD-ROM stage directories will not be created. 304.It Va NODOC 305If defined, the SGML-based documentation from the 306.Fx 307Documentation Project will not be built. 308However, the 309.Dq doc 310distribution will still be created with the minimal documentation set 311provided in 312.Pa src/share/doc . 313.It Va NO_FLOPPIES 314If defined, no boot and fixit floppy disk images will be created (i386-only). 315.It Va NOPORTS 316If defined, the Ports Collection will be omitted from the release. 317.It Va NOPORTREADMES 318If defined, readme files will not be created for each individual port 319in the Ports Collection. 320The default behavior is for 321.Dq Li "make release" 322to run 323.Dq Li "make readmes" 324from 325.Pa ${CHROOTDIR}/usr/ports , 326which can be a very time consuming operation. 327.It Va PORTSRELEASETAG 328The CVS tag to use when checking out the ports tree. 329Usually, 330the head of the ports tree is used by default. 331If 332.Va RELEASETAG 333specifies a release tag, 334then the associated release version is used as the default instead. 335.It Va NO_PREFETCHDISTFILES 336If this variable is defined, 337then distfiles needed during the release build will not be downloaded prior to 338entering the 339.Xr chroot 8 340environment. 341Note that if 342.Va NO_PREFETCHDISTFILES 343is not set, 344the fetching is done after any distfiles are obtained via 345.Va RELEASEDISTFILES . 346.It Va RELEASEDISTFILES 347The directory where the distribution files for ports required by the 348release build can be found. 349This may save a significant amount of time over downloading the 350distfiles through a slow link. 351.It Va RELEASENOUPDATE 352If this variable is defined for 353.Dq Li "make rerelease" , 354the source code will not be updated with 355.Dq Li "cvs update" . 356.It Va RELEASETAG 357The CVS tag corresponding to the release that is to be built. 358If undefined, the release will be built from the 359.Dv HEAD 360of the CVS tree 361(a 362.Dq "-CURRENT snapshot" ) . 363.It Va TARGET_ARCH 364The target machine processor architecture. 365This is analogous to the 366.Dq Nm uname Fl p 367output. 368Set this to cross-build for a different architecture. 369.It Va TARGET 370The target hardware platform. 371This is analogous to the 372.Dq Nm uname Fl m 373output. 374This is necessary to cross-build some target architectures. 375For example, cross-building for PC98 machines requires 376.Va TARGET_ARCH Ns = Ns Li i386 377and 378.Va TARGET Ns = Ns Li pc98 . 379.It Va WORLDDIR 380The directory where 381.Dq Li "make buildworld" 382was run; defaults to 383.Pa ${.CURDIR}/.. 384which usually points to 385.Pa /usr/src . 386.It Va WORLD_FLAGS 387The contents of this variable are passed to 388.Xr make 1 389when building world during the release build. 390For example, setting this variable to 391.Dq Li "-j 4" 392will instruct 393.Xr make 1 394to execute up to four processes at a time. 395.El 396.Sh FILES 397.Bl -tag -compact 398.It Pa /etc/make.conf 399.It Pa /usr/doc/Makefile 400.It Pa /usr/doc/share/mk/doc.project.mk 401.It Pa /usr/ports/Mk/bsd.port.mk 402.It Pa /usr/ports/Mk/bsd.sites.mk 403.It Pa /usr/share/examples/etc/make.conf 404.It Pa /usr/src/Makefile 405.It Pa /usr/src/Makefile.inc1 406.It Pa /usr/src/release/Makefile 407.It Pa /usr/src/release/${arch}/drivers.conf 408.It Pa /usr/src/release/${arch}/boot_crunch.conf 409.It Pa /usr/src/release/${arch}/fixit_crunch.conf 410.El 411.Sh EXAMPLES 412The following sequence of commands was used to build the 413.Fx 4.5 414release: 415.Bd -literal -offset indent 416cd /usr 417cvs co -rRELENG_4_5_0_RELEASE src 418cd src 419make buildworld 420cd release 421make release CHROOTDIR=/local3/release BUILDNAME=4.5-RELEASE \\ 422 CVSROOT=/host/cvs/usr/home/ncvs RELEASETAG=RELENG_4_5_0_RELEASE 423.Ed 424.Pp 425After running these commands, a complete system suitable for FTP or 426CD-ROM distribution is available in the 427.Pa /local3/release/R 428directory. 429.Pp 430The following sequence of commands can be used to build a 431.Dq "-CURRENT snapshot" 432of a 433locally modified source tree: 434.Bd -literal -offset indent 435cd /usr/src 436cvs diff -u > /path/to/local.patch 437make buildworld 438cd release 439make release CHROOTDIR=/local3/release BUILDNAME=5.0-CURRENT \\ 440 CVSROOT=/host/cvs/usr/home/ncvs LOCAL_PATCHES=/path/to/local.patch 441.Ed 442.Sh SEE ALSO 443.Xr cc 1 , 444.Xr crunchgen 1 , 445.Xr cvs 1 , 446.Xr install 1 , 447.Xr make 1 , 448.Xr patch 1 , 449.Xr uname 1 , 450.Xr md 4 , 451.Xr drivers.conf 5 , 452.Xr make.conf 5 , 453.Xr build 7 , 454.Xr ports 7 , 455.Xr chroot 8 , 456.Xr mtree 8 , 457.Xr sysctl 8 458.Rs 459.%T "FreeBSD Release Engineering" 460.%O http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/releng/ 461.Re 462.Rs 463.%T "FreeBSD Release Engineering of Third Party Packages" 464.%O http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/releng-packages/ 465.Re 466.Rs 467.%T "FreeBSD Developers' Handbook" 468.%O http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/ 469.Re 470.Sh HISTORY 471.Fx 4721.x 473used a manual checklist, compiled by 474.An Rod Grimes , 475to produce a release. 476Apart from being incomplete, the list put a lot of specific demands on 477available file systems and was quite torturous to execute. 478.Pp 479As part of the 480.Fx 2.0 481release engineering effort, significant 482effort was spent getting 483.Pa src/release/Makefile 484into a shape where it could at least automate most of the tediousness 485of building a release in a sterile environment. 486.Pp 487With its almost 1000 revisions spread over multiple branches, the 488.Xr cvs 1 489log of 490.Pa src/release/Makefile 491contains a vivid historical record of some 492of the hardships release engineers go through. 493.Sh AUTHORS 494.Pa src/release/Makefile 495was originally written by 496.An -nosplit 497.An Rod Grimes , 498.An Jordan Hubbard , 499and 500.An Poul-Henning Kamp . 501This manual page was written by 502.An Murray Stokely Aq murray@FreeBSD.org . 503.Sh BUGS 504Infrastructure changes are occasionally made to the 505.Fx 506documentation set in such a way that release builds on security 507branches can fail. 508To work around this, release builds can be made to checkout the 509documentation from the last fully supported release of 510.Fx . 511For example: 512.Pp 513.Dl "make release RELEASETAG=RELENG_4_5 DOCRELEASETAG=RELEASE_4_5_0 ..." 514