Monday, August 2, 2010

Kernel 2.6.35 available for Ubuntu 10.04

On August 1, 2010 Linus released the 2.6.35 kernel. This kernel is now available in the git repository of Ubuntu 10.04 and you are able to compile your own 2.6.35 kernel for Ubuntu 10.04. This kernel is backported from the Maverick kernel repository.

Kernel Newbies has a nice overview of the new features in the 2.6.35 kernel. Their summary:



Linux 2.6.35 includes support for transparent spreading of incoming network load across CPUs, Direct-IO support for Btrfs, an new experimental journal mode for XFS, the KDB debugger UI based on top of KGDB, improvements to ‘perf’, H.264 and VC1 video acceleration in Intel G45+ chips, support for the future Intel Cougarpoint graphic chip, power management for AMD Radeon chips, a memory defragmentation mechanism, support for the Tunneling Protocol version 3 (RFC 3931), support for multiple multicast route tables, support for the CAIF protocol used by ST-Ericsson products, support for the ACPI Platform Error Interface, and many new drivers and small improvements.


Introduction

This article is written for the Ubuntu-lts 2.6.35 and the Ubuntu-lts-2.6.34 kernel.

git

I’ll be using git to get the latest kernel version. This is my favorite way to get the sources and it is in my opinion the fastest way to make changes later on when you want to update your own kernel to the latest version.

I suggest adding my Launchpad repository to your system. The repository holds the latest version of git and is usually updated within a day of a new release of git, follow the instructions on the page Git Packages for Ubuntu to add my repository. There is a version available for Lucid as well.

Arch

I am compiling the i386 version, if you want to compile for amd64 you need replace i386 for amd64 throughout this article.

Flavor

I choose the name core2 as the flavor name as for my personal use I’ll build a kernel for a Core2 processor. Besides the change of processor type in the configuration I also select support for 64GB as my laptop has 4GB, which is the main reason I started compiling my own kernels. I have some other changes but that’s beyond this article.

If you used my previous article you can skip to Creating a branch.

Preparations

Let’s get started by preparing our machine for compiling the Ubuntu Lucid kernel.

Open a terminal.


sudo su -
apt-get install fakeroot build-essential
apt-get install crash kexec-tools makedumpfile kernel-wedge
apt-get build-dep linux
apt-get install git-core libncurses5 libncurses5-dev
apt-get install libelf-dev asciidoc binutils-dev

Create a directory where you would like to build your kernel, this directory will hold the kernel source in a sub directory and all the deb files will end up in this folder. I choose /d1/development/kernel/lucid

Getting the source


cd /d1/development/kernel/lucid
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-lucid.git  source 
cd source

The source code is installed in the directory source.

Creating a branch

If you already created a branch for the non lts 2.6.34 or 2.6.32 branch if you followed my previous arfticles make sure you use a different name for the branch created in this article or remove the branch by typing:


git branch -D core2

We will create a branch in which we will be doing our modifications. That way the master branch will stay in tact which will make it a whole lot easier when we want to update our own Ubuntu Lucid kernel to a newer version.

To see all the 2.6.35 kernels available type the following command:


git tag -l Ubuntu-lts-2.6.35*

The Ubuntu kernel developers tag each version as Ubuntu-lts- and therefore we can checkout the version we want as


git checkout Ubuntu-lts-2.6.35-7.11 -b core2

This will create a branch called core2.

Creating a new config

I’ll be using the method of creating a new flavor, this adds a bit more work but you can always compile the original kernels.

We’ll use the generic flavor as the base for our own flavor being core2.


cp debian.maverick/config/i386/config.flavour.generic debian.maverick/config/i386/config.flavour.core2
fakeroot debian/rules clean
debian/rules updateconfigs

To make changes to the configuration file we need to edit the configuration file. The kernel developers have created a script to edit kernel configurations which has to be called through the debian/rules makefile, unfortunately you will have to go through all the flavors for this script to work properly.


debian/rules editconfigs

The script will ask you if you want to edit the particular configuration. You should not make changes to any of the configurations until you see the core2 configuration


Do you want to edit config: i386/config.flavour.core2? [Y/n]

Make your changes, save the configuration and then keep going until the script ends.

When you’re done, make a backup of the config flavor file.


cp debian.maverick/config/i386/config.flavour.core2 ../.

Now we need to clean up the git tree in order to get ready for compilation.


git reset --hard 
git clean -xdf

Getting ready for compilation

Because we are going to be creating a new flavor based on a existing flavor (generic in my case) we need to create some extra files. During compilation the process checks the previous release for some settings, as we’re creating a local flavor it doesn’t exist in the source, so we’re creating it. The previous release in this case is 2.6.35-7.10.


ls debian.maverick/abi


cp debian.maverick/abi/2.6.35-7.10/i386/generic debian.maverick/abi/2.6.35-7.10/i386/core2
cp debian.maverick/abi/2.6.35-7.10/i386/generic.modules debian.maverick/abi/2.6.35-7.10/i386/core2.modules

Copy our flavored configuration file back.


cp ../config.flavour.core2 debian.maverick/config/i386/

We need to edit some files:

File: debian.maverick/etc/getabis

Search for the line:


getall i386 generic generic-pae 386

Change it in:


getall i386 generic generic-pae 386 core2

File: debian.maverick/rules.d/i386.mk

Search for the line:


flavours        = generic generic-pae virtual core2

Change it in:


flavours        = generic generic-pae virtual core2

We need to make the compilation process aware of our own flavor we want to compile.


cp debian.maverick/control.d/vars.generic debian.maverick/control.d/vars.core2

You can edit the file and make it your own.


arch="i386 amd64"
supported="Core2"
target="Geared toward Core2 desktop systems."
desc="x86/x86_64"
bootloader="grub-pc | grub | lilo (>= 19.1)"
provides="kvm-api-4, redhat-cluster-modules, ivtv-modules, ndiswrapper-modules-1.9"

We need to commit our changes in the git repository.


git add .
git commit -a -m "Core2 modifications"

The text after -m is the message you add to your commit.

Compilation

It’s finally time for compiling but before we can start the compilation process there is one more step to do. I didn’t put this in the Preparations section as you need to the following step whether you make changes to the configuration or not


fakeroot debian/rules clean

All the packages will be created in the directory /d1/development/kernel/lucid

Create independent packages:


skipabi=true skipmodule=true fakeroot debian/rules binary-indep

The above statement will create the following deb files:


llinux-maverick-source-2.6.35_2.6.35-7.11~lucid1_all.deb
linux-maverick-doc_2.6.35-7.11~lucid1_all.deb
linux-maverick-tools-common_2.6.35-7.11~lucid1_all.deb
linux-headers-2.6.35-7_2.6.35-7.11~lucid1_all.deb

Create the tools packages:


skipabi=true skipmodule=true fakeroot debian/rules binary-perarch

The above statement will create the following deb files:


linux-maverick-source-2.6.35_2.6.35-7.11~lucid1_all.deb
linux-maverick-tools-2.6.35-7_2.6.35-7.11~lucid1_i386.deb

Create the flavour depended files:


skipabi=true skipmodule=true fakeroot debian/rules binary-core2

The above statement will create the following deb files:


linux-headers-2.6.35-7-core2_2.6.35-7.11~lucid1_i386.deb
linux-image-2.6.35-7-core2_2.6.35-7.11~lucid1_i386.deb

Installation

After the compilation is finished we’ll have the above packages in the parent directory.

To install the files


cd ..
sudo dpkg -i  linux-headers-2.6.35-7-core2_2.6.35-7.11~lucid1_i386.deb linux-headers-2.6.35-7_2.6.35-7.11~lucid1_all.deb linux-image-2.6.35-7-core2_2.6.35-7.11~lucid1_i386.deb

Check your bootloader if the newly installed kernel is the default one, for grub check the file /boot/grub/menu.lst or if you run grub2 check /boot/grub/grub.cfg

If you have the linux-tools package installed you should remove this package before installing the new tools package.

Reboot and enjoy your newly installed kernel.

1 comment:

  1. hi,i have gone by all the steps what u have followed but still i am get ing some problem can u help me out please mail me complite steps to be followed to this mail id:charan.k87@gmail.com

    its an assignment to me.,,,,,

    ReplyDelete

UA-39498145-1