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