Skip navigation.

70池中之物

Ray's BLOG

Use Debian official kernel package

This is about recompiling kernel, but not only recompiling kernel.

My general way to update my Linux kernel on my distribution would be,

1, go to kernel.org.
2, download whatever version you need.
3, unpack it and make menuconfig.
3.1, or maybe you want to patch something before you really start config.
4, make bzImage && make modules && make modules_install
5, copy your new Linux image to your boot loader recoganized dir.
6, make a initrd image if neccesary.
7, update your boot loader config entry and reboot.
8, pray and then the world becomes a new one.

But now, I want to use the source tree from Debian official releasing rather than the original one, how?
But now, I don't want to touch make or other basic tools, would a decent script help me to finish all above?

We can start from getting Linux source tree from debian.

# apt-get install linux-tree-`uname -r` # here we will take 2.6.18-4 as `uname -r` result for example.

You may also need the following packages, linux-source-2.6.18, kernel-package, make-kpkg, fakeroot. And normally a general patch package is also installed, linux-patch-debian-2.6.18.

After lots of google work, I have now figured out how is the relationship between linux-tree package and linux-patch package.

linux-patch-debian-2.6.18 contains all the patches made by Debian, and some scripts for applying or unpatching those patches to linux kernel. After installing, the contents are put in /usr/src/kernel-patches/.

linux-tree-2.6.18 contains the latest kernel source package, after installing you will find the .bz2 file from /usr/src. Unpack it you will get the source tree.

Tricky:

Debian official released kernel version is composed by linux kernel version and patch level, 2.6.18-8 means this linux kernel is based on Linux 2.6.18 and with Debian's patch of level 8.

To find out which version of your linux source tree, navigate to /usr/src/linux-source-2.6.18 (or whereever you unpacked the previous .bz2 file), and 'cat version.Debian'. That might be '2.6.18-6' or something similar, but most probably this will not match with your current running kernel (it might be '2.6.18-4' or else).

Now navigate to '/usr/src/kernel-patches/all/2.6.18/apply' and 'cat debian', from the header part, you can see the capability of this patch set from this line.

_default_revisions = "1 2 3 4 5 6 7 8 9 10"

That means by applying this patch to your source tree, you can get the kernel source with different patch level (from 2.6.18-1 to 2.6.18-10). And that would farily easy.

# cd /usr/src/kernel-patches/all/2.6.18/apply && ./debian 2.6.18-9
=> will upgrade your source tree from 2.6.18-8 to 2.6.18-9.

# cd /usr/src/kernel-patches/all/2.6.18/apply && ./debian 2.6.18-4
=> will downgrade your source tree to 2.6.18-4, which matches your current running kernel.

Tricky end.

Till this step, you have got the Debian official released kernel source and can easily change to different patch level.

From next step, you can either use my general way to compile and install kernel imag. Or, you can select to use Debian way to install.

1, cd /usr/src/linux-source-2.6.18
2, make menuconfig # Yes, still need this :frown:
3, fakeroot make-kpkg clean
4, fakeroot make-kpkg --initrd --revision=custom.1.0 kernel_image

Yes, this is a script, but you difinitely need to read the manual carefully to get what you really want. And hopefully if everything runs well, you will get a .deb file (linux-image-2.6.18_custom.1.0_i386.deb), which is a redistributable kernel package.

5, install your new kernel, of cource to use "dpkg -i ../linux-image-2.6.18_custom.1.0_i386.deb". And then just reboot, because dpkg will handle all bootloader upgrade stuff.

All done :smile:

As an alternative way of using Debian official released kernel source, you can also try to get the preconfigured source package via 'apt-get source linux-major' and follow the guide from http://kernel-handbook.alioth.debian.org/ch-common-tasks.html, section 4.2.

But this need a valid source apt source. Not tried this yet.




北京城区地面数字电视收视指南高清电视收视软件

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies

December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31