xref: /freebsd/share/man/man7/release.7 (revision 148a8da8)
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 28, 2018
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.Pp
318When set,
319.Va WITH_DVD
320is unset, and
321.Va NODOC
322is defined.
323Additionally,
324.Va EMBEDDED_TARGET
325and
326.Va EMBEDDED_TARGET_ARCH
327must also be defined.
328When the build environment is created,
329.Fa release.sh
330runs a separate build script located in an architecture-specific
331directory in
332.Pa src/release/${EMBEDDED_TARGET}/ .
333.It Va EMBEDDEDPORTS
334Set to the list of any ports that are required for the target device
335in the format of
336.Fa category/port .
337The
338.Fa devel/subversion
339port is built by default.
340.It Va EMBEDDED_TARGET
341When set, its value is passed to
342.Xr make 1
343to set the
344.Va TARGET
345.Pq value of Cm uname Fl m
346to cross build the target userland.
347.It Va EMBEDDED_TARGET_ARCH
348When set, its value is passed to
349.Xr make 1
350to set the
351.Va TARGET_ARCH
352.Pq value of Cm uname Fl p
353to cross build the target userland.
354.El
355.Sh VIRTUAL MACHINE DISK IMAGES
356The following
357.Fa release.conf
358variables are relevant only to virtual machine disk image builds:
359.Bl -tag -width Ev
360.It Va WITH_VMIMAGES
361Set to a non-null value to build virtual machine disk images as part
362of the release build.
363.Va WITH_VMIMAGES
364may also be specified as an environment variable passed to
365.Xr make 1 .
366.Pp
367The option requires
368.Xr mkimg 1
369version 20140927 or later.
370.It Va WITH_COMPRESSED_VMIMAGES
371Set to a non-null value to compress the virtual machine disk images with
372.Xr xz 1
373as part of the
374.Cm install
375.Xr make 1
376target.
377Note that compressing virtual machine disk images may take a very long
378time on some systems.
379.It Va VMBASE
380Set to change the name of the resulting virtual machine disk image file.
381The default value is
382.Va vm .
383.It Va VMSIZE
384Set to change the size of the virtual machine disk capacity.
385The default value is
386.Va 20G .
387See
388.Xr truncate 1
389for valid values.
390.Pp
391Virtual machine disk images are, by default, created as sparse images.
392When
393.Va WITH_COMPRESSED_VMIMAGES
394is used, the resulting files compressed with
395.Xr xz 1
396compress to roughly the same size, regardless of the specified disk image
397size.
398.It Va VMFORMATS
399Set to the target virtual disk image format(s) to create.
400By default, the
401.Va vhdf , Va vmdk , Va qcow2 ,
402and
403.Va raw
404formats are created.
405See
406.Xr mkimg 1
407for valid format values
408.Pq requires version 20140927 or later .
409.El
410.Pp
411For a list of supported
412.Va VMFORMATS
413values
414.Pq including cloud hosting provider formats
415along with a brief description, run:
416.Bd -literal -offset indent
417cd /usr/src
418make -C release list-vmtargets
419.Ed
420.Sh CLOUD HOSTING MACHINE IMAGES
421The
422.Fx
423release build tools support building virtual machine images for various
424cloud hosting providers, each with their own specific configuration to
425include support for each hosting provider by default.
426.Pp
427The following
428.Xr make 1
429environment variables are supported:
430.Bl -tag -width Ev
431.It Va CLOUDWARE
432Set to a list of one or more cloud hosting providers, enclosed in quotes.
433Requires
434.Va WITH_CLOUDWARE
435to also be set.
436.It Va WITH_CLOUDWARE
437Set to a non-empty value to enable building virtual machine images
438for various cloud hosting providers.
439Requires
440.Va CLOUDWARE
441to also be set.
442.El
443.Pp
444Additionally, the
445.Va CLOUDWARE
446and
447.Va WITH_CLOUDWARE
448variables can be added to
449.Pa release.conf ,
450and used in conjunction with
451.Pa release.sh .
452.Pp
453For a list of supported
454.Va CLOUDWARE
455values, run:
456.Bd -literal -offset indent
457cd /usr/src
458make -C release list-cloudware
459.Ed
460.Sh MAKEFILE TARGETS
461The release makefile
462.Pq Pa src/release/Makefile
463is fairly abstruse.
464Most developers will only be concerned with the
465.Cm release
466and
467.Cm install
468targets.
469.\" XXX: Some sort of introduction to this list?  All the others have one.
470.Bl -tag -width ".Cm packagesystem"
471.It Cm release
472Meta-target to build all release media and distributions applicable to this
473platform.
474.It Cm install
475Copy all produced release media to
476.Pa ${DESTDIR} .
477.It Cm cdrom
478Builds installation CD-ROM images.
479This may require the
480.Xr md 4
481(memory disk) device driver be present in the kernel
482(either by being compiled in or available as a module).
483This target produces files called
484.Pa disc1.iso
485and
486.Pa bootonly.iso
487as its output.
488.It Cm dvdrom
489Builds installation DVD-ROM images.
490This may require the
491.Xr md 4
492(memory disk) device driver be present in the kernel
493(either by being compiled in or available as a module).
494This target produces the
495.Pa dvd1.iso
496file as its output.
497.It Cm memstick
498Builds an installation memory stick image named
499.Pa memstick.img .
500Not applicable on all platforms.
501Requires that the
502.Xr md 4
503.Pq memory disk
504device driver be present in the kernel
505.Pq either by being compiled in or available as a module .
506.It Cm mini-memstick
507Similar to
508.Cm memstick ,
509with the exception that the installation distribution sets
510are not included.
511.It Cm ftp
512Creates a directory named
513.Pa ftp
514containing the distribution files used in network installations
515and suitable for upload to an FTP mirror.
516.It Cm vm-image
517Creates virtual machine disk images in various formats.
518The
519.Cm vm-image
520target requires the
521.Va WITH_VMIMAGES
522.Xr make 1
523environment variable to be set to a non-null value.
524.It Cm vm-cloudware
525Builds
526.Fx
527virtual machine images for various cloud hosting providers.
528See
529.Qq CLOUD HOSTING MACHINE IMAGES
530for implementation details.
531.It Cm list-cloudware
532Displays the list of valid
533.Va CLOUDWARE
534values.
535.It Cm list-vmtargets
536Displays the list of valid
537.Va VMFORMAT
538and
539.Va CLOUDWARE
540values.
541.El
542.Pp
543Major subtargets called by targets above:
544.Bl -tag -width ".Cm packagesystem"
545.It Cm packagesystem
546Generates all the distribution archives
547.Pq base, kernel, ports, doc
548applicable on this platform.
549.It Cm disc1
550Builds a bootable installation system containing all the distribution files
551packaged by the
552.Cm packagesystem
553target, and suitable for imaging by the
554.Cm cdrom ,
555.Cm dvdrom
556and
557.Cm memstick
558targets.
559.It Cm reldoc
560Builds the release documentation.
561This includes the release notes,
562hardware guide, and installation instructions.
563Other documentation, such as the Handbook,
564is built during the
565.Cm base.txz
566target invoked by
567.Cm packagesystem .
568.El
569.Sh ENVIRONMENT
570Optional variables:
571.Bl -tag -width ".Ev TARGET_ARCH"
572.It Ev OSRELEASE
573Optional base name for generated media images
574.Pq e.g., FreeBSD-9.0-RC2-amd64 .
575Defaults to the output of
576.Ic `uname -s`-`uname -r`-`uname -p`
577within the chroot.
578.It Ev WORLDDIR
579Location of a directory containing the src tree.
580By default, the directory
581above the one containing the makefile
582.Pq Pa src .
583.It Ev PORTSDIR
584Location of a directory containing the ports tree.
585By default,
586.Pa /usr/ports .
587If it is unset or cannot be found, ports will not be included in the release.
588.It Ev DOCDIR
589Location of a directory containing the doc tree.
590By default,
591.Pa /usr/doc .
592If it is unset or cannot be found, most documentation will not be included in
593the release; see
594.Ev NODOC
595below.
596.It Ev NOPORTS
597If defined, the Ports Collection will be omitted from the release.
598.It Ev NOSRC
599If set, do not include system source code in the release.
600.It Ev NODOC
601If defined, the XML-based documentation from the
602.Fx
603Documentation Project will not be built.
604However, the
605.Dq doc
606distribution will still be created with the minimal documentation set
607provided in
608.Pa src/share/doc .
609.It Ev TARGET
610The target hardware platform.
611This is analogous to the
612.Dq Nm uname Fl m
613output.
614This is necessary to cross-build some target architectures.
615For example, cross-building for ARM64 machines requires
616.Ev TARGET_ARCH Ns = Ns Li aarch64
617and
618.Ev TARGET Ns = Ns Li arm64 .
619If not set,
620.Ev TARGET
621defaults to the current hardware platform.
622.It Ev TARGET_ARCH
623The target machine processor architecture.
624This is analogous to the
625.Dq Nm uname Fl p
626output.
627Set this to cross-build for a different architecture.
628If not set,
629.Ev TARGET_ARCH
630defaults to the current machine architecture, unless
631.Ev TARGET
632is also set, in which case it defaults to the appropriate
633value for that platform.
634Typically, one only needs to set
635.Ev TARGET .
636.El
637.Sh FILES
638.Bl -tag -compact -width Pa
639.It Pa /usr/doc/Makefile
640.It Pa /usr/doc/share/mk/doc.project.mk
641.It Pa /usr/ports/Mk/bsd.port.mk
642.It Pa /usr/ports/Mk/bsd.sites.mk
643.It Pa /usr/share/examples/etc/make.conf
644.It Pa /usr/src/Makefile
645.It Pa /usr/src/Makefile.inc1
646.It Pa /usr/src/release/Makefile
647.It Pa /usr/src/release/Makefile.vm
648.It Pa /usr/src/release/release.sh
649.It Pa /usr/src/release/release.conf.sample
650.It Pa /usr/src/release/tools/*.conf
651.It Pa /usr/src/release/tools/vmimage.subr
652.El
653.Sh EXAMPLES
654The following sequence of commands can be used to build a
655.Dq "-CURRENT snapshot":
656.Bd -literal -offset indent
657cd /usr
658svn co svn://svn.freebsd.org/base/head src
659cd src
660make buildworld buildkernel
661cd release
662make release
663make install DESTDIR=/var/freebsd-snapshot
664.Ed
665.Pp
666After running these commands, all produced distribution files (tarballs
667for FTP, CD-ROM images, etc.) are available in the
668.Pa /var/freebsd-snapshot
669directory.
670.Pp
671The following sequence of commands can be used to build a
672.Dq "-CURRENT snapshot"
673in a clean environment, including ports and documentation:
674.Bd -literal -offset indent
675cd /usr/src/release
676sh release.sh
677.Ed
678.Pp
679Optionally, a configuration file can be used customize the release build,
680such as the subversion revision to use, the branch of the subversion tree for
681.Li src/ ,
682.Li ports/ ,
683and
684.Li doc/ .
685.Bd -literal -offset indent
686cd /usr/src/release
687sh release.sh -c $HOME/release.conf
688.Ed
689.Pp
690Configuration files specific to various supported embedded systems, such as
691the Raspberry Pi, exist in the directory corresponding to the
692.Va TARGET
693.Xr make 1
694variable.
695For example, to build an image for the Raspberry Pi:
696.Bd -literal -offset indent
697cd /usr/src/release
698sh release.sh -c arm/RPI-B.conf
699.Ed
700.Pp
701To build an image for the Raspberry Pi 3:
702.Bd -literal -offset indent
703cd /usr/src/release
704sh release.sh -c arm64/RPI3.conf
705.Ed
706.Pp
707After running these commands, all prepared release files are available in the
708.Pa /scratch
709directory.
710The target directory can be changed by specifying the
711.Va CHROOTDIR
712variable in
713.Li release.conf .
714.Sh SEE ALSO
715.Xr cc 1 ,
716.Xr install 1 ,
717.Xr make 1 ,
718.Xr svn 1 Pq Pa ports/devel/subversion ,
719.Xr uname 1 ,
720.Xr md 4 ,
721.Xr make.conf 5 ,
722.Xr build 7 ,
723.Xr ports 7 ,
724.Xr chroot 8 ,
725.Xr mtree 8 ,
726.Xr sysctl 8
727.Rs
728.%T "FreeBSD Release Engineering"
729.%U https://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/freebsd-releng/
730.Re
731.Rs
732.%T "FreeBSD Developers' Handbook"
733.%U https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/
734.Re
735.Sh HISTORY
736.Fx
7371.x
738used a manual checklist, compiled by
739.An Rod Grimes ,
740to produce a release.
741Apart from being incomplete, the list put a lot of specific demands on
742available file systems and was quite torturous to execute.
743.Pp
744As part of the
745.Fx 2.0
746release engineering effort, significant
747effort was spent getting
748.Pa src/release/Makefile
749into a shape where it could at least automate most of the tediousness
750of building a release in a sterile environment.
751.Pp
752For the
753.Fx 9.0
754release,
755.Pa src/release/Makefile
756was overhauled and the wrapper script
757.Pa src/release/generate-release.sh
758introduced to support the introduction of a new installer.
759.Pp
760For the
761.Fx 9.2
762release,
763.Pa src/release/release.sh
764was introduced to support per-build configuration files.
765.Pa src/release/release.sh
766is heavily based on the
767.Pa src/release/generate-release.sh
768script.
769.Pp
770At near 1000 revisions spread over multiple branches, the
771.Xr svn 1
772log of
773.Pa src/release/Makefile
774contains a vivid historical record of some
775of the hardships release engineers go through.
776.Sh AUTHORS
777.Pa src/release/Makefile
778was originally written by
779.An -nosplit
780.An Rod Grimes ,
781.An Jordan Hubbard ,
782and
783.An Poul-Henning Kamp .
784.Pp
785This manual page was originally written by
786.An Murray Stokely Aq Mt murray@FreeBSD.org .
787.Pp
788It was updated by
789.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org
790to include the
791.Fa generate-release.sh
792script used for the
793.Fx 9.0
794release cycle.
795.Pp
796It was later updated by
797.An Glen Barber Aq Mt gjb@FreeBSD.org
798to include the
799.Fa release.sh
800script used for the
801.Fx 9.2
802release cycle.
803