KernelNewbies:

"DRAFT" DaveHolt 20120511 15:38 PST - needs better formatting!

This is a worked example of building a Linux 3.3 kernel. When complete I intend to link to it from the kernel building FAQ.

Simple (but detailed) example of building a customized Linux 3.3 kernel on Ubuntu 12.04 LTS. I started with an uninitialized system, and tried to document everything needed to build a modern kernel.

The intent is to include everything I needed (e.g. libncurses5-dev ) without including unnecessary steps (emacs + RCS).

On 26 April 2012 I downloaded + burned a CD with "Ubuntu 12.04 LTS" (Desktop 32bit edition) from http://www.ubuntu.com . That took about an hour (your performance will vary with the speed of the network and your system).

I booted the CD on a scratch system (a VMware VM), and told it to install. That also took about an hour. The system now booted.

I ran the Update Manager from "Dash Home" and let it update. That also took about an hour.

I started firefox and went to http://kernel.org and downloaded the "Latest Stable Kernel", which was 3.3.3 , selecting save_file to ~/Downloads .

I then did

cd ~/Downloads
tar xf linux-3.3.3.tar.bz2

which extracted the source tree in ~/Downloads/Linux-3.3.3/

Next I installed a recommended package for kernel building (sudo for privilege required to install software on system - it may prompt for your password).

sudo apt-get install build-essential

Hit return to tell it to continue.

I then installed ncurses to allow the most basic "graphical" config interface (menuconfig).

sudo apt-get install libncurses5-dev

Now go to the kernel tree (depends on what kernel sources you download), and begin the configuration process.

cd linux-3.3.3/
make menuconfig

In the "General setup" section, select "Local version". Add something to your customized kernel (e.g. initials).

Exit menuconfig, saving (which writes the hidden file .config ).

Next, begin making the kernl (takes ~90 minutes) with

make

Now elevate your privileges with sudo to install the kernel:

sudo make modules_install
sudo make install

Note that this automatically does other necessary updates, including initrd, and updating the grub2 configuration.

After you reboot, as with a command like

sudo shutdown -r now

you will come up running your new kernel, which you can verify with

uname -a

You will see your initials in the name of the kernel running.

Go forth and modify!

KernelNewbies: BuildLinux33 (last edited 2012-05-11 23:06:22 by DaveHolt)