xref: /freebsd/share/man/man7/development.7 (revision 48096bb39805b421930e62464d57c460b4cf8b58)
16ed033beSMatthew Dillon.\" Copyright (c) 1998, Matthew Dillon.  Terms and conditions are those of
26ed033beSMatthew Dillon.\" the BSD Copyright as specified in the file "/usr/src/COPYRIGHT" in
36ed033beSMatthew Dillon.\" the FreeBSD source tree.
46ed033beSMatthew Dillon.\"
56ed033beSMatthew Dillon.\" $FreeBSD$
66ed033beSMatthew Dillon.\"
76ed033beSMatthew Dillon.Dd December 21, 2002
86ed033beSMatthew Dillon.Dt DEVELOPMENT 7
96ed033beSMatthew Dillon.Os
106ed033beSMatthew Dillon.Sh NAME
116ed033beSMatthew Dillon.Nm development
126ed033beSMatthew Dillon.Nd introduction to development with the FreeBSD codebase
136ed033beSMatthew Dillon.Sh DESCRIPTION
1448096bb3SMatthew DillonThis manual page describes how an ordinary sysop,
1548096bb3SMatthew Dillon.Ux admin, or developer
166ed033beSMatthew Dilloncan, without any special permission, obtain, maintain, and modify the
1748096bb3SMatthew Dillon.Fx
1848096bb3SMatthew Dilloncodebase as well as how to maintaining a master build which can
1948096bb3SMatthew Dillonthen be exported to other machines in your network.
2048096bb3SMatthew DillonThis manual page
216ed033beSMatthew Dillonis targeted to system operators, programmers, and developers.
226ed033beSMatthew Dillon.Pp
236ed033beSMatthew DillonPlease note that what is being described here is based on a complete
2448096bb3SMatthew DillonFreeBSD environment, not just the FreeBSD kernel.
2548096bb3SMatthew DillonThe methods described
266ed033beSMatthew Dillonhere are as applicable to production installations as it is to development
2748096bb3SMatthew Dillonenvironments.
2848096bb3SMatthew DillonYou need a good 12-17GB of disk space on one machine to make this work
2948096bb3SMatthew Dillonconveniently.
306ed033beSMatthew Dillon.Sh SETTING UP THE ENVIRONMENT ON THE MASTER SERVER
316ed033beSMatthew DillonYour master server should always run a stable, production version of the
326ed033beSMatthew Dillon.Fx
3348096bb3SMatthew Dillonoperating system.   This does not prevent you from doing -CURRENT
346ed033beSMatthew Dillonbuilds or development.  The last thing you want to do is to run an
356ed033beSMatthew Dillonunstable environment on your master server which could lead to a situation
366ed033beSMatthew Dillonwhere you lose the environment and/or cannot recover from a mistake.
376ed033beSMatthew Dillon.Pp
3848096bb3SMatthew DillonCreate a huge partition called /FreeBSD.
3948096bb3SMatthew Dillon8-12GB is recommended.
4048096bb3SMatthew DillonThis partition will contain nearly all the development environment,
416ed033beSMatthew Dillonincluding the CVS tree, broken-out source, and possibly even object files.
426ed033beSMatthew DillonYou are going to export this partition to your other machines via a
436ed033beSMatthew DillonREAD-ONLY NFS export so do not mix it with other more security-sensitive
446ed033beSMatthew Dillonpartitions.
456ed033beSMatthew Dillon.Pp
4648096bb3SMatthew DillonYou have to make a choice in regards to /usr/obj.
4748096bb3SMatthew DillonYou can put /usr/obj in /FreeBSD or you can make /usr/obj its own partition.
4848096bb3SMatthew DillonI recommend making /usr/obj its own partition for safety (it is being
4948096bb3SMatthew Dillonconstantly modified) as well as to make certain things easier in the
5048096bb3SMatthew Dillondevelopment environment which I describe down the line.
5148096bb3SMatthew DillonI recommend a /usr/obj partition of at least 5GB.
526ed033beSMatthew Dillon.Pp
536ed033beSMatthew DillonOn the master server, use cvsup to automatically pull down and maintain
546ed033beSMatthew Dillonthe
556ed033beSMatthew Dillon.Fx
566ed033beSMatthew DillonCVS archive once a day.  The first pull will take a long time,
5748096bb3SMatthew Dillonit is several gigabytes, but once you have it the daily syncs will be quite
586ed033beSMatthew Dillonsmall.
596ed033beSMatthew Dillon.Bd -literal -offset 4n
606ed033beSMatthew Dillonmkdir /FreeBSD/FreeBSD-CVS
616ed033beSMatthew Dillonrm -rf /home/ncvs
626ed033beSMatthew Dillonln -s /FreeBSD/FreeBSD-CVS /home/ncvs
636ed033beSMatthew Dillon.Ed
646ed033beSMatthew Dillon.Pp
656ed033beSMatthew DillonThe cron job should look something like this (please randomize the time of
6648096bb3SMatthew Dillonday!).
6748096bb3SMatthew DillonNote that you can use the cvsup file example directly from
686ed033beSMatthew Dillon/usr/share/examples without modification by supplying appropriate arguments
696ed033beSMatthew Dillonto cvsup.
706ed033beSMatthew Dillon.Bd -literal -offset 4n
716ed033beSMatthew Dillon33 6 * * *      /usr/local/bin/cvsup -g -r 20 -L 2 -h cvsup.freebsd.org /usr/share/examples/cvsup/cvs-supfile
726ed033beSMatthew Dillon.Ed
736ed033beSMatthew Dillon.Pp
746ed033beSMatthew DillonRun the cvsup manually the first time to pull down the archive.  It could take
7548096bb3SMatthew Dillonall day depending on how fast your connection is!
7648096bb3SMatthew DillonYou will run all cvsup and cvs operations as root and you need to set
7748096bb3SMatthew Dillonup a ~/.cvsrc (/root/.cvsrc) file, as shown below, for proper cvs operation.
7848096bb3SMatthew DillonUsing ~/.cvsrc to specify cvs defaults is an excellent way
7948096bb3SMatthew Dillonto "file and forget", but you should never forget that you put them in there.
8048096bb3SMatthew Dillon.Bd -literal -offset 4n
8148096bb3SMatthew Dillon# cvs -q
8248096bb3SMatthew Dillondiff -u
8348096bb3SMatthew Dillonupdate -Pd
8448096bb3SMatthew Dilloncheckout -P
8548096bb3SMatthew Dillon.Ed
8648096bb3SMatthew Dillon.Pp
8748096bb3SMatthew DillonNow use cvs to checkout a -STABLE source tree and a -CURRENT source tree,
886ed033beSMatthew Dillonas well as ports and docs, to create your initial source environment.
896ed033beSMatthew DillonKeeping the broken-out source and ports in /FreeBSD allows you to export
9048096bb3SMatthew Dillonit to other machines via read-only NFS.
9148096bb3SMatthew DillonThis also means you only need to edit/maintain files in one place and all
9248096bb3SMatthew Dillonyour clients automatically pick up the changes.
936ed033beSMatthew Dillon.Bd -literal -offset 4n
946ed033beSMatthew Dillonmkdir /FreeBSD/FreeBSD-4.x
956ed033beSMatthew Dillonmkdir /FreeBSD/FreeBSD-current
966ed033beSMatthew Dillon
976ed033beSMatthew Dilloncd /FreeBSD/FreeBSD-4.x
986ed033beSMatthew Dilloncvs -d /home/ncvs checkout -rRELENG_4 src
996ed033beSMatthew Dillon
1006ed033beSMatthew Dilloncd /FreeBSD/FreeBSD-current
1016ed033beSMatthew Dilloncvs -d /home/ncvs checkout src
1026ed033beSMatthew Dilloncvs -d /home/ncvs checkout ports
1036ed033beSMatthew Dilloncvs -d /home/ncvs checkout doc
1046ed033beSMatthew Dillon.Ed
1056ed033beSMatthew Dillon.Pp
10648096bb3SMatthew DillonNow create a softlink for /usr/src and /usr/src2.
10748096bb3SMatthew DillonOn the main server I always point /usr/src at -STABLE and /usr/src2 at
10848096bb3SMatthew Dillon-CURRENT.  On client machines I usually do not have a /usr/src2 and I make
10948096bb3SMatthew Dillon/usr/src point at whatever version of FreeBSD the client box is intended to
11048096bb3SMatthew Dillonrun.
1116ed033beSMatthew Dillon.Bd -literal -offset 4n
1126ed033beSMatthew Dilloncd /usr
1136ed033beSMatthew Dillonrm -rf src src2
11448096bb3SMatthew Dillonln -s /FreeBSD/FreeBSD-4.x/src src	(could be -CURRENT on a client)
1156ed033beSMatthew Dillonln -s /FreeBSD/FreeBSD-current/src src2	(MASTER SERVER ONLY)
1166ed033beSMatthew Dillon.Ed
1176ed033beSMatthew Dillon.Pp
11848096bb3SMatthew DillonNow you have to make a choice for /usr/obj.
11948096bb3SMatthew DillonWell, hopefully you made it already and chose the partition method.  If you
12048096bb3SMatthew Dillonchose poorly you probably intend to put it in /FreeBSD and, if so, this is
12148096bb3SMatthew Dillonwhat you want to do:
1226ed033beSMatthew Dillon.Bd -literal -offset 4n
1236ed033beSMatthew Dillon(ONLY IF YOU MADE A POOR CHOICE AND PUT /usr/obj in /FreeBSD!)
1246ed033beSMatthew Dillonmkdir /FreeBSD/obj
1256ed033beSMatthew Dilloncd /usr
1266ed033beSMatthew Dillonrm -rf obj
1276ed033beSMatthew Dillonln -s /FreeBSD/obj obj
1286ed033beSMatthew Dillon.Ed
1296ed033beSMatthew Dillon.Pp
1306ed033beSMatthew DillonAlternatively you may chose simply to leave /usr/obj in /usr.  If your
1316ed033beSMatthew Dillon/usr is large enough this will work, but I do not recommend it for
1326ed033beSMatthew Dillonsafety reasons (/usr/obj is constantly being modified, /usr is not).
1336ed033beSMatthew Dillon.Pp
1346ed033beSMatthew DillonNote that exporting /usr/obj via read-only NFS to your other boxes will
1356ed033beSMatthew Dillonallow you to build on your main server and install from your other boxes.
1366ed033beSMatthew DillonIf you also want to do builds on some or all of the clients you can simply
13748096bb3SMatthew Dillonhave /usr/obj be a local directory on those clients.
13848096bb3SMatthew DillonYou should never export /usr/obj read-write, it will lead to all sorts of
13948096bb3SMatthew Dillonproblems and issues down the line and presents a security problem as well.
14048096bb3SMatthew DillonIt is far easier to do builds on the master server and then only do installs
14148096bb3SMatthew Dillonon the clients.
1426ed033beSMatthew Dillon.Pp
14348096bb3SMatthew DillonI usually maintain my ports tree via CVS.
14448096bb3SMatthew DillonIt is sitting right there in the master CVS archive and I've even told you
14548096bb3SMatthew Dillonto check it out (see above).
14648096bb3SMatthew DillonWith some fancy softlinks you can make the ports tree available both on your
14748096bb3SMatthew Dillonmaster server and on all of your other machines.
14848096bb3SMatthew DillonNote that the ports tree exists only on the HEAD cvs branch, so its always
14948096bb3SMatthew Dillon-CURRENT even on a -STABLE box.  This is what you do:
1506ed033beSMatthew Dillon.Bd -literal -offset 4n
1516ed033beSMatthew Dillon(THESE COMMANDS ON THE MASTER SERVER AND ON ALL CLIENTS)
1526ed033beSMatthew Dilloncd /usr
1536ed033beSMatthew Dillonrm -rf ports
1546ed033beSMatthew Dillonln -s /FreeBSD/FreeBSD-current/ports ports
1556ed033beSMatthew Dillon
1566ed033beSMatthew Dilloncd /usr/ports   			(this pushes into the softlink)
1576ed033beSMatthew Dillonrm -rf distfiles			(ON MASTER SERVER ONLY)
1586ed033beSMatthew Dillonln -s /usr/ports.distfiles distfiles	(ON MASTER SERVER ONLY)
1596ed033beSMatthew Dillon
1606ed033beSMatthew Dillonmkdir /usr/ports.distfiles
1616ed033beSMatthew Dillonmkdir /usr/ports.workdir
1626ed033beSMatthew Dillon.Ed
1636ed033beSMatthew Dillon.Pp
1646ed033beSMatthew DillonSince /usr/ports is softlinked into what will be read-only on all of your
1656ed033beSMatthew Dillonclients, you have to tell the ports system to use a different working
16648096bb3SMatthew Dillondirectory to hold ports builds.
16748096bb3SMatthew DillonYou want to add a line to your /etc/make.conf file on the master server
16848096bb3SMatthew Dillonand on all your clients:
1696ed033beSMatthew Dillon.Bd -literal -offset 4n
1706ed033beSMatthew DillonWRKDIRPREFIX=/usr/ports.workdir
1716ed033beSMatthew Dillon.Ed
1726ed033beSMatthew Dillon.Pp
1736ed033beSMatthew DillonYou should try to make the directory you use for the ports working directory
1746ed033beSMatthew Dillonas well as the directory used to hold distfiles consistent across all of your
17548096bb3SMatthew Dillonmachines.
17648096bb3SMatthew DillonIf there isn't enough room in /usr/ports.distfiles and /usr/ports.workdir I
17748096bb3SMatthew Dillonusually make those softlinks (since this is on /usr these are per-machine) to
17848096bb3SMatthew Dillonwhere the distfiles and working space really are.
1796ed033beSMatthew Dillon.Sh EXPORTING VIA NFS FROM THE MASTER SERVER
1806ed033beSMatthew DillonThe master server needs to export /FreeBSD and /usr/obj via NFS so all the
18148096bb3SMatthew Dillonrest of your machines can get at them.
18248096bb3SMatthew DillonI strongly recommend using a read-only export for both security and safety.
18348096bb3SMatthew DillonThe environment I am describing in this manual page is designed primarily
18448096bb3SMatthew Dillonaround read-only NFS exports.
18548096bb3SMatthew DillonYour exports file on the master server should contain the following lines:
1866ed033beSMatthew Dillon.Bd -literal -offset 4n
1876ed033beSMatthew Dillon/FreeBSD -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK
1886ed033beSMatthew Dillon/usr/obj -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK
1896ed033beSMatthew Dillon.Ed
1906ed033beSMatthew Dillon.Pp
1916ed033beSMatthew DillonOf course, NFS server operations must also be configured on that machine.
1926ed033beSMatthew DillonThis is typically done via your /etc/rc.conf:
1936ed033beSMatthew Dillon.Bd -literal -offset 4n
1946ed033beSMatthew Dillonnfs_server_enable="YES"
1956ed033beSMatthew Dillonnfs_server_flags="-u -t -n 4"
1966ed033beSMatthew Dillon.Ed
1976ed033beSMatthew Dillon.Sh THE CLIENT ENVIRONMENT
1986ed033beSMatthew DillonAll of your client machines can import the development/build environment
1996ed033beSMatthew Dillondirectory simply by NFS mounting /FreeBSD and /usr/obj from the master
2006ed033beSMatthew Dillonserver.
20148096bb3SMatthew DillonA typical /etc/fstab entry on your client machines will be something like this:
2026ed033beSMatthew Dillon.Bd -literal -offset 4n
2036ed033beSMatthew Dillonmasterserver:/FreeBSD     /FreeBSD        nfs     ro,bg    0       0
2046ed033beSMatthew Dillonmasterserver:/usr/obj     /usr/obj        nfs     ro,bg    0       0
2056ed033beSMatthew Dillon.Ed
2066ed033beSMatthew Dillon.Pp
2076ed033beSMatthew DillonAnd, of course, you should configure the client for NFS client operations
20848096bb3SMatthew Dillonvia /etc/rc.conf.
20948096bb3SMatthew DillonIn particular, this will turn on nfsiod which will improve client-side NFS
21048096bb3SMatthew Dillonperformance:
2116ed033beSMatthew Dillon.Bd -literal -offset 4n
2126ed033beSMatthew Dillonnfs_client_enable="YES"
2136ed033beSMatthew Dillon.Ed
2146ed033beSMatthew Dillon.Pp
2156ed033beSMatthew DillonEach client should create softlinks for /usr/ports and /usr/src that point
2166ed033beSMatthew Dilloninto the NFS-mounted environment.
21748096bb3SMatthew DillonIf a particular client is running -CURRENT, /usr/src
21848096bb3SMatthew Dillonshould be a softlink to /FreeBSD/FreeBSD-current/src.
21948096bb3SMatthew DillonIf it is running -STABLE, /usr/src should be a softlink to
22048096bb3SMatthew Dillon/FreeBSD/FreeBSD-4.x/src.  I do not usually create a /usr/src2 softlink on
22148096bb3SMatthew Dillonclients, that is used as a convenient shortcut when working on the source
22248096bb3SMatthew Dilloncode on the master server only and could create massive confusion (of the
22348096bb3SMatthew Dillonhuman variety) on a client.
2246ed033beSMatthew Dillon.Bd -literal -offset 4n
2256ed033beSMatthew Dillon(ON EACH CLIENT)
2266ed033beSMatthew Dilloncd /usr
2276ed033beSMatthew Dillonrm -rf ports src
2286ed033beSMatthew Dillonln -s /FreeBSD/FreeBSD-current/ports ports
2296ed033beSMatthew Dillonln -s /FreeBSD/FreeBSD-XXX/src src
2306ed033beSMatthew Dillon.Ed
2316ed033beSMatthew Dillon.Pp
2326ed033beSMatthew DillonDon't forget to create the working directories so you can build ports, as
23348096bb3SMatthew Dillonpreviously described.
23448096bb3SMatthew DillonIf these are not good locations, make them softlinks to the correct location.
23548096bb3SMatthew DillonRemember that /usr/ports/distfiles is exported by
2366ed033beSMatthew Dillonthe master server and is therefore going to point to the same place
2376ed033beSMatthew Dillon(typically /usr/ports.distfiles) on every machine.
2386ed033beSMatthew Dillon.Bd -literal -offset 4n
2396ed033beSMatthew Dillonmkdir /usr/ports.distfiles
2406ed033beSMatthew Dillonmkdir /usr/ports.workdir
2416ed033beSMatthew Dillon.Ed
2426ed033beSMatthew Dillon.Sh BUILDING KERNELS
24348096bb3SMatthew DillonHere is how you build a -STABLE kernel (on your main development box).
2446ed033beSMatthew DillonIf you want to create a custom kernel, cp GENERIC to YOURKERNEL and then
24548096bb3SMatthew Dillonedit it before configuring and building.
24648096bb3SMatthew DillonThe kernel configuration file lives in /usr/src/sys/i386/conf/KERNELNAME.
2476ed033beSMatthew Dillon.Bd -literal -offset 4n
2486ed033beSMatthew Dilloncd /usr/src
2496ed033beSMatthew Dillonmake buildkernel KERNCONF=KERNELNAME
2506ed033beSMatthew Dillon.Ed
2516ed033beSMatthew Dillon.Pp
25248096bb3SMatthew Dillon.Sy WARNING!
25348096bb3SMatthew DillonIf you are familiar with the old config/cd/make method of building
25448096bb3SMatthew Dillona -STABLE kernel, note that the config method will put the build
2556ed033beSMatthew Dillonenvironment in /usr/src/sys/compile/KERNELNAME instead of in /usr/obj.
2566ed033beSMatthew Dillon.Pp
25748096bb3SMatthew DillonBuilding a -CURRENT kernel
2586ed033beSMatthew Dillon.Bd -literal -offset 4n
2596ed033beSMatthew Dilloncd /usr/src2		(on the master server)
2606ed033beSMatthew Dillonmake buildkernel KERNCONF=KERNELNAME
2616ed033beSMatthew Dillon.Ed
2626ed033beSMatthew Dillon.Sh INSTALLING KERNELS
26348096bb3SMatthew DillonInstalling a -STABLE kernel (typically done on a client.
26448096bb3SMatthew DillonOnly do this on your main development server if you want to install a new
26548096bb3SMatthew Dillonkernel for your main development server):
26648096bb3SMatthew Dillon.Bd -literal -offset 4n
26748096bb3SMatthew Dilloncd /usr/src
26848096bb3SMatthew Dillonmake installkernel KERNCONF=KERNELNAME
26948096bb3SMatthew Dillon.Ed
27048096bb3SMatthew Dillon.Pp
27148096bb3SMatthew DillonIf you are using the older config/cd/make build mechanism for stable, you
27248096bb3SMatthew Dillonwould install using:
2736ed033beSMatthew Dillon.Bd -literal -offset 4n
2746ed033beSMatthew Dilloncd /usr/src/sys/compile/KERNELNAME
2756ed033beSMatthew Dillonmake install
2766ed033beSMatthew Dillon.Ed
2776ed033beSMatthew Dillon.Pp
27848096bb3SMatthew DillonInstalling a -CURRENT kernel (typically done only on a client)
2796ed033beSMatthew Dillon.Bd -literal -offset 4n
2806ed033beSMatthew Dillon(remember /usr/src is pointing to the client's specific environment)
2816ed033beSMatthew Dilloncd /usr/src
2826ed033beSMatthew Dillonmake installkernel KERNCONF=KERNELNAME
2836ed033beSMatthew Dillon.Ed
28448096bb3SMatthew Dillon.Pp
2856ed033beSMatthew Dillon.Sh BUILDING THE WORLD
2866ed033beSMatthew DillonThis environment is designed such that you do all builds on the master server,
28748096bb3SMatthew Dillonand then install from each client.
28848096bb3SMatthew DillonYou can do builds on a client only if /usr/obj is local to that client.
28948096bb3SMatthew DillonBuilding the world is easy:
2906ed033beSMatthew Dillon.Bd -literal -offset 4n
2916ed033beSMatthew Dilloncd /usr/src
2926ed033beSMatthew Dillonmake buildworld
2936ed033beSMatthew Dillon.Ed
2946ed033beSMatthew Dillon.Pp
29548096bb3SMatthew DillonIf you are on the master server you are running in a -STABLE environment, but
29648096bb3SMatthew Dillonthat does not prevent you from building the -CURRENT world.
29748096bb3SMatthew DillonJust cd into the appropriate source directory and you are set.  Do not
29848096bb3SMatthew Dillonaccidently install it on your master server though!
2996ed033beSMatthew Dillon.Bd -literal -offset 4n
3006ed033beSMatthew Dilloncd /usr/src2
3016ed033beSMatthew Dillonmake buildworld
3026ed033beSMatthew Dillon.Ed
3036ed033beSMatthew Dillon.Sh INSTALLING THE WORLD
3046ed033beSMatthew DillonYou can build on your main development server and install on clients.
3056ed033beSMatthew DillonThe main development server must export /FreeBSD and /usr/obj via
3066ed033beSMatthew Dillonread-only NFS to the clients.
3076ed033beSMatthew Dillon.Pp
30848096bb3SMatthew Dillon.Em NOTE!!!
30948096bb3SMatthew DillonIf /usr/obj is a softlink on the master server, it must also be the EXACT
31048096bb3SMatthew DillonSAME softlink on each client.
31148096bb3SMatthew DillonIf /usr/obj is a directory in /usr or a mount point on the master server,
31248096bb3SMatthew Dillonthen it must be (interchangeably) a directory in /usr or a mount point on
31348096bb3SMatthew Dilloneach client.
3146ed033beSMatthew DillonThis is because the
3156ed033beSMatthew Dillonabsolute paths are expected to be the same when building the world as when
3166ed033beSMatthew Dilloninstalling it, and you generally build it on your main development box
31748096bb3SMatthew Dillonand install it from a client.
31848096bb3SMatthew DillonIf you do not setup /usr/obj properly you will not be able to build on
31948096bb3SMatthew Dillonmachine and install on another.
3206ed033beSMatthew Dillon.Bd -literal -offset 4n
3216ed033beSMatthew Dillon(ON THE CLIENT)
3226ed033beSMatthew Dillon(remember /usr/src is pointing to the client's specific environment)
3236ed033beSMatthew Dilloncd /usr/src
3246ed033beSMatthew Dillonmake installworld
3256ed033beSMatthew Dillon.Ed
32648096bb3SMatthew Dillon.Pp
32748096bb3SMatthew Dillon.Sy WARNING!
32848096bb3SMatthew DillonIf builds work on the master server but installs do not work from the
32948096bb3SMatthew Dillonclients, for example you try to install and the client complains that
33048096bb3SMatthew Dillonthe install tried to write into the read-only /usr/obj, then it is likely
33148096bb3SMatthew Dillonthat the /etc/make.conf file on the client does not match the one on the
33248096bb3SMatthew Dillonmaster server closely enough and the install is trying to install something
33348096bb3SMatthew Dillonthat was not built.
3346ed033beSMatthew Dillon.Sh DOING DEVELOPMENT ON A CLIENT (NOT JUST INSTALLING)
3356ed033beSMatthew DillonDevelopers often want to run buildkernel's or buildworld's on client
33648096bb3SMatthew Dillonboxes simply to life-test the box.
33748096bb3SMatthew DillonYou do this in the same manner that you buildkernel and buildworld on your
33848096bb3SMatthew Dillonmaster server.
33948096bb3SMatthew DillonAll you have to do is make sure that /usr/obj is pointing to local storage.
34048096bb3SMatthew DillonIf you followed my advise and made /usr/obj its own partition on the master
34148096bb3SMatthew Dillonserver,
34248096bb3SMatthew Dillonthen it is typically going to be an NFS mount on the client.
34348096bb3SMatthew DillonSimply unmounting /usr/obj will leave you with a /usr/obj that is a
34448096bb3SMatthew Dillonsubdirectory in /usr which is typically local to the client.
34548096bb3SMatthew DillonYou can then do builds to your heart's content!
3466ed033beSMatthew Dillon.Sh MULTIPLE VERSIONS OF THE SOURCE TREE
3476ed033beSMatthew DillonI have described how to maintain two versions of the source tree, a stable
3486ed033beSMatthew Dillonversion in /FreeBSD/FreeBSD-4.x and a current version
34948096bb3SMatthew Dillonin /FreeBSD/FreeBSD-current.
35048096bb3SMatthew DillonThere is absolutely nothing preventing you
3516ed033beSMatthew Dillonfrom breaking out other versions of the source tree
35248096bb3SMatthew Dilloninto /FreeBSD/XXX.
35348096bb3SMatthew DillonIn fact, my /FreeBSD partition also contains
35448096bb3SMatthew Dillon.Ox ,
35548096bb3SMatthew Dillon.Nx ,
35648096bb3SMatthew Dillonand various flavors of Linux.
35748096bb3SMatthew DillonYou may not necessarily be able to build non-FreeBSD operating systems on
35848096bb3SMatthew Dillonyour master server, but being able
3596ed033beSMatthew Dillonto collect and manage source distributions from a central server is a very
3606ed033beSMatthew Dillonuseful thing to be able to do and you can certainly export to machines
3616ed033beSMatthew Dillonwhich can build those other operating systems.
3626ed033beSMatthew Dillon.Sh UPDATING VIA CVS
3636ed033beSMatthew DillonThe advantage of using cvsup to maintain an updated copy of the CVS
3646ed033beSMatthew Dillonrepository instead of using it to maintain source trees directly is that you
3656ed033beSMatthew Dilloncan then pick and choose when you bring your source tree (or pieces of your
36648096bb3SMatthew Dillonsource tree) up to date.
36748096bb3SMatthew DillonBy using a cron job to maintain an updated CVS repository, you can update
36848096bb3SMatthew Dillonyour source tree at any time without any network cost as follows:
3696ed033beSMatthew Dillon.Bd -literal -offset 4n
3706ed033beSMatthew Dillon(on the main development server)
3716ed033beSMatthew Dilloncd /usr/src
3726ed033beSMatthew Dilloncvs -d /home/ncvs update
3736ed033beSMatthew Dilloncd /usr/src2
3746ed033beSMatthew Dilloncvs -d /home/ncvs update
3756ed033beSMatthew Dilloncd /usr/ports
3766ed033beSMatthew Dilloncvs -d /home/ncvs update
3776ed033beSMatthew Dillon.Ed
3786ed033beSMatthew Dillon.Pp
3796ed033beSMatthew DillonIt is that simple, and since you are exporting the whole lot to your
3806ed033beSMatthew Dillonclients, your clients have immediately visibility into the updated
38148096bb3SMatthew Dillonsource.
38248096bb3SMatthew DillonThis is a good time to also remind you that most of the cvs operations
38348096bb3SMatthew Dillonyou do will be done as root, and that certain options are
38448096bb3SMatthew Dillonrequired for CVS to operate properly on the
38548096bb3SMatthew Dillon.Fx
38648096bb3SMatthew Dillonrepository.  For example,
38748096bb3SMatthew Dillon.Fl Pd
38848096bb3SMatthew Dillonis necessary when running "cvs update".
38948096bb3SMatthew DillonThese options are typically placed in your ~/.cvsrc (as already described)
39048096bb3SMatthew Dillonso you do not have to respecify them every time you run a CVS command.
39148096bb3SMatthew DillonMaintaining the CVS repository also gives you far more flexibility
39248096bb3SMatthew Dillonin regards to breaking out multiple versions of the source tree.
39348096bb3SMatthew DillonIt is a good idea to give your /FreeBSD partition a lot of space (I recommend
39448096bb3SMatthew Dillon8-12GB) precisely for that reason.
39548096bb3SMatthew DillonIf you can make it 15GB I would do it.
3966ed033beSMatthew Dillon.Pp
39748096bb3SMatthew DillonI generally do not cvs update via a cron job.
39848096bb3SMatthew DillonThis is because I generally want the source to not change out from under me
39948096bb3SMatthew Dillonwhen I am developing code.
40048096bb3SMatthew DillonInstead I manually update the source every so often... when I feel it is
40148096bb3SMatthew Dillona good time.
40248096bb3SMatthew DillonMy recommendation is to only keep the cvs repository synchronized via cron.
4036ed033beSMatthew Dillon.Sh SEE ALSO
40448096bb3SMatthew Dillon.Xr build 7 ,
40548096bb3SMatthew Dillon.Xr crontab 1 ,
40648096bb3SMatthew Dillon.Xr crontab 5 ,
40748096bb3SMatthew Dillon.Xr diskless 8 ,
40848096bb3SMatthew Dillon.Xr firewall 7 ,
40948096bb3SMatthew Dillon.Xr tuning 7
4106ed033beSMatthew Dillon.Sh HISTORY
4116ed033beSMatthew DillonThe
4126ed033beSMatthew Dillon.Nm
4136ed033beSMatthew Dillonmanual page was originally written by
41448096bb3SMatthew Dillon.An Matthew Dillon Aq dillon@FreeBSD.org
4156ed033beSMatthew Dillonand first appeared
4166ed033beSMatthew Dillonin
41748096bb3SMatthew Dillon.Fx 5.0 ,
4186ed033beSMatthew DillonDecember 2002.
419