Quick notes for compile a kernel following the Debian way

30 03 2016

Simple guide for compiling a custom kernel following the Debian way:

Before all, check your kernel version:
uname -r

Assure that you have “deb-src” section in your “/etc/apt/sources.list” and search for the kernel sources available:
apt-cache search linux-source*

Go to the source path for store the source code there:
cd /usr/src/

Get the linux source code (maybe get it from backports?):
apt-get install linux-source-4.4
(or) apt-get -t jessie-backports install linux-source-4.4

And some requirements:
apt-get install libncurses5-dev build-essential fakeroot ncurses-dev

Extract the code:
tar xaf linux-source-4.4.tar.xz

Enter and configure, don’t fortget saving the changes:
cd linux-source-4.4/
make nconfig

If you have a previous kernel configuration, you can copy it from /boot/ and avoid the nconfig:

cp /boot/config-4.4-amd64 /usr/src/linux-source-4.4/.config

Save some disk space:
scripts/config --disable DEBUG_INFO

Proceed and wait:
make clean
make deb-pkg

Finally install the kernel and the headers:
dpkg -i ../linux-image-4.4.6_4.4.6-1_amd64.deb
dpkg -i ../linux-headers-4.4.6_4.4.6-1_amd64.deb

If you have out-of-tree kernel modules, check their status with the following command and compile manually if is necessary:
dkms status

If you have some patches to apply, like the rt supplied by Debian, do it before the configuration:
cd linux-source-4.4/
xz -cd ../linux-patch-4.4-rt.patch.xz | patch -p1

More info:
http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s-common-building
https://debian-handbook.info/browse/en-US/stable/sect.kernel-compilation.html

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: