YMMV

* your mileage may vary

Friday, 6 June 2014

Beaglebone Black (BBB) Kernel Headers & Source + Compile Driver Module


Steps to compile a driver on the BBB.  Downloading the source and headers requires about 600Mb of free space.
Update: ///
New easier way to get headers....

debian@beaglebone:~$ uname -r
3.8.13-bone50
debian@beaglebone:~$ apt-cache search linux-headers | grep 3.8.13 


find the corresponding package needed ...
sudo apt-get install linux-headers-3.8.13-bone50

note: if no package is found for the uname -r version => upgrade/downgrade to suitable version with headers available.. 
 

/// 
 


Before:

root@beaglebone:/# uname -a && cat /etc/*release
Linux beaglebone 3.8.13-bone50 #1 SMP Tue May 13 13:24:52 UTC 2014 armv7l
GNU/Linux
PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
NAME="Debian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="http://bugs.debian.org/"



Robert Nelson provides a handy script to do all the work. Backup copy is here:
https://drive.google.com/file/d/0BwUGkFVOqZsPX21BdzVqcENxR2s/edit?usp=sharing

wget https://raw.github.com/gkaindl/beaglebone-ubuntu-scripts/master/bb-get-rcn-kernel-source.sh
chmod +x bb-get-rcn-kernel-source.sh
sudo ./bb-get-rcn-kernel-source.sh



Get the basic hello driver, and compile it

wget www.linuxdevcenter.com/linux/2007/07/05/examples/hello_printk.tar.gz
xzvf hello_printk.tar.gz
cd hello_printk
make



Load the driver and check for kernel messages plus some other checks

sudo insmod ./hello_printk.ko
dmesg | tail
lsmod
modinfo hello_printk.ko



Unload the driver and check the kernel messages

sudo rmmod hello_printk
dmesg | tail
lsmod



2 comments:

  1. "
    root@beaglebone:~# ./bb-get-rcn-kernel-source.sh
    installing kernel sources for 3.8.13-bone50...

    using linux distribution: wheezy-armhf
    getting file listing from http://rcn-ee.net/deb/wheezy-armhf/v3.8.13-bone50/...
    --2016-03-31 21:50:16-- http://rcn-ee.net/deb/wheezy-armhf/v3.8.13-bone50/
    Resolving rcn-ee.net (rcn-ee.net)... 45.33.2.10, 2600:3c00::f03c:91ff:fe37:6ad5
    Connecting to rcn-ee.net (rcn-ee.net)|45.33.2.10|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 1243 (1.2K) [text/html]
    Saving to: `/tmp/tmp.Z42Y0MmhuZ/index.html'

    100%[======================================>] 1,243 --.-K/s in 0s

    2016-03-31 21:50:21 (11.9 MB/s) - `/tmp/tmp.Z42Y0MmhuZ/index.html' saved [1243/1243]

    no kernel header package found for 3.8.13-bone50, try another kernel.
    root@beaglebone:~#
    "
    Could help?

    ReplyDelete
  2. Same here brsilve,
    Did you get the solution for this?

    ReplyDelete