Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to patch kernel sources?
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
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Sun Sep 30, 2012 7:17 am    Post subject: How to patch kernel sources? Reply with quote

How can I apply the following patches to vanilla-sources-3.2.30?

https://github.com/beagleboard/kernel/tree/beaglebone-3.2/patches/3.2.30

How about these to git-sources-3.6_rc7?

https://github.com/beagleboard/kernel/tree/beaglebone-3.6/patches
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54028
Location: 56N 3W

PostPosted: Sun Sep 30, 2012 11:36 am    Post subject: Reply with quote

grant123,

cd /usr/src/linux_sources
get patch_file to ./

patch < patch_file

watch for failed hunks and manually clean up the mess.

Code:
man patch

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Sep 30, 2012 2:30 pm    Post subject: Reply with quote

grant123 ...

I'd suggest using '--dry-run' first as then you will be provided with some idea if the patch will apply cleanly or not.

Code:
patch -p1 --dry-run -d /usr/src/linux <patch.diff

'-p[N]' is the number (path) to strip off the patch header, so if the patch is a unified diff from /usr/src then one level should be stripped as in the above we are supplying the path (-d) to the kernel sources.

best ... khay
Back to top
View user's profile Send private message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Mon Oct 01, 2012 2:18 pm    Post subject: Reply with quote

All I get are failed hunks unfortunately:

# patch -p1 --dry-run -d /usr/src/linux <0134-VFS-make-vfs_fstat-use-f-get-put-_light.patch
patching file fs/stat.c
Hunk #1 FAILED at 57.
1 out of 1 hunk FAILED -- saving rejects to file fs/stat.c.rej

Can I add an epatch line for this somewhere in the ebuild instead?

EAPI="2"
K_NOUSENAME="yes"
K_NOSETEXTRAVERSION="yes"
K_SECURITY_UNSUPPORTED="1"
K_DEBLOB_AVAILABLE="1"
ETYPE="sources"
inherit kernel-2
detect_version

DESCRIPTION="Full sources for the Linux kernel"
HOMEPAGE="http://www.kernel.org"
SRC_URI="${KERNEL_URI}"

KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
IUSE="deblob"
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Mon Oct 01, 2012 4:29 pm    Post subject: Reply with quote

grant123 wrote:
Can I add an epatch line for this somewhere in the ebuild instead?

Do not expect things that you cannot achieve "manually" to automagically become possible thanks to an ebuild.

If you want to patch an x.y.z kernel then, take the patch designed for this version.
If you cannot then... you are on your own and MUST know exactly what you are patching and why in order to adapt.

In the failure you mention, it simply appears that stat.c significantly evolved between the 3.2 you get and the 3.2.30 the patch was designed for. And that the patch designed for 3.2.30 no longer recognizes what should be modified. => Cant be applied.

Then, depending on your knowledge of the code, you may know what to do to adapt the patch or at least know if it is critical to get it or not so that you can drop it.

Well... at the end of the day... you are not in the worst situation... if you do not know the code and patch it blindly, the patch command might well work and... create a mess you would detect... at runtime...

Another thing. The patchset you mention is rather huge. I believe that each individual patch must be applied in a given order. Did you follow it scrupulously ?
_________________
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54028
Location: 56N 3W

PostPosted: Mon Oct 01, 2012 5:10 pm    Post subject: Reply with quote

grant123,

I I was doing what I think you are doing ... and I am playing with a Raspberry Pi,

I would clone the git repository and get a ready patched kernel.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Tue Oct 02, 2012 7:37 am    Post subject: Reply with quote

Thanks guys. There is a patch.sh script I'm going to use instead.
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