Upgrading a kernel
Inevitably it happens, you have a custom built kernel, working just
wonderfully except for one little thing that you know is fixed in the
latest release from the kernel developers. Or a security problem is found,
and a new stable kernel release is made public. Either way, you are faced
with the issue of upgrading the kernel and you do not want to lose all the
time and effort that went into making that perfect kernel configuration.
This chapter is going to show how easy it is to update a kernel from an
older versions, while still retaining all of the configuration options from
the previous one.
First off, please back up the .config file in the
kernel source directory. You have spent some time and effort into
creating it, and it should be saved in case something goes wrong when
trying to upgrade.
cp .config ../good_config
There are only five simple steps that are needed to upgrade a kernel from a
previously built one:
Get the new source code.
Apply the changes to the old source tree to bring it up to the newer level.
Reconfigure the kernel based on the previous kernel configuration.
Build the new kernel.
Install the new kernel.
The last two steps work the same as described before, so we will only
discuss the first three steps in this chapter.
In this chapter, we are going to assume that you have built a successful
188.8.131.52 kernel release, and want to upgrade to the 184.108.40.206 release.
The Linux kernel developers realize that all users do not wish to download
the entire source code to the kernel for every update. That would be a
waste of bandwidth and time. Because of this, they offer a patch
that can upgrade an older kernel release, to a newer one.
On the main kernel.org website, you will remember that
it contained a list of the current kernel versions that are available for
Figure 7.1. The main kernel.org web site
Previously, you used the link pointed to you by the F to
download the entire source code for the kernel. However, if you click on
the name of the kernel release, it will download a patch file instead:
Figure 7.2. Downloading a patch from kernel.org
This is what we want to do when upgrading. But we need to figure out what
patch to download.
Which patch applies to which release?
A kernel patch file only will upgrade the source code from one specific
release to another specific release. Here is how the different patch files
can be applied:
Stable kernel patches apply to the base kernel version. This means that
the 220.127.116.11 patch will only apply to the 2.6.17 kernel release. The
18.104.22.168 kernel patch will not apply to the 22.214.171.124 kernel or any other
Base kernel release patches only apply to the previous base kernel version.
This means that the 2.6.18 patch will only apply to the 2.6.17 kernel
release. It will not apply to the last 2.6.17.y kernel release, or any
Incremental patches upgrade from a specific release to the next release.
This allows developers to not have to downgrade their kernel and then
upgrade it, just to switch from the latest stable release to the next
stable release (remember that the stable release patches are only against
the base kernel, not the previous stable release.) Whenever possible, it
is recommended that you use the incremental patches to make your life
As we want to go from the 126.96.36.199 kernel release, to the 188.8.131.52
release, we will need to download two different patches. We will need a
patch from the 184.108.40.206 release to the 220.127.116.11 release, and then from the
18.104.22.168 release to the 22.214.171.124 release.
The stable and base kernel patches are located in the same directory
structure as the main source trees. All incremental patches can be found
one level lower, in the incr subdirectory. So, to
find the patch that goes from 126.96.36.199 to 188.8.131.52, we look in the
/pub/linux/kernel/v2.6/incr directory to find the
files we need:
cd ok, cwd=/pub/linux/kernel/v2.6/incr
-rw-rw-r-- 1 536 536 2872 Aug 22 19:23 patch-184.108.40.206-10.bz2
2872 bytes transferred
7901 bytes transferred
good_config linux-220.127.116.11/ patch-18.104.22.168-11.bz2 patch-22.214.171.124-10.bz2