Compiling the NetBSD kernel

Fetching and extracting the very release version that you are running,

cd /
ftp -a ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-`uname -r`/source/sets/syssrc.tgz
progress -zf syssrc.tgz tar xf -
cd ~/
ln -s ../usr/src

Tweaking the kernel configuration,

echo ${HOST%%\.*}
kernel=`echo ${HOST%%\.*} | tr 'a-z' 'A-Z'`

cd /usr/src/sys/arch/`uname -m`/conf/
cp -pi GENERIC $kernel
#cp -pi XEN3_DOMU $kernel
vi $kernel

#options        INSECURE

Compiling the new kernel,

config $kernel
cd /usr/src/sys/arch/`uname -m`/compile/$kernel/
make depend
make clean
time nice make -j2
unset kernel

Ready to go,

mv /netbsd /netbsd.old
mv netbsd /
#scp guest:/usr/src/sys/arch/amd64/compile/KERNELCONFIG/netbsd /data/kernels/netbsdX/

Troubleshooting

make[1]: don't know how to make absvdi2.c. Stop

==> either use config -s or put your sources folder in the default location (/usr/src)

References