Adding CAN Bus (can0) device to BeagleBone

I’m trying to add can0 to my BeagleBone so that I can communicate on the CAN Bus. I’m using the image from April 2012 found here:

iproute2 is installed, and i’m trying to add the device by using: ip link add dev can0 type can
The response I get back is: RTNETLINK answers: Operation not permitted

How do I add a CAN device? Is there a way to tell if D_CAN is included in the kernel?

Simple start - does it show up in 'cat /proc/net/dev'?
If not, the device is not present.

No… just lo and eth0. Does this mean I need to reconfigure the kernel?

You need the following kernel configs.




CAN Device Drivers

CONFIG_CAN_VCAN is not set




D_CAN driver for Bosh parts. The TI controller is HECC (high end CAN controller).

Then it works great.

Cheers Mike.

Thanks Mike. I did see this posted somewhere, but I couldn’t find where I need to set this. (I’m still looking) Sorry, but I’m still learning linux, so I’m not familiar with kernel configs. Is this a file located somewhere in the directory on the BeagleBoard? Or do I need to follow the instructions here and build the kernel? Thanks for your help.

You need at least the kernel sources from this repo:

Setup a proper PATH to your compiler toolchain (for example Linaro, CodeSourcery etc.), export your arch:

export ARCH=arm


make menuconfig

and go to “Networking support” → “CAN bus subsystem support”

choose Raw CAN protocol

then go to “CAN Device drivers” and select “CAN platform drivers with netlink support” and “CAN bittiming calculation” and “Bosch D_CAN devices” → “Generic Platform Bus based D_CAN driver”

That should be enough. HECC is not available on am335x, but on am3517/15.

I’m not getting anywhere. I downloaded the CodeSourcery toolchain and followed their instructions on how to install it, ran “make menuconfig” and set the options for can. But when I run “make”, I get the following errors:

CC kernel/bounds.s
cc1: error: unrecognized command line option ‘-mlittle-endian’
… ‘mapcs’
… ‘mno-sched-prolog’
kernel/bounds.c:1:0: error: unknown ABI (apcs-gnu) for -mabi= switch

make ARCH=arm <...>


Not following… I need to type: “export ARCH=arm” or “export ARCH=armv7”? Or “make ARCH=arm”? I’ve tried all and get the same result. (Actually there is no armv7 directory so that one gives me a different error)

From your kernel source directory, with the correct "defconfig" saved
as ".config"..

Then run:

make ARCH=arm menuconfig
make ARCH=arm CROSS_COMPILE=path/to/codesourcy/arm/cross/gcc uImage modules


Where would the defconfig/config file be located? In the arch/arm/configs folder?

When I run “make ARCH=arm CROSS_COMPILE=/opt/CodeSourcery/Sourcery_G++_Lite/bin uImage modules”, I get an error saying gcc: Command not found. I feel like I’m missing something… Do I need the commercial version of CodeSourcery? Or use a different toolchain?

Where would the defconfig/config file be located? In the arch/arm/configs

From the same place you got the patched kernel source code... Or from
your current running beaglebone..

When I run "make ARCH=arm
CROSS_COMPILE=/opt/CodeSourcery/Sourcery_G++_Lite/bin uImage modules", I get
an error saying gcc: Command not found. I feel like I'm missing
something... Do I need the commercial version of CodeSourcery? Or use a
different toolchain?

Nah, just not fully complete..


But double check the "bin" dir and adjust accordingly, encase it's
slightly different...


Thanks, that got me further. I’m in the process of compiling, but getting lots of errors and having to exclude some configurations from the config file. Is this normal? Is there a base config file that I should start from?

You can also try Buildroot.

Get source:

git clone git://

then choose BeagleBone config:

make beaglebone_defconfig

and make the first build:


after that you can configure the kernel:

make linux-menuconfig

The images are placed under build/images

Brent, sounds like you got a random source then..

For the source/config currently used by Angstrom, look at :

git clone git://
cd kernel
git checkout origin/beaglebone-3.2 -b beaglebone-3.2

config is in patches/beaglebone/defconfig

and the patched source is under kernel dir.


Ah, that makes sense. I was using the one here: I'll try this over the
weekend. Thanks for all your help!


I’ve tried compiling from the source you suggested (git://, and I keep getting errors about not being able to find asm/leds.h. Do you know anything about this? Here is the output:
arch/arm/mach-versatile/core.c:42:22: fatal error: asm/leds.h: No such file or directory
compilation terminated.
make[1]: *** [arch/arm/mach-versatile/core.o] Error 1
make: *** [arch/arm/mach-versatile] Error 2

I’ve tried a different compilier and still no luck.

ah.. "mach-versatile"? It looks like you forgot to copy the defconfig
from patches/beagleboard/defconfig and save it as .config in kernel
directory right..


Thanks, that helped a lot! I had an issue about not finding the firmware, but I found your post here to resolve that one.

I feel like I’m seeing the light at the end of the tunnel. Hopefully these are the last questions… Is the output in the arch/arm/boot/ directory? Is there a procedure somewhere on how to get the files on the SD card?

Your going to copy the uImage to where your boot script looks for it..
(older looked in the fat16 partition, newer ones look under /boot/ on
the extX partition..)

For the modules just do:

make ARCH=arm CROSS_COMPILE=${CC} modules_install INSTALL_MOD_PATH=/media/rootfs

or wherever you have your mmc's rootfs mounted...