Socketcan CAN-bus drivers added to OpenEmbedded
I just added a recipe to OpenEmbedded to build the Socketcan kernel modules from the socketcan SVN. So if you are using the latest OpenEmbedded metadata, you can:
- bitbake socketcan-modules
- scp
/build/angstrom-2008.1/tmp/deploy/glibc/ipk/ /socketcan-modules_0.0+svnr917-r0_cm-x270.ipk root@ :
and then on the target system:
- opkg install socketcan-modules_0.0+svnr917-r0_cm-x270.ipk
- opkg files socketcan-modules
Package socketcan-modules (0.0+svnr917-r0) is installed on root and has the following files:
/lib/modules/2.6.27/extra/net/can/can-bcm.ko
/lib/modules/2.6.27/extra/drivers/net/can/sja1000/ems_pci.ko
/lib/modules/2.6.27/extra/net/can/can-raw.ko
/lib/modules/2.6.27/extra/drivers/net/can/sja1000/sja1000.ko
/lib/modules/2.6.27/extra/drivers/net/can/softing/softing.ko
/lib/modules/2.6.27/extra/drivers/net/can/sja1000/ems_pcmcia.ko
/lib/modules/2.6.27/extra/drivers/net/can/sja1000/sja1000_platform.ko
/lib/modules/2.6.27/extra/drivers/net/can/can-dev.ko
/lib/modules/2.6.27/extra/drivers/net/can/softing/softing_cs.ko
/lib/modules/2.6.27/extra/drivers/net/can/sja1000/pipcan.ko
/lib/modules/2.6.27/extra/drivers/net/can/mcp251x.ko
/lib/modules/2.6.27/extra/net/can/can.ko
/lib/modules/2.6.27/extra/net/can/can-isotp.ko
/lib/modules/2.6.27/extra/drivers/net/can/vcan.ko
Then to use the modules:
- depmod
- modprobe mcp251x
- modprobe can-bcm
What is CAN? Can stands for Controller-area network and is popular in industrial and automotive applications. A convenient way to add CAN to your Embedded Linux system is with the Microchip MCP2515. This device connects to a SPI bus which means it can be interfaced with a number of popular SOC’s such as the PXA270, OMAP3, 91SAM9xxx, etc.
More on Socketcan later …
BTW, this recipe really illustrates how easy it is to compile kernel modules outside a kernel in OpenEmbedded:
DESCRIPTION = "Socketcan kernel modules"
HOMEPAGE = "http://developer.berlios.de/projects/socketcan/"
SECTION = "kernel/modules"
LICENSE = "GPL"
DEPENDS = "virtual/kernel"
PV = "0.0+svnr${SRCREV}"
SRC_URI = "svn://svn.berlios.de/socketcan/trunk;module=kernel;proto=svn"
S = "${WORKDIR}/kernel/2.6"
inherit module
This recipe tells OE to download the source, cross-compile it against your target kernel build dir, and then package it for easy install on the device. This is the way things should work – no messing around figuring out make options, kernel source paths, compiler env variables, etc.