LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-05-2007, 04:40 AM   #1
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
How can I use this patch file?


Hi everyone,

This is my first time to encounter a patch file and I do not know how to use it. When I looked at the man page of patch, I tried to use what it said:

patch -p0 < gcov_ker

but it gives me an error stating something like the file does not exist.

The patch file that I am trying to use is located at this page:

http://downloads.sourceforge.net/ltp...5&big_mirror=1

I browsed this file and I guess some parts of it was garbage so I am really not sure if it was the command that does work, or the file isn't just working.

I am using an embedded linux distribution: MontaVista Linux Professional Edition kernel version 2.6.10.

I have seen that parts of the patch file was for 2.4.xx and parts of it was for 2.6.xx.

I have verified that the kernel source really does not have the corresponding gcov files that this patch was supposed to patch, but I guess that this patch will create those files if they do not exist. I am really not sure.

I hope someone can help me on how to use this patch file.

Thanks!
-archie
 
Old 12-05-2007, 06:53 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
I went ahead and d/l the file from the url you provided. It contains patches for kernels 2.4.21and 2.4.25 for the 2.4 series and for 2.6.4, 2.6.5, 2.6.14-2.6.22 for the 2.6 series.
So unfortunately your kernel (2.6.10) does not match any of the above. Either you upgrade your kernel to one of the supported versions, or you can try to use the patch for 2.6.14 to see if it works. To do so copy the patch in /usr/src and create a symlink to your kernel:
Code:
cp linux-2.6.14-gcov.patch /usr/src
ln -s /usr/src/linux-2.6.10 /usr/src/linux-2.6.14
Then:
Code:
cd /usr/src
patch -p0 < linux-2.6.14-gcov.patch
Good luck
 
Old 12-05-2007, 06:56 AM   #3
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
I wouldn't recommend patching a kernel that the patch isn't made for; if it's possible, rather upgrade to a kernel that the patch is meant for. Less trouble that way.
 
Old 12-05-2007, 11:24 AM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
If you wanted to apply a patch for a 2.6.14 kernel and you're running 2.6.10, that means you'll need to patch your kernel to become 2.6.14 before applying this patch. That means you'd have to download the 2.6.11, 2.6.12, 2.6.13 and then 2.6.14 and patch them in order.

In those cases, it's just easier to download the whole kernel, 2.6.14 and recompile with the patch if needed. Or you could possibly download a even later version that includes this patch.

Why are you patching anyways? Is it something specific to add support for hardware? I mean, you say you ran across a patch file but is there a reason or did you just happen to run across it and think you need it?
 
Old 12-11-2007, 12:26 AM   #5
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Original Poster
Rep: Reputation: 41
Thanks for your suggestion guys! Sorry for the late reply.

Basically I need to patch my kernel to have the gcov application. I would like to run coverage tests on my kernel modules, which can be done by this patch.

I have tried bathory's suggestion, but I encountered an error while loading my modules. It says something like disagrees with the version of struct_module, and invalid module symbol. My module is working properly before I tried the 2.6.14 patch. When I also tried to apply the patch, I expected that the gcov module will be loaded automatically, but it does not. It says on my book that for a module to be loaded, it has to have the ".ko" extension, but object files produced on the drivers/gcov/ folder are just ".o".

Ah so does it mean, if I have to upgrade my kernel to 2.6.18, I have to apply the patches from 2.6.11, 2.6.12, 2.6.13, 2.6.14, 2.6.15, 2.6.16, 2.6.17.... Do I have to compile the kernel in every patch? (execute "make menuconfig" then "make", is this correct?) This can take half a day... :-(

Thank you so much!

by the way this is the site of the linux distribution that I cam curently using, http://www.mvista.com/product_features_pro.php

Their newest kernel version is 2.6.18.. I wonder where can I get the 2.6.11 to 2.6.17 patches...

Last edited by archieval; 12-11-2007 at 12:30 AM. Reason: indicate ddistribution site
 
Old 12-11-2007, 06:23 AM   #6
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
No, only download patches how trickykid said. They apply of top of the previous one for 2.6.X
As soon as they have all passed without reject file, you can build.

If you have a good bandwidth, dl directly the 2.6.14, patch it with your patch and build.
 
Old 12-11-2007, 07:36 AM   #7
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Yeah, never patch if you need to go up more than 2 versions. Just download the version you need, the full and complete source, then apply your separate patch, then recompile. No reason to apply a dozen patches when you can do it with one download, one patch and one recompile.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
patch problem - can't find file to patch jnutt Linux - Kernel 3 02-10-2010 03:45 PM
How to use .patch file? tobiasw Linux - Newbie 2 10-24-2006 08:05 AM
Regarding Patch file yugandhar Linux - Software 1 07-04-2006 07:55 AM
About patch file yugandhar Linux - General 1 07-04-2006 07:23 AM
how do i patch a file Hockeyfan Linux - Newbie 1 05-09-2004 03:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration