HowtoPatchKernel
From Paldo
This guide will explain you how to patch your kernel with a patch. For this guide I'm using the hdaps-kernel-2.6.2X-X.patch.
Contents |
[edit] Preparing the folders
Create a dir construction like this:
sources/linux-2.6 specs
[edit] Mod the spec file
Download the newest linux-2.6.xml from the paldo.org server to the specs folder.
Now change to the specs folder.
Create a new file called link-server and post this content to it:
#!/bin/bash # sed -i -e 's%<patch name="%<patch name="http://www.paldo.org/paldo/sources/linux-2.6/%' ./linux-2.6.xml sed -i -e 's%<archive name="%<archive name="http://www.paldo.org/paldo/sources/linux-2.6/%' ./linux-2.6.xml
Make it executable via:
chmod a+x ./link-server
Run the script via:
./link-server
You have linked the needed packages to the server paldo.org, otherwise you have to download all needed files to your local repository.
Open now the XML-file and scroll down to this part:
stable
<!-- KERNEL -->
<archive name="http://www.paldo.org/paldo/sources/linux-2.6/linux-2.6.20" srcdir="linux-$TAG">
<patch name="http://www.paldo.org/paldo/sources/linux-2.6/linux-$VERSION"/>
<patch name="http://www.paldo.org/paldo/sources/linux-2.6/linux-$VERSION-nozomi"/><!-- HSDPA Broadband PCMCIA card, already in -mm -->
<patch name="http://www.paldo.org/paldo/sources/linux-2.6/linux-$VERSION-unionfs-1"/><!-- add unionfs, already in -mm -->
<archive name="http://www.paldo.org/paldo/sources/linux-2.6/linux-agp-compat-$AGPVERSION"><!-- update agp support for i915tex -->
<cmd>cp -v agp.h backend.c frontend.c generic.c intel-agp.c isoch.c ../drivers/char/agp/</cmd>
</archive>
testing
<!-- KERNEL -->
<archive name="http://www.paldo.org/paldo/sources/linux-2.6/linux-2.6.21" srcdir="linux-$TAG">
<patch name="http://www.paldo.org/paldo/sources/linux-2.6/linux-$VERSION"/>
<patch name="http://www.paldo.org/paldo/sources/linux-2.6/linux-$VERSION-nozomi"/><!-- HSDPA Broadband PCMCIA card, already in -mm -->
<archive name="http://www.paldo.org/paldo/sources/linux-2.6/squashfs$SQUASHFSVERSION"><!-- add squashfs support - improves rescue / live cds -->
<cmd>patch -d .. -Np1 < kernel-patches/linux-2.6.20/squashfs3.2-patch</cmd>
</archive>
[edit] Add the patch to the package linux-2.6
- Download the .patch file to sources/linux-2.6 (hdaps-kernel-2.6.2X-X.patch)
- Pack the .patch file to a .patch.bz2 file with this command:
bzip2 ./*.patch
- Add the .patch file to the spec:
<!-- KERNEL -->
<archive name="http://www.paldo.org/paldo/sources/linux-2.6/linux-2.6.21" srcdir="linux-$TAG">
<patch name="http://www.paldo.org/paldo/sources/linux-2.6/linux-$VERSION"/>
<patch name="hdaps-kernel-2.6.2X-X"/><!-- your patch located in your local repo -->
<patch name="http://www.paldo.org/paldo/sources/linux-2.6/linux-$VERSION-nozomi"/><!-- HSDPA Broadband PCMCIA card, already in -mm -->
<archive name="http://www.paldo.org/paldo/sources/linux-2.6/squashfs$SQUASHFSVERSION"><!-- add squashfs support - improves rescue / live cds -->
<cmd>patch -d .. -Np1 < kernel-patches/linux-2.6.20/squashfs3.2-patch</cmd>
</archive>
Use the same name as the bz2-tarball without .bz2 in it.
[edit] Install the moded kernel to your paldo system
If you renamed your kernel you have to edit also the global.xml-Spec in your local repository.
These are the relevant lines:
<branch name="testing"> <settings> <toolchain>glibc-2.6-gcc-4.2-1</toolchain> <builddir>/usr/src</builddir> <statedir>/var/lib/upkg</statedir> <chrootdir>/upkg</chrootdir> <staging>no</staging> <binary>yes</binary> <environment name="PATH">/bin:/usr/bin:/sbin:/usr/sbin:/stage2/bin:/stage2/sbin</environment> <environment name="DISTRIB_RELEASE">1.14</environment> <environment name="LDFLAGS">$LDFLAGS</environment> <environment name="LINGUAS">en en_US en_GB de de_CH de_DE fr fr_CH fr_FR it it_CH it_IT es pt pl ru tr</environment> <variable name="DOCDIR">/usr/share/doc/$NAME</variable> <variable name="LDFLAGS">-Wl,-O1 -Wl,--hash-style=both</variable> <variable name="LINUX_VERSION">2.6.25.4-paldo2-$ARCH</variable> </settings>
You've to edit this LINUX_VERSION">2.6.25.4-paldo2-$ARCH to your version.
Add the local repo to your local upkg.conf file with this command:
$ su Password: enter your root password # sed -i -e 's%<repositories>%&\n<repository>path/to/your/kernel/repo/</repository>%' /etc/upkg.conf
Install the moded kernel with this command:
upkg-build --disable-binary linux-2.6

