2004-08-07 04:40:20 +00:00
|
|
|
.\" Copyright (C) 1998 Matthew Dillon. 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 AUTHOR 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 AUTHOR 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.
|
2002-12-22 02:07:05 +00:00
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
|
|
|
.Dd December 21, 2002
|
|
|
|
.Dt DEVELOPMENT 7
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm development
|
2005-01-15 11:12:40 +00:00
|
|
|
.Nd "introduction to development with the FreeBSD codebase"
|
2002-12-22 02:07:05 +00:00
|
|
|
.Sh DESCRIPTION
|
2006-12-14 13:35:59 +00:00
|
|
|
This manual page describes how an ordinary system operator,
|
2005-01-15 11:12:40 +00:00
|
|
|
.Ux
|
2006-12-14 13:35:59 +00:00
|
|
|
administrator, or developer
|
2002-12-22 02:07:05 +00:00
|
|
|
can, without any special permission, obtain, maintain, and modify the
|
2002-12-23 07:27:53 +00:00
|
|
|
.Fx
|
2005-01-15 11:12:40 +00:00
|
|
|
codebase as well as how to maintain a master build which can
|
2002-12-23 07:27:53 +00:00
|
|
|
then be exported to other machines in your network.
|
|
|
|
This manual page
|
2002-12-22 02:07:05 +00:00
|
|
|
is targeted to system operators, programmers, and developers.
|
|
|
|
.Pp
|
|
|
|
Please note that what is being described here is based on a complete
|
2005-01-15 11:12:40 +00:00
|
|
|
.Fx
|
|
|
|
environment, not just the
|
|
|
|
.Fx
|
|
|
|
kernel.
|
2002-12-23 07:27:53 +00:00
|
|
|
The methods described
|
2002-12-22 02:07:05 +00:00
|
|
|
here are as applicable to production installations as it is to development
|
2002-12-23 07:27:53 +00:00
|
|
|
environments.
|
|
|
|
You need a good 12-17GB of disk space on one machine to make this work
|
|
|
|
conveniently.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Sh SETTING UP THE ENVIRONMENT ON THE MASTER SERVER
|
|
|
|
Your master server should always run a stable, production version of the
|
|
|
|
.Fx
|
2004-07-03 18:29:24 +00:00
|
|
|
operating system.
|
|
|
|
This does not prevent you from doing -CURRENT
|
|
|
|
builds or development.
|
|
|
|
The last thing you want to do is to run an
|
2002-12-22 02:07:05 +00:00
|
|
|
unstable environment on your master server which could lead to a situation
|
|
|
|
where you lose the environment and/or cannot recover from a mistake.
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
Create a huge partition called
|
|
|
|
.Pa /FreeBSD .
|
2002-12-23 07:27:53 +00:00
|
|
|
8-12GB is recommended.
|
|
|
|
This partition will contain nearly all the development environment,
|
2002-12-22 02:07:05 +00:00
|
|
|
including the CVS tree, broken-out source, and possibly even object files.
|
2003-05-21 15:55:40 +00:00
|
|
|
You are going to export this partition to your other machines via a
|
2002-12-22 02:07:05 +00:00
|
|
|
READ-ONLY NFS export so do not mix it with other more security-sensitive
|
|
|
|
partitions.
|
|
|
|
.Pp
|
2002-12-28 19:08:11 +00:00
|
|
|
You have to make a choice in regards to
|
|
|
|
.Pa /usr/obj .
|
|
|
|
You can put
|
|
|
|
.Pa /usr/obj
|
|
|
|
in
|
|
|
|
.Pa /FreeBSD
|
|
|
|
or you can make
|
|
|
|
.Pa /usr/obj
|
|
|
|
its own partition.
|
2004-07-03 18:29:24 +00:00
|
|
|
I recommend making it a separate partition for several reasons.
|
|
|
|
First,
|
2002-12-28 19:08:11 +00:00
|
|
|
as a safety measure since this partition is written to a great deal.
|
|
|
|
Second, because you typically do not have to back it up.
|
|
|
|
Third, because it makes it far easier to mix and match the development
|
|
|
|
environments which are described later in this document.
|
|
|
|
I recommend a
|
|
|
|
.Pa /usr/obj
|
|
|
|
partition of at least 5GB.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
On the master server, use
|
2005-07-14 20:29:08 +00:00
|
|
|
.Xr cvsup 1 Pq Pa ports/net/cvsup
|
2005-01-15 11:12:40 +00:00
|
|
|
to automatically pull down and maintain
|
2002-12-22 02:07:05 +00:00
|
|
|
the
|
|
|
|
.Fx
|
2004-07-03 18:29:24 +00:00
|
|
|
CVS archive once a day.
|
|
|
|
The first pull will take a long time,
|
2006-12-14 13:35:59 +00:00
|
|
|
it is several gigabytes, but once you have it,
|
|
|
|
the daily synchronizations will be quite small.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
mkdir /FreeBSD/FreeBSD-CVS
|
|
|
|
rm -rf /home/ncvs
|
|
|
|
ln -s /FreeBSD/FreeBSD-CVS /home/ncvs
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
The
|
|
|
|
.Xr cron 8
|
|
|
|
job should look something like this (please randomize the time of
|
2002-12-23 07:27:53 +00:00
|
|
|
day!).
|
2005-01-15 11:12:40 +00:00
|
|
|
Note that you can use the
|
|
|
|
.Xr cvsup 1
|
|
|
|
configuration file example directly from
|
|
|
|
.Pa /usr/share/examples
|
|
|
|
without modification by supplying appropriate arguments
|
|
|
|
to
|
|
|
|
.Xr cvsup 1 .
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
33 6 * * * /usr/local/bin/cvsup -g -r 20 -L 2 -h cvsup.freebsd.org /usr/share/examples/cvsup/cvs-supfile
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
Run the
|
|
|
|
.Xr cvsup 1
|
|
|
|
manually the first time to pull down the archive.
|
2004-07-03 18:29:24 +00:00
|
|
|
It could take
|
2002-12-23 07:27:53 +00:00
|
|
|
all day depending on how fast your connection is!
|
2005-01-15 11:12:40 +00:00
|
|
|
You will run all
|
|
|
|
.Xr cvsup 1
|
|
|
|
and
|
|
|
|
.Xr cvs 1
|
|
|
|
operations as
|
|
|
|
.Dq Li root
|
|
|
|
and you need to set up a
|
|
|
|
.Pa ~/.cvsrc
|
|
|
|
.Pq Pa /root/.cvsrc
|
|
|
|
file, as shown below, for proper
|
|
|
|
.Xr cvs 1
|
|
|
|
operation.
|
|
|
|
Using
|
|
|
|
.Pa ~/.cvsrc
|
|
|
|
to specify
|
|
|
|
.Xr cvs 1
|
|
|
|
defaults is an excellent way to
|
|
|
|
.Dq "file and forget" ,
|
|
|
|
but you should never forget that you put them in there.
|
2002-12-23 07:27:53 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
# cvs -q
|
|
|
|
diff -u
|
|
|
|
update -Pd
|
|
|
|
checkout -P
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
Now use
|
|
|
|
.Xr cvs 1
|
|
|
|
to check out a -STABLE source tree and a -CURRENT source tree,
|
2003-05-21 15:55:40 +00:00
|
|
|
as well as ports and docs, to create your initial source environment.
|
2005-01-15 11:12:40 +00:00
|
|
|
Keeping the broken-out source and ports in
|
|
|
|
.Pa /FreeBSD
|
|
|
|
allows you to export
|
2002-12-23 07:27:53 +00:00
|
|
|
it to other machines via read-only NFS.
|
|
|
|
This also means you only need to edit/maintain files in one place and all
|
|
|
|
your clients automatically pick up the changes.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
mkdir /FreeBSD/FreeBSD-4.x
|
|
|
|
mkdir /FreeBSD/FreeBSD-current
|
|
|
|
|
|
|
|
cd /FreeBSD/FreeBSD-4.x
|
|
|
|
cvs -d /home/ncvs checkout -rRELENG_4 src
|
|
|
|
|
|
|
|
cd /FreeBSD/FreeBSD-current
|
|
|
|
cvs -d /home/ncvs checkout src
|
|
|
|
cvs -d /home/ncvs checkout ports
|
|
|
|
cvs -d /home/ncvs checkout doc
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
Now create a softlink for
|
|
|
|
.Pa /usr/src
|
|
|
|
and
|
|
|
|
.Pa /usr/src2 .
|
|
|
|
On the main server I always point
|
|
|
|
.Pa /usr/src
|
|
|
|
at -STABLE and
|
|
|
|
.Pa /usr/src2
|
|
|
|
at -CURRENT.
|
|
|
|
On client machines I usually do not have a
|
|
|
|
.Pa /usr/src2
|
|
|
|
and I make
|
|
|
|
.Pa /usr/src
|
|
|
|
point at whatever version of
|
|
|
|
.Fx
|
|
|
|
the client box is intended to
|
2002-12-23 07:27:53 +00:00
|
|
|
run.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
cd /usr
|
|
|
|
rm -rf src src2
|
2002-12-23 07:27:53 +00:00
|
|
|
ln -s /FreeBSD/FreeBSD-4.x/src src (could be -CURRENT on a client)
|
2002-12-22 02:07:05 +00:00
|
|
|
ln -s /FreeBSD/FreeBSD-current/src src2 (MASTER SERVER ONLY)
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
Now you have to make a choice for
|
|
|
|
.Pa /usr/obj .
|
2004-07-03 18:29:24 +00:00
|
|
|
Well, hopefully you made it already and chose the partition method.
|
|
|
|
If you
|
2005-01-15 11:12:40 +00:00
|
|
|
chose poorly you probably intend to put it in
|
|
|
|
.Pa /FreeBSD
|
|
|
|
and, if so, this is
|
2002-12-23 07:27:53 +00:00
|
|
|
what you want to do:
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
(ONLY IF YOU MADE A POOR CHOICE AND PUT /usr/obj in /FreeBSD!)
|
|
|
|
mkdir /FreeBSD/obj
|
|
|
|
cd /usr
|
|
|
|
rm -rf obj
|
|
|
|
ln -s /FreeBSD/obj obj
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
Alternatively you may chose simply to leave
|
|
|
|
.Pa /usr/obj
|
|
|
|
in
|
|
|
|
.Pa /usr .
|
2004-07-03 18:29:24 +00:00
|
|
|
If your
|
2005-01-15 11:12:40 +00:00
|
|
|
.Pa /usr
|
|
|
|
is large enough this will work, but I do not recommend it for
|
|
|
|
safety reasons
|
|
|
|
.Pa ( /usr/obj
|
|
|
|
is constantly being modified,
|
|
|
|
.Pa /usr
|
|
|
|
is not).
|
|
|
|
.Pp
|
|
|
|
Note that exporting
|
|
|
|
.Pa /usr/obj
|
|
|
|
via read-only NFS to your other boxes will
|
2002-12-22 02:07:05 +00:00
|
|
|
allow you to build on your main server and install from your other boxes.
|
|
|
|
If you also want to do builds on some or all of the clients you can simply
|
2005-01-15 11:12:40 +00:00
|
|
|
have
|
|
|
|
.Pa /usr/obj
|
|
|
|
be a local directory on those clients.
|
|
|
|
You should never export
|
|
|
|
.Pa /usr/obj
|
|
|
|
read-write, it will lead to all sorts of
|
2002-12-23 07:27:53 +00:00
|
|
|
problems and issues down the line and presents a security problem as well.
|
|
|
|
It is far easier to do builds on the master server and then only do installs
|
|
|
|
on the clients.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Pp
|
2002-12-23 07:27:53 +00:00
|
|
|
I usually maintain my ports tree via CVS.
|
2005-01-15 11:12:40 +00:00
|
|
|
It is sitting right there in the master CVS archive and I have even told you
|
2002-12-23 07:27:53 +00:00
|
|
|
to check it out (see above).
|
|
|
|
With some fancy softlinks you can make the ports tree available both on your
|
|
|
|
master server and on all of your other machines.
|
2005-01-15 11:12:40 +00:00
|
|
|
Note that the ports tree exists only on the HEAD CVS branch, so its always
|
2004-07-03 18:29:24 +00:00
|
|
|
-CURRENT even on a -STABLE box.
|
|
|
|
This is what you do:
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
(THESE COMMANDS ON THE MASTER SERVER AND ON ALL CLIENTS)
|
|
|
|
cd /usr
|
|
|
|
rm -rf ports
|
|
|
|
ln -s /FreeBSD/FreeBSD-current/ports ports
|
|
|
|
|
|
|
|
cd /usr/ports (this pushes into the softlink)
|
|
|
|
rm -rf distfiles (ON MASTER SERVER ONLY)
|
|
|
|
ln -s /usr/ports.distfiles distfiles (ON MASTER SERVER ONLY)
|
|
|
|
|
|
|
|
mkdir /usr/ports.distfiles
|
|
|
|
mkdir /usr/ports.workdir
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
Since
|
|
|
|
.Pa /usr/ports
|
|
|
|
is softlinked into what will be read-only on all of your
|
2002-12-22 02:07:05 +00:00
|
|
|
clients, you have to tell the ports system to use a different working
|
2002-12-23 07:27:53 +00:00
|
|
|
directory to hold ports builds.
|
2005-01-15 11:12:40 +00:00
|
|
|
You want to add a line to your
|
2005-10-10 14:55:59 +00:00
|
|
|
.Xr make.conf 5
|
2005-01-15 11:12:40 +00:00
|
|
|
file on the master server
|
2002-12-23 07:27:53 +00:00
|
|
|
and on all your clients:
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
WRKDIRPREFIX=/usr/ports.workdir
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
You should try to make the directory you use for the ports working directory
|
|
|
|
as well as the directory used to hold distfiles consistent across all of your
|
2002-12-23 07:27:53 +00:00
|
|
|
machines.
|
2005-01-15 11:12:40 +00:00
|
|
|
If there is not enough room in
|
|
|
|
.Pa /usr/ports.distfiles
|
|
|
|
and
|
|
|
|
.Pa /usr/ports.workdir
|
|
|
|
I usually make those softlinks (since this is on
|
|
|
|
.Pa /usr
|
|
|
|
these are per-machine) to
|
2002-12-23 07:27:53 +00:00
|
|
|
where the distfiles and working space really are.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Sh EXPORTING VIA NFS FROM THE MASTER SERVER
|
2005-01-15 11:12:40 +00:00
|
|
|
The master server needs to export
|
|
|
|
.Pa /FreeBSD
|
|
|
|
and
|
|
|
|
.Pa /usr/obj
|
|
|
|
via NFS so all the
|
2002-12-23 07:27:53 +00:00
|
|
|
rest of your machines can get at them.
|
|
|
|
I strongly recommend using a read-only export for both security and safety.
|
|
|
|
The environment I am describing in this manual page is designed primarily
|
|
|
|
around read-only NFS exports.
|
|
|
|
Your exports file on the master server should contain the following lines:
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
/FreeBSD -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK
|
|
|
|
/usr/obj -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Of course, NFS server operations must also be configured on that machine.
|
2005-01-15 11:12:40 +00:00
|
|
|
This is typically done via your
|
|
|
|
.Pa /etc/rc.conf :
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
nfs_server_enable="YES"
|
|
|
|
nfs_server_flags="-u -t -n 4"
|
|
|
|
.Ed
|
|
|
|
.Sh THE CLIENT ENVIRONMENT
|
|
|
|
All of your client machines can import the development/build environment
|
2005-01-15 11:12:40 +00:00
|
|
|
directory simply by NFS mounting
|
|
|
|
.Pa /FreeBSD
|
|
|
|
and
|
|
|
|
.Pa /usr/obj
|
|
|
|
from the master server.
|
|
|
|
A typical
|
|
|
|
.Pa /etc/fstab
|
|
|
|
entry on your client machines will be something like this:
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
masterserver:/FreeBSD /FreeBSD nfs ro,bg 0 0
|
|
|
|
masterserver:/usr/obj /usr/obj nfs ro,bg 0 0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
And, of course, you should configure the client for NFS client operations
|
2005-01-15 11:12:40 +00:00
|
|
|
via
|
|
|
|
.Pa /etc/rc.conf .
|
|
|
|
In particular, this will turn on
|
|
|
|
.Xr nfsiod 8
|
|
|
|
which will improve client-side NFS
|
2002-12-23 07:27:53 +00:00
|
|
|
performance:
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
nfs_client_enable="YES"
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
Each client should create softlinks for
|
|
|
|
.Pa /usr/ports
|
|
|
|
and
|
|
|
|
.Pa /usr/src
|
|
|
|
that point
|
2002-12-23 07:27:53 +00:00
|
|
|
into the NFS-mounted environment.
|
2005-01-15 11:12:40 +00:00
|
|
|
If a particular client is running -CURRENT,
|
|
|
|
.Pa /usr/src
|
|
|
|
should be a softlink to
|
|
|
|
.Pa /FreeBSD/FreeBSD-current/src .
|
|
|
|
If it is running -STABLE,
|
|
|
|
.Pa /usr/src
|
|
|
|
should be a softlink to
|
|
|
|
.Pa /FreeBSD/FreeBSD-4.x/src .
|
|
|
|
I do not usually create a
|
|
|
|
.Pa /usr/src2
|
|
|
|
softlink on
|
2002-12-23 07:27:53 +00:00
|
|
|
clients, that is used as a convenient shortcut when working on the source
|
|
|
|
code on the master server only and could create massive confusion (of the
|
|
|
|
human variety) on a client.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
(ON EACH CLIENT)
|
|
|
|
cd /usr
|
|
|
|
rm -rf ports src
|
|
|
|
ln -s /FreeBSD/FreeBSD-current/ports ports
|
|
|
|
ln -s /FreeBSD/FreeBSD-XXX/src src
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
Do not forget to create the working directories so you can build ports, as
|
2002-12-23 07:27:53 +00:00
|
|
|
previously described.
|
|
|
|
If these are not good locations, make them softlinks to the correct location.
|
2005-01-15 11:12:40 +00:00
|
|
|
Remember that
|
|
|
|
.Pa /usr/ports/distfiles
|
|
|
|
is exported by
|
2002-12-22 02:07:05 +00:00
|
|
|
the master server and is therefore going to point to the same place
|
2005-01-15 11:12:40 +00:00
|
|
|
(typically
|
|
|
|
.Pa /usr/ports.distfiles )
|
|
|
|
on every machine.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
mkdir /usr/ports.distfiles
|
|
|
|
mkdir /usr/ports.workdir
|
|
|
|
.Ed
|
|
|
|
.Sh BUILDING KERNELS
|
2002-12-23 07:27:53 +00:00
|
|
|
Here is how you build a -STABLE kernel (on your main development box).
|
2005-01-15 11:12:40 +00:00
|
|
|
If you want to create a custom kernel, copy
|
|
|
|
.Pa GENERIC
|
|
|
|
to
|
|
|
|
.Pa KERNELNAME
|
|
|
|
and then edit it before configuring and building.
|
|
|
|
The kernel configuration file lives in
|
|
|
|
.Pa /usr/src/sys/i386/conf/KERNELNAME .
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
cd /usr/src
|
|
|
|
make buildkernel KERNCONF=KERNELNAME
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2002-12-23 07:27:53 +00:00
|
|
|
.Sy WARNING!
|
|
|
|
If you are familiar with the old config/cd/make method of building
|
2005-01-15 11:12:40 +00:00
|
|
|
a -STABLE kernel, note that the
|
|
|
|
.Xr config 8
|
|
|
|
method will put the build environment in
|
|
|
|
.Pa /usr/src/sys/i386/compile/KERNELNAME
|
|
|
|
instead of in
|
|
|
|
.Pa /usr/obj .
|
2002-12-22 02:07:05 +00:00
|
|
|
.Pp
|
2002-12-23 07:27:53 +00:00
|
|
|
Building a -CURRENT kernel
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
cd /usr/src2 (on the master server)
|
|
|
|
make buildkernel KERNCONF=KERNELNAME
|
|
|
|
.Ed
|
|
|
|
.Sh INSTALLING KERNELS
|
2005-01-15 11:12:40 +00:00
|
|
|
Installing a -STABLE kernel (typically done on a client,
|
|
|
|
only do this on your main development server if you want to install a new
|
2002-12-23 07:27:53 +00:00
|
|
|
kernel for your main development server):
|
|
|
|
.Bd -literal -offset 4n
|
|
|
|
cd /usr/src
|
|
|
|
make installkernel KERNCONF=KERNELNAME
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
If you are using the older config/cd/make build mechanism for -STABLE, you
|
2002-12-23 07:27:53 +00:00
|
|
|
would install using:
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
2005-01-15 11:12:40 +00:00
|
|
|
cd /usr/src/sys/i386/compile/KERNELNAME
|
2002-12-22 02:07:05 +00:00
|
|
|
make install
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2002-12-23 07:27:53 +00:00
|
|
|
Installing a -CURRENT kernel (typically done only on a client)
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
(remember /usr/src is pointing to the client's specific environment)
|
|
|
|
cd /usr/src
|
|
|
|
make installkernel KERNCONF=KERNELNAME
|
|
|
|
.Ed
|
|
|
|
.Sh BUILDING THE WORLD
|
|
|
|
This environment is designed such that you do all builds on the master server,
|
2002-12-23 07:27:53 +00:00
|
|
|
and then install from each client.
|
2005-01-15 11:12:40 +00:00
|
|
|
You can do builds on a client only if
|
|
|
|
.Pa /usr/obj
|
|
|
|
is local to that client.
|
2002-12-23 07:27:53 +00:00
|
|
|
Building the world is easy:
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
cd /usr/src
|
|
|
|
make buildworld
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2002-12-23 07:27:53 +00:00
|
|
|
If you are on the master server you are running in a -STABLE environment, but
|
|
|
|
that does not prevent you from building the -CURRENT world.
|
2005-01-15 11:12:40 +00:00
|
|
|
Just
|
|
|
|
.Xr cd 1
|
|
|
|
into the appropriate source directory and you are set.
|
2004-07-03 18:29:24 +00:00
|
|
|
Do not
|
2002-12-28 19:08:11 +00:00
|
|
|
accidentally install it on your master server though!
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
cd /usr/src2
|
|
|
|
make buildworld
|
|
|
|
.Ed
|
|
|
|
.Sh INSTALLING THE WORLD
|
|
|
|
You can build on your main development server and install on clients.
|
2005-01-15 11:12:40 +00:00
|
|
|
The main development server must export
|
|
|
|
.Pa /FreeBSD
|
|
|
|
and
|
|
|
|
.Pa /usr/obj
|
|
|
|
via read-only NFS to the clients.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Pp
|
2002-12-23 07:27:53 +00:00
|
|
|
.Em NOTE!!!
|
2005-01-15 11:12:40 +00:00
|
|
|
If
|
|
|
|
.Pa /usr/obj
|
|
|
|
is a softlink on the master server, it must also be the EXACT
|
2002-12-23 07:27:53 +00:00
|
|
|
SAME softlink on each client.
|
2005-01-15 11:12:40 +00:00
|
|
|
If
|
|
|
|
.Pa /usr/obj
|
|
|
|
is a directory in
|
|
|
|
.Pa /usr
|
|
|
|
or a mount point on the master server,
|
|
|
|
then it must be (interchangeably) a directory in
|
|
|
|
.Pa /usr
|
|
|
|
or a mount point on
|
2002-12-23 07:27:53 +00:00
|
|
|
each client.
|
2002-12-22 02:07:05 +00:00
|
|
|
This is because the
|
|
|
|
absolute paths are expected to be the same when building the world as when
|
|
|
|
installing it, and you generally build it on your main development box
|
2002-12-23 07:27:53 +00:00
|
|
|
and install it from a client.
|
2005-01-15 11:12:40 +00:00
|
|
|
If you do not set up
|
|
|
|
.Pa /usr/obj
|
|
|
|
properly you will not be able to build on
|
2002-12-23 07:27:53 +00:00
|
|
|
machine and install on another.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
(ON THE CLIENT)
|
|
|
|
(remember /usr/src is pointing to the client's specific environment)
|
|
|
|
cd /usr/src
|
|
|
|
make installworld
|
|
|
|
.Ed
|
2002-12-23 07:27:53 +00:00
|
|
|
.Pp
|
|
|
|
.Sy WARNING!
|
|
|
|
If builds work on the master server but installs do not work from the
|
|
|
|
clients, for example you try to install and the client complains that
|
2005-01-15 11:12:40 +00:00
|
|
|
the install tried to write into the read-only
|
|
|
|
.Pa /usr/obj ,
|
|
|
|
then it is likely
|
|
|
|
that the
|
2005-10-10 14:55:59 +00:00
|
|
|
.Xr make.conf 5
|
2005-01-15 11:12:40 +00:00
|
|
|
file on the client does not match the one on the
|
2002-12-23 07:27:53 +00:00
|
|
|
master server closely enough and the install is trying to install something
|
|
|
|
that was not built.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Sh DOING DEVELOPMENT ON A CLIENT (NOT JUST INSTALLING)
|
|
|
|
Developers often want to run buildkernel's or buildworld's on client
|
2002-12-23 07:27:53 +00:00
|
|
|
boxes simply to life-test the box.
|
|
|
|
You do this in the same manner that you buildkernel and buildworld on your
|
|
|
|
master server.
|
2005-01-15 11:12:40 +00:00
|
|
|
All you have to do is make sure that
|
|
|
|
.Pa /usr/obj
|
|
|
|
is pointing to local storage.
|
|
|
|
If you followed my advise and made
|
|
|
|
.Pa /usr/obj
|
|
|
|
its own partition on the master
|
2002-12-23 07:27:53 +00:00
|
|
|
server,
|
|
|
|
then it is typically going to be an NFS mount on the client.
|
2005-01-15 11:12:40 +00:00
|
|
|
Simply unmounting
|
|
|
|
.Pa /usr/obj
|
|
|
|
will leave you with a
|
|
|
|
.Pa /usr/obj
|
|
|
|
that is a
|
|
|
|
subdirectory in
|
|
|
|
.Pa /usr
|
|
|
|
which is typically local to the client.
|
2002-12-23 07:27:53 +00:00
|
|
|
You can then do builds to your heart's content!
|
2003-08-22 17:12:55 +00:00
|
|
|
.Sh MAINTAINING A LOCAL BRANCH
|
2002-12-22 02:07:05 +00:00
|
|
|
I have described how to maintain two versions of the source tree, a stable
|
2005-01-15 11:12:40 +00:00
|
|
|
version in
|
|
|
|
.Pa /FreeBSD/FreeBSD-4.x
|
|
|
|
and a current version in
|
|
|
|
.Pa /FreeBSD/FreeBSD-current .
|
2002-12-23 07:27:53 +00:00
|
|
|
There is absolutely nothing preventing you
|
2002-12-22 02:07:05 +00:00
|
|
|
from breaking out other versions of the source tree
|
2005-01-15 11:12:40 +00:00
|
|
|
into
|
|
|
|
.Pa /FreeBSD/XXX .
|
|
|
|
In fact, my
|
|
|
|
.Pa /FreeBSD
|
|
|
|
partition also contains
|
2002-12-23 07:27:53 +00:00
|
|
|
.Ox ,
|
|
|
|
.Nx ,
|
2005-01-15 11:12:40 +00:00
|
|
|
and various flavors of
|
|
|
|
.Tn Linux .
|
|
|
|
You may not necessarily be able to build
|
|
|
|
.Pf non- Fx
|
|
|
|
operating systems on
|
2002-12-23 07:27:53 +00:00
|
|
|
your master server, but being able
|
2002-12-22 02:07:05 +00:00
|
|
|
to collect and manage source distributions from a central server is a very
|
|
|
|
useful thing to be able to do and you can certainly export to machines
|
|
|
|
which can build those other operating systems.
|
2003-08-22 17:12:55 +00:00
|
|
|
.Pp
|
|
|
|
Many developers choose to maintain a local branch of
|
|
|
|
.Fx
|
|
|
|
to test patches or build a custom distribution.
|
|
|
|
This can be done with CVS or another source code management system
|
|
|
|
(SubVersion, Perforce, BitKeeper) with its own repository.
|
2004-07-02 19:07:33 +00:00
|
|
|
Since the main
|
2003-08-22 17:12:55 +00:00
|
|
|
.Fx
|
|
|
|
tree is based on CVS, the former is convenient.
|
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
First, you need to modify your
|
|
|
|
.Xr cvsup 1
|
|
|
|
environment to avoid it modifying
|
2003-08-25 19:08:37 +00:00
|
|
|
the local changes you have committed to the repository.
|
2005-01-15 11:12:40 +00:00
|
|
|
It is important to remove the
|
|
|
|
.Ic delete
|
|
|
|
keyword from your
|
|
|
|
.Pa supfile
|
|
|
|
and to add the
|
|
|
|
.Pa CVSROOT
|
|
|
|
subdirectory to your
|
|
|
|
.Pa refuse
|
|
|
|
file.
|
2003-08-25 19:08:37 +00:00
|
|
|
For more information, see
|
|
|
|
.Xr cvsup 1 .
|
|
|
|
.Pp
|
2003-08-22 17:12:55 +00:00
|
|
|
The
|
|
|
|
.Fx
|
2005-01-15 11:12:40 +00:00
|
|
|
version of
|
|
|
|
.Xr cvs 1
|
|
|
|
examines a custom environmental variable,
|
|
|
|
.Ev CVS_LOCAL_BRANCH_NUM ,
|
|
|
|
which specifies an integer to use when doing a
|
|
|
|
.Xr cvs 1
|
|
|
|
.Cm tag Ns / Ns Cm rtag .
|
2003-08-22 17:12:55 +00:00
|
|
|
Set this number to something high (say 1000) to avoid colliding
|
2004-07-03 18:29:24 +00:00
|
|
|
with potential future branches of the main repository.
|
|
|
|
For example,
|
2003-08-22 17:12:55 +00:00
|
|
|
branching a file with version 1.4 produces 1.4.1000.
|
|
|
|
Future commits to this branch will produce revisions 1.4.1000.1,
|
|
|
|
1.4.1000.2, etc.
|
|
|
|
.Pp
|
|
|
|
To fork your local branch, do:
|
|
|
|
.Bd -literal -offset 4n
|
|
|
|
cvs rtag -r RELENG_4 -b LOCAL_RELENG_4 src
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
After this, you can check out a copy from your local repository using the
|
|
|
|
new tag and begin making changes and committing them.
|
2005-01-15 11:12:40 +00:00
|
|
|
For more information on using CVS, see
|
2003-08-22 17:12:55 +00:00
|
|
|
.Xr cvs 1 .
|
2003-08-25 19:08:37 +00:00
|
|
|
.Pp
|
|
|
|
.Sy WARNING!
|
2005-01-15 11:12:40 +00:00
|
|
|
The
|
|
|
|
.Xr cvsup 1
|
|
|
|
utility may blow away changes made on a local branch in
|
2003-08-25 19:08:37 +00:00
|
|
|
some situations.
|
|
|
|
This has been reported to occur when the master CVS repository is
|
|
|
|
directly manipulated or an RCS file is changed.
|
2005-01-15 11:12:40 +00:00
|
|
|
At this point,
|
|
|
|
.Xr cvsup 1
|
|
|
|
notices that the client and server have entirely
|
2003-08-25 19:08:37 +00:00
|
|
|
different RCS files, so it does a full replace instead of trying to
|
|
|
|
send just deltas.
|
|
|
|
Ideally this situation should never arise, but in the real world it
|
|
|
|
happens all the time.
|
|
|
|
.Pp
|
|
|
|
While this is the only scenario where the problem should crop up,
|
|
|
|
there have been some suspicious-sounding reports of
|
2005-01-15 11:12:40 +00:00
|
|
|
.Ev CVS_LOCAL_BRANCH_NUM
|
|
|
|
lossage that cannot be explained by this alone.
|
2003-08-25 19:08:37 +00:00
|
|
|
Bottom line is, if you value your local branch then you
|
|
|
|
should back it up before every update.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Sh UPDATING VIA CVS
|
2005-01-15 11:12:40 +00:00
|
|
|
The advantage of using
|
|
|
|
.Xr cvsup 1
|
|
|
|
to maintain an updated copy of the CVS
|
2002-12-22 02:07:05 +00:00
|
|
|
repository instead of using it to maintain source trees directly is that you
|
|
|
|
can then pick and choose when you bring your source tree (or pieces of your
|
2002-12-23 07:27:53 +00:00
|
|
|
source tree) up to date.
|
2005-01-15 11:12:40 +00:00
|
|
|
By using a
|
|
|
|
.Xr cron 8
|
|
|
|
job to maintain an updated CVS repository, you can update
|
2002-12-23 07:27:53 +00:00
|
|
|
your source tree at any time without any network cost as follows:
|
2002-12-22 02:07:05 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
(on the main development server)
|
|
|
|
cd /usr/src
|
|
|
|
cvs -d /home/ncvs update
|
|
|
|
cd /usr/src2
|
|
|
|
cvs -d /home/ncvs update
|
|
|
|
cd /usr/ports
|
|
|
|
cvs -d /home/ncvs update
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
It is that simple, and since you are exporting the whole lot to your
|
2005-01-15 11:12:40 +00:00
|
|
|
clients, your clients have immediate visibility into the updated
|
2002-12-23 07:27:53 +00:00
|
|
|
source.
|
2005-01-15 11:12:40 +00:00
|
|
|
This is a good time to also remind you that most of the
|
|
|
|
.Xr cvs 1
|
|
|
|
operations you do will be done as
|
|
|
|
.Dq Li root ,
|
|
|
|
and that certain options are
|
2002-12-23 07:27:53 +00:00
|
|
|
required for CVS to operate properly on the
|
|
|
|
.Fx
|
2004-07-03 18:29:24 +00:00
|
|
|
repository.
|
|
|
|
For example,
|
2002-12-23 07:27:53 +00:00
|
|
|
.Fl Pd
|
2005-01-15 11:12:40 +00:00
|
|
|
is necessary when running
|
|
|
|
.Nm cvs Cm update .
|
|
|
|
These options are typically placed in your
|
|
|
|
.Pa ~/.cvsrc
|
|
|
|
(as already described)
|
2006-12-14 13:35:59 +00:00
|
|
|
so you do not have to re-specify them every time you run a
|
2005-01-15 11:12:40 +00:00
|
|
|
.Xr cvs 1
|
|
|
|
command.
|
2002-12-23 07:27:53 +00:00
|
|
|
Maintaining the CVS repository also gives you far more flexibility
|
|
|
|
in regards to breaking out multiple versions of the source tree.
|
2005-01-15 11:12:40 +00:00
|
|
|
It is a good idea to give your
|
|
|
|
.Pa /FreeBSD
|
|
|
|
partition a lot of space (I recommend
|
2002-12-23 07:27:53 +00:00
|
|
|
8-12GB) precisely for that reason.
|
|
|
|
If you can make it 15GB I would do it.
|
2002-12-22 02:07:05 +00:00
|
|
|
.Pp
|
2005-01-15 11:12:40 +00:00
|
|
|
I generally do not
|
|
|
|
.Nm cvs Cm update
|
|
|
|
via a
|
|
|
|
.Xr cron 8
|
|
|
|
job.
|
2002-12-23 07:27:53 +00:00
|
|
|
This is because I generally want the source to not change out from under me
|
|
|
|
when I am developing code.
|
2004-07-03 18:29:24 +00:00
|
|
|
Instead I manually update the source every so often...\& when I feel it is
|
2002-12-23 07:27:53 +00:00
|
|
|
a good time.
|
2005-01-15 11:12:40 +00:00
|
|
|
My recommendation is to only keep the CVS repository synchronized via
|
|
|
|
.Xr cron 8 .
|
2002-12-22 02:07:05 +00:00
|
|
|
.Sh SEE ALSO
|
2002-12-23 07:27:53 +00:00
|
|
|
.Xr crontab 1 ,
|
|
|
|
.Xr crontab 5 ,
|
2005-10-10 14:55:59 +00:00
|
|
|
.Xr make.conf 5 ,
|
2003-05-20 23:25:44 +00:00
|
|
|
.Xr build 7 ,
|
2002-12-23 07:27:53 +00:00
|
|
|
.Xr firewall 7 ,
|
2003-05-21 07:16:32 +00:00
|
|
|
.Xr release 7 ,
|
2003-05-20 23:25:44 +00:00
|
|
|
.Xr tuning 7 ,
|
|
|
|
.Xr diskless 8
|
2002-12-22 02:07:05 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
manual page was originally written by
|
2002-12-23 07:27:53 +00:00
|
|
|
.An Matthew Dillon Aq dillon@FreeBSD.org
|
2002-12-22 02:07:05 +00:00
|
|
|
and first appeared
|
|
|
|
in
|
2002-12-23 07:27:53 +00:00
|
|
|
.Fx 5.0 ,
|
2002-12-22 02:07:05 +00:00
|
|
|
December 2002.
|