xref: /freebsd/share/man/man7/development.7 (revision 4f8f43b06ed07e96a250855488cc531799d5b78f)
1.\" Copyright (c) 2018 Edward Tomasz Napierala <trasz@FreeBSD.org>
2.\"
3.\" Redistribution and use in source and binary forms, with or without
4.\" modification, are permitted provided that the following conditions
5.\" are met:
6.\" 1. Redistributions of source code must retain the above copyright
7.\"    notice, this list of conditions and the following disclaimer.
8.\" 2. Redistributions in binary form must reproduce the above copyright
9.\"    notice, this list of conditions and the following disclaimer in the
10.\"    documentation and/or other materials provided with the distribution.
11.\"
12.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
13.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
16.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22.\" SUCH DAMAGE.
23.\"
24.Dd November 1, 2022
25.Dt DEVELOPMENT 7
26.Os
27.Sh NAME
28.Nm development
29.Nd introduction to
30.Fx
31development process
32.Sh DESCRIPTION
33.Fx
34development is split into three major subprojects: doc, ports, and src.
35Doc is the documentation, such as the
36.Fx
37Handbook.
38To read more, see:
39.Pp
40.Lk https://docs.FreeBSD.org/en/books/fdp-primer/
41.Pp
42Ports, described further in
43.Xr ports 7 ,
44are the way to build, package, and install third party software.
45To read more, see:
46.Pp
47.Lk https://docs.FreeBSD.org/en/books/porters-handbook/
48.Pp
49The last one, src, revolves around the source code for the base system,
50consisting of the kernel, and the libraries and utilities commonly called
51the world.
52.Pp
53The Committer's Guide, describing topics relevant to all committers,
54can be found at:
55.Pp
56.Lk https://docs.freebsd.org/en/articles/committers-guide/
57.Pp
58.Fx
59src development takes place in the project-hosted
60Git repository, located at:
61.Pp
62.Lk https://git.FreeBSD.org/src.git
63.Pp
64The push URL is:
65.Pp
66.Lk ssh://git@gitrepo.FreeBSD.org/src.git
67.Pp
68There is also a list of public, read-only Git mirrors at:
69.Pp
70.Lk https://docs.FreeBSD.org/en/books/handbook/mirrors/#external-mirrors
71.Pp
72The
73.Ql main
74Git branch represents CURRENT;
75all changes are first committed to CURRENT and then usually cherry-picked
76back to STABLE, which refers to Git branches such as
77.Ql stable/13 .
78Every few years a new STABLE is branched from CURRENT,
79with an incremented major version number.
80Releases are then branched off STABLE and numbered with consecutive minor
81numbers.
82.Pp
83The layout of the source tree is described in its
84.Pa README.md
85file.
86Build instructions can be found in
87.Xr build 7
88and
89.Xr release 7 .
90Kernel programming interfaces (KPIs) are documented in section 9
91manual pages; use
92.Ql "apropos -s 9 ."
93for a list.
94Regression test suite is described in
95.Xr tests 7 .
96For coding conventions, see
97.Xr style 9 .
98.Pp
99To ask questions regarding development, use the mailing lists,
100such as freebsd-arch@ and freebsd-hackers@:
101.Pp
102.Lk https://lists.FreeBSD.org
103.Pp
104To get your patches integrated into the main
105.Fx
106repository use Phabricator;
107it is a code review tool that allows other developers to review the changes,
108suggest improvements, and, eventually, allows them to pick up the change and
109commit it:
110.Pp
111.Lk https://reviews.FreeBSD.org
112.Pp
113To check the latest
114.Fx
115build and test status of CURRENT and STABLE branches,
116the continuous integration system is at:
117.Pp
118.Lk https://ci.FreeBSD.org
119.Pp
120.Sh EXAMPLES
121Check out the CURRENT branch, build it, and install, overwriting the current
122system:
123.Bd -literal -offset indent
124git clone https://git.FreeBSD.org/src.git src
125cd src
126make -sj8 buildworld buildkernel installkernel
127shutdown -r now
128.Ed
129.Pp
130After reboot:
131.Bd -literal -offset indent
132cd src
133make -j8 installworld
134reboot
135.Ed
136.Pp
137Rebuild and reinstall a single piece of userspace, in this
138case
139.Xr ls 1 :
140.Bd -literal -offset indent
141cd src/bin/ls
142make clean all install
143.Ed
144.Pp
145Quickly rebuild and reinstall the kernel, only recompiling the files
146changed since last build; note that this will only work if the full kernel
147build has been completed in the past, not on a fresh source tree:
148.Bd -literal -offset indent
149cd src
150make -sj8 kernel KERNFAST=1
151.Ed
152.Pp
153To rebuild parts of
154.Fx
155for another CPU architecture,
156first prepare your source tree by building the cross-toolchain:
157.Bd -literal -offset indent
158cd src
159make -sj8 toolchain TARGET_ARCH=aarch64
160.Ed
161.Pp
162Afterwards, to build and install a single piece of userspace, use:
163.Bd -literal -offset indent
164cd src/bin/ls
165make buildenv TARGET_ARCH=aarch64
166make clean all install DESTDIR=/clients/arm
167.Ed
168.Pp
169Likewise, to quickly rebuild and reinstall the kernel, use:
170.Bd -literal -offset indent
171cd src
172make buildenv TARGET_ARCH=aarch64
173make -sj8 kernel KERNFAST=1 DESTDIR=/clients/arm
174.Ed
175.Sh SEE ALSO
176.Xr git 1 ,
177.Xr witness 4 ,
178.Xr build 7 ,
179.Xr hier 7 ,
180.Xr ports 7 ,
181.Xr release 7 ,
182.Xr tests 7 ,
183.Xr locking 9 ,
184.Xr style 9
185.Sh HISTORY
186The
187.Nm
188manual page was originally written by
189.An Matthew Dillon Aq Mt dillon@FreeBSD.org
190and first appeared
191in
192.Fx 5.0 ,
193December 2002.
194It was since extensively modified by
195.An Eitan Adler Aq Mt eadler@FreeBSD.org
196to reflect the repository conversion from
197.Lk https://www.nongnu.org/cvs/ CVS
198to
199.Lk https://subversion.apache.org/ Subversion .
200It was rewritten from scratch by
201.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
202for
203.Fx 12.0 .
204