Diff for /wikisrc/tutorials/how_to_build_netbsd-current.mdwn between versions 1.1 and 1.2

version 1.1, 2011/11/20 20:55:21 version 1.2, 2012/02/05 07:14:36
Line 1 Line 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.  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.
 #Contents  #Contents
   
 [[!toc]]  [[!toc]]
   
 #Disk space requirements  #Disk space requirements
   
 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.  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.
 #Short way for impatient  #Short way for impatient
 <pre><code>  <pre><code>
 # fetch source:  # fetch source:
 cd /usr; cvs -z3 -d anoncvs@anoncvs.se.netbsd.org:/cvsroot co -P src  cd /usr; cvs -z3 -d anoncvs@anoncvs.se.netbsd.org:/cvsroot co -P src
 # everything goes into this directory  # everything goes into this directory
 mkdir /usr/obj  mkdir /usr/obj
 # build tools (to build everything else), custom kernel, binary sets  # build tools (to build everything else), custom kernel, binary sets
 cd /usr/src; ./build.sh -O /usr/obj -U -j 8 tools kernel=H4KK1T modules distribution sets  cd /usr/src; ./build.sh -O /usr/obj -U -j 8 tools kernel=H4KK1T modules distribution sets
 # install kernel:  # install kernel:
 cd /usr/obj/sys/compile/arch/*/compile/H4KK1T; su root -c 'make install'  cd /usr/obj/sys/compile/arch/*/compile/H4KK1T; su root -c 'make install'
 # test kernel:  # test kernel:
 su root -c 'shutdown -r now'  su root -c 'shutdown -r now'
 # update userland:  # update userland:
 cd /usr/src; ./build.sh -O /usr/obj install=/  cd /usr/src; ./build.sh -O /usr/obj install=/
 # follow printed instructions about "postinstall"  # follow printed instructions about "postinstall"
   
 # build CD image (omit "tools" if built already):  # build CD image (omit "tools" if built already):
 cd /usr/src; ./build.sh -O /usr/obj -U -j 8 tools release iso-image  cd /usr/src; ./build.sh -O /usr/obj -U -j 8 tools release iso-image
 </code></pre>  </code></pre>
   
 #Obtaining the sources via CVS  #Obtaining the sources via CVS
   
 Create the directories src, xsrc and objdir as root in /usr  Create the directories src, xsrc and objdir as root in /usr
   
     # cd /usr      # cd /usr
     # mkdir src xsrc objdir      # mkdir src xsrc objdir 
   
 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.  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.
   
     # mkdir tooldir releasedir destdir      # mkdir tooldir releasedir destdir
   
 Change the owner of the directories:  Change the owner of the directories:
   
     # chown john src/ xsrc/ objdir/ tooldir/ releasedir/ destdir/      # chown john src/ xsrc/ objdir/ tooldir/ releasedir/ destdir/
   
 The following steps from now on can be done as a non-root user:  The following steps from now on can be done as a non-root user:
   
     # logout      # logout
     $      $
   
 Set the environment variable CVSROOT: (For that, please choose a [Mirror](http://www.de.netbsd.org/mirrors/#anoncvs) close to you)  Set the environment variable CVSROOT: (For that, please choose a [Mirror](http://www.de.netbsd.org/mirrors/#anoncvs) close to you)
   
 csh users:  csh users:
   
     % setenv CVSROOT anoncvs@anoncvs.se.NetBSD.org:/cvsroot      % setenv CVSROOT anoncvs@anoncvs.se.NetBSD.org:/cvsroot
   
 Bourne compatible shell (sh, ksh, zsh, bash...) Users:  Bourne compatible shell (sh, ksh, zsh, bash...) Users:
   
     $ export CVSROOT=anoncvs@anoncvs.se.NetBSD.org:/cvsroot      $ export CVSROOT=anoncvs@anoncvs.se.NetBSD.org:/cvsroot
   
 Set the environment variable CVS_RSH:  Set the environment variable CVS_RSH:
   
     $ export CVS_RSH=ssh      $ export CVS_RSH=ssh
   
 The src directory currently needs about 1500 MB disk space and the xsrc directory currently needs about 579 MB of disk space.  The src directory currently needs about 1500 MB disk space and the xsrc directory currently needs about 579 MB of disk space.
 Now check out the current sources, like this:  Now check out the current sources, like this:
   
     $ cvs checkout -PA src      $ cvs checkout -PA src
   
 If you want to use Xorg from pkgsrc you can skip the next step.  If you want to use Xorg from pkgsrc you can skip the next step.
   
     $ cvs checkout -PA xsrc      $ cvs checkout -PA xsrc
   
 Or you can check out a certain release, by passing -r  Or you can check out a certain release, by passing -r
   
     $ cvs checkout -rnetbsd-5-0 -PA src      $ cvs checkout -rnetbsd-5-0 -PA src
     $ cvs checkout -rnetbsd-5-0 -PA xsrc      $ cvs checkout -rnetbsd-5-0 -PA xsrc
   
 #Building the toolchain  #Building the toolchain
   
 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.  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.
 <pre><code>  <pre><code>
 $ cd /usr/src  $ cd /usr/src
 $ ./build.sh -T ../tooldir -D ../destdir -R ../releasedir -O ../objdir -U -j2 tools  $ ./build.sh -T ../tooldir -D ../destdir -R ../releasedir -O ../objdir -U -j2 tools 
   
         build.sh started: Sat Jan 22 21:34:56 CET 2005          build.sh started: Sat Jan 22 21:34:56 CET 2005
         No /usr/tools/bin/nbmake, needs building.          No /usr/tools/bin/nbmake, needs building.
         Bootstrapping nbmake          Bootstrapping nbmake
         MACHINE:          i386          MACHINE:          i386
         MACHINE_ARCH:     i386          MACHINE_ARCH:     i386
         TOOLDIR path:     /usr/tooldir          TOOLDIR path:     /usr/tooldir
         DESTDIR path:     /usr/destdir          DESTDIR path:     /usr/destdir
         RELEASEDIR path:  /usr/releasedir          RELEASEDIR path:  /usr/releasedir
         Created /usr/tools/bin/nbmake          Created /usr/tools/bin/nbmake
         makewrapper:      /usr/tools/bin/nbmake-i386          makewrapper:      /usr/tools/bin/nbmake-i386
         Updated /usr/src/obj/tooldir/bin/nbmake-i386          Updated /usr/src/obj/tooldir/bin/nbmake-i386
         Tools built to /usr/src/obj/tooldir          Tools built to /usr/src/obj/tooldir
         build.sh started: Sat Jan 22 21:34:56 CET 2005          build.sh started: Sat Jan 22 21:34:56 CET 2005
         build.sh ended:   Sat Jan 22 21:41:26 CET 2005          build.sh ended:   Sat Jan 22 21:41:26 CET 2005
 </code></pre>  </code></pre>
 #Building the release  #Building the release
   
 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=1.165.2.3;content-type=text%2Fx-cvsweb-markup).  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=1.165.2.3;content-type=text%2Fx-cvsweb-markup).
   
 In this example  In this example
 We are building as a user (non-root): -U  We are building as a user (non-root): -U
 We are building the X11R6 sources (Xservers, this is XFree 4.5.0 not Xorg): -x  We are building the X11R6 sources (Xservers, this is XFree 4.5.0 not Xorg): -x
 We are using separate directories: -T, -D, -R, -O, -X  We are using separate directories: -T, -D, -R, -O, -X
 We are removing contents of tooldir and destdir before building: -r  We are removing contents of tooldir and destdir before building: -r
 We are using -j2 because we have a multiprocessor system  We are using -j2 because we have a multiprocessor system
   
 We are building a release: release  We are building a release: release
   
     $ ./build.sh -T ../tooldir -D ../destdir -R ../releasedir -O ../objdir -X ../xsrc -U -x -j2 -r release      $ ./build.sh -T ../tooldir -D ../destdir -R ../releasedir -O ../objdir -X ../xsrc -U -x -j2 -r release 
   
 This process takes at least two hours on an high-end server, and usually much longer, depending on your computing power.  This process takes at least two hours on an high-end server, and usually much longer, depending on your computing power.
 <pre><code>  <pre><code>
         build.sh started: Sat Jan 22 21:50:47 CET 2005          build.sh started: Sat Jan 22 21:50:47 CET 2005
         No nonexistent/bin/nbmake, needs building.          No nonexistent/bin/nbmake, needs building.
         Bootstrapping nbmake          Bootstrapping nbmake
         MACHINE:          i386          MACHINE:          i386
         MACHINE_ARCH:     i386          MACHINE_ARCH:     i386
         TOOLDIR path:     /usr/src/tooldir          TOOLDIR path:     /usr/src/tooldir
         DESTDIR path:     /usr/src/destdir          DESTDIR path:     /usr/src/destdir
         RELEASEDIR path:  /usr/src/releasedir          RELEASEDIR path:  /usr/src/releasedir
         Created /usr/src/tooldir/bin/nbmake          Created /usr/src/tooldir/bin/nbmake
         makewrapper:      /usr/src/tooldir/bin/nbmake-i386          makewrapper:      /usr/src/tooldir/bin/nbmake-i386
         Updated /usr/src/tooldir/bin/nbmake-i386          Updated /usr/src/tooldir/bin/nbmake-i386
         Successful make release          Successful make release
         build.sh started: Sat Jan 22 21:50:47 CET 2005          build.sh started: Sat Jan 22 21:50:47 CET 2005
         build.sh ended:   Sun Jan 23 01:20:43 CET 2005          build.sh ended:   Sun Jan 23 01:20:43 CET 2005
 </code></pre>  </code></pre>
 If you are using Xorg via pkgsrc (recommended), you can skip building the Xserver (-x).  If you are using Xorg via pkgsrc (recommended), you can skip building the Xserver (-x).
   
 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.  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.
   
 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]]  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]]
 #Creating an ISO-Image  #Creating an ISO-Image
   
 to create an iso-image just add the option iso-image  to create an iso-image just add the option iso-image
   
     $ ./build.sh <other options> -U -x -r release iso-image      $ ./build.sh <other options> -U -x -r release iso-image
   
 the resulting iso image will reside in relasedir/platform/installation/cdrom/  the resulting iso image will reside in relasedir/platform/installation/cdrom/
   
 This option will create an iso-image only on platforms that are bootable from such a media.  This option will create an iso-image only on platforms that are bootable from such a media.
 #Burning the image  #Burning the image
   
 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.  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.
   
     # cdrecord -dev=/dev/rcd0d -data -pad -v NetBSD-install.iso      # cdrecord -dev=/dev/rcd0d -data -pad -v NetBSD-install.iso
   
 #Building current faster  #Building current faster
   
 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.  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.
   
 $ ./build.sh <your options> -U tools distribution sets kernel=MYKERNEL  $ ./build.sh <your options> -U tools distribution sets kernel=MYKERNEL
   
 Additional Information  Additional Information
   
 * [cvs(1)](http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current) manpage  * [cvs(1)](http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current) manpage
 * [Tracking NetBSD-current](http://www.netbsd.org/docs/current/)  * [Tracking NetBSD-current](http://www.netbsd.org/docs/current/)

Removed from v.1.1  
changed lines
  Added in v.1.2


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb