Building the NetBSD kernel

assuming same NetBSD release or at least branch – no need to build tools

make sure you have enough RAM (at least 2GB I would say, but 8GB is probably preferable), and eventually increase the number of vcpus


diff -Naur GENERIC $kernel > $kernel.diff

ls -lhF ../compile/$kernel/
rm -rf ../compile/$kernel/

config $kernel
#/usr/tooldir/bin/nbconfig GENERIC_XENHVM

cd ../compile/$kernel/
dmesg | grep -E [v]?cpu
time make -j16 depend >/dev/null && echo DEPEND

#make clean
time make -j16 > /root/$kernel.log && echo BUILT

For bare-metal

mv /netbsd /netbsd.old
cp /usr/src/sys/arch/`uname -m`/compile/$kernel/netbsd /
shutdown -r now

For a XEN host

scp bsdbuild:/usr/src/sys/arch/amd64/compile/ALTQNPF/netbsd netbsd.altqnpf
scp bsdbuild:/usr/src/sys/arch/amd64/compile/GENERICMULTI/netbsd netbsd.genericmulti

Ready to go

XEN guest

shutdown -p now

and change its settings to point to the new kernel,

kernel = "/data/kernels/netbsd8/altqnpf"

At system startup, watch the console and check,

dmesg | grep ^NetBSD
uname -a


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)



this is not required anymore – it’s built in already

Enabling NPF

pseudo-device   npf                     # NPF packet filter

options         NPF_EXT_LOG
options         NPF_EXT_NORMALISE
options         BPFJIT
options         SLJIT