How to compile a Ubuntu 10.10 (Maverick) kernel with sched: automated per tty task groups kernel patch

Lately there has been quiet some buzz about the “sched: automated per tty task groups” kernel patch. It’s supposed to dramatically improve the desktop interactivity under system strain. You can read a test at Phoronix.
The patch is written for the 2.6.37 kernel but Ubuntu 10.10 runs the 2.6.35 kernel. This doesn’t mean you can’t compile your own 2.6.35 kernel for Ubuntu 10.10 with the patch included. Currently I am running this version but I haven’t done any testing for speed improvements.

Introduction

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.

Architecture
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 tty as the flavor name as this reflects the patch we’re using.

Preparations

If you already build your kernel using my guide you can skip to section the Creating a branch.
Let’s get started by preparing our machine for compiling the Ubuntu Maverick 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 libdw-dev asciidoc binutils-dev libnewt-dev
exit

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/maverick

Getting the source

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

The source code is installed in the directory source.

Creating a branch
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 10.10 kernel to a newer version.

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

git tag -l | sort -V

The patch I created from the original “sched: automated per tty task groups” patch was made for version Ubuntu-2.6.35-23.40. I don’t know if the patch will working fine on other versions. I might keep the patch updated for future versions, so keep coming back.

git checkout Ubuntu-2.6.35-23.40 -b tty

This will create a branch called tty.

Applying the “sched: automated per tty task groups” patch

Download the patch from my server.
Extract the tar.bz2 file and place the patch in the directory: /d1/development/kernel/maverick
run the following commands to apply the patch: cd /d1/development/kernel/maverick/source
git am ../0001-sched-automated-per-tty-task-groups.patch

Creating a new config

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

We'll use the generic flavor as the base for our own flavor being tty.

cp debian.master/config/i386/config.flavour.generic debian.master/config/i386/config.flavour.tty
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 tty configuration

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

Make your changes. As I take it you want to utilize the patch make sure you select:
General setup ---> Automatic process group scheduling
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.master/config/i386/config.flavour.tty ../. 

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-23.39

ls debian.master/abi
cp debian.master/abi/2.6.35-23.39/i386/generic debian.master/abi/2.6.35-23.39/i386/tty
cp debian.master/abi/2.6.35-23.39/i386/generic.modules debian.master/abi/2.6.35-23.39/i386/tty.modules

Copy our flavored configuration file back.

cp ../config.flavour.tty debian.master/config/i386/

We need to edit some files:

File: debian.master/etc/getabis

Search for the line:

getall i386 generic generic-pae virtual

Change it in:

getall i386 generic generic-pae virtual tty

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

Search for the line:

flavours        = generic generic-pae virtual

Change it in:

flavours        = generic generic-pae virtual tty

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

cp debian.master/control.d/vars.generic debian.master/control.d/vars.tty

You can edit the file and make it your own.

arch="i386 amd64"
supported="TTY"
target="Geared toward TTY 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 "TTY 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/maverick
Create independent packages:

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

The above statement will create the following deb files:

linux-headers-2.6.35-23_2.6.35-23.40_all.deb
linux-tools-common_2.6.35-23.40_all.deb
linux-doc_2.6.35-23.40_all.deb
linux-source-2.6.35_2.6.35-23.40_all.deb 

Create the tools package:

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

The above statement will create the following deb file:

linux-tools-2.6.35-23_2.6.35-23.40_i386.deb

Create the flavour depended files:

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

The above statement will create the following deb files:

linux-headers-2.6.35-40-tty_2.6.35-23.40_i386.deb
linux-image-2.6.35-23-tty_2.6.35-23.40_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-23-tty_2.6.35-23.40_i386.deb linux-headers-2.6.35-23_2.6.35-23.40_all.deb linux-image-2.6.35-23-tty_2.6.35-23.40_i386.deb

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

Reboot and enjoy your newly installed Ubuntu 10.10 kernel.

This article is filed under the categories Ubuntu » Compile a kernel and has the following tags associated with it: , , .

For more of the same articles see the page Compile a kernel for Ubuntu overview
Showing 10 comments
Skip to the end and leave a comment.
  1. Richard Tripp

    There is a typo in your article.

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

    should be

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

    Otherwise great. Got everything installed and it runs real nice.

    Thanks for taking the time to write the howto. It was very helpful.

    • Peter

      Thanks for the catch Richard, I’ve corrected the article accordingly.

  2. Daniel Bruce

    Hi Peter. Excellent article.

    Instead of applying the patch, I used the userspace method and it worked really well. I was able to compile a kernel (using your previous post), play a full HD video with flash, run glxgears, and play a full screen 3d game on wine with no stuttering or response problems.

    I don’t know how much the typical linux user will benefit from this patch (most users don’t peg all their CPU’s at 100% by launching processes in separate ttys) but for me this is a wonder patch.

  3. Michael Stephenson

    What a chore, can’t you just dput your .dsc to a launchpad ppa and save us the trouble?

  4. Ranga

    Thanks for excellent instructions. Worked well.

    I had to install libnewt-dev for the compilation steps (binary-indep etc.) to go through. I did come across a few warnings during execution of “skipabi=true skipmodule=true fakeroot debian/rules binary-tty”

    • Peter

      Sometimes when you check and/or uncheck certain options in the kernel configuration you need to install extra packages.

  5. Patrick J. Culliton

    Peter,

    I have used GNU/Linux for 5 or 6 months now. I was lucky enough to get my hands on a Dell Laptop (Latitude PP01L) and I installed Ubuntu on it. I’m up to 10.10 now and when I heard about this Kernel ‘patch’ on Linux Today I couldn’t help but try it.

    I am proud to say I got this installed on this Dell laptop and I am writing this on it now.

    I found the instructions a little hard to follow but that might be a good thing. I accidently put the ‘source’ in the ‘root’ folder, if the ‘root’ is a folder?… anyway recovered from that mistake and got the kernel compiled.

    It took 26 hours to compile on this laptop. I think its a P4 1.8 GHz? Wish I knew that before I started!!!

    Anyway. All went well and everything seems to be running fine.

    Thanks you so much for this article.

    Paddy Joe.

  6. Eugene

    Hi Peter!

    Thanks for your articles.

    I have error in last compilation stage:

    run-parts: executing debian/tests/check-aliases
    Checking for dupe aliases in eup…
    Could not open /home/eugenep/linux/kernel/Lucid/git/source/debian/linux-image-2.6.32-27-eup/lib/modules/2.6.32-27-eup/modules.alias at debian/tests/check-aliases line 10.
    run-parts: debian/tests/check-aliases exited with return code 2
    make: *** [install-eup] Error 1

    Do you have any idea what wrong ?

    • Peter

      I’m not really sure. Did you forget to copy the generic.modules to your flavour.modules?

      • Eugene

        No. I did not. I checked it now. I did all steps.

  7.  

Leave a comment

For questions and/or support consider using the forums.

download