Skip to content

How to install 6LoWPAN Linux Kernel on Raspberry Pi

BytesGalore edited this page Jun 9, 2015 · 34 revisions

This is work in progress and just hacked together for now...

Objective

Install a fairly new (next) Linux kernel on a raspberry pi, which is able to run IEEE802.15.4 devices (i.e. the Atmel AT86RF233) and 6LoWPAN.

These are the results of a long night:

NOTE There is much room for improvement here, so follow the steps with caution :-)

Flash the current of-the-shelf raspian image

Get a toolchain that supports arm-linux-gnueabihf- (with hard fp)

For debugging, connect a UART adapter to the Pi, see for pinout:

http://elinux.org/RPi_Low-level_peripherals

Take the official raspberry pi kernel (branch rpi-4.0.y):

git clone git@github.com:raspberrypi/linux.git linux-rpi
cd linux rpi
git checkout rpi-4.0.y

On top get the newest raspberry firmware (branch: next):

git clone git@github.com:raspberrypi/firmware.git firmware
cd firmware
git checkout next

Activate modules and patch the device tree as described in

http://openlabs.co/blog/archives/1-6LoWPAN-kernel-on-a-Raspberry-Pi Don't forget the lib dir

Follow these sections:

  • cross-compiling
  • building the Linux kernel
  • patching the device tree

But also add the option:

 Boot options -> Use appended device tree blob to zImage

-- is this needed? --

Build the kernel as described in

http://elinux.org/Raspberry_Pi_Kernel_Compilation

Copy Kernel and Modules and Firmware to the boot dir of the Pi as described in

http://elinux.org/Raspberry_Pi_Kernel_Compilation

Also copy over the vp dir in the hf version (whatever it does), see also

http://elinux.org/Raspberry_Pi_Kernel_Compilation

Add a config.txt file with options from

https://github.com/raspberrypi/linux/wiki/How-to-boot-using-device-tree (but remove the option init_emmc_clock)

reboot and hope!

Now, on the Pi, install the userspace tools:

install some needed packets on the Pi:

sudo apt-get install libnl-3-dev libnl-genl-3-dev

####get them from here: https://github.com/linux-wpan/wpan-tools

The current master seems to fail while configuring...

run autoconf and make the thing

cd wpan-tools
./autogen.sh
./configure 

get them frome here, then:

http://wpan.cakelab.org/releases/wpan-tools-0.4.tar.gz

unzip and build them

tar xfvz wpan-tools-0.4.tar.gz
cd wpan-tools-0.4.tar.gz
./configure
make
sudo make install

Now it should work?

For testing, follow some of the instructions at http://wpan.cakelab.org/#_how_to_8217_s

How-to install and use 6LoWPAN on a Raspberry Pi with Linux Kernel 4.0.5+

Objective

This howto will guide you to

  1. Configure the Raspberry Pi Kernel for 802.15.4 and 6LoWPAN
  2. show you how to patch support for the openlabs Raspberry-Pi-802.15.4-radio
  3. compile a recent Linux kernel (rpi-4.0.y) for the Raspberry Pi
  4. and use the new built Kernel on your RasPi

Make a first clean run (Prepare the RasPi)

To start off, we obtain the official and latest Raspbian image and flash it on our SDCard.

  • We download the official latest Raspbian image (scroll down a bit),
  • and follow the guides to flash it on our SDCard.
  • Then we Plug the SDCard and fire our RasPi.
  • Note if you login the first time, the username is pi and the password is raspberry
  • Second note watch out if you have a german keyboard layout, the keys y and z are switched.
  • In the first run we set the filesystem to be expanded and if desired set additional options for the system using the raspi-config tool and let the RasPi reboot when we finished.
  • After the reboot we login and first update the system entering sudo apt-get update and sudo apt-get upgrade.

Get a new RasPi Kernel (on a Linux Host)

We focus on cross compilation here, since we don't want to spend a night watching the build process ;).
First we obtain an appropriate and recent Cross GCC to build the Kernel.
The RasPi rquires an arm-gnueabihf GCC for cortex a7 processors. So, the Linaro GCC 4.9 is our candidate here.
We download the appropriate tar.xz file and decompress it. Now we open a terminal and export the path to the newly decompressed GCC bin directory. We type export PATH=$PATH:/home/<myusername>/Downloads/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin.
To test if the export succeeded we type arm-linux-gnueabihf-gcc --version and should be provided with the version information of our cross compiler.
If not, the path export seems to be failed, you can check it by type in $PATH in the terminal. Note, if you use a 64 bit Linux you may also need multilib support.

Now we get the RasPi latest Kernel sources from their Git repository

git clone https://github.com/raspberrypi/linux.git linux-rpi
cd linux rpi
git checkout rpi-4.0.y
cd ..

and the latest firmware

git clone https://github.com/raspberrypi/firmware.git firmware
cd firmware
git checkout next
cd ..

Configure the new kernel

First we configure the sources with an appropriate configuration for the RasPi. We switch in the kernel source folder, typing cd linux-rpi followed by

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig

This setups the kernel with an initial configuration.

Now we need to enable 802.15.4 and 6LoWPAN plus the supported devices. We type

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

and start to configure/enable the desired features.

Clone this wiki locally