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 4606d66a71SMatthew DillonYou have to make a choice in regards to 4706d66a71SMatthew Dillon.Pa /usr/obj . 4806d66a71SMatthew DillonYou can put 4906d66a71SMatthew Dillon.Pa /usr/obj 5006d66a71SMatthew Dillonin 5106d66a71SMatthew Dillon.Pa /FreeBSD 5206d66a71SMatthew Dillonor you can make 5306d66a71SMatthew Dillon.Pa /usr/obj 5406d66a71SMatthew Dillonits own partition. 5506d66a71SMatthew DillonI recommend making it a separate partition for several reasons. First, 5606d66a71SMatthew Dillonas a safety measure since this partition is written to a great deal. 5706d66a71SMatthew DillonSecond, because you typically do not have to back it up. 5806d66a71SMatthew DillonThird, because it makes it far easier to mix and match the development 5906d66a71SMatthew Dillonenvironments which are described later in this document. 6006d66a71SMatthew DillonI recommend a 6106d66a71SMatthew Dillon.Pa /usr/obj 6206d66a71SMatthew Dillonpartition of at least 5GB. 636ed033beSMatthew Dillon.Pp 646ed033beSMatthew DillonOn the master server, use cvsup to automatically pull down and maintain 656ed033beSMatthew Dillonthe 666ed033beSMatthew Dillon.Fx 676ed033beSMatthew DillonCVS archive once a day. The first pull will take a long time, 6848096bb3SMatthew Dillonit is several gigabytes, but once you have it the daily syncs will be quite 696ed033beSMatthew Dillonsmall. 706ed033beSMatthew Dillon.Bd -literal -offset 4n 716ed033beSMatthew Dillonmkdir /FreeBSD/FreeBSD-CVS 726ed033beSMatthew Dillonrm -rf /home/ncvs 736ed033beSMatthew Dillonln -s /FreeBSD/FreeBSD-CVS /home/ncvs 746ed033beSMatthew Dillon.Ed 756ed033beSMatthew Dillon.Pp 766ed033beSMatthew DillonThe cron job should look something like this (please randomize the time of 7748096bb3SMatthew Dillonday!). 7848096bb3SMatthew DillonNote that you can use the cvsup file example directly from 796ed033beSMatthew Dillon/usr/share/examples without modification by supplying appropriate arguments 806ed033beSMatthew Dillonto cvsup. 816ed033beSMatthew Dillon.Bd -literal -offset 4n 826ed033beSMatthew Dillon33 6 * * * /usr/local/bin/cvsup -g -r 20 -L 2 -h cvsup.freebsd.org /usr/share/examples/cvsup/cvs-supfile 836ed033beSMatthew Dillon.Ed 846ed033beSMatthew Dillon.Pp 856ed033beSMatthew DillonRun the cvsup manually the first time to pull down the archive. It could take 8648096bb3SMatthew Dillonall day depending on how fast your connection is! 8748096bb3SMatthew DillonYou will run all cvsup and cvs operations as root and you need to set 8848096bb3SMatthew Dillonup a ~/.cvsrc (/root/.cvsrc) file, as shown below, for proper cvs operation. 8948096bb3SMatthew DillonUsing ~/.cvsrc to specify cvs defaults is an excellent way 9048096bb3SMatthew Dillonto "file and forget", but you should never forget that you put them in there. 9148096bb3SMatthew Dillon.Bd -literal -offset 4n 9248096bb3SMatthew Dillon# cvs -q 9348096bb3SMatthew Dillondiff -u 9448096bb3SMatthew Dillonupdate -Pd 9548096bb3SMatthew Dilloncheckout -P 9648096bb3SMatthew Dillon.Ed 9748096bb3SMatthew Dillon.Pp 9848096bb3SMatthew DillonNow use cvs to checkout a -STABLE source tree and a -CURRENT source tree, 996ed033beSMatthew Dillonas well as ports and docs, to create your initial source environment. 1006ed033beSMatthew DillonKeeping the broken-out source and ports in /FreeBSD allows you to export 10148096bb3SMatthew Dillonit to other machines via read-only NFS. 10248096bb3SMatthew DillonThis also means you only need to edit/maintain files in one place and all 10348096bb3SMatthew Dillonyour clients automatically pick up the changes. 1046ed033beSMatthew Dillon.Bd -literal -offset 4n 1056ed033beSMatthew Dillonmkdir /FreeBSD/FreeBSD-4.x 1066ed033beSMatthew Dillonmkdir /FreeBSD/FreeBSD-current 1076ed033beSMatthew Dillon 1086ed033beSMatthew Dilloncd /FreeBSD/FreeBSD-4.x 1096ed033beSMatthew Dilloncvs -d /home/ncvs checkout -rRELENG_4 src 1106ed033beSMatthew Dillon 1116ed033beSMatthew Dilloncd /FreeBSD/FreeBSD-current 1126ed033beSMatthew Dilloncvs -d /home/ncvs checkout src 1136ed033beSMatthew Dilloncvs -d /home/ncvs checkout ports 1146ed033beSMatthew Dilloncvs -d /home/ncvs checkout doc 1156ed033beSMatthew Dillon.Ed 1166ed033beSMatthew Dillon.Pp 11748096bb3SMatthew DillonNow create a softlink for /usr/src and /usr/src2. 11848096bb3SMatthew DillonOn the main server I always point /usr/src at -STABLE and /usr/src2 at 11948096bb3SMatthew Dillon-CURRENT. On client machines I usually do not have a /usr/src2 and I make 12048096bb3SMatthew Dillon/usr/src point at whatever version of FreeBSD the client box is intended to 12148096bb3SMatthew Dillonrun. 1226ed033beSMatthew Dillon.Bd -literal -offset 4n 1236ed033beSMatthew Dilloncd /usr 1246ed033beSMatthew Dillonrm -rf src src2 12548096bb3SMatthew Dillonln -s /FreeBSD/FreeBSD-4.x/src src (could be -CURRENT on a client) 1266ed033beSMatthew Dillonln -s /FreeBSD/FreeBSD-current/src src2 (MASTER SERVER ONLY) 1276ed033beSMatthew Dillon.Ed 1286ed033beSMatthew Dillon.Pp 12948096bb3SMatthew DillonNow you have to make a choice for /usr/obj. 13048096bb3SMatthew DillonWell, hopefully you made it already and chose the partition method. If you 13148096bb3SMatthew Dillonchose poorly you probably intend to put it in /FreeBSD and, if so, this is 13248096bb3SMatthew Dillonwhat you want to do: 1336ed033beSMatthew Dillon.Bd -literal -offset 4n 1346ed033beSMatthew Dillon(ONLY IF YOU MADE A POOR CHOICE AND PUT /usr/obj in /FreeBSD!) 1356ed033beSMatthew Dillonmkdir /FreeBSD/obj 1366ed033beSMatthew Dilloncd /usr 1376ed033beSMatthew Dillonrm -rf obj 1386ed033beSMatthew Dillonln -s /FreeBSD/obj obj 1396ed033beSMatthew Dillon.Ed 1406ed033beSMatthew Dillon.Pp 1416ed033beSMatthew DillonAlternatively you may chose simply to leave /usr/obj in /usr. If your 1426ed033beSMatthew Dillon/usr is large enough this will work, but I do not recommend it for 1436ed033beSMatthew Dillonsafety reasons (/usr/obj is constantly being modified, /usr is not). 1446ed033beSMatthew Dillon.Pp 1456ed033beSMatthew DillonNote that exporting /usr/obj via read-only NFS to your other boxes will 1466ed033beSMatthew Dillonallow you to build on your main server and install from your other boxes. 1476ed033beSMatthew DillonIf you also want to do builds on some or all of the clients you can simply 14848096bb3SMatthew Dillonhave /usr/obj be a local directory on those clients. 14948096bb3SMatthew DillonYou should never export /usr/obj read-write, it will lead to all sorts of 15048096bb3SMatthew Dillonproblems and issues down the line and presents a security problem as well. 15148096bb3SMatthew DillonIt is far easier to do builds on the master server and then only do installs 15248096bb3SMatthew Dillonon the clients. 1536ed033beSMatthew Dillon.Pp 15448096bb3SMatthew DillonI usually maintain my ports tree via CVS. 15548096bb3SMatthew DillonIt is sitting right there in the master CVS archive and I've even told you 15648096bb3SMatthew Dillonto check it out (see above). 15748096bb3SMatthew DillonWith some fancy softlinks you can make the ports tree available both on your 15848096bb3SMatthew Dillonmaster server and on all of your other machines. 15948096bb3SMatthew DillonNote that the ports tree exists only on the HEAD cvs branch, so its always 16048096bb3SMatthew Dillon-CURRENT even on a -STABLE box. This is what you do: 1616ed033beSMatthew Dillon.Bd -literal -offset 4n 1626ed033beSMatthew Dillon(THESE COMMANDS ON THE MASTER SERVER AND ON ALL CLIENTS) 1636ed033beSMatthew Dilloncd /usr 1646ed033beSMatthew Dillonrm -rf ports 1656ed033beSMatthew Dillonln -s /FreeBSD/FreeBSD-current/ports ports 1666ed033beSMatthew Dillon 1676ed033beSMatthew Dilloncd /usr/ports (this pushes into the softlink) 1686ed033beSMatthew Dillonrm -rf distfiles (ON MASTER SERVER ONLY) 1696ed033beSMatthew Dillonln -s /usr/ports.distfiles distfiles (ON MASTER SERVER ONLY) 1706ed033beSMatthew Dillon 1716ed033beSMatthew Dillonmkdir /usr/ports.distfiles 1726ed033beSMatthew Dillonmkdir /usr/ports.workdir 1736ed033beSMatthew Dillon.Ed 1746ed033beSMatthew Dillon.Pp 1756ed033beSMatthew DillonSince /usr/ports is softlinked into what will be read-only on all of your 1766ed033beSMatthew Dillonclients, you have to tell the ports system to use a different working 17748096bb3SMatthew Dillondirectory to hold ports builds. 17848096bb3SMatthew DillonYou want to add a line to your /etc/make.conf file on the master server 17948096bb3SMatthew Dillonand on all your clients: 1806ed033beSMatthew Dillon.Bd -literal -offset 4n 1816ed033beSMatthew DillonWRKDIRPREFIX=/usr/ports.workdir 1826ed033beSMatthew Dillon.Ed 1836ed033beSMatthew Dillon.Pp 1846ed033beSMatthew DillonYou should try to make the directory you use for the ports working directory 1856ed033beSMatthew Dillonas well as the directory used to hold distfiles consistent across all of your 18648096bb3SMatthew Dillonmachines. 18748096bb3SMatthew DillonIf there isn't enough room in /usr/ports.distfiles and /usr/ports.workdir I 18848096bb3SMatthew Dillonusually make those softlinks (since this is on /usr these are per-machine) to 18948096bb3SMatthew Dillonwhere the distfiles and working space really are. 1906ed033beSMatthew Dillon.Sh EXPORTING VIA NFS FROM THE MASTER SERVER 1916ed033beSMatthew DillonThe master server needs to export /FreeBSD and /usr/obj via NFS so all the 19248096bb3SMatthew Dillonrest of your machines can get at them. 19348096bb3SMatthew DillonI strongly recommend using a read-only export for both security and safety. 19448096bb3SMatthew DillonThe environment I am describing in this manual page is designed primarily 19548096bb3SMatthew Dillonaround read-only NFS exports. 19648096bb3SMatthew DillonYour exports file on the master server should contain the following lines: 1976ed033beSMatthew Dillon.Bd -literal -offset 4n 1986ed033beSMatthew Dillon/FreeBSD -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK 1996ed033beSMatthew Dillon/usr/obj -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK 2006ed033beSMatthew Dillon.Ed 2016ed033beSMatthew Dillon.Pp 2026ed033beSMatthew DillonOf course, NFS server operations must also be configured on that machine. 2036ed033beSMatthew DillonThis is typically done via your /etc/rc.conf: 2046ed033beSMatthew Dillon.Bd -literal -offset 4n 2056ed033beSMatthew Dillonnfs_server_enable="YES" 2066ed033beSMatthew Dillonnfs_server_flags="-u -t -n 4" 2076ed033beSMatthew Dillon.Ed 2086ed033beSMatthew Dillon.Sh THE CLIENT ENVIRONMENT 2096ed033beSMatthew DillonAll of your client machines can import the development/build environment 2106ed033beSMatthew Dillondirectory simply by NFS mounting /FreeBSD and /usr/obj from the master 2116ed033beSMatthew Dillonserver. 21248096bb3SMatthew DillonA typical /etc/fstab entry on your client machines will be something like this: 2136ed033beSMatthew Dillon.Bd -literal -offset 4n 2146ed033beSMatthew Dillonmasterserver:/FreeBSD /FreeBSD nfs ro,bg 0 0 2156ed033beSMatthew Dillonmasterserver:/usr/obj /usr/obj nfs ro,bg 0 0 2166ed033beSMatthew Dillon.Ed 2176ed033beSMatthew Dillon.Pp 2186ed033beSMatthew DillonAnd, of course, you should configure the client for NFS client operations 21948096bb3SMatthew Dillonvia /etc/rc.conf. 22048096bb3SMatthew DillonIn particular, this will turn on nfsiod which will improve client-side NFS 22148096bb3SMatthew Dillonperformance: 2226ed033beSMatthew Dillon.Bd -literal -offset 4n 2236ed033beSMatthew Dillonnfs_client_enable="YES" 2246ed033beSMatthew Dillon.Ed 2256ed033beSMatthew Dillon.Pp 2266ed033beSMatthew DillonEach client should create softlinks for /usr/ports and /usr/src that point 2276ed033beSMatthew Dilloninto the NFS-mounted environment. 22848096bb3SMatthew DillonIf a particular client is running -CURRENT, /usr/src 22948096bb3SMatthew Dillonshould be a softlink to /FreeBSD/FreeBSD-current/src. 23048096bb3SMatthew DillonIf it is running -STABLE, /usr/src should be a softlink to 23148096bb3SMatthew Dillon/FreeBSD/FreeBSD-4.x/src. I do not usually create a /usr/src2 softlink on 23248096bb3SMatthew Dillonclients, that is used as a convenient shortcut when working on the source 23348096bb3SMatthew Dilloncode on the master server only and could create massive confusion (of the 23448096bb3SMatthew Dillonhuman variety) on a client. 2356ed033beSMatthew Dillon.Bd -literal -offset 4n 2366ed033beSMatthew Dillon(ON EACH CLIENT) 2376ed033beSMatthew Dilloncd /usr 2386ed033beSMatthew Dillonrm -rf ports src 2396ed033beSMatthew Dillonln -s /FreeBSD/FreeBSD-current/ports ports 2406ed033beSMatthew Dillonln -s /FreeBSD/FreeBSD-XXX/src src 2416ed033beSMatthew Dillon.Ed 2426ed033beSMatthew Dillon.Pp 2436ed033beSMatthew DillonDon't forget to create the working directories so you can build ports, as 24448096bb3SMatthew Dillonpreviously described. 24548096bb3SMatthew DillonIf these are not good locations, make them softlinks to the correct location. 24648096bb3SMatthew DillonRemember that /usr/ports/distfiles is exported by 2476ed033beSMatthew Dillonthe master server and is therefore going to point to the same place 2486ed033beSMatthew Dillon(typically /usr/ports.distfiles) on every machine. 2496ed033beSMatthew Dillon.Bd -literal -offset 4n 2506ed033beSMatthew Dillonmkdir /usr/ports.distfiles 2516ed033beSMatthew Dillonmkdir /usr/ports.workdir 2526ed033beSMatthew Dillon.Ed 2536ed033beSMatthew Dillon.Sh BUILDING KERNELS 25448096bb3SMatthew DillonHere is how you build a -STABLE kernel (on your main development box). 2556ed033beSMatthew DillonIf you want to create a custom kernel, cp GENERIC to YOURKERNEL and then 25648096bb3SMatthew Dillonedit it before configuring and building. 25748096bb3SMatthew DillonThe kernel configuration file lives in /usr/src/sys/i386/conf/KERNELNAME. 2586ed033beSMatthew Dillon.Bd -literal -offset 4n 2596ed033beSMatthew Dilloncd /usr/src 2606ed033beSMatthew Dillonmake buildkernel KERNCONF=KERNELNAME 2616ed033beSMatthew Dillon.Ed 2626ed033beSMatthew Dillon.Pp 26348096bb3SMatthew Dillon.Sy WARNING! 26448096bb3SMatthew DillonIf you are familiar with the old config/cd/make method of building 26548096bb3SMatthew Dillona -STABLE kernel, note that the config method will put the build 2666ed033beSMatthew Dillonenvironment in /usr/src/sys/compile/KERNELNAME instead of in /usr/obj. 2676ed033beSMatthew Dillon.Pp 26848096bb3SMatthew DillonBuilding a -CURRENT kernel 2696ed033beSMatthew Dillon.Bd -literal -offset 4n 2706ed033beSMatthew Dilloncd /usr/src2 (on the master server) 2716ed033beSMatthew Dillonmake buildkernel KERNCONF=KERNELNAME 2726ed033beSMatthew Dillon.Ed 2736ed033beSMatthew Dillon.Sh INSTALLING KERNELS 27448096bb3SMatthew DillonInstalling a -STABLE kernel (typically done on a client. 27548096bb3SMatthew DillonOnly do this on your main development server if you want to install a new 27648096bb3SMatthew Dillonkernel for your main development server): 27748096bb3SMatthew Dillon.Bd -literal -offset 4n 27848096bb3SMatthew Dilloncd /usr/src 27948096bb3SMatthew Dillonmake installkernel KERNCONF=KERNELNAME 28048096bb3SMatthew Dillon.Ed 28148096bb3SMatthew Dillon.Pp 28248096bb3SMatthew DillonIf you are using the older config/cd/make build mechanism for stable, you 28348096bb3SMatthew Dillonwould install using: 2846ed033beSMatthew Dillon.Bd -literal -offset 4n 2856ed033beSMatthew Dilloncd /usr/src/sys/compile/KERNELNAME 2866ed033beSMatthew Dillonmake install 2876ed033beSMatthew Dillon.Ed 2886ed033beSMatthew Dillon.Pp 28948096bb3SMatthew DillonInstalling a -CURRENT kernel (typically done only on a client) 2906ed033beSMatthew Dillon.Bd -literal -offset 4n 2916ed033beSMatthew Dillon(remember /usr/src is pointing to the client's specific environment) 2926ed033beSMatthew Dilloncd /usr/src 2936ed033beSMatthew Dillonmake installkernel KERNCONF=KERNELNAME 2946ed033beSMatthew Dillon.Ed 29548096bb3SMatthew Dillon.Pp 2966ed033beSMatthew Dillon.Sh BUILDING THE WORLD 2976ed033beSMatthew DillonThis environment is designed such that you do all builds on the master server, 29848096bb3SMatthew Dillonand then install from each client. 29948096bb3SMatthew DillonYou can do builds on a client only if /usr/obj is local to that client. 30048096bb3SMatthew DillonBuilding the world is easy: 3016ed033beSMatthew Dillon.Bd -literal -offset 4n 3026ed033beSMatthew Dilloncd /usr/src 3036ed033beSMatthew Dillonmake buildworld 3046ed033beSMatthew Dillon.Ed 3056ed033beSMatthew Dillon.Pp 30648096bb3SMatthew DillonIf you are on the master server you are running in a -STABLE environment, but 30748096bb3SMatthew Dillonthat does not prevent you from building the -CURRENT world. 30848096bb3SMatthew DillonJust cd into the appropriate source directory and you are set. Do not 30906d66a71SMatthew Dillonaccidentally install it on your master server though! 3106ed033beSMatthew Dillon.Bd -literal -offset 4n 3116ed033beSMatthew Dilloncd /usr/src2 3126ed033beSMatthew Dillonmake buildworld 3136ed033beSMatthew Dillon.Ed 3146ed033beSMatthew Dillon.Sh INSTALLING THE WORLD 3156ed033beSMatthew DillonYou can build on your main development server and install on clients. 3166ed033beSMatthew DillonThe main development server must export /FreeBSD and /usr/obj via 3176ed033beSMatthew Dillonread-only NFS to the clients. 3186ed033beSMatthew Dillon.Pp 31948096bb3SMatthew Dillon.Em NOTE!!! 32048096bb3SMatthew DillonIf /usr/obj is a softlink on the master server, it must also be the EXACT 32148096bb3SMatthew DillonSAME softlink on each client. 32248096bb3SMatthew DillonIf /usr/obj is a directory in /usr or a mount point on the master server, 32348096bb3SMatthew Dillonthen it must be (interchangeably) a directory in /usr or a mount point on 32448096bb3SMatthew Dilloneach client. 3256ed033beSMatthew DillonThis is because the 3266ed033beSMatthew Dillonabsolute paths are expected to be the same when building the world as when 3276ed033beSMatthew Dilloninstalling it, and you generally build it on your main development box 32848096bb3SMatthew Dillonand install it from a client. 32948096bb3SMatthew DillonIf you do not setup /usr/obj properly you will not be able to build on 33048096bb3SMatthew Dillonmachine and install on another. 3316ed033beSMatthew Dillon.Bd -literal -offset 4n 3326ed033beSMatthew Dillon(ON THE CLIENT) 3336ed033beSMatthew Dillon(remember /usr/src is pointing to the client's specific environment) 3346ed033beSMatthew Dilloncd /usr/src 3356ed033beSMatthew Dillonmake installworld 3366ed033beSMatthew Dillon.Ed 33748096bb3SMatthew Dillon.Pp 33848096bb3SMatthew Dillon.Sy WARNING! 33948096bb3SMatthew DillonIf builds work on the master server but installs do not work from the 34048096bb3SMatthew Dillonclients, for example you try to install and the client complains that 34148096bb3SMatthew Dillonthe install tried to write into the read-only /usr/obj, then it is likely 34248096bb3SMatthew Dillonthat the /etc/make.conf file on the client does not match the one on the 34348096bb3SMatthew Dillonmaster server closely enough and the install is trying to install something 34448096bb3SMatthew Dillonthat was not built. 3456ed033beSMatthew Dillon.Sh DOING DEVELOPMENT ON A CLIENT (NOT JUST INSTALLING) 3466ed033beSMatthew DillonDevelopers often want to run buildkernel's or buildworld's on client 34748096bb3SMatthew Dillonboxes simply to life-test the box. 34848096bb3SMatthew DillonYou do this in the same manner that you buildkernel and buildworld on your 34948096bb3SMatthew Dillonmaster server. 35048096bb3SMatthew DillonAll you have to do is make sure that /usr/obj is pointing to local storage. 35148096bb3SMatthew DillonIf you followed my advise and made /usr/obj its own partition on the master 35248096bb3SMatthew Dillonserver, 35348096bb3SMatthew Dillonthen it is typically going to be an NFS mount on the client. 35448096bb3SMatthew DillonSimply unmounting /usr/obj will leave you with a /usr/obj that is a 35548096bb3SMatthew Dillonsubdirectory in /usr which is typically local to the client. 35648096bb3SMatthew DillonYou can then do builds to your heart's content! 3576ed033beSMatthew Dillon.Sh MULTIPLE VERSIONS OF THE SOURCE TREE 3586ed033beSMatthew DillonI have described how to maintain two versions of the source tree, a stable 3596ed033beSMatthew Dillonversion in /FreeBSD/FreeBSD-4.x and a current version 36048096bb3SMatthew Dillonin /FreeBSD/FreeBSD-current. 36148096bb3SMatthew DillonThere is absolutely nothing preventing you 3626ed033beSMatthew Dillonfrom breaking out other versions of the source tree 36348096bb3SMatthew Dilloninto /FreeBSD/XXX. 36448096bb3SMatthew DillonIn fact, my /FreeBSD partition also contains 36548096bb3SMatthew Dillon.Ox , 36648096bb3SMatthew Dillon.Nx , 36748096bb3SMatthew Dillonand various flavors of Linux. 36848096bb3SMatthew DillonYou may not necessarily be able to build non-FreeBSD operating systems on 36948096bb3SMatthew Dillonyour master server, but being able 3706ed033beSMatthew Dillonto collect and manage source distributions from a central server is a very 3716ed033beSMatthew Dillonuseful thing to be able to do and you can certainly export to machines 3726ed033beSMatthew Dillonwhich can build those other operating systems. 3736ed033beSMatthew Dillon.Sh UPDATING VIA CVS 3746ed033beSMatthew DillonThe advantage of using cvsup to maintain an updated copy of the CVS 3756ed033beSMatthew Dillonrepository instead of using it to maintain source trees directly is that you 3766ed033beSMatthew Dilloncan then pick and choose when you bring your source tree (or pieces of your 37748096bb3SMatthew Dillonsource tree) up to date. 37848096bb3SMatthew DillonBy using a cron job to maintain an updated CVS repository, you can update 37948096bb3SMatthew Dillonyour source tree at any time without any network cost as follows: 3806ed033beSMatthew Dillon.Bd -literal -offset 4n 3816ed033beSMatthew Dillon(on the main development server) 3826ed033beSMatthew Dilloncd /usr/src 3836ed033beSMatthew Dilloncvs -d /home/ncvs update 3846ed033beSMatthew Dilloncd /usr/src2 3856ed033beSMatthew Dilloncvs -d /home/ncvs update 3866ed033beSMatthew Dilloncd /usr/ports 3876ed033beSMatthew Dilloncvs -d /home/ncvs update 3886ed033beSMatthew Dillon.Ed 3896ed033beSMatthew Dillon.Pp 3906ed033beSMatthew DillonIt is that simple, and since you are exporting the whole lot to your 3916ed033beSMatthew Dillonclients, your clients have immediately visibility into the updated 39248096bb3SMatthew Dillonsource. 39348096bb3SMatthew DillonThis is a good time to also remind you that most of the cvs operations 39448096bb3SMatthew Dillonyou do will be done as root, and that certain options are 39548096bb3SMatthew Dillonrequired for CVS to operate properly on the 39648096bb3SMatthew Dillon.Fx 39748096bb3SMatthew Dillonrepository. For example, 39848096bb3SMatthew Dillon.Fl Pd 39948096bb3SMatthew Dillonis necessary when running "cvs update". 40048096bb3SMatthew DillonThese options are typically placed in your ~/.cvsrc (as already described) 40148096bb3SMatthew Dillonso you do not have to respecify them every time you run a CVS command. 40248096bb3SMatthew DillonMaintaining the CVS repository also gives you far more flexibility 40348096bb3SMatthew Dillonin regards to breaking out multiple versions of the source tree. 40448096bb3SMatthew DillonIt is a good idea to give your /FreeBSD partition a lot of space (I recommend 40548096bb3SMatthew Dillon8-12GB) precisely for that reason. 40648096bb3SMatthew DillonIf you can make it 15GB I would do it. 4076ed033beSMatthew Dillon.Pp 40848096bb3SMatthew DillonI generally do not cvs update via a cron job. 40948096bb3SMatthew DillonThis is because I generally want the source to not change out from under me 41048096bb3SMatthew Dillonwhen I am developing code. 41148096bb3SMatthew DillonInstead I manually update the source every so often... when I feel it is 41248096bb3SMatthew Dillona good time. 41348096bb3SMatthew DillonMy recommendation is to only keep the cvs repository synchronized via cron. 4146ed033beSMatthew Dillon.Sh SEE ALSO 41548096bb3SMatthew Dillon.Xr crontab 1 , 41648096bb3SMatthew Dillon.Xr crontab 5 , 417c89927b8SChristian Brueffer.Xr build 7 , 41848096bb3SMatthew Dillon.Xr firewall 7 , 4198347fe67SChristian Brueffer.Xr release 7 , 420c89927b8SChristian Brueffer.Xr tuning 7 , 421c89927b8SChristian Brueffer.Xr diskless 8 4226ed033beSMatthew Dillon.Sh HISTORY 4236ed033beSMatthew DillonThe 4246ed033beSMatthew Dillon.Nm 4256ed033beSMatthew Dillonmanual page was originally written by 42648096bb3SMatthew Dillon.An Matthew Dillon Aq dillon@FreeBSD.org 4276ed033beSMatthew Dillonand first appeared 4286ed033beSMatthew Dillonin 42948096bb3SMatthew Dillon.Fx 5.0 , 4306ed033beSMatthew DillonDecember 2002. 431