Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Kernel Patching
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
jargon2001
n00b
n00b


Joined: 05 May 2004
Posts: 6
Location: Michigan

PostPosted: Sat May 08, 2004 4:43 pm    Post subject: Kernel Patching Reply with quote

I'm on my 7th attempt to build a HTPC using MythTV, PVR-350, etc. I've been reading through the forums about making the PVR-350 remote work with lircd. It seems I need the i2c-2.8.0 patch. I downloaded the patch; however, I'm not sure how to properly apply it. I'm running the gentoo-sources 2.4.25r2. Here's the name of the patch: linux-2.4.25-i2c-2.8.4.patch.gz

Thanks
Back to top
View user's profile Send private message
Vitaliy
Guru
Guru


Joined: 06 Apr 2004
Posts: 451
Location: Brooklyn, NY

PostPosted: Sat May 08, 2004 5:04 pm    Post subject: Reply with quote

Quote:
How do I apply a patch ?


The answer to this depends on how the patch was created, specifically to which directory the patch is done from. In general though, patches are done in the root of the source tree (/usr/src/linux), and the following assumes this.

For example's sake, you have unpacked a tarball of Linux 2.4.0, and you want to apply Linus' patch-2.4.1.bz2, which you have placed in /usr/src. Do the following :

cd /usr/src/linux
bzip2 -dc /usr/src/patch-2.4.1.bz2 | patch -p1 --dry-run

We used the --dry-run option to check that the patch applies cleanly. This can be a life-saver sometimes as it can be a real pain to back out a partially-applied patch. The -p1 option strips off part of the diff file's pathnames for each changed file (see the patch(1) manpage for more details). Now you've checked that it should apply cleanly, do :

bzip2 -dc /usr/src/patch-2.4.1.bz2 | patch -p1

to actually apply it. You're done !
This is actually simple with Linus' standard patches, as you can use the script linux/scripts/patch-kernel to automatically do the patches for you.

The situation with other patches is not always so simple. For example, Linus' pre patches (found in pub/linux/kernel/testing) are not incremental, That is pre10.bz2 must be applied on top of the tarball of the previous full release kernel. Eg, patch-2.4.8-pre2 goes on top of an unpacked 2.4.7 tarball, *not* on top of a patched 2.4.8-pre1 kernel. If you have a 2.4.8-pre1 kernel, you can get back to 2.4.7 by following the section 'Reversing a patch' below.

Alan Cox's ac patches (pub/linux/kernel/people/alan/) follow the same method, unless you get the incremental patches from bzimage.org.

Occasionally you may want to test a patch from linux-kernel or similar. Generally these will be incremental against the named version (so, say, 2.4.0-test1-ac22-hosedmm.diff should be applied against 2.4.0-test1-ac22), and relative to the root. You may need to play with the -p option.

Reversing a patch
You've applied several patches, and now you want to remove them. Simply use the -R option to patch, with the same patch file, to back out the patch (alas, the patch(1) manpage is less than clear on this).
Back to top
View user's profile Send private message
jargon2001
n00b
n00b


Joined: 05 May 2004
Posts: 6
Location: Michigan

PostPosted: Tue May 11, 2004 12:51 am    Post subject: Reply with quote

Vitaliy,

That did the trick. Thank you for your help.


jargon2001
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum