Compiling Kernel 3.4.5

With the Precise mainline kernels held at 3.4.0 while 3.4.5 is the latest stable release, would a 3.4.5 kernel compiled from source code run in Ubuntu 10.10?

Curiosity beckoned, and the result was not bad. Seeking a simple process for compiling the kernel, here are the steps taken to compile a 3.4.5 64-bit kernel in order to update a virtual Ubuntu 10.10 running inside VirtualBox followed by a test on real hardware using the Acer Aspire One 722 netbook.

The kernel was compiled in Ubuntu 10.10 64-bit running on real hardware, then the resulting .deb files were copied into the virtual machine to update the virtual Ubuntu 10.10 64-bit OS.

NOTE: The kernel is the heart of Linux, so exercise care. If upgrading a main system, backup important files first in case something goes wrong.

Obtaining the 3.4.5 Kernel

Download the latest stable release 3.4.5 from and extract it to a dedicated directory in home. For this example, a directory named src was created in home (mkdir ~/src). The linux-3.4.5 directory was then extracted into ~/src.

~/src/linux-3.4.5 should exist. Change to this directory.

cd ~/src/linux-3.4.5

Kernel Configuration

A wealth of kernel options are available to manually customize the kernel to suit individual needs, but a quick trick that saves time is to copy the existing configuration of the current kernel and use that.

cp /boot/config-$(uname -r) .config

This copies the current kernel’s configuration into the hidden file .config located in ~/src/linux-3.4.5. The $(uname -r) part grabs current kernel version so to spare us from entering it manually. To check it out, try entering uname -r in a terminal to see what it returns.

Menu Configuration

If additional customization if needed, run,

make menuconfig

to bring up a text-based menu system that allows further customization. This step is not necessary if the existing configuration file is used, but it never hurts to take a look to see what is available.

Kernel Building…Be Prepared to Wait

With the configuration (.config) file ready to go, the next step is to actually build the kernel into two .deb files for installation. This requires a few packages to be installed first. Some were already present on the test system, but any missing files were noted in the errors.

Two essential packages are kernel-package and fakeroot.

sudo apt-get install kernel-package fakeroot

Other tutorials included the package libncurses5-dev, but no errors were encountered in its absence. However, this might be because it was already installed on the system. If any required files are missing, the build process will halt and report them.
It’s always a good idea to clean the directory first.

make-kpkg clean

Assuming all required packages are present, build the kernel.

fakeroot make-kpkg --initrd kernel_headers kernel_image

The build process is lengthy, so be prepared to wait a…very…long…time. Building took about two hours. Let it complete until the end.

When finished, there will be two .deb files in ~/src. One will be the headers file and the other will be the image.


Kernel Installation

The kernel compiled without errors. So far, so good. Rather than risk damaging the host machine, a virtual Ubuntu 10.10 64-bit OS running kernel 3.4.0 was opened in VirtualBox. Would the custom 3.4.5 kernel work?

The two .deb files were copied from ~/src to the user’s home directory in the virtual Ubuntu. Install the header package first followed by the image package.


  1. linux-headers-3.4.5_3.4.5-10.00.Custom_amd64.deb
  2. linux-image-3.4.5_3.4.5-10.00.Custom_amd64.deb
  3. sudo update-grub
  4. Reboot

Before rebooting, make sure to update GRUB2 (in the virtual machine) with the sudo update-grub command. Then, reboot the virtual machine.

The virtual Ubuntu loaded fine, but was kernel 3.4.5 running? Entering the command uname -a in a terminal showed that 3.4.5 was indeed loaded and active.

A few programs were compiled from source to check if programs could be compiled using the custom kernel. This is where the headers package is required. The few source files tested compiled and executed without errors.

Did the 3.4.5 Kernel Work with the Acer Aspire One?

Satisfied that the custom 3.4.5 kernel was running properly inside a virtual Ubuntu 10.10 64-bit, how would it perform on real hardware? Specifically, how would the 3.4.5 kernel run on the Acer Aspire One 722 netbook? Would the power management issues be fixed?

The same headers and image .deb files were copied to the user’s home on the netbook and installed using the same procedure used above for the virtual Ubuntu. Headers first, image second. Update grub, then reboot.

The result? It works!

The netbook booted into Ubuntu without any problems. Just like the virtual Ubuntu, uname -a showed 3.4.5 installed and running as the current kernel. The netbook was completely usable, but the graphics were unaccelerated. Moving windows caused tearing, but this was normal since the Catalyst drivers must be reinstalled each time the kernel is updated.

Testing Catalyst 12.6

Catalyst 12.6 was incompatible with kernel 3.4.0, so would it work with 3.4.5?
Sadly, no. The same issue encountered with 3.4.0 occurred with kernel 3.4.5. Catalyst 12.4 was uninstalled in order to try the reliable Catalyst 12.4. Desktop effects did not enable.

Testing Catalyst 12.4

Catalyst 12.4 runs fine with kernel 3.4.0 as long as modifications are made to two source files. But does it work with kernel 3.4.5? No. Installing Catalyst 12.4 the same way as kernel 3.4.0 had no effect. Desktop effects did not enable because Ubuntu says the driver could not be found. In addition, the custom build step required for installing Catalyst 12.4 always halted with errors by complaining that the fglrx directory was not found.

Even though kernel 3.4.5 installed on the netbook, the graphics were limited to a basic mode.

Did Suspend and Hibernation Work?

This was a surprise. With kernel 3.4.5 on the netbook, suspend encounters the same problem as before: the netbook enters suspend mode but never wakes up the display.

However, hibernation did work. Several windows and terminals were opened, and then the netbook was placed in a hibernation state by selecting Hibernate from the shutdown menu. The netbook powered down. After waking up from hibernation, all windows were restored. This might be because the proprietary Catalyst drivers were not installed and activated.

Restoring the Netbook to 3.4.0 kernel with Catalyst 12.4

Satisfied with the results, it was time to return the netbook to a working state by reverting to kernel 3.4.0 with Catalyst 12.4.

1. Reboot with kernel 3.4.0

Do not remove a kernel whose version is the same as the running kernel.

2. Remove 3.4.5 using Synaptic Package Manager.
Mark for Complete removal.

3. Update GRUB2
sudo update-grub

4. Install Catalyst 12.4
Use the same modification technique as before.


Compiling a custom 3.4.5 kernel in Ubuntu 10.10 64-bit running on real hardware produces two .deb files that can be copied to and installed on equivalent Ubuntu 10.10 64-bit systems whether virtual or real. There is no need to compile a separate kernel for each system. As long as the OS distribution (Ubuntu), version (10.10), and architecture (i386 or amd64) are the same, the custom kernel should work.

The same kernel files installed and functioned properly in both a virtual Ubuntu 10.10 64-bit and an Acer Aspire One 722 netbook running Ubuntu 10.10 64-bit. However, Catalyst 12.4 refused to build under kernel 3.4.5 due to a missing fglrx directory despite following the same steps that worked before. Even though 3.4.5 worked, the netbook was restored to 3.4.0 in order to have a working system with accelerated graphics.

One safety precaution is to test the kernel inside a virtual machine before installing it on real hardware in order to check for any errors that might result.

Kernel compilation can become a complex project. More could have been tested to make the Catalyst drivers work on the netbook, but the aim of this experiment was to compile 3.4.5 in the easiest and quickest way possible.


, , ,

  1. Leave a comment

Leave a Reply

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

You are commenting using your 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: