Compiling the NetBSD kernel

Make sure you have enough RAM (256MB might not do), and eventually increase the number of vcpus.

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

cd /
ftp -a`uname -r`/source/sets/syssrc.tgz
#ftp -a`uname -r`/source/sets/syssrc.tgz
#ftp -a`uname -r`/source/sets/syssrc.tgz
ls -l usr/src/
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

#enable kernel security levels
#options        INSECURE

#altq options available as of netbsd 8.0
options         ALTQ            # Manipulate network interfaces' output queues
options         ALTQ_BLUE       # Stochastic Fair Blue
options         ALTQ_CBQ        # Class-Based Queueing
options         ALTQ_CDNR       # Diffserv Traffic Conditioner
options         ALTQ_FIFOQ      # First-In First-Out Queue 
options         ALTQ_FLOWVALVE  # RED/flow-valve (red-penalty-box)
options         ALTQ_HFSC       # Hierarchical Fair Service Curve
options         ALTQ_LOCALQ     # Local queueing discipline
options         ALTQ_PRIQ       # Priority Queueing 
options         ALTQ_RED        # Random Early Detection
options         ALTQ_RIO        # RED with IN/OUT
options         ALTQ_WFQ        # Weighted Fair Queueing

#just to notice this is not the GENERIC kernel anymore
options         WS_KERNEL_FG=WSCOL_RED

Compiling the new kernel,

#rm -rf ../compile/$kernel/
config $kernel
cd /usr/src/sys/arch/`uname -m`/compile/$kernel/
make depend
#make clean
dmesg | egrep ^[v]?cpu
time nice make -j4 > make.log
tail make.log
#time make -j4 > make.log

Ready to go,

mv /netbsd /netbsd.old
cp /usr/src/sys/arch/`uname -m`/compile/$kernel/netbsd /
#scp guest:/usr/src/sys/arch/amd64/compile/KERNELCONFIG/netbsd ./
sudo mv netbsd /data/kernels/netbsd8/netbsd.altq

In case this is a XEN guest, change its settings to point to the new kernel,

shutdown -p now

or simply reboot,

shutdown -r now

watch the console and check,

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)


Last update 2018-09-14 | Home | Very old doc | Old doc | New doc | HTML/CSS