Frog
Posts: 2
Joined: Fri Mar 01, 2013 12:22 pm

Writing own device driver

Sun Mar 03, 2013 1:04 pm

Hello,

I'm trying to write my own device driver. I have some examples about writing device drivers. In this examples I need to #include <linux/modules.h>. But "modules.h" includes some other header files like "cache.h" and inside "cache.h" there is a include to <asm/cache.h>. But I have no asm directory, I only have a asm-generic directory.

What I have done so far (I'm using the 2013-02-09-wheezy-raspbian image)
1. Created directory for kernel sources "mkdir ~/raspberrypi"
"cd ~/raspberrypi"
2. I loaded the kernel sources "wget https://github.com/raspberrypi/linux/ar ... 6.y.tar.gz -O rpi-3.6.y.tar.gz"
3. I extracted the tar file "tar xfz rpi-3.6.y.tar.gz"
"cd linux-rpi-3.2.27"
4. I configured the kernel "make mrproper"
"zcat /proc/config.gz > .config"
"make oldconfig"
5. I compiled the kernel "make"

But I don't have a asm directory. What else can I do?


Frog


Killertechno
Posts: 176
Joined: Wed Jan 02, 2013 8:28 am

Re: Writing own device driver

Mon Apr 29, 2013 3:33 pm

Hi, is there a tutorial (or similar) about writing driverso for Raspberry?
I would like to make my own (I know this feature is already available, but I would make it by myself) timing system: PPS output on GPIO, I sync time through NTP, if not available GPS receiver connected.
How can I use hardware resources (peripherals) of raspberry?
Thanks.

User avatar
fbutler
Posts: 302
Joined: Thu Mar 15, 2012 4:09 pm
Location: Surrey, England

Re: Writing own device driver

Mon Apr 29, 2013 5:03 pm

Killertechno wrote:Hi, is there a tutorial (or similar) about writing driverso for Raspberry?
I would like to make my own (I know this feature is already available, but I would make it by myself) timing system: PPS output on GPIO, I sync time through NTP, if not available GPS receiver connected.
How can I use hardware resources (peripherals) of raspberry?
Thanks.
I believe this book on the subject may be what you are looking for: http://www.amazon.co.uk/Linux-Device-Dr ... ce+drivers

richardp
Posts: 117
Joined: Thu Jan 12, 2012 11:46 am

Re: Writing own device driver

Mon Apr 29, 2013 6:31 pm

fbutler wrote:
Killertechno wrote:Hi, is there a tutorial (or similar) about writing driverso for Raspberry?
I would like to make my own (I know this feature is already available, but I would make it by myself) timing system: PPS output on GPIO, I sync time through NTP, if not available GPS receiver connected.
How can I use hardware resources (peripherals) of raspberry?
Thanks.
I believe this book on the subject may be what you are looking for: http://www.amazon.co.uk/Linux-Device-Dr ... ce+drivers
http://lwn.net/Kernel/LDD3/

The book is published under the Creative Commons License.. Its the main source of information for anyone aspiring to do device drivers.

Richard
RaspberryPi's galore
Solid run CuBox
ODroid U2

Return to “C/C++”