Subject: Building NetBSD
To: None <netbsd-users@NetBSD.org>
From: Mark Weinem <mark.weinem@alumni.uni-due.de>
List: netbsd-users
Date: 10/30/2007 05:10:46
Hello,

Unfortunately, the documented instructions to build NetBSD are not 
coherent:

The procedure from "Updating a stable NetBSD release"

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

    (http://netbsd.org/docs/updating.html#summary)

* 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
 	$ ./build.sh -O ../obj -T ../tools -U -u tools
 	$ ./build.sh  -O ../obj -T ../tools -U -u distribution
 	$ ./build.sh  -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
     	# ./build.sh -O ../obj -T ../tools -U install=/
 	# /usr/src/usr.sbin/postinstall/postinstall -s /usr/src -d // fix
 	# /usr/sbin/etcupdate -s /usr/src

    (http://netbsd.org/docs/current/#updating)

* building the userland before the kernel!

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

* 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 "./build.sh ... kernel" before "./build.sh ... 
distribution" or installing the new kernel before installing the new 
userland?

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
Jabber: weinem@jabber.cz