freebsd-skq/share/man/man7/development.7
Edward Tomasz Napierala 375409b48b .Xr ports(7) and development(7).
MFC after:	2 weeks
2019-08-26 10:16:46 +00:00

189 lines
5.3 KiB
Groff

.\" Copyright (c) 2018 Edward Tomasz Napierala <trasz@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd May 16, 2019
.Dt DEVELOPMENT 7
.Os
.Sh NAME
.Nm development
.Nd introduction to
.Fx
development process
.Sh DESCRIPTION
.Fx
development is split into three major suprojects: doc, ports, and src.
Doc is the documentation, such as the
.Fx
Handbook.
To read more, see:
.Pp
.Lk https://www.FreeBSD.org/doc/en/books/fdp-primer/
.Pp
Ports, described further in
.Xr ports 7 ,
are the way to build, package, and install third party software.
To read more, see:
.Pp
.Lk https://www.FreeBSD.org/doc/en/books/porters-handbook/
.Pp
The last one, src, revolves around the source code for the base system,
consisting of the kernel, and the libraries and utilities commonly called
the world.
.Pp
The Committer's Guide, describing topics relevant to all committers,
can be found at:
.Pp
.Lk https://www.FreeBSD.org/doc/en/articles/committers-guide/
.Pp
.Fx
src development takes place in the CURRENT branch in Subversion,
located at:
.Pp
.Lk https://svn.FreeBSD.org/base/head
.Pp
There is also a read-only GitHub mirror at:
.Pp
.Lk https://github.com/freebsd/freebsd
.Pp
Changes are first committed to CURRENT and then usually merged back
to STABLE.
Every few years the CURRENT branch is renamed to STABLE, and a new
CURRENT is branched, with an incremented major version number.
Releases are then branched off STABLE and numbered with consecutive minor
numbers.
.Pp
Layout of the source tree is described in
.Xr hier 7 .
Build instructions can be found in
.Xr build 7
and
.Xr release 7 .
Kernel programming interfaces (KPIs) are documented in section 9
manual pages; use
.Ql "apropos -s 9 ."
for a list.
Regression test suite is described in
.Xr tests 7 .
For coding conventions, see
.Xr style 9 .
.Pp
To ask questions regarding development, use the mailing lists,
such as freebsd-arch@ and freebsd-hackers@:
.Pp
.Lk https://lists.FreeBSD.org
.Pp
To get your patches integrated into the main
.Fx
repository use Phabricator;
it is a code review tool that allows other developers to review the changes,
suggest improvements, and, eventually, allows them to pick up the change and
commit it:
.Pp
.Lk https://reviews.FreeBSD.org
.Sh EXAMPLES
Check out the CURRENT branch, build it, and install, overwriting the current
system:
.Bd -literal -offset indent
svnlite co https://svn.FreeBSD.org/base/head src
cd src
make -sj8 buildworld buildkernel installkernel
shutdown -r now
.Ed
.Pp
After reboot:
.Bd -literal -offset indent
cd src
make -j8 installworld
reboot
.Ed
.Pp
Rebuild and reinstall a single piece of userspace, in this
case
.Xr ls 1 :
.Bd -literal -offset indent
cd src/bin/ls
make clean all install
.Ed
.Pp
Quickly rebuild and reinstall the kernel, only recompiling the files
changed since last build; note that this will only work if the full kernel
build has been completed in the past, not on a fresh source tree:
.Bd -literal -offset indent
cd src
make -sj8 kernel KERNFAST=1
.Ed
.Pp
To rebuild parts of
.Fx
for another CPU architecture,
first prepare your source tree by building the cross-toolchain:
.Bd -literal -offset indent
cd src
make -sj8 toolchain TARGET_ARCH=armv6
.Ed
.Pp
Afterwards, to build and install a single piece of userspace, use:
.Bd -literal -offset indent
cd src/bin/ls
make buildenv TARGET_ARCH=armv6
make clean all install DESTDIR=/clients/arm
.Ed
.Pp
Likewise, to quickly rebuild and reinstall the kernel, use:
.Bd -literal -offset indent
cd src
make buildenv TARGET_ARCH=armv6
make -sj8 kernel KERNFAST=1 DESTDIR=/clients/arm
.Ed
.Sh SEE ALSO
.Xr svnlite 1 ,
.Xr witness 4 ,
.Xr build 7 ,
.Xr hier 7 ,
.Xr ports 7 ,
.Xr release 7 ,
.Xr locking 9 ,
.Xr style 9
.Sh HISTORY
The
.Nm
manual page was originally written by
.An Matthew Dillon Aq Mt dillon@FreeBSD.org
and first appeared
in
.Fx 5.0 ,
December 2002.
It was since extensively modified by
.An Eitan Adler Aq Mt eadler@FreeBSD.org
to reflect the repository conversion from
.Xr cvs 1
to
.Xr svn 1 .
It was rewritten from scratch by
.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
for
.Fx 12.0 .