You are not logged in.

#1 2013-02-27 14:26:44

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

[SOLVED] Best way to patch kernel

Hello,

I need to apply a single patch to the kernel to make my AverMedia Volar Green HD (A835B) work. However, this need a kernel recompilation every single time the kernel updates. I need to pull the latest abs tree, alter the PKGBUILD (1 single line) and build it.
Is there any solution to all that mess?
I use the default kernel, but right now I'm testing linux-ck. What can I do? Is there any specific folder that i put all my patches and yaourt applies it? or any way to build the specific module I need with the patch applied outside of the kernel?
Also, I have an nvidia card and I use the propriety drivers (I need 3D acceleration). It may cause some trouble...

Last edited by ttouch (2013-04-27 06:51:35)

Offline

#2 2013-02-27 14:51:14

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [SOLVED] Best way to patch kernel

ttouch wrote:

I need to pull the latest abs tree, alter the PKGBUILD (1 single line) and build it. Is there any solution to all that mess?

That doesn't really sound like a mess to me. hmm Add the patch to the kernel you want to use (official from ABS, linux-ck...) and use makepkg.

You're right, there is a way to rebuild only the module you patched, but I unfortunately don't know how to do that. I'd just take the lazy way and use the ABS. tongue

Offline

#3 2013-02-27 15:22:58

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

Re: [SOLVED] Best way to patch kernel

but I have to do all the abs thing EVERY time...

Offline

#4 2013-02-27 15:25:54

SidK
Member
Registered: 2011-03-03
Posts: 116

Re: [SOLVED] Best way to patch kernel

You can use https://aur.archlinux.org/packages/customizepkg/ to help things along but, yes, you will have to compile the kernel on every update (which a lot of us do anyway if we're using -ck/...)

Offline

#5 2013-02-27 16:12:41

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

Re: [SOLVED] Best way to patch kernel

I want to be able to just yaourt -Syua. Editing the PKGBUILD every single time is not a smart way of maintaining your system...
EDIT: customizepkg is just what I needed! thank you!

Last edited by ttouch (2013-02-27 16:19:17)

Offline

#6 2013-02-27 16:19:36

progandy
Member
Registered: 2012-05-17
Posts: 5,193

Re: [SOLVED] Best way to patch kernel

You can automate it further, if customizepkg is not enough. Create your own script that does the following:
- sync abs
- compare kernel version in abs to version in your custom PKGBUILD
- if new kernel available:
- - clean build dir
- - copy new PKGBUILD and patches
- - add your patch file, mdsum and patch command
- - run makepkg
- - run pacman and wait for user to complete installation

Last edited by progandy (2013-02-27 16:20:16)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#7 2013-02-27 17:06:23

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] Best way to patch kernel

For a better long-term solution, you should submit the patch upstream (check if it's already been submitted first, of course).

Offline

#8 2013-02-27 18:24:02

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

Re: [SOLVED] Best way to patch kernel

@prograndy: wow, thats an overkill tongue it's a single patch
@tomk: where? I mean the arch official kernel?
It doesn't work with customizepkg 99.99% my mistake.
Here is my /etc/customizepkg.d/linux-ck:

replace#global#patch -p1 -i "${srcdir}/patch-${pkgver}"#patch -p1 -i "${srcdir}/patch-${pkgver}"\npatch -p1 -i "/media/files/Linux/a835.patch"

I just need to add the line:

patch -p1 -i "/media/files/Linux/a835.patch"

after the line:

patch -p1 -i "${srcdir}/patch-${pkgver}"

Last edited by ttouch (2013-02-27 18:25:14)

Offline

#9 2013-02-27 21:40:41

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] Best way to patch kernel

ttouch wrote:

@tomk: where?

Here and/or here.

Upstream == the people who write the code, so the kernel developers in this case.
Downstream == the people who package and distribute the code, so Arch in this case.

Offline

#10 2013-02-27 22:32:42

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,791

Re: [SOLVED] Best way to patch kernel

Well, as an old Gentoo guy --

Create a directory someplace convenient (Like your home directory).
Download and unpack the kernel source there
Your configuration of the the running kernel is in /proc/config.gz.  Unpack that to your build directory.
Apply your patches
If you have to change your configuration, use make menuconfig.  I strongly recommend you change the name of your kernel to something unique (add your initials to the name.)
compile using make
install modules using sudo make modules_install
copy the kernel from the appropriate place in ./arch  (I don't remember the exact place in there, but it is something like ./arch/x86_64/boot/bzimage) to your /boot directory with a new name
Edit your bootloader configuration to add an new entry that is just like ArchLinux, but uses the name of your new kernel instead.

Good Luck.  I'll watch this tread to lend a hand....


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#11 2013-02-28 12:49:26

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

Re: [SOLVED] Best way to patch kernel

ewaller no. I have to do all the process every time I update the kernel. thats harder, not easier?
Can anyone check my custompkg config?
is it right?

Offline

#12 2013-02-28 12:50:37

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] Best way to patch kernel

... just run it and check the results.

Offline

#13 2013-02-28 13:01:12

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

Re: [SOLVED] Best way to patch kernel

doesnt work...

Offline

#14 2013-02-28 13:29:48

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] Best way to patch kernel

You know what customizepkg is doing right? So check what it did to your PKGBUILD, and compare that to a working PKGBUILD that you amended yourself. Then change your customizepkg configuration accordingly.

BTW, can you post the patch, or a link to it? I don't use this kind of gear, I'm just a bit curious now.

Offline

#15 2013-02-28 14:03:28

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

Re: [SOLVED] Best way to patch kernel

--- linux-3.7.1/drivers/media/dvb-core/dvb-usb-ids.h.orig	2012-12-27 23:10:35.000000000 +0100
+++ linux-3.7.1/drivers/media/dvb-core/dvb-usb-ids.h	2012-12-27 23:13:50.049680727 +0100
@@ -233,6 +233,10 @@
 #define USB_PID_AVERMEDIA_A815M				0x815a
 #define USB_PID_AVERMEDIA_A835				0xa835
 #define USB_PID_AVERMEDIA_B835				0xb835
+#define USB_PID_AVERMEDIA_A835B_1835			0x1835
+#define USB_PID_AVERMEDIA_A835B_2835			0x2835
+#define USB_PID_AVERMEDIA_A835B_3835			0x3835
+#define USB_PID_AVERMEDIA_A835B_4835			0x4835
 #define USB_PID_AVERMEDIA_1867				0x1867
 #define USB_PID_AVERMEDIA_A867				0xa867
 #define USB_PID_AVERMEDIA_TWINSTAR			0x0825
--- linux-3.7.1/drivers/media/usb/dvb-usb-v2/it913x.c.orig	2012-12-27 23:10:35.000000000 +0100
+++ linux-3.7.1/drivers/media/usb/dvb-usb-v2/it913x.c	2012-12-27 23:13:49.000693841 +0100
@@ -773,6 +773,18 @@
 	{ DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9135_9006,
 		&it913x_properties, "ITE 9135(9006) Generic",
 			RC_MAP_IT913X_V1) },
+	{ DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_1835,
+		&it913x_properties, "Avermedia A835B(1835)",
+			RC_MAP_IT913X_V2) },
+	{ DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_2835,
+		&it913x_properties, "Avermedia A835B(2835)",
+			RC_MAP_IT913X_V2) },
+	{ DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_3835,
+		&it913x_properties, "Avermedia A835B(3835)",
+			RC_MAP_IT913X_V2) },
+	{ DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_4835,
+		&it913x_properties, "Avermedia A835B(4835)",
+			RC_MAP_IT913X_V2) },
 	{}		/* Terminating entry */
 };

I'll report the output PKGBUILD later.

Offline

#16 2013-02-28 17:33:43

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: [SOLVED] Best way to patch kernel

ewaller wrote:

Well, as an old Gentoo guy --

Create a directory someplace convenient (Like your home directory).
Download and unpack the kernel source there
Your configuration of the the running kernel is in /proc/config.gz.  Unpack that to your build directory.
Apply your patches

Wow, that's so 20th century.

I use git to maintain my patches. Much less PITA.

Last edited by mich41 (2013-02-28 19:41:20)

Offline

#17 2013-03-01 00:42:39

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,791

Re: [SOLVED] Best way to patch kernel

mich41 wrote:

Wow, that's so 20th century.

Hey, I spent 75% of my life (Thus Far) in the 20th century.  I guess I am so 20th century too! tongue

Get of my Lawn!


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#18 2013-03-04 15:35:03

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

Re: [SOLVED] Best way to patch kernel

After some hours, I finally made it! smile
my /etc/customizepkg.d/linux-ck:

replace#global#.*DEFAULT_CONSOLE_LOGLEVEL.*#patch -p1 -i \"\\/media\\/files\\/Linux\\/a835.patch\"

Offline

Board footer

Powered by FluxBB