Writing a Linux Device driver

Questions about applications and software
Forum rules
Before you post please read this

Writing a Linux Device driver

Postby kibkid on Sat Apr 04, 2009 2:28 pm

Hi everybody. I am new to Linux Mint. I have a question, i am trying to follow these instructions in this page:

http://www.freesoftwaremagazine.com/art ... vers_linux

It says to build modules by doing:

$ make -C /usr/src/kernel-source-2.6.8 M=pwd modules (for version 2.6.8, I guess I have 2.6.24-16, I have Elyssa)

But when I look in /usr/src/ i don't see any kernel-sources directory I just see linux-headers-2.6.24-16-generic and linux-headers-2.6.24-16. When I cd into them and I try to do make modules I get:

CHK include/linux/version.h
CHK include/linux/utsrelease.h
make[1]: *** No rule to make target `arch/x86/kernel/asm-offsets.c', needed by `arch/x86/kernel/asm-offsets.s'. Stop.
make: *** [prepare0] Error 2


Any ideas how can I get the sources so that I am able to get the sample device driver there to work?

Thank you
kibkid
Level 1
Level 1
 
Posts: 2
Joined: Sat Apr 04, 2009 2:06 pm

Linux Mint is funded by ads and donations.
 

Re: Writing a Linux Device driver

Postby merlwiz79 on Sat Apr 04, 2009 4:06 pm

Open synaptic and search for linux source and install the version for your kernel.
User avatar
merlwiz79
Level 11
Level 11
 
Posts: 3637
Joined: Wed Apr 04, 2007 1:50 pm
Location: Here again :)

Re: Writing a Linux Device driver

Postby kibkid on Tue Apr 07, 2009 10:35 am

Hello, thank you for your reply.

Actually before you replied I went to kernel.org and downloaded the latest kernel source there. Then I did make and make modules. Then I built my little driver and created the .ko image. But when I do insmod it says -l bad file format.

I am not sure if this is because I am running a different kernel form the sources I downloaded. Does any of you know how to make the sources one the active kernel. Or otherwise do you know what might the problem be?

Thank you.
kibkid
Level 1
Level 1
 
Posts: 2
Joined: Sat Apr 04, 2009 2:06 pm


Return to Software & Applications

Who is online

Users browsing this forum: No registered users and 29 guests