I Compiled A Linux Kernel!

“I Compiled A Linux Kernel!” this is really cool title, right? Okay, this was my first time about compiling a kernel so I was a little bit excited. I’ve been thinking about building my very own Linux system for a long time. For building Linux from nothing there is a website called “Linux From Scratch”. :) I was thinking about using this website to build my Linux system on my old computer. I postponed this for a long time. Because this would take a long time (at least for me) and I was waiting for this non-busy time to start it. Well, I’m not the busiest person on this world but I just couldn’t find time and energy for starting this idea. A few weeks ago, we had LPIC-1 exam. (which you can find more at lpi.org) And I thought it was pointless to wait more to start my project.

Before starting this project I wanted to try compiling a kernel. It wasn’t so hard to find some documents on internet about it. (Even Turkish HOW-TO document was really old and needed to be update) I opened 2-3 documents on my computer and I started to compiling at my old computer. It is not really hard to find documents about this on internet but I’ll write how I did it.

First I became root at terminal. I copied last kernel version’s link (3.8.1) and with

wget link

command I downloaded kernel to under /usr/src in my computer.

tar xvjf kernel.tar.bz2

With this command I opened the file. This took a few minutes. After this I just selected menu option to specialize compiling process.

make menuconfig

You can use menu with this command. But first you need to download ncurses library to your computer.

apt-get install libncurses5-dev

After dowloading and installing ncurses libraries I take a look to the kernel optimizations. There was a lot of options and I really did not understand some of them. Because I didn’t understand the options I couldn’t make lots of changes but I changed something about processor. For compiling kernel;

make-kpkg clean 

make-kpkg kernel-image kernel_headers –initrd

You need to install kernel-package to use this commands. I read that it would take at least 20 minutes to compile a kernel but at my old computer it took really a long time. I even suspect that I did something wrong. But after some time it finally ended.

dpkg -i header image

With this command I installed new kernel to my computer and I reboot my machine to use my new kernel. 

cat /proc/version
uname -r

I checked that I did everything right. But it was too late when I noticed my computer wasn’t aware of my wireless card.

sudo apt-get purge linux-image-3.8.1*

With this command I removed the freshly installed kernel and start to use my good old kernel again.

 

About these ads

5 thoughts on “I Compiled A Linux Kernel!

  1. Seems like you forgot to build the kernel modules needed to run your hardware, thats the part you forgot.. next time, try “make modules_install install” after making of the new kernel.

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 )

Connecting to %s