Annotation of wikisrc/tutorials/how_to_build_netbsd-current.mdwn, revision 1.3
1.2 schmonz 1: Thanks to the Autobuild-System, you can easily build a new Release from the NetBSD CVS sources. I'll show you, how to build a release, sets and a bootable installation CD-ROM for i386, step by step. For this, you need a running NetBSD System and a working Internet Connection.
6: #Disk space requirements
8: You will need a minimum of 5.1 GB of disk space to build a whole release. You need currently 1.2 GB for the sources src and 579 MB for xsrc. About 2.4 GB will reside in the obj directory after building a release.
9: #Short way for impatient
11: # fetch source:
12: cd /usr; cvs -z3 -d email@example.com:/cvsroot co -P src
13: # everything goes into this directory
14: mkdir /usr/obj
15: # build tools (to build everything else), custom kernel, binary sets
16: cd /usr/src; ./build.sh -O /usr/obj -U -j 8 tools kernel=H4KK1T modules distribution sets
17: # install kernel:
18: cd /usr/obj/sys/compile/arch/*/compile/H4KK1T; su root -c 'make install'
19: # test kernel:
20: su root -c 'shutdown -r now'
21: # update userland:
22: cd /usr/src; ./build.sh -O /usr/obj install=/
23: # follow printed instructions about "postinstall"
25: # build CD image (omit "tools" if built already):
26: cd /usr/src; ./build.sh -O /usr/obj -U -j 8 tools release iso-image
29: #Obtaining the sources via CVS
31: Create the directories src, xsrc and objdir as root in /usr
33: # cd /usr
34: # mkdir src xsrc objdir
36: We also create the following directories in /usr: tooldir, releasedir, destdir. We do this, because we want the src directory to stay clean and not polluted by the build process. We will pass options flags to build.sh, to separate the directories.
38: # mkdir tooldir releasedir destdir
40: Change the owner of the directories:
42: # chown john src/ xsrc/ objdir/ tooldir/ releasedir/ destdir/
44: The following steps from now on can be done as a non-root user:
46: # logout
49: Set the environment variable CVSROOT: (For that, please choose a [Mirror](http://www.de.netbsd.org/mirrors/#anoncvs) close to you)
51: csh users:
53: % setenv CVSROOT firstname.lastname@example.org.NetBSD.org:/cvsroot
55: Bourne compatible shell (sh, ksh, zsh, bash...) Users:
57: $ export CVSROOTemail@example.com.NetBSD.org:/cvsroot
59: Set the environment variable CVS_RSH:
61: $ export CVS_RSH=ssh
63: The src directory currently needs about 1500 MB disk space and the xsrc directory currently needs about 579 MB of disk space.
64: Now check out the current sources, like this:
66: $ cvs checkout -PA src
68: If you want to use Xorg from pkgsrc you can skip the next step.
70: $ cvs checkout -PA xsrc
72: Or you can check out a certain release, by passing -r
74: $ cvs checkout -rnetbsd-5-0 -PA src
75: $ cvs checkout -rnetbsd-5-0 -PA xsrc
77: #Building the toolchain
1.3 ! schmonz 79: The toolchain contains the software that is needed to build NetBSD, like the GNU C-Compiler and other tools. This way, it is ensured that NetBSD can build itself on almost any Unix™. You can omit this step, if you want to build a new release, because a release always includes building the tools.
1.2 schmonz 80: <pre><code>
81: $ cd /usr/src
82: $ ./build.sh -T ../tooldir -D ../destdir -R ../releasedir -O ../objdir -U -j2 tools
84: build.sh started: Sat Jan 22 21:34:56 CET 2005
85: No /usr/tools/bin/nbmake, needs building.
86: Bootstrapping nbmake
87: MACHINE: i386
88: MACHINE_ARCH: i386
89: TOOLDIR path: /usr/tooldir
90: DESTDIR path: /usr/destdir
91: RELEASEDIR path: /usr/releasedir
92: Created /usr/tools/bin/nbmake
93: makewrapper: /usr/tools/bin/nbmake-i386
94: Updated /usr/src/obj/tooldir/bin/nbmake-i386
95: Tools built to /usr/src/obj/tooldir
96: build.sh started: Sat Jan 22 21:34:56 CET 2005
97: build.sh ended: Sat Jan 22 21:41:26 CET 2005
99: #Building the release
101: Variables to pass to build.sh can be found in [src/share/mk/bsd.README](http://cvsweb.de.netbsd.org/cgi-bin/cvsweb.cgi/src/share/mk/bsd.README?rev=188.8.131.52;content-type=text%2Fx-cvsweb-markup).
103: In this example
104: We are building as a user (non-root): -U
105: We are building the X11R6 sources (Xservers, this is XFree 4.5.0 not Xorg): -x
106: We are using separate directories: -T, -D, -R, -O, -X
107: We are removing contents of tooldir and destdir before building: -r
108: We are using -j2 because we have a multiprocessor system
110: We are building a release: release
112: $ ./build.sh -T ../tooldir -D ../destdir -R ../releasedir -O ../objdir -X ../xsrc -U -x -j2 -r release
114: This process takes at least two hours on an high-end server, and usually much longer, depending on your computing power.
116: build.sh started: Sat Jan 22 21:50:47 CET 2005
117: No nonexistent/bin/nbmake, needs building.
118: Bootstrapping nbmake
119: MACHINE: i386
120: MACHINE_ARCH: i386
121: TOOLDIR path: /usr/src/tooldir
122: DESTDIR path: /usr/src/destdir
123: RELEASEDIR path: /usr/src/releasedir
124: Created /usr/src/tooldir/bin/nbmake
125: makewrapper: /usr/src/tooldir/bin/nbmake-i386
126: Updated /usr/src/tooldir/bin/nbmake-i386
127: Successful make release
128: build.sh started: Sat Jan 22 21:50:47 CET 2005
129: build.sh ended: Sun Jan 23 01:20:43 CET 2005
131: If you are using Xorg via pkgsrc (recommended), you can skip building the Xserver (-x).
133: If you have a multiprocessor system, add -j. The number of jobs should be equal to your number of CPU's/cores. Don't use -j on single CPU systems.
135: If your build fails, because of insufficient space on install flopies, you might find this useful: [[How to build install sets, when you can't build install floppies]]
136: #Creating an ISO-Image
138: to create an iso-image just add the option iso-image
140: $ ./build.sh <other options> -U -x -r release iso-image
142: the resulting iso image will reside in relasedir/platform/installation/cdrom/
144: This option will create an iso-image only on platforms that are bootable from such a media.
145: #Burning the image
147: If you have a CD/DVD-Writer, you can burn the iso image to a CD. For this task you need to install cdrecord, which is part of sysutils/cdrtools.
149: # cdrecord -dev=/dev/rcd0d -data -pad -v NetBSD-install.iso
151: #Building current faster
153: In case you don't need whole a release or a bootable iso image, the fastest way to build current is to build new tools, distribution, followed by sets and a kernel (custom or GENERIC). I recommend to build a custom kernel that fits your needs.
155: $ ./build.sh <your options> -U tools distribution sets kernel=MYKERNEL
157: Additional Information
159: * [cvs(1)](http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current) manpage
160: * [Tracking NetBSD-current](http://www.netbsd.org/docs/current/)
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb