#!/bin/bash

#get kernel sources from kernel.org

#untar them to /usr/src/linux
cd /usr/src/linux
cp /tmp/trunk-cfg .config
make oldconfig

apt-get install dpkg-dev

make -j 9 KDEB_PKGVERSION=001 deb-pkg
dpkg -i ../linux-image-XXXXX_001_i386.deb
dpkg -i ../linux-initrd-XXXXX_001_i386.deb
dpkg -i ../linux-*

#CPU core count for option -j = num availibale CPU cores + 1

echo $(($(cat /proc/cpuinfo | grep -c processor)+1))

#Custom configuration kernel parameters:

make menuconfig

# Also need install ncurses devel package:

apt-get install libncurses5-dev