LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-07-2020, 03:41 AM   #1
theCapitain
Member
 
Registered: Jul 2010
Location: Northern Italy
Distribution: Slackware, Slax
Posts: 59

Rep: Reputation: 2
How to patch a kernel module


Hello,
I need to patch the kernel module: /lib/modules/4.4.217/kernel/drivers/media/usb/gspca/gspca_ov519.ko
using the source I’ve found here: github.com/torvalds/linux/blob/master/drivers/media/usb/gspca/ov519.c (that should add some tricks to support mi webcam).
Since I never did something like that, and I have no idea how to proceed, would someone be so kind as to show me the way step by step?
Thanks for helping.
 
Old 04-07-2020, 04:00 AM   #2
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 4,667

Rep: Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786Reputation: 1786
you need to patch the kernel source and rebuild the modules again
 
2 members found this post helpful.
Old 04-07-2020, 04:07 AM   #3
theCapitain
Member
 
Registered: Jul 2010
Location: Northern Italy
Distribution: Slackware, Slax
Posts: 59

Original Poster
Rep: Reputation: 2
Thanks for the quick reply willysr, could you show me how to do that? Really, my skills do not go beyond using upgradepkg.
 
Old 04-07-2020, 06:20 AM   #4
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado, USA
Distribution: Slackware
Posts: 930

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
I recommend checking out SlackBuilds for "kmod" packages. My last public SlackBuild for a module upgrade was for kvm-kmod in the 14.0 Slackbuilds. There are other examples if you search around at SlackBuilds.org.
 
Old 04-07-2020, 08:22 AM   #5
theCapitain
Member
 
Registered: Jul 2010
Location: Northern Italy
Distribution: Slackware, Slax
Posts: 59

Original Poster
Rep: Reputation: 2
Quote:
I recommend checking out SlackBuilds for "kmod" packages
I can see that the source for your kmod’s SlackBuilds contains multiple files, including of course Makefile and configure. That make me think I cannot download only the ov519.c source file from the repository, should I download the whole gspca module? Or is it fine to use the gspca folder I have un /usr/src/ replacing ov519.c?

Last edited by theCapitain; 04-08-2020 at 03:03 AM.
 
Old 04-07-2020, 08:32 AM   #6
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,375

Rep: Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754
The kernel Makefile accepts an option to build a single kernel module. From the /usr/src/linux directory:
Code:
make M=drivers/media/usb/gspca
 
1 members found this post helpful.
Old 04-07-2020, 08:58 AM   #7
0XBF
Member
 
Registered: Nov 2018
Distribution: Slackware
Posts: 769

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
I've used a method similar to this post on stackoverflow to build single kernel modules:
https://stackoverflow.com/questions/...04152#44204152

You'll need the kernel source for the same version as what you're running, and you'll have to apply your patch before building the module. Once you build it you can try replacing the existing module with the newly patched one. Note that if you upgrade the kernel afterwards with slackpkg your modules will be replaced with the stock ones again.
 
1 members found this post helpful.
Old 04-08-2020, 02:46 AM   #8
theCapitain
Member
 
Registered: Jul 2010
Location: Northern Italy
Distribution: Slackware, Slax
Posts: 59

Original Poster
Rep: Reputation: 2
Great! That was the kind of help I was asking for.
I've followed your guide. Step 9 shows:

Code:
bash-4.3# make -C . M=/root/extra
make: Entering directory '/root/linux-4.4.217'
  Building modules, stage 2.
  MODPOST 0 modules
make: Leaving directory '/root/linux-4.4.217'
After that I only have the ov519.o in the extra/ directory, the ov519.ko is missing (moreover it is called gspca_ov519.ko in my modules tree)

the Makefile I created only contains the row:
Code:
obj-y    += ov519.o
any idea?
 
Old 04-08-2020, 03:01 AM   #9
theCapitain
Member
 
Registered: Jul 2010
Location: Northern Italy
Distribution: Slackware, Slax
Posts: 59

Original Poster
Rep: Reputation: 2
I've found the way. I've modified the Makefile as follows:
Code:
obj-$(CONFIG_USB_GSPCA_OV519)    += gspca_ov519.o

gspca_ov519-objs    := ov519.o
It worked!

Last edited by theCapitain; 04-08-2020 at 03:16 AM. Reason: typo
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
After patch a patch to kernel? Do I need to compile whole kernel again? Anders Lind Linux - Kernel 2 02-29-2012 03:40 PM
How do i patch 2.4.21-37 kernel with antidote2 security patch suchi Linux - Kernel 4 09-05-2006 02:29 AM
Kernel Patch (Patch-2.6.13) ukez Linux - Hardware 4 08-30-2005 03:40 PM
Unable to patch 2.6.11.7 kernel with Reiser4 mm patch SlackwareInAZ Slackware 9 04-26-2005 06:33 AM
debian-patch-debianlogo w/2.6.5 kernel-patch-lpp Outabux Debian 11 05-20-2004 01:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:15 AM.

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