BBB Kernel Modules
Here you'll find information on kernel modules, i.e. the device drivers that extends the kernel so it will be able to handle specific hardware.
Getting started
First you'll need to download a few things before starting to develop kernel modules.
root ..$] apt-get update root ..$] apt-cache search linux-headers-$(uname -r)
will update your local copy of the content on the remote repositories and then search through for the linux-headers.
Expect an output something like:
linux-headers-3.8.13-bone70 - Linux kernel headers for 3.8.13-bone70 on armhf
Then
root ..$] apt-get install linux-headers-$(uname -r) apt-get install linux-headers-$(uname -r) Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: linux-headers-3.8.13-bone70 0 upgraded, 1 newly installed, 0 to remove and 161 not upgraded. Need to get 8430 kB of archives. ...
will install these development files on your BBB.
If you look into /usr/src/linux-headers-3.8.13-bone70 you'll find a Makefile. This is the main makefile for the kernel development. This is the one being use by the scull examples.
Add a user
If you havn't added yourself as a user do that now. You can develop and compile the kernel modules as an ordinary user. And this is the preferable way.
$] useradd -d /home/<desired login name> -m -s `which bash` <desired login name> $] passwd <desired login name> #enter your desired password twice $] groupadd moduledev $] usermod <desired login name> -G moduledev $] mkdir -p /home/emb $] chown <desired login name>:moduledev /home/emb
The first line adds the new user, the second forces a password on that account and the third adds a development group to use for development and finaly the login name just created is added to the moduledev group. Then we create a work directory to develop modules in - /home/emb and assigns it to the moduledev group and <desired login name> as the owner.
Login as this new user now.
The Linux Device Driver book examples
Along with the book "Linux Device Drivers" came a bunch of example drivers - the scull drivers.
Now create a directory for your copy of the examples of the scull drivers
$] mkdir -p /home/emb $] cd /home $] chown moduledev:moduledev emb
next copy the drivers from bren to /home/emb
$] cd /home/emb $] scp klausk@bren.hih.au.dk:/home/emb/examples.tar.gz .
if you don't have a DNS entry for bren.hih.au.dk then use the IP address. And of course use your own login name.
Unpack the examples
$] tar zxvf examples.tar.gz