1 .\" Copyright (c) 2002 Murray Stokely <murray@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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
32 .Nd "release building infrastructure"
35 provides a complete build environment suitable for users to make
39 All of the tools necessary to build a release are available from the
41 source code repository in
43 A complete release can be built with only a single command,
44 including the creation of ISO images suitable for burning to CD-ROM,
45 memory stick images, and a network install directory.
46 This command is aptly named
47 .Dq Li "make release" .
49 For some users, it may be desirable to provide an absolutely clean
50 build environment, with no local modifications to the source tree or to
52 and with clean checkouts of specific versions of the doc, src, and ports
54 For this purpose, a script
55 .Pq Pa src/release/release.sh
56 is provided to automate these checkouts and then execute
61 Before attempting to build a release, the user is expected to be
62 familiar with the contents of
64 and should have experience upgrading systems from source.
66 The release build process requires that
68 be populated with the output of
69 .Dq Li "make buildworld"
71 .Dq Li "make buildkernel" .
72 This is necessary to provide the object files for the release or, when
75 so that the object files for a complete system can be installed into a clean
79 If the target release build is for a different architecture or machine type,
84 variables must be used.
87 variables for more information.
89 The release procedure on some architectures may also require that the
91 (memory disk) device driver be present in the kernel
92 .Pq either by being compiled in or available as a module .
94 This document does not cover source code management, quality
95 assurance, or other aspects of the release engineering process.
96 .Sh CLEAN RELEASE GENERATION
99 are produced in a clean environment to
100 ensure consistency between the versions of the src, ports, and doc trees
101 and to avoid contamination from the host system
102 .Po such as local patches, changes
107 This is accomplished using the wrapper script
108 .Pa src/release/release.sh .
111 .Op Fl c Ar release.conf
122 .Dq Li "make buildworld"
124 .Dq Li "make installworld"
129 .Dq Li "make release"
132 environment and places the result in
137 configuration file supports the following variables:
140 The directory within which the release will be built.
141 .It Va CHROOT_MAKEENV
144 arguments to pass through, which directly affect the
145 tuning of the build chroot.
147 Do not explicitly require the
149 port to be installed.
153 host used to check out the various trees.
155 .Pa https://git.FreeeBSD.org .
169 The target machine type for cross-building a release.
171 The target machine architecture for cross-building a release.
173 For the supported list of
177 combinations, consult the output of
182 The target kernel configuration to use.
187 entries may be specified.
191 to use for the release build.
194 to prevent polluting the release with local system changes.
198 to use for the release build.
201 to prevent polluting the release with local system changes.
203 Additional flags to pass to
206 Additional flags to pass to
211 Defaults to setting the number of
215 to the number of CPUs available on a SMP-capable system.
217 Additional flags to pass to
222 Defaults to setting the number of
226 to half the number of CPUs available on a SMP-capable system.
228 Set to a non-empty value to skip the
235 distribution package from being created.
237 Set to a non-empty value to include the
240 .It Va WITH_COMPRESSED_IMAGES
241 Set to a non-empty value to compress the release images with
245 images are not removed.
246 .It Va XZ_THREADS Pq Vt int
247 Set to the number of threads
249 should use when compressing images.
254 which uses all available cores on the system.
256 The command run to obtain the source trees.
258 .Qq Cm git clone Fl q .
259 .It Va CHROOTBUILD_SKIP
267 build environment setup are skipped.
268 This is intended solely for cases where the
270 userland are provided by alternate means.
271 .It Va SRC_UPDATE_SKIP
272 Set to a non-empty value to prevent checkout or update of
276 This is intended for use only when
278 is expected to exist by alternative means.
279 .It Va PORTS_UPDATE_SKIP
280 Set to a non-empty value to prevent checkout or update of
284 This is intended for use only when
286 is expected to exist by alternative means.
291 variables are relevant only to release builds for embedded systems:
294 Set to a non-null value to enable functionality for embedded device
303 .Va EMBEDDED_TARGET_ARCH
304 must also be defined.
305 When the build environment is created,
307 runs a separate build script located in an architecture-specific
309 .Pa src/release/${EMBEDDED_TARGET}/ .
311 Set to the list of any ports that are required for the target device
316 port is built by default.
317 .It Va EMBEDDED_TARGET
318 When set, its value is passed to
322 .Pq value of Cm uname Fl m
323 to cross build the target userland.
324 .It Va EMBEDDED_TARGET_ARCH
325 When set, its value is passed to
329 .Pq value of Cm uname Fl p
330 to cross build the target userland.
332 .Sh VIRTUAL MACHINE DISK IMAGES
335 variables are relevant only to virtual machine disk image builds:
338 Set to a non-null value to build virtual machine disk images as part
339 of the release build.
341 may also be specified as an environment variable passed to
346 version 20140927 or later.
347 .It Va WITH_COMPRESSED_VMIMAGES
348 Set to a non-null value to compress the virtual machine disk images with
354 Note that compressing virtual machine disk images may take a very long
355 time on some systems.
357 Set to change the name of the resulting virtual machine disk image file.
361 Set to change the size of the virtual machine disk capacity.
368 Virtual machine disk images are, by default, created as sparse images.
370 .Va WITH_COMPRESSED_VMIMAGES
371 is used, the resulting files compressed with
373 compress to roughly the same size, regardless of the specified disk image
376 Set to the target virtual disk image format(s) to create.
378 .Va vhdf , Va vmdk , Va qcow2 ,
384 for valid format values
385 .Pq requires version 20140927 or later .
388 For a list of supported
391 .Pq including cloud hosting provider formats
392 along with a brief description, run:
393 .Bd -literal -offset indent
395 make -C release list-vmtargets
397 .Sh CLOUD HOSTING MACHINE IMAGES
400 release build tools support building virtual machine images for various
401 cloud hosting providers, each with their own specific configuration to
402 include support for each hosting provider by default.
406 environment variables are supported:
409 Set to a list of one or more cloud hosting providers, enclosed in quotes.
413 .It Va WITH_CLOUDWARE
414 Set to a non-empty value to enable building virtual machine images
415 for various cloud hosting providers.
425 variables can be added to
427 and used in conjunction with
430 For a list of supported
433 .Bd -literal -offset indent
435 make -C release list-cloudware
439 .Pq Pa src/release/Makefile
441 Most developers will only be concerned with the
446 .\" XXX: Some sort of introduction to this list? All the others have one.
447 .Bl -tag -width ".Cm packagesystem"
449 Meta-target to build all release media and distributions applicable to this
452 Copy all produced release media to
455 Builds installation CD-ROM images.
458 (memory disk) device driver be present in the kernel
459 (either by being compiled in or available as a module).
460 This target produces files called
466 Builds installation DVD-ROM images.
469 (memory disk) device driver be present in the kernel
470 (either by being compiled in or available as a module).
471 This target produces the
475 Builds an installation memory stick image named
477 Not applicable on all platforms.
481 device driver be present in the kernel
482 .Pq either by being compiled in or available as a module .
486 with the exception that the installation distribution sets
489 Creates a directory named
491 containing the distribution files used in network installations
492 and suitable for upload to an FTP mirror.
494 Creates virtual machine disk images in various formats.
500 environment variable to be set to a non-null value.
504 virtual machine images for various cloud hosting providers.
506 .Qq CLOUD HOSTING MACHINE IMAGES
507 for implementation details.
508 .It Cm list-cloudware
509 Displays the list of valid
512 .It Cm list-vmtargets
513 Displays the list of valid
520 Major subtargets called by targets above:
521 .Bl -tag -width ".Cm packagesystem"
523 Generates all the distribution archives
524 .Pq base, kernel, ports, doc
525 applicable on this platform.
527 Builds a bootable installation system containing all the distribution files
530 target, and suitable for imaging by the
537 Builds the release documentation.
538 This includes the release notes,
539 hardware guide, and installation instructions.
540 Other documentation, such as the Handbook,
548 .Bl -tag -width ".Ev TARGET_ARCH"
550 Optional base name for generated media images when invoking the
553 .Pq e.g., FreeBSD-12.1-RELEASE-amd64 .
554 Defaults to the output of
555 .Ic `uname -s`-`uname -r`-`uname -p`
558 Location of a directory containing the src tree.
559 By default, the directory
560 above the one containing the makefile
563 Location of a directory containing the ports tree.
566 If it is unset or cannot be found, ports will not be included in the release.
568 If defined, the Ports Collection will be omitted from the release.
570 If set, do not include system source code in the release.
572 The target hardware platform.
573 This is analogous to the
576 This is necessary to cross-build some target architectures.
577 For example, cross-building for ARM64 machines requires
578 .Ev TARGET_ARCH Ns = Ns Li aarch64
580 .Ev TARGET Ns = Ns Li arm64 .
583 defaults to the current hardware platform.
585 The target machine processor architecture.
586 This is analogous to the
589 Set this to cross-build for a different architecture.
592 defaults to the current machine architecture, unless
594 is also set, in which case it defaults to the appropriate
595 value for that platform.
596 Typically, one only needs to set
600 .Bl -tag -compact -width Pa
601 .It Pa /usr/doc/Makefile
602 .It Pa /usr/doc/share/mk/doc.project.mk
603 .It Pa /usr/ports/Mk/bsd.port.mk
604 .It Pa /usr/ports/Mk/bsd.sites.mk
605 .It Pa /usr/share/examples/etc/make.conf
606 .It Pa /usr/src/Makefile
607 .It Pa /usr/src/Makefile.inc1
608 .It Pa /usr/src/release/Makefile
609 .It Pa /usr/src/release/Makefile.vm
610 .It Pa /usr/src/release/release.sh
611 .It Pa /usr/src/release/release.conf.sample
612 .It Pa /usr/src/release/tools/*.conf
613 .It Pa /usr/src/release/tools/vmimage.subr
616 The following sequence of commands can be used to build a
617 .Dq "-CURRENT snapshot":
618 .Bd -literal -offset indent
620 git clone -b main https://git.freebsd.org/src.git src
622 make buildworld buildkernel
626 make install DESTDIR=/var/freebsd-snapshot
629 After running these commands, all produced distribution files (tarballs
630 for FTP, CD-ROM images, etc.) are available in the
631 .Pa /var/freebsd-snapshot
634 The following sequence of commands can be used to build a
635 .Dq "-CURRENT snapshot"
636 in a clean environment, including ports and documentation:
637 .Bd -literal -offset indent
642 Optionally, a configuration file can be used customize the release build,
643 such as the subversion revision to use, the branch of the subversion tree for
648 .Bd -literal -offset indent
650 sh release.sh -c $HOME/release.conf
653 Configuration files specific to various supported embedded systems, such as
654 the Raspberry Pi, exist in the directory corresponding to the
658 For example, to build an image for the Raspberry Pi:
659 .Bd -literal -offset indent
661 sh release.sh -c arm/RPI-B.conf
664 To build an image for the Raspberry Pi 3:
665 .Bd -literal -offset indent
667 sh release.sh -c arm64/RPI3.conf
670 After running these commands, all prepared release files are available in the
673 The target directory can be changed by specifying the
678 The reldoc target was removed in commit f61e92ca5a23, and
681 .Ev DOC_UPDATE_SKIP ,
684 are therefore no longer supported.
687 .Xr git 1 Pq Pa ports/devel/git ,
699 .%T "FreeBSD Release Engineering"
700 .%U https://docs.freebsd.org/en/articles/freebsd-releng/
703 .%T "FreeBSD Developers' Handbook"
704 .%U https://docs.freebsd.org/en/books/developers-handbook/
709 used a manual checklist, compiled by
711 to produce a release.
712 Apart from being incomplete, the list put a lot of specific demands on
713 available file systems and was quite torturous to execute.
717 release engineering effort, significant
718 effort was spent getting
719 .Pa src/release/Makefile
720 into a shape where it could at least automate most of the tediousness
721 of building a release in a sterile environment.
726 .Pa src/release/Makefile
727 was overhauled and the wrapper script
728 .Pa src/release/generate-release.sh
729 introduced to support the introduction of a new installer.
734 .Pa src/release/release.sh
735 was introduced to support per-build configuration files.
736 .Pa src/release/release.sh
737 is heavily based on the
738 .Pa src/release/generate-release.sh
741 At near 1000 revisions spread over multiple branches, the
744 .Pa src/release/Makefile
745 contains a vivid historical record of some
746 of the hardships release engineers go through.
748 .Pa src/release/Makefile
749 was originally written by
754 .An Poul-Henning Kamp .
756 This manual page was originally written by
757 .An Murray Stokely Aq Mt murray@FreeBSD.org .
760 .An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org
762 .Fa generate-release.sh
767 It was later updated by
768 .An Glen Barber Aq Mt gjb@FreeBSD.org