Subject: Building NetBSD
To: None <>
From: Mark Weinem <>
List: netbsd-users
Date: 10/30/2007 05:10:46

Unfortunately, the documented instructions to build NetBSD are not 

The procedure from "Updating a stable NetBSD release"

 	$ cd /usr/src
 	$ ./ -O ../obj -T ../tools kernel=<KERNEL>
 	$ ./ -U distribution
 	$ su ...
 	# mv /netbsd /netbsd.old
 	# mv /usr/src/sys/arch/<ARCH>/compile/<KERNEL>/netbsd /
 	# shutdown -r now ...
 	$ cd /usr/src
 	$ su
 	# ./ -O ../obj -T ../tools -U install=/


* re-building the toolchain is not mentioned in the summary
* building the kernel before the userland
* running etcupdate(8) is missing

The procedure from "Tracking NetBSD-current":

 	$ cd /usr/src
 	$ ./ -O ../obj -T ../tools -U -u tools
 	$ ./  -O ../obj -T ../tools -U -u distribution
 	$ ./  -O ../obj -T ../tools -U -u kernel=GENERIC
 	$ cd ../obj/sys/arch/<ARCH>/compile/GENERIC
     	$ su ...
     	# mv /netbsd /netbsd.old
     	# cp netbsd /netbsd
 	# shutdown -r now
 	$ cd /usr/src
 	$ su
     	# ./ -O ../obj -T ../tools -U install=/
 	# /usr/src/usr.sbin/postinstall/postinstall -s /usr/src -d // fix
 	# /usr/sbin/etcupdate -s /usr/src


* building the userland before the kernel!

* any reason to run "/usr/src/usr.sbin/postinstall/postinstall" instead of

* running postinstall(8) manually - is this still necessary, as
   etcupdate(8) runs postinstall too?

The documents src/BUILDING and src/UPDATING don't provide complete 
procedures. src/UPDATING states:

 	Build a new kernel first:
         This makes sure that any new system calls or features
         expected by the new userland will be present. This
         helps to avoid critical errors when upgrading.

What is meant here, running "./ ... kernel" before "./ ... 
distribution" or installing the new kernel before installing the new 

So what's the "correct" procedure (or the recommended practice)? And 
should this be documented in src/BUILDING and src/UPDATING?

Thanks in advance & best regards, Mark

Mark Weinem