xref: /freebsd/share/man/man7/release.7 (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
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 20, 2015
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 CHROOT_MAKEENV
142Additional
143.Xr make 1
144arguments to pass through, which directly affect the
145tuning of the build chroot.
146.It Va SVNROOT
147The
148.Xr svn 1
149host used to check out the various trees.
150Defaults to
151.Pa svn://svn.FreeeBSD.org .
152.It Va SRCBRANCH
153The
154.Li src/
155branch to use.
156Defaults to
157.Va head/@rHEAD .
158.It Va DOCBRANCH
159The
160.Li doc/
161branch to use.
162Defaults to
163.Va head/@rHEAD .
164.It Va PORTBRANCH
165The
166.Li ports/
167branch to use.
168Defaults to
169.Va head/@rHEAD .
170.It Va TARGET
171The target machine type for cross-building a release.
172.It Va TARGET_ARCH
173The target machine architecture for cross-building a release.
174.Pp
175For the supported list of
176.Va TARGET
177and
178.Va TARGET_ARCH
179combinations, consult the output of
180.Dq make targets
181as documented in
182.Xr build 7 .
183.It Va KERNEL
184The target kernel configuration to use.
185Defaults to
186.Va GENERIC .
187Multiple
188.Va KERNEL
189entries may be specified.
190.It Va MAKE_CONF
191The
192.Xr make.conf 5
193to use for the release build.
194Defaults to
195.Fa /dev/null
196to prevent polluting the release with local system changes.
197.It Va SRC_CONF
198The
199.Xr src.conf 5
200to use for the release build.
201Defaults to
202.Fa /dev/null
203to prevent polluting the release with local system changes.
204.It Va MAKE_FLAGS
205Additional flags to pass to
206.Xr make 1 .
207.It Va WORLD_FLAGS
208Additional flags to pass to
209.Xr make 1
210during the
211.Dq buildworld
212phase.
213Defaults to setting the number of
214.Xr make 1
215jobs
216.Pq Ar -j
217to the number of CPUs available on a SMP-capable system.
218.It Va KERNEL_FLAGS
219Additional flags to pass to
220.Xr make 1
221during the
222.Dq buildkernel
223phase.
224Defaults to setting the number of
225.Xr make 1
226jobs
227.Pq Ar -j
228to half the number of CPUs available on a SMP-capable system.
229.It Va NODOC
230Set to a non-empty value to skip the
231.Li doc/
232tree checkout.
233When set,
234.Va NODOC
235will prevent the
236.Fa doc.txz
237distribution package from being created.
238.It Va NOPORTS
239Set to a non-empty value to skip the
240.Li ports/
241tree checkout.
242When set,
243.Va NOPORTS
244will prevent the
245.Fa ports.txz
246distribution package from being created.
247Setting this also sets
248.Va NODOC .
249.It Va WITH_DVD
250Set to a non-empty value to include the
251.Cm dvdrom
252target.
253.It Va WITH_COMPRESSED_IMAGES
254Set to a non-empty value to compress the release images with
255.Xr xz 1 .
256The original
257.Pq uncompressed
258images are not removed.
259.It Va XZ_THREADS Pq Vt int
260Set to the number of threads
261.Xr xz 1
262should use when compressing images.
263By default,
264.Va XZ_THREADS
265is set to
266.Va 0 ,
267which uses all available cores on the system.
268.It Va VCSCMD
269The command run to obtain the source trees.
270Defaults to
271.Qq Cm svn checkout .
272.It Va CHROOTBUILD_SKIP
273If defined, the
274.Li buildworld ,
275.Li installworld ,
276and
277.Li distribution
278stages of the
279.Xr chroot 8
280build environment setup are skipped.
281This is intended solely for cases where the
282.Xr chroot 8
283userland are provided by alternate means.
284.It Va SRC_UPDATE_SKIP
285Set to a non-empty value to prevent checkout or update of
286.Fa /usr/src
287within the
288.Xr chroot 8 .
289This is intended for use only when
290.Fa /usr/src
291is expected to exist by alternative means.
292.It Va DOC_UPDATE_SKIP
293Set to a non-empty value to prevent checkout or update of
294.Fa /usr/doc
295within the
296.Xr chroot 8 .
297This is intended for use only when
298.Fa /usr/doc
299is expected to exist by alternative means.
300.It Va PORTS_UPDATE_SKIP
301Set to a non-empty value to prevent checkout or update of
302.Fa /usr/ports
303within the
304.Xr chroot 8 .
305This is intended for use only when
306.Fa /usr/ports
307is expected to exist by alternative means.
308.El
309.Sh EMBEDDED BUILDS
310The following
311.Fa release.conf
312variables are relevant only to release builds for embedded systems:
313.Bl -tag -width Ev
314.It Va EMBEDDEDBUILD
315Set to a non-null value to enable functionality for embedded device
316release builds.
317.Pq This option is considered highly experimental.
318.Pp
319When set,
320.Va WITH_DVD
321is unset, and
322.Va NODOC
323is defined.
324Additionally,
325.Va XDEV
326and
327.Va XDEV_ARCH
328must also be defined.
329When the build environment is created,
330.Fa release.sh
331runs a separate build script located in an architecture-specific
332directory in
333.Pa src/release/${XDEV}/ .
334.It Va EMBEDDEDPORTS
335Set to the list of any ports that are required for the target device
336in the format of
337.Fa category/port .
338The
339.Fa devel/subversion
340port is built by default.
341.It Va CROCHETSRC
342Set to the source URL for the Crochet build tool.
343.It Va CROCHETBRANCH
344Set to the subversion branch from
345.Va ${CROCHETSRC}
346to use.
347Defaults to
348.Pa trunk .
349.It Va UBOOTSRC
350Set to the source URL of u-boot, if required.
351.It Va UBOOTBRANCH
352Set to the subversion branch from
353.Va ${UBOOTSRC}
354to use.
355Defaults to
356.Pa trunk .
357.It Va UBOOTDIR
358Set to the target directory within
359.Va ${CHROOTDIR}
360to check out
361.Va ${UBOOTSRC}/${UBOOTBRANCH} .
362.El
363.Sh VIRTUAL MACHINE DISK IMAGES
364The following
365.Fa release.conf
366variables are relevant only to virtual machine disk image builds:
367.Bl -tag -width Ev
368.It Va WITH_VMIMAGES
369Set to a non-null value to build virtual machine disk images as part
370of the release build.
371.Va WITH_VMIMAGES
372may also be specified as an environment variable passed to
373.Xr make 1 .
374.Pp
375The option requires
376.Xr mkimg 1
377version 20140927 or later.
378.It Va WITH_COMPRESSED_VMIMAGES
379Set to a non-null value to compress the virtual machine disk images with
380.Xr xz 1
381as part of the
382.Cm install
383.Xr make 1
384target.
385Note that compressing virtual machine disk images may take a very long
386time on some systems.
387.It Va VMBASE
388Set to change the name of the resulting virtual machine disk image file.
389The default value is
390.Va vm .
391.It Va VMSIZE
392Set to change the size of the virtual machine disk capacity.
393The default value is
394.Va 20G .
395See
396.Xr truncate 1
397for valid values.
398.Pp
399Virtual machine disk images are, by default, created as sparse images.
400When
401.Va WITH_COMPRESSED_VMIMAGES
402is used, the resulting files compressed with
403.Xr xz 1
404compress to roughly the same size, regardless of the specified disk image
405size.
406.It Va VMFORMATS
407Set to the target virtual disk image format(s) to create.
408By default, the
409.Va vhdf , Va vmdk , Va qcow2 ,
410and
411.Va raw
412formats are created.
413See
414.Xr mkimg 1
415for valid format values
416.Pq requires version 20140927 or later .
417.El
418.Pp
419For a list of supported
420.Va VMFORMATS
421values
422.Pq including cloud hosting provider formats
423along with a brief description, run:
424.Bd -literal -offset indent
425cd /usr/src
426make -C release list-vmtargets
427.Ed
428.Sh CLOUD HOSTING MACHINE IMAGES
429The
430.Fx
431release build tools support building virtual machine images for various
432cloud hosting providers, each with their own specific configuration to
433include support for each hosting provider by default.
434.Pp
435The following
436.Xr make 1
437environment variables are supported:
438.Bl -tag -width Ev
439.It Va CLOUDWARE
440Set to a list of one or more cloud hosting providers, enclosed in quotes.
441Requires
442.Va WITH_CLOUDWARE
443to also be set.
444.It Va WITH_CLOUDWARE
445Set to a non-empty value to enable building virtual machine images
446for various cloud hosting providers.
447Requires
448.Va CLOUDWARE
449to also be set.
450.El
451.Pp
452Additionally, the
453.Va CLOUDWARE
454and
455.Va WITH_CLOUDWARE
456variables can be added to
457.Pa release.conf ,
458and used in conjunction with
459.Pa release.sh .
460.Pp
461For a list of supported
462.Va CLOUDWARE
463values, run:
464.Bd -literal -offset indent
465cd /usr/src
466make -C release list-cloudware
467.Ed
468.Sh MAKEFILE TARGETS
469The release makefile
470.Pq Pa src/release/Makefile
471is fairly abstruse.
472Most developers will only be concerned with the
473.Cm release
474and
475.Cm install
476targets.
477.\" XXX: Some sort of introduction to this list?  All the others have one.
478.Bl -tag -width ".Cm packagesystem"
479.It Cm release
480Meta-target to build all release media and distributions applicable to this
481platform.
482.It Cm install
483Copy all produced release media to
484.Pa ${DESTDIR} .
485.It Cm cdrom
486Builds installation CD-ROM images.
487This may require the
488.Xr md 4
489(memory disk) device driver be present in the kernel
490(either by being compiled in or available as a module).
491This target produces files called
492.Pa disc1.iso
493and
494.Pa bootonly.iso
495as its output.
496.It Cm dvdrom
497Builds installation DVD-ROM images.
498This may require the
499.Xr md 4
500(memory disk) device driver be present in the kernel
501(either by being compiled in or available as a module).
502This target produces the
503.Pa dvd1.iso
504file as its output.
505.It Cm memstick
506Builds an installation memory stick image named
507.Pa memstick.img .
508Not applicable on all platforms.
509Requires that the
510.Xr md 4
511.Pq memory disk
512device driver be present in the kernel
513.Pq either by being compiled in or available as a module .
514.It Cm mini-memstick
515Similar to
516.Cm memstick ,
517with the exception that the installation distribution sets
518are not included.
519.It Cm ftp
520Creates a directory named
521.Pa ftp
522containing the distribution files used in network installations
523and suitable for upload to an FTP mirror.
524.It Cm vm-image
525Creates virtual machine disk images in various formats.
526The
527.Cm vm-image
528target requires the
529.Va WITH_VMIMAGES
530.Xr make 1
531environment variable to be set to a non-null value.
532.It Cm vm-cloudware
533Builds
534.Fx
535virtual machine images for various cloud hosting providers.
536See
537.Qq CLOUD HOSTING MACHINE IMAGES
538for implementation details.
539.It Cm list-cloudware
540Displays the list of valid
541.Va CLOUDWARE
542values.
543.It Cm list-vmtargets
544Displays the list of valid
545.Va VMFORMAT
546and
547.Va CLOUDWARE
548values.
549.El
550.Pp
551Major subtargets called by targets above:
552.Bl -tag -width ".Cm packagesystem"
553.It Cm packagesystem
554Generates all the distribution archives
555.Pq base, kernel, ports, doc
556applicable on this platform.
557.It Cm disc1
558Builds a bootable installation system containing all the distribution files
559packaged by the
560.Cm packagesystem
561target, and suitable for imaging by the
562.Cm cdrom ,
563.Cm dvdrom
564and
565.Cm memstick
566targets.
567.It Cm reldoc
568Builds the release documentation.
569This includes the release notes,
570hardware guide, and installation instructions.
571Other documentation, such as the Handbook,
572is built during the
573.Cm base.txz
574target invoked by
575.Cm packagesystem .
576.El
577.Sh ENVIRONMENT
578Optional variables:
579.Bl -tag -width ".Ev TARGET_ARCH"
580.It Ev OSRELEASE
581Optional base name for generated media images
582.Pq e.g., FreeBSD-9.0-RC2-amd64 .
583Defaults to the output of
584.Ic `uname -s`-`uname -r`-`uname -p`
585within the chroot.
586.It Ev WORLDDIR
587Location of a directory containing the src tree.
588By default, the directory
589above the one containing the makefile
590.Pq Pa src .
591.It Ev PORTSDIR
592Location of a directory containing the ports tree.
593By default,
594.Pa /usr/ports .
595If it is unset or cannot be found, ports will not be included in the release.
596.It Ev DOCDIR
597Location of a directory containing the doc tree.
598By default,
599.Pa /usr/doc .
600If it is unset or cannot be found, most documentation will not be included in
601the release; see
602.Ev NODOC
603below.
604.It Ev NOPORTS
605If defined, the Ports Collection will be omitted from the release.
606.It Ev NOSRC
607If set, do not include system source code in the release.
608.It Ev NODOC
609If defined, the XML-based documentation from the
610.Fx
611Documentation Project will not be built.
612However, the
613.Dq doc
614distribution will still be created with the minimal documentation set
615provided in
616.Pa src/share/doc .
617.It Ev TARGET
618The target hardware platform.
619This is analogous to the
620.Dq Nm uname Fl m
621output.
622This is necessary to cross-build some target architectures.
623For example, cross-building for PC98 machines requires
624.Ev TARGET_ARCH Ns = Ns Li i386
625and
626.Ev TARGET Ns = Ns Li pc98 .
627If not set,
628.Ev TARGET
629defaults to the current hardware platform.
630.It Ev TARGET_ARCH
631The target machine processor architecture.
632This is analogous to the
633.Dq Nm uname Fl p
634output.
635Set this to cross-build for a different architecture.
636If not set,
637.Ev TARGET_ARCH
638defaults to the current machine architecture, unless
639.Ev TARGET
640is also set, in which case it defaults to the appropriate
641value for that platform.
642Typically, one only needs to set
643.Ev TARGET .
644.El
645.Sh FILES
646.Bl -tag -compact -width Pa
647.It Pa /usr/doc/Makefile
648.It Pa /usr/doc/share/mk/doc.project.mk
649.It Pa /usr/ports/Mk/bsd.port.mk
650.It Pa /usr/ports/Mk/bsd.sites.mk
651.It Pa /usr/share/examples/etc/make.conf
652.It Pa /usr/src/Makefile
653.It Pa /usr/src/Makefile.inc1
654.It Pa /usr/src/release/Makefile
655.It Pa /usr/src/release/Makefile.vm
656.It Pa /usr/src/release/release.sh
657.It Pa /usr/src/release/release.conf.sample
658.It Pa /usr/src/release/tools/*.conf
659.It Pa /usr/src/release/tools/vmimage.subr
660.El
661.Sh EXAMPLES
662The following sequence of commands can be used to build a
663.Dq "-CURRENT snapshot":
664.Bd -literal -offset indent
665cd /usr
666svn co svn://svn.freebsd.org/base/head src
667cd src
668make buildworld buildkernel
669cd release
670make release
671make install DESTDIR=/var/freebsd-snapshot
672.Ed
673.Pp
674After running these commands, all produced distribution files (tarballs
675for FTP, CD-ROM images, etc.) are available in the
676.Pa /var/freebsd-snapshot
677directory.
678.Pp
679The following sequence of commands can be used to build a
680.Dq "-CURRENT snapshot"
681in a clean environment, including ports and documentation:
682.Bd -literal -offset indent
683cd /usr/src/release
684sh release.sh
685.Ed
686.Pp
687Optionally, a configuration file can be used customize the release build,
688such as the subversion revision to use, the branch of the subversion tree for
689.Li src/ ,
690.Li ports/ ,
691and
692.Li doc/ .
693.Bd -literal -offset indent
694cd /usr/src/release
695sh release.sh -c $HOME/release.conf
696.Ed
697.Pp
698After running these commands, all prepared release files are available in the
699.Pa /scratch
700directory.
701The target directory can be changed by specifying the
702.Va CHROOTDIR
703variable in
704.Li release.conf .
705.Sh SEE ALSO
706.Xr cc 1 ,
707.Xr install 1 ,
708.Xr make 1 ,
709.Xr svn 1 Pq Pa ports/devel/subversion ,
710.Xr uname 1 ,
711.Xr md 4 ,
712.Xr make.conf 5 ,
713.Xr build 7 ,
714.Xr ports 7 ,
715.Xr chroot 8 ,
716.Xr mtree 8 ,
717.Xr sysctl 8
718.Rs
719.%T "FreeBSD Release Engineering"
720.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/releng/
721.Re
722.Rs
723.%T "FreeBSD Developers' Handbook"
724.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/
725.Re
726.Sh HISTORY
727.Fx
7281.x
729used a manual checklist, compiled by
730.An Rod Grimes ,
731to produce a release.
732Apart from being incomplete, the list put a lot of specific demands on
733available file systems and was quite torturous to execute.
734.Pp
735As part of the
736.Fx 2.0
737release engineering effort, significant
738effort was spent getting
739.Pa src/release/Makefile
740into a shape where it could at least automate most of the tediousness
741of building a release in a sterile environment.
742.Pp
743For the
744.Fx 9.0
745release,
746.Pa src/release/Makefile
747was overhauled and the wrapper script
748.Pa src/release/generate-release.sh
749introduced to support the introduction of a new installer.
750.Pp
751For the
752.Fx 9.2
753release,
754.Pa src/release/release.sh
755was introduced to support per-build configuration files.
756.Pa src/release/release.sh
757is heavily based on the
758.Pa src/release/generate-release.sh
759script.
760.Pp
761At near 1000 revisions spread over multiple branches, the
762.Xr svn 1
763log of
764.Pa src/release/Makefile
765contains a vivid historical record of some
766of the hardships release engineers go through.
767.Sh AUTHORS
768.Pa src/release/Makefile
769was originally written by
770.An -nosplit
771.An Rod Grimes ,
772.An Jordan Hubbard ,
773and
774.An Poul-Henning Kamp .
775.Pp
776This manual page was originally written by
777.An Murray Stokely Aq Mt murray@FreeBSD.org .
778.Pp
779It was updated by
780.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org
781to include the
782.Fa generate-release.sh
783script used for the
784.Fx 9.0
785release cycle.
786.Pp
787It was later updated by
788.An Glen Barber Aq Mt gjb@FreeBSD.org
789to include the
790.Fa release.sh
791script used for the
792.Fx 9.2
793release cycle.
794