OLPC SocketCAN

From CarrottElectric
Jump to navigation Jump to search

Setting up LinuxCAN aka SocketCAN on olpc XO-1 with slcan driver on OLPC OS 13.2.0 for XO-1 (build 9)

wget http://rpmdropbox.laptop.org/f18-xo4/kernel-devel-3.5.7_xo4-20130705.0203.olpc.e77de3d.armv7hl.rpm
rpm -i kernel-devel-3.5.7_xo4-20130705.0203.olpc.e77de3d.armv7hl.rpm
sudo yum install -y git subversion gcc make usbutils meld screen

# can get the kernel from git or from an rpm, this gets it from git
git clone git://dev.laptop.org/olpc-kernel
cd olpc-kernel
git checkout <revision of currently running kernel>


gunzip </proc/config.gz >.config
echo 'CONFIG_CAN=m
CONFIG_CAN_RAW=m
CONFIG_CAN_BCM=m
CONFIG_CAN_GW=m

#
# CAN Device Drivers
#
CONFIG_CAN_VCAN=m
CONFIG_CAN_SLCAN=m
CONFIG_CAN_DEV=m
CONFIG_CAN_CALC_BITTIMING=y
# CONFIG_CAN_SJA1000 is not set
# CONFIG_CAN_C_CAN is not set
# CONFIG_CAN_CC770 is not set

#
# CAN USB interfaces
#
# CONFIG_CAN_EMS_USB is not set
# CONFIG_CAN_ESD_USB2 is not set
# CONFIG_CAN_PEAK_USB is not set
# CONFIG_CAN_SOFTING is not set
# CONFIG_CAN_DEBUG_DEVICES is not set
CONFIG_CAN=m
CONFIG_CAN_RAW=m
CONFIG_CAN_BCM=m
CONFIG_CAN_GW=m
CONFIG_CAN_VCAN=m
CONFIG_CAN_SLCAN=m
CONFIG_CAN_DEV=m' >>.config
cp /usr/src/kernels/`uname -r`*/Module.symvers .
make prepare scripts KERNELRELEASE=`uname -r`
make M=net/can
make M=drivers/net/can

sudo mkdir -p /lib/modules/`uname -r`/kernel/net/can
sudo cp net/can/*.ko /lib/modules/`uname -r`/kernel/net/can
sudo mkdir -p /lib/modules/`uname -r`/kernel/drivers/net/can
sudo cp drivers/net/can/*.ko /lib/modules/`uname -r`/kernel/drivers/net/can

sudo depmod -a

cd ~/develop
git clone git://gitorious.org/linux-can/can-utils.git
cd can-utils
make

sudo modprobe slcan can_bcm
sudo ./slcan_attach -w -o -f -s6 -c /dev/ttyUSB0
sudo ifconfig slcan0 up