A few days ago I revised my How to compile a custom kernel for Ubuntu Jaunty as the Ubuntu kernel developers made some changes to the kernel source, effecting the old way of compiling your own custom kernel.
These changes also effect if you want to update your own kernel with the newest kernel from the git repository.
This article assumes you have followed the directions of my previous article.
Just to refresh your memory, we have our kernel source in the following directory /d1/packaging/kernel/jaunty/source and we have two branches, master and core2.
Upgrading the source
It’s time to get the new kernel source.
We’re going to update our master branch and use the master branch to update our own core2 branch.
Go to the kernel source directory and check which branch you are on
cd /d1/packaging/kernel/jaunty/source
git branch
The output will look something like this
* core2
master
The asterisk in front of core2 indicates that is the active active branch. We need to switch to the master branch.
git checkout master
If you have a problem switching to the master branch and you are stuck in the core2 branch use the following commands
git reset HEAD --hard
git clean -xdf
git checkout master
To update the master branch with the latest kernel source we need to pull the sources from the remote git repository
git pull
We now have the latest kernel source but we don’t want the updates that are part of the release that is still in progress. To determine the latest release:
less debian.master/changelog
The output will look something like this.
linux (2.6.28-15.53) UNRELEASED; urgency=low
CHANGELOG: Do not edit directly. Autogenerated at release.
CHANGELOG: Use the printchanges target to see the curent changes.
CHANGELOG: Use the insertchanges target to create the final log.
-- Stefan Bader Tue, 08 Sep 2009 16:28:39 +0200
linux (2.6.28-15.52) jaunty-proposed; urgency=low
We will be updating our custom Ubuntu kernel with version 2.6.28-15.52
We need to switch to the core2 branch and make sure it’s clean
git checkout core2
git reset HEAD --hard
git clean -xdf
To update the our branch we need merge from the master branch but we only want the updated sources up to version 2.6.28-15.52, luckily the Ubuntu kernel developers use tags in git for each kernel release. The tag is made up of Ubuntu-
Ubuntu-2.6.28-15.52
We merge the kernel sources up to the version selected.
git merge Ubuntu-2.6.28-15.52
As we have created our own flavor and added the files to the abi directory we need to move these. First we need to determine the old and new directories in the abi directory.
ls debian.master/abi
The output will look like this
2.6.28-15.49 2.6.28-15.51 perm-blacklist
To move our own files we’ll use git again.
git mv debian.master/abi/2.6.28-15.49/ debian.master/abi/2.6.28-15.51/
Lets commit our changes
git commit -a -m "Core2 modifications"
The text after -m is the message you add to your commit.
I personally also like to tag my commits, but this is not necessary, you can skip this part if you want to.
git tag avh-2.6.28-15.52
We are set to start our compilation process.
Compilation
To get started we need to intialize the debian directory by executing the following command
fakeroot debian/rules clean
To start the compilation.
CONCURRENCY_LEVEL=2 NOEXTRAS=1 skipabi=true skipmodule=true fakeroot debian/rules binary-core2
Because I have a Dual Core I want to utilize both processors by setting the CONCURRENCY_LEVEL. Set this to the amount of processors you have, if you have only one, just skip it completely. Now grab yourself some coffee or watch your favorite show while we’re compiling.
After the compilation is complete, it’s wise to also run the following. This doesn’t take as long as the previous compile session.
CONCURRENCY_LEVEL=2 NOEXTRAS=1 skipabi=true skipmodule=true fakeroot debian/rules binary-indep
Installation
After the compilation is finished we’ll have several deb files in the parent directory. To install the files
cd ..
dpkg -i linux-image-2.6.28-15-core2_2.6.28-15.52_i386.deb
dpkg -i linux-headers-2.6.28-15-core2_2.6.28-15.52_i386.deb linux-headers-2.6.28-11_2.6.28-11.52_all.deb
Check your bootloader if the newly installed kernel is the default one, for grub check the file /boot/grub/menu.lst
Reboot and enjoy your newly installed kernel.
