Subject: Re: Rebuild NetBSD
To: Linyin <linyin.cn@gmail.com>
From: None <yancm@sdf.lonestar.org>
List: netbsd-users
Date: 03/31/2006 07:40:44
> BSDOBJDIR /usr/obj does not exist, bailing...

Yes, you must have a directory created with write permissions for the user
doing the compiling. If you do this with root, it's not a problem...

Let me save you some time (maybe)...
DO NOT DO THIS ON A CRITICAL SYSTEM the first time you try it!

Here are the steps I use to rebuild the kernal and "userland".
My source is on /usr/src and my object target is in /usr/obj.

First, sync/update the src tree to a particular release branch.
   http://mail-index.netbsd.org/netbsd-announce/2005/01/13/0000.html

In my case I track the 2.xxx stable branch and so update with:
cd /usr
cvs -q up -rnetbsd-2 -PAd src
[if they do not exist, create /usr/obj and /usr/tools]
cd src   [now in /usr/src]

#For clean sheet rebuild:
./build.sh -O ../obj -T ../tools kernel=MYKERNEL
[note: MYKERNEL is a customized kernel definition file...this will
not work for you unless you customize a kernel definition and
use MYKERNEL for it's name!]
# Boot into new kernel
./build.sh -O ../obj -T ../tools -u distribution
./build.sh -O ../obj -T ../tools -U install=/

# After Install - check this
/usr/src/etc/postinstall -s /usr/src -d // fix defaults mtree obsolete

# Update /etc/
/usr/sbin/etcupdate -s /usr/src/etc

Hope that helps...