Today’s blog post will be about being bleeding edge. Debian, well, Debian isn’t bleeding edge, it will never be bleeding edge. Debian stands for stable. In most cases, stable is more then enough. I’m using Debian for my servers, mostly I don’t need the latest kernel. But what if you have a piece of hardware that is supported by the latest kernel, but isn’t in the Debian stable/experimental. Or what if you have a raid controller that needs drivers and you need include those into the kernel.
Debian stable currently runs on kernel 2.6.32. The experimental version of Debian runs kernel 3.2.0.2. The latest version right now is 3.6-rc1. As you see, the stable Debian runs a few kernels behind. The experimental updates more frequent but still, it runs a few kernels behind.
Why would you want to build your own kernel?
Pro – Building your own kernel
- You’re running the latest kernel version, including the latest fixes and drivers.
- You can tune your kernel and gain performance.
- You can include external drivers.
- You can downscale the kernel size.
Con – Building your own kernel
- It’s time consuming.
- It can go seriously wrong!
- You have to keep patching manually.
- Documentation is horrible. (On Debian at least)
So you still want to continue?
OK, First we have to prepare the system. I’m logged in as the root user. Before I start to compile my kernel, I make sure that my system is up to date.
apt-get update && apt-get dist-upgrade
When the system is up to date, I install the required packages.
apt-get install libncurses5-dev kernel-package make fakeroot
Next, we download the kernel and unpack it.
wget http://www.kernel.org/pub/linux/kernel/v3.0/testing/linux-3.6-rc1.tar.bz2
tar xvf linux-3.6-rc1.tar.bz2
cd linux-3.6-rc1
Now that we have unpacked the kernel, we’re ready to configure it. If you’re doing this to configure the kernel yourself, feel free to skip this step. However, it’s fairly easy to copy the current kernel configuration and work from there on.
First we’re going to copy the current kernel configuration. Next we’re going to configure the options that are new compared to the previous version. Once this is done, we can configure the exact kernel parameters.
cp /boot/config-`uname -r` /tmp/
make oldconfig
make menuconfig
If you’re not planning to tune you’re kernel, feel free to exit the configuration manager. Remember to save the configuration file, else you might end up with an unusable kernel.
Now, set the CONCURRENCY_LEVEL, this will optimize the compiling speed. I entered the number of cores my virtual machine has.
export CONCURRENCY_LEVEL=6
fakeroot make-kpkg –initrd –append-to-version=-custom01 kernel-image kernel-headers modules_image
This command might take a while. My computer needed 15 min on 6 cores and over 45 min on a single core (I lost track of time). Once this progress is done, we’re ready to install the latest kernel.
If you ever created a kernel on Arch of Gentoo, you will remember that you had to copy everything manually. With Debian, this isn’t true. The command above created an installable package in the directory above the compile directory.
cd ../
dpkg -i linux-image-3.6.0-rc1-custom01_3.6.0-rc1-custom01-10.00.Custom_amd64.deb
When the installation completes, reboot your system. You will see the new kernel appear in the Grub menu. If you have any problems, you can always boot the old kernel again. Always keep two or more previous kernels. This can always be handy.I hope this tutorial helped you out.
Cheers and have fun with your bleeding edge kernel.
Debian 6 compile your own kernel
I loved this.
But the last two main things did not work;
Inputted Line: fakeroot make-kpkg –initrd –append-to-version=-custom01 kernel-image kernel-headers modules_image
Output: fakeroot: FAKEROOTKEY set to
fakeroot: nested operation not yet supported
and
Inputted Line: dpkg -i linux-image-3.6.0-rc1-custom01_3.6.0-rc1-custom01-10.00.Custom_amd64.deb
Output: dpkg: error processing linux-image-3.6.0-rc1-custom01_3.6.0-rc1-custom01-10.00.Custom_amd64.deb (–install):
cannot access archive: No such file or directory
Errors were encountered while processing:
linux-image-3.6.0-rc1-custom01_3.6.0-rc1-custom01-10.00.Custom_amd64.deb
Can you help with this?
The last line is very normal, the package didn’t build correctly.
Could you give me some more information on what you exactly did? I might be able to help you with that.
I never used fakeroot myself, instead the following method works well for me:
…
# 1 + num cores
export CONCURRENCY_LEVEL=7
make-kpkg clean
make-kpkg –initrd –append-to-version=-my1a kernel_image kernel_headers
Okay, I did copy & paste the relevant lines into my terminal. It worked until:
fakeroot make-kpkg –initrd –append-to-version=-custom01 kernel-image kernel-headers modules_image
So I changed it to:
fakeroot make-kpkg –initrd –append-to-version=-custom01 kernel-image kernel-headers modules_image
for it work on my Dell D520
HTH
The formatting for this page, in Chromium is showing “dash dash” as a long (?Em) dash. The line should read:
fakeroot make-kpkg “dash dash”initrd “dash dash”append-to-version=-custom01 kernel-image kernel-headers modules_image
Where dash is – and the ” are omitted.
Hi!
I’m afraid that the blog is changing – - into a big -, I will have a look at this and I will try to fix it!
I’m happy to read that you found it out and that things are working now!
Cheers!