xref: /freebsd/share/man/man7/release.7 (revision a18eacbefdfa1085ca3db829e86ece78cd416493)
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 November 7, 2013
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
40.Fx
41source code repository in
42.Pa src/release .
43A complete release can actually be built with only a single command,
44including the creation of ISO images suitable for burning to CD-ROM,
45memory stick images, and an FTP install directory.
46This command is aptly named
47.Dq Li "make release" .
48.Pp
49For some users, it may be desirable to provide an absolutely clean
50build environment, with no local modifications to the source tree or to
51.Xr make.conf 5 ,
52and with clean checkouts of specific versions of the doc, src, and ports
53trees.
54For this purpose, a script
55.Pq Pa src/release/release.sh
56is provided to automate these checkouts and then execute
57.Dq Li "make release"
58in a clean
59.Xr chroot 8 .
60.Pp
61Before attempting to build a release, the user is expected to be
62familiar with the contents of
63.Xr build 7 ,
64and should have experience upgrading systems from source.
65.Pp
66The release build process requires that
67.Pa /usr/obj
68be populated with the output of
69.Dq Li "make buildworld"
70and
71.Dq Li "make buildkernel" .
72This is necessary to provide the object files for the release or, when
73using
74.Pa release.sh ,
75so that the object files for a complete system can be installed into a clean
76.Xr chroot 8
77environment.
78.Pp
79If the target release build is for a different architecture or machine type,
80the
81.Va TARGET
82and
83.Va TARGET_ARCH
84variables must be used.
85See the supported
86.Fa release.conf
87variables for more information.
88.Pp
89The release procedure on some architectures may also require that the
90.Xr md 4
91(memory disk) device driver be present in the kernel
92.Pq either by being compiled in or available as a module .
93.Pp
94This document does not cover source code management, quality
95assurance, or other aspects of the release engineering process.
96.Sh CLEAN RELEASE GENERATION
97Official releases of
98.Fx
99are produced in a totally clean environment to
100ensure consistency between the versions of the src, ports, and doc trees
101and to avoid contamination from the host system
102.Po such as local patches, changes
103to
104.Xr make.conf 5 ,
105etc.
106.Pc .
107This is accomplished using the wrapper script
108.Pa src/release/release.sh .
109.Pp
110.Ic release.sh
111.Op Fl c Ar release.conf
112.Pp
113.Ic release.sh
114checks out the
115.Li src/ ,
116.Li ports/ ,
117and
118.Li doc/
119trees to
120.Va CHROOTDIR ,
121then calls
122.Dq Li "make buildworld"
123and
124.Dq Li "make installworld"
125to generate a
126.Xr chroot 8
127environment.
128Next,
129.Dq Li "make release"
130is run within the
131.Xr chroot 8
132environment and places the result in
133.Pa $CHROOTDIR/R .
134.Pp
135The optional
136.Fa release.conf
137configuration file supports the following variables:
138.Bl -tag -width Ev
139.It Va CHROOTDIR
140The directory within which the release will be built.
141.It Va SVNROOT
142The
143.Xr svn 1
144host used to check out the various trees.
145Defaults to
146.Pa svn://svn.FreeeBSD.org .
147.It Va SRCBRANCH
148The
149.Li src/
150branch to use.
151Defaults to
152.Va head/@rHEAD .
153.It Va DOCBRANCH
154The
155.Li doc/
156branch to use.
157Defaults to
158.Va head/@rHEAD .
159.It Va PORTBRANCH
160The
161.Li ports/
162branch to use.
163Defaults to
164.Va head/@rHEAD .
165.It Va TARGET
166The target machine type for cross-building a release.
167.It Va TARGET_ARCH
168The target machine architecture for cross-building a release.
169.Pp
170For the supported list of
171.Va TARGET
172and
173.Va TARGET_ARCH
174combinations, consult the output of
175.Dq make targets
176as documented in
177.Xr build 7 .
178.It Va KERNEL
179The target kernel configuration to use.
180Defaults to
181.Va GENERIC .
182Multiple
183.Va KERNEL
184entries may be specified.
185.It Va MAKE_CONF
186The
187.Xr make.conf 5
188to use for the release build.
189Defaults to
190.Fa /dev/null
191to prevent polluting the release with local system changes.
192.It Va SRC_CONF
193The
194.Xr src.conf 5
195to use for the release build.
196Defaults to
197.Fa /dev/null
198to prevent polluting the release with local system changes.
199.It Va MAKE_FLAGS
200Additional flags to pass to
201.Xr make 1 .
202.It Va WORLD_FLAGS
203Additional flags to pass to
204.Xr make 1
205during the
206.Dq buildworld
207phase.
208Defaults to setting the number of
209.Xr make 1
210jobs
211.Pq Ar -j
212to the number of CPUs available on a SMP-capable system.
213.It Va KERNEL_FLAGS
214Additional flags to pass to
215.Xr make 1
216during the
217.Dq buildkernel
218phase.
219Defaults to setting the number of
220.Xr make 1
221jobs
222.Pq Ar -j
223to half the number of CPUs available on a SMP-capable system.
224.It Va NODOC
225Set to a non-empty value to skip the
226.Li doc/
227tree checkout.
228When set,
229.Va NODOC
230will prevent the
231.Fa doc.txz
232distribution package from being created.
233.It Va NOPORTS
234Set to a non-empty value to skip the
235.Li ports/
236tree checkout.
237When set,
238.Va NOPORTS
239will prevent the
240.Fa ports.txz
241distribution package from being created.
242Setting this also sets
243.Va NODOC .
244.El
245.Sh MAKEFILE TARGETS
246The release makefile
247.Pq Pa src/release/Makefile
248is fairly abstruse.
249Most developers will only be concerned with the
250.Cm release
251and
252.Cm install
253targets.
254.\" XXX: Some sort of introduction to this list?  All the others have one.
255.Bl -tag -width ".Cm packagesystem"
256.It Cm release
257Meta-target to build all release media and distributions applicable to this
258platform.
259.It Cm install
260Copy all produced release media to
261.Pa ${DESTDIR} .
262.It Cm cdrom
263Builds installation CD-ROM images.
264This may require the
265.Xr md 4
266(memory disk) device driver be present in the kernel
267(either by being compiled in or available as a module).
268This target produces files called
269.Pa disc1.iso
270and
271.Pa bootonly.iso
272as its output.
273.It Cm memstick
274Builds an installation memory stick image named
275.Pa memstick.img .
276Not applicable on all platforms.
277Requires that the
278.Xr md 4
279.Pq memory disk
280device driver be present in the kernel
281.Pq either by being compiled in or available as a module .
282.It Cm mini-memstick
283Similar to
284.Cm memstick ,
285with the exception that the installation distribution sets
286are not included.
287.It Cm ftp
288Creates a directory named
289.Pa ftp
290containing the distribution files used in network installations
291and suitable for upload to an FTP mirror.
292.El
293.Pp
294Major subtargets called by targets above:
295.Bl -tag -width ".Cm packagesystem"
296.It Cm packagesystem
297Generates all the distribution archives
298.Pq base, kernel, ports, doc
299applicable on this platform.
300.It Cm system
301Builds a bootable installation system containing all the distribution files
302packaged by the
303.Cm packagesystem
304target, and suitable for imaging by the
305.Cm cdrom
306and
307.Cm memstick
308targets.
309.It Cm reldoc
310Builds the release documentation.
311This includes the release notes,
312hardware guide, and installation instructions.
313Other documentation, such as the Handbook,
314is built during the
315.Cm base.txz
316target invoked by
317.Cm packagesystem .
318.El
319.Sh ENVIRONMENT
320Optional variables:
321.Bl -tag -width ".Ev TARGET_ARCH"
322.It Ev OSRELEASE
323Optional base name for generated media images
324.Pq e.g., FreeBSD-9.0-RC2-amd64 .
325Defaults to the output of
326.Ic `uname -s`-`uname -r`-`uname -p`
327within the chroot.
328.It Ev WORLDDIR
329Location of a directory containing the src tree.
330By default, the directory
331above the one containing the makefile
332.Pq Pa src .
333.It Ev PORTSDIR
334Location of a directory containing the ports tree.
335By default,
336.Pa /usr/ports .
337If it is unset or cannot be found, ports will not be included in the release.
338.It Ev DOCDIR
339Location of a directory containing the doc tree.
340By default,
341.Pa /usr/doc .
342If it is unset or cannot be found, most documentation will not be included in
343the release; see
344.Ev NODOC
345below.
346.It Ev NOPORTS
347If defined, the Ports Collection will be omitted from the release.
348.It Ev NOSRC
349If set, do not include system source code in the release.
350.It Ev NODOC
351If defined, the XML-based documentation from the
352.Fx
353Documentation Project will not be built.
354However, the
355.Dq doc
356distribution will still be created with the minimal documentation set
357provided in
358.Pa src/share/doc .
359.It Ev TARGET
360The target hardware platform.
361This is analogous to the
362.Dq Nm uname Fl m
363output.
364This is necessary to cross-build some target architectures.
365For example, cross-building for PC98 machines requires
366.Ev TARGET_ARCH Ns = Ns Li i386
367and
368.Ev TARGET Ns = Ns Li pc98 .
369If not set,
370.Ev TARGET
371defaults to the current hardware platform.
372.It Ev TARGET_ARCH
373The target machine processor architecture.
374This is analogous to the
375.Dq Nm uname Fl p
376output.
377Set this to cross-build for a different architecture.
378If not set,
379.Ev TARGET_ARCH
380defaults to the current machine architecture, unless
381.Ev TARGET
382is also set, in which case it defaults to the appropriate
383value for that platform.
384Typically, one only needs to set
385.Ev TARGET .
386.El
387.Sh FILES
388.Bl -tag -compact -width Pa
389.It Pa /usr/doc/Makefile
390.It Pa /usr/doc/share/mk/doc.project.mk
391.It Pa /usr/ports/Mk/bsd.port.mk
392.It Pa /usr/ports/Mk/bsd.sites.mk
393.It Pa /usr/share/examples/etc/make.conf
394.It Pa /usr/src/Makefile
395.It Pa /usr/src/Makefile.inc1
396.It Pa /usr/src/release/Makefile
397.It Pa /usr/src/release/release.sh
398.It Pa /usr/src/release/release.conf.sample
399.El
400.Sh EXAMPLES
401The following sequence of commands can be used to build a
402.Dq "-CURRENT snapshot":
403.Bd -literal -offset indent
404cd /usr
405svn co svn://svn.freebsd.org/base/head src
406cd src
407make buildworld buildkernel
408cd release
409make release
410make install DESTDIR=/var/freebsd-snapshot
411.Ed
412.Pp
413After running these commands, all produced distribution files (tarballs
414for FTP, CD-ROM images, etc.) are available in the
415.Pa /var/freebsd-snapshot
416directory.
417.Pp
418The following sequence of commands can be used to build a
419.Dq "-CURRENT snapshot"
420in a clean environment, including ports and documentation:
421.Bd -literal -offset indent
422cd /usr/src/release
423sh release.sh
424.Ed
425.Pp
426Optionally, a configuration file can be used customize the release build,
427such as the subversion revision to use, the branch of the subversion tree for
428.Li src/ ,
429.Li ports/ ,
430and
431.Li doc/ .
432.Bd -literal -offset indent
433cd /usr/src/release
434sh release.sh -c $HOME/release.conf
435.Ed
436.Pp
437After running these commands, all prepared release files are available in the
438.Pa /scratch
439directory.
440The target directory can be changed by specifying the
441.Va CHROOTDIR
442variable in
443.Li release.conf .
444.Sh SEE ALSO
445.Xr cc 1 ,
446.Xr install 1 ,
447.Xr make 1 ,
448.Xr svn 1 Pq Pa ports/devel/subversion ,
449.Xr uname 1 ,
450.Xr md 4 ,
451.Xr make.conf 5 ,
452.Xr build 7 ,
453.Xr ports 7 ,
454.Xr chroot 8 ,
455.Xr mtree 8 ,
456.Xr sysctl 8
457.Rs
458.%T "FreeBSD Release Engineering"
459.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/releng/
460.Re
461.Rs
462.%T "FreeBSD Release Engineering of Third Party Packages"
463.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/releng-packages/
464.Re
465.Rs
466.%T "FreeBSD Developers' Handbook"
467.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/
468.Re
469.Sh HISTORY
470.Fx
4711.x
472used a manual checklist, compiled by
473.An Rod Grimes ,
474to produce a release.
475Apart from being incomplete, the list put a lot of specific demands on
476available file systems and was quite torturous to execute.
477.Pp
478As part of the
479.Fx 2.0
480release engineering effort, significant
481effort was spent getting
482.Pa src/release/Makefile
483into a shape where it could at least automate most of the tediousness
484of building a release in a sterile environment.
485.Pp
486For the
487.Fx 9.0
488release,
489.Pa src/release/Makefile
490was overhauled and the wrapper script
491.Pa src/release/generate-release.sh
492introduced to support the introduction of a new installer.
493.Pp
494For the
495.Fx 9.2
496release,
497.Pa src/release/release.sh
498was introduced to support per-build configuration files.
499.Pa src/release/release.sh
500is heavily based on the
501.Pa src/release/generate-release.sh
502script.
503.Pp
504At near 1000 revisions spread over multiple branches, the
505.Xr svn 1
506log of
507.Pa src/release/Makefile
508contains a vivid historical record of some
509of the hardships release engineers go through.
510.Sh AUTHORS
511.Pa src/release/Makefile
512was originally written by
513.An -nosplit
514.An Rod Grimes ,
515.An Jordan Hubbard ,
516and
517.An Poul-Henning Kamp .
518.Pp
519This manual page was originally written by
520.An Murray Stokely Aq murray@FreeBSD.org .
521.Pp
522It was updated by
523.An Nathan Whitehorn Aq nwhitehorn@FreeBSD.org
524to include the
525.Fa generate-release.sh
526script used for the
527.Fx 9.0
528release cycle.
529.Pp
530It was later updated by
531.An Glen Barber Aq gjb@FreeBSD.org
532to include the
533.Fa release.sh
534script used for the
535.Fx 9.2
536release cycle.
537