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 - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-24-2012, 08:15 AM   #1
igor012
Member
 
Registered: Feb 2010
Posts: 89

Rep: Reputation: 2
Build a module from another kernel


Hello,
Is it possible to use a module (wacom) from a more recent kernel ? My current kernel is 3.1.2 and the one I want to use the module from is 3.4.

Thank you
 
Old 04-24-2012, 08:25 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Modules from different kernels are not compatible. Just build the driver for your kernel instead, maybe this can help: http://sourceforge.net/apps/mediawik...itle=Main_Page
 
Old 04-24-2012, 09:41 AM   #3
igor012
Member
 
Registered: Feb 2010
Posts: 89

Original Poster
Rep: Reputation: 2
Even if I recompile it for my current kernel ?
 
Old 04-24-2012, 09:42 AM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
If you compile it for your current kernel then it is not a module for a different kernel. Modules are binary compiled drivers.
 
Old 04-24-2012, 02:14 PM   #5
karan2386
Member
 
Registered: Jan 2012
Posts: 34

Rep: Reputation: Disabled
reply

If you are compiling your code then also you must be ready to get some errors....well it depends if there is a change of function or even the position of some data structure then it'll be giving some problems...to solve that you have to see the kernel source......
 
Old 04-27-2012, 08:45 AM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Well, a better answer would be, "it depends." Take your driver in source form, attempt to compile it with reference to your kernel sources. (Which you'll have to do anyhow.) If it compiles okay, try it. But if it doesn't, you're faced with rewriting it. (And there's where I'd hit the proverbial STOP button, and look for "plan B.")

But, first, I would search carefully for a Wacom tablet driver that is built for your kernel, or seriously consider upgrading your kernel. I just don't think that you really are "cutting new ground" here, unless you mean it as an exercise.
 
Old 05-02-2012, 11:19 AM   #7
igor012
Member
 
Registered: Feb 2010
Posts: 89

Original Poster
Rep: Reputation: 2
Hello,
When you say
Quote:
Take your driver in source form, attempt to compile it with reference to your kernel sources
I just have to copy the files related to it into the source folder, right ?
 
Old 05-03-2012, 06:42 AM   #8
emntech
LQ Newbie
 
Registered: May 2012
Posts: 8

Rep: Reputation: Disabled
Try this:

1) Download the kernel source code (linux-3.4 or whichever your want)
2) create a directory some where, like:
$mkdir wacom_module
3) copy wacom files to the 'wacom_module' directory.
cp ~/linux-3.4/drivers/input/tablet/wacom* wacom_module
4) Write a Makefile like this in the wacom_module directory.
$vim Makefile
wacom-objs := wacom_wac.o wacom_sys.o

obj-m = wacom.o

all:
<TAB>make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

5) Use the 'make' command to compile the module
$make

You will get wecam module with the name 'wacom.ko' in the 'wacom_module' directory

To use this module, insert the module using insmod command.
$sudo insmod ./wacom.ko
 
Old 05-03-2012, 11:40 AM   #9
igor012
Member
 
Registered: Feb 2010
Posts: 89

Original Poster
Rep: Reputation: 2
here is the output of make
Quote:
make -C /lib/modules/3.1.2-1.4-desktop/build M=/mnt/fab/wacom-build modules
make[1]: Entering directory `/mnt/fab/kernelbuild/build/linux-3.1.2'
CC [M] /mnt/fab/wacom-build/wacom_wac.o
CC [M] /mnt/fab/wacom-build/wacom_sys.o
/mnt/fab/wacom-build/wacom_sys.c:1214: warning: data definition has no type or storage class
/mnt/fab/wacom-build/wacom_sys.c:1214: warning: type defaults to ‘int’ in declaration of ‘module_usb_driver’
/mnt/fab/wacom-build/wacom_sys.c:1214: warning: parameter names (without types) in function declaration
/mnt/fab/wacom-build/wacom_sys.c:1203: warning: ‘wacom_driver’ defined but not used
LD [M] /mnt/fab/wacom-build/wacom.o
Building modules, stage 2.
MODPOST 1 modules
CC /mnt/fab/wacom-build/wacom.mod.o
LD [M] /mnt/fab/wacom-build/wacom.ko
make[1]: Leaving directory `/mnt/fab/kernelbuild/build/linux-3.1.2'
And then insmod ./wacom.ko right after but nothing happened.
 
Old 05-03-2012, 11:47 AM   #10
emntech
LQ Newbie
 
Registered: May 2012
Posts: 8

Rep: Reputation: Disabled
Nothing will happen. Your wecam driver module loaded. Now you need to know how to use your driver.
How did you use this wacom in linux-3.1?.
 
Old 05-03-2012, 11:59 AM   #11
igor012
Member
 
Registered: Feb 2010
Posts: 89

Original Poster
Rep: Reputation: 2
Yes i did with another tablet.
I am using kcmshell4 kcm_wacomtablet to configure it.

EDIT
It's at least supposed to be working as a mouse

Last edited by igor012; 05-04-2012 at 05:14 AM.
 
  


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
How to build kernel module arbis Linux - Software 2 11-13-2008 12:28 PM
Build 2.4 kernel module under 2.6 Ryanitus Linux - Software 1 09-15-2008 02:37 PM
[Error] Kernel Module : No kernel module build environment saman007uk Debian 7 09-09-2006 06:34 PM
LXer: Howto: build Linux kernel module against installed kernel w/o full kernel source tree LXer Syndicated Linux News 0 09-03-2006 08:21 PM
Unable to build NVIDIA kernel module / determin kernel version Night Ink Fedora 2 05-31-2004 04:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:51 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