Differences between revisions 13 and 110 (spanning 97 versions)
Revision 13 as of 2008-02-29 18:41:11
Size: 4237
Editor: rrs
Comment: The commands listed were incorrect. The change lists the correct commands.
Revision 110 as of 2018-09-25 20:49:30
Size: 482
Editor: BenHutchings
Comment: Update kernel-handbook URL
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= This Page is about Rebuilding an official Debian kernel package =
There is the Kernel Handbook about this:
#language en
||<tablestyle="width: 100%;" style="border: 0px hidden">~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English - [[it/HowToRebuildAnOfficialDebianKernelPackage|Italiano]]-~||<style="text-align: right;border: 0px hidden"> (!) [[/Discussion|Discussion]]||
Line 5: Line 4:
We are following section 4.2: '''Rebuilding an official Debian kernel package''' See the Kernel Handbook section [[https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official|Rebuilding official Debian kernel packages]].
Line 7: Line 6:
 * Reasons to do this:
  1.#1 Modifying the Debian configuration to change the '''preemption model'''.
  1.#2 Modifying the Debian configuration to change the '''timer frequency'''.
  1.#3 Modifying the Debian configuration to change to '''Pata'''.
  1.#4 Add an patch fix.
  1.#5 Add your favorite patchset.
What you'll get is exactly the kernel that Debian releases but with those added changes.

== Add a Patch to linux-2.6 ==

First get the orig tar ball from buildserver, see [DebianKernel], unpack it:
~/src$ tar xzf linux-2.6_2.6.24~rc6.orig.tar.gz

Get latest Debian patches + config settings:
~/src/linux-2.6-2.6.24-rc6$ svn export svn://svn.debian.org/svn/kernel/dists/trunk/linux-2.6/debian

Now you can start adding patches inside the patches dir. To have them applied don't forget to add them to the series file.

~/src/linux-2.6-2.6.24~rc6$ cp ~/special-fix.patch debian/patches/bugfix/
~/src/linux-2.6-2.6.24~rc6$ echo "+ bugfix/special-fix.patch" \
  >> debian/patches/series/1~experimental.1

Now check that your patchset still applies and fix some eventual conflicts
~/src/linux-2.6-2.6.24~rc6$ make -f debian/rules source-all

Then build with appropriate DEBIAN_KERNEL_JOBS according to the box core cpu number:
~/src/linux-2.6-2.6.24~rc6$ DEBIAN_KERNEL_JOBS=${NR_CPUS} debuild

== 10 easy (albeit time consuming) steps ==
Assuming you are just interested in building one flavor of a kernel-image.

 1. Create the directory where you will build the kernel package as a normal user.
 1.#2 Get the kernel source. You could install the kernel source package:
apt-get install linux-source-2.6

 1.#3 Download the Debian diff.gz file. That is the file that contains all the Debian changes for this kernel package. E.g http://ftp.debian.org/debian/pool/main/l/linux-2.6/linux-2.6_2.6.20-3.diff.gz
 1.#4 Patch the source with that. Cd into the tree of where you put the source, e.g. /home/hugo/linux-2.6.20-3-build/linux-2.6.20. You created linux-2.6.20-3-build and your script put linux-2.6.20 into it, cd into the latter and then:
zcat <path>linux-2.6_2.6.20-3.diff.gz| patch -p1
Now your tree holds the source and all changes Debian made to it.
 1.#5 '''Make debian/rules executable'''. In your tree there is a directory named '''debian''', in there is a file called '''rules''', that has to be made executable, because it is executed.
 1.#6 '''Change the file debian/bin/abicheck.py'''. After line 18 that contains '''ret = 0''' add a line that says '''return 0'''. This will stop you from doing the abicheck.
 1.#7 Prepare the tree for build. Still in the tree directory where you patched, do:
fakeroot debian/rules debian/build debian/stamps
fakeroot make -f debian/rules.gen setup_i386_none_k7
This presumes you are only interested in building a k7 AMD processor image! If you where interested in a 686 processor image do:
fakeroot make -f debian/rules.gen setup_i386_none_686
This will build a tree in the debian/build/build-i386-none-k7 or debian/build/build-i386-none-686 directory. Cd to that directory.
 1.#8 Change the .config file. Do:
make menuconfig
and make any changes you had in mind. E.g the changes mentioned above in '''Reasons for doing this'''. Also this is the time to add additional patches, e.g. the Debian Logo patch.
 1.#9 Compile the kernel and generate the image and headers debs. Do:
fakeroot make -f debian/rules.gen binary-arch_i386_none_k7
fakeroot make -f debian/rules.gen binary-arch_i386_none_686
And on a 2.0GHz CPU the compile will take 1 hour and 20 minutes and 2 deb files will be generated: the image file and the headers file, e.g.
 1.#10 Install them with dpkg and now you have installed the stock Debian kernel with your changes in it. Congratulations ;-)
 . CategoryKernel

Translation(s): English - Italiano

(!) ?Discussion

See the Kernel Handbook section Rebuilding official Debian kernel packages.