Subject: Re: Confused about how to build world
To: Kirk Strauser <kirk@strauser.com>
From: None <sigsegv@rambler.ru>
List: netbsd-users
Date: 02/21/2005 16:48:54
Kirk Strauser wrote:
> I'm experimenting with NetBSD 2.0 on an older laptop.  I've used *Free*BSD 
> servers and desktops for years, but this is my first experience with 
> *Net*BSD.  The installation went perfectly (except that the kernel didn't 
> associate my PCMCIA network card with the correct driver; PR submitted) and 
> I now have a fully running system.  So far so good!
> 
> Now, though, I want to rebuild my system.  I checked out a copy of the 
> source with "cvs checkout -rnetbsd-2-0 -P src" (that'll give me 2.0 + 
> security updates, won't it?).  Do I understand correctly that the "correct" 
> way to re-compile everything is as a crosscompile, as per chapter 25 of the 
> guide, even though I'm not really crosscompiling?
> 
> If so, then the instructions look like I'm supposed to "build.sh build" and 
> then "build.sh release", but /usr/src/BUILDING doesn't make it sound like 
> the "release" target actually installs the newly-compiled binaries.
> 
> Please forgive my ignorance and the fact that I haven't experimented too 
> heavily yet.  Said laptop is a K6-3/333 and the "build.sh build" step I 
> played with took overnight to finish, so it's kind of hard to try things 
> out to see what works.
> 
> Many thanks!

Well, I think 'build.sh release' target will also run 'build' and 
'distribution' targets. To install newly built binaries, you need to run 
something like 'build.sh install=/' Have a look at my example below.

Personally, I use the following scripts to get bug fixes for 2.0, I 
think it's upcoming 2.0.1, I don't really understand the relationships 
between different branches.


# cat srcget.sh
#!/bin/sh

CVSROOT=:pserver:anoncvs@anoncvs.netbsd.org:/cvsroot
export CVSROOT

cvs login
cvs checkout -P -rnetbsd-2 src
cvs checkout -P -rnetbsd-2 xsrc
#cvs checkout -P pkgsrc


# cat srcupdate.sh
#!/bin/sh

CVSROOT=:pserver:anoncvs@anoncvs.netbsd.org:/cvsroot
export CVSROOT

cvs login
cd /opt/src \
&& cvs -d:pserver:anoncvs@anoncvs.netbsd.org:/cvsroot update -dP \
&& cd /opt/xsrc \
&& cvs -d:pserver:anoncvs@anoncvs.netbsd.org:/cvsroot update -dP \
&& cd /opt/pkgsrc \
&& cvs -d:pserver:anoncvs@anoncvs.netbsd.org:/cvsroot update -dP


I use the following script to set the location of mk.conf file and build 
the entire release. I have different scripts for cross-compiling for 
different architectures, they're done in a chroot jail:

# cat i386_generic.build
#!/bin/sh

MAKECONF=/scripts/mk.i386_generic.conf
export MAKECONF

cd /opt/src && ./build.sh -u -m i386 -x -X /opt/xsrc \
         -O /opt/obj.i386_generic -T /opt/tools.i386_generic \
         release 2>&1 | tee /scripts/log.i386_generic


# cat mk.i386_generic.conf
MKCRYPTO_IDEA=yes
MKCRYPTO_MDC2=yes
MKCRYPTO_RC5=yes
#NOCLEANDIR=yes

WRKOBJDIR=/opt/obj.i386_generic/pkg
PACKAGES=/opt/packages.i386_generic
DISTDIR=/opt/distfiles
DEPENDS_TARGET=package

#setting -O2 will produce larger binaries, which may require adding
#FLOPPYMAX=2 to various Makefiles under src/distrib/i386/floppies/*
OPTIM_FLAGS=-Os

.ifdef BSD_PKG_MK
COPTS+=${OPTIM_FLAGS}
CFLAGS+=${OPTIM_FLAGS}
CXXFLAGS+=${OPTIM_FLAGS}
.else
COPTS+=${OPTIM_FLAGS}
.endif


And here is a script to create a bootable CD-ROM containing netbsd release:

# cat i386_generic.mkcd
#!/bin/sh

mkisofs -U -R -o ./i386_generic.iso -b 
i386/installation/floppy/boot-big.fs \
         /opt/obj.i386_generic/releasedir \
&& cdrecord -v dev=/dev/cd0d ./i386_generic.iso


Below is a script I use to update the entire userland + X11 after a 
successful build of release of distribution targets by build.sh

# cat i386_generic.install
#!/bin/sh

MAKECONF=/opt/sandbox/scripts/mk.i386_generic.conf
export MAKECONF

/opt/src/build.sh -x -O /opt/sandbox/opt/obj.i386_generic \
     -D /opt/sandbox/opt/obj.i386_generic/destdir.i386 \
     -T /opt/sandbox/opt/tools.i386_generic install=/