Here are the steps I used to get the latest version of Linux 6LoWPAN stack running on Raspberry Pi B and Raspberry Pi B+. These are my notes from what I learned from the Openlabs blog post on this very subject.
To have a known starting point, I install Raspbian on the Pi, following these installation instructions. The release date of Raspbian I used is 2015-Feb-16 and kernel image is 3.18. I suggest installing Raspbian, booting it, and running “sudo raspi-config” to expand the file system to use all storage on your sdcard. This also makes sure that things are working before you try a new kernel.
Now build the new 6LoWPAN kernel for Pi:
1 2 3 4 5 6 7 8 9 10 |
mkdir openlabs cd openlabs sudo apt-get install autoconf automake gawk g++ git-core libjpeg62-dev libncurses5-dev libtool make python-dev gawk pkg-config libperl-dev libgdbm-dev libdb-dev libssl-dev git clone https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git cd bluetooth-next/ CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm make bcm2835_defconfig CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm make menuconfig CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm make modules CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm INSTALL_MOD_PATH=.mods make modules_install |
Next, we need to add the Openlabs radio to the device tree. The file to use depends on if you have a Pi B or Pi B+. I have both, so I edit both of them:
1 2 |
vi arch/arm/boot/dts/bcm2835-rpi-b-plus.dts vi arch/arm/boot/dts/bcm2835-rpi-b.dts |
Each file has this added to the bottom:
1 2 3 4 5 6 7 8 9 10 11 12 |
&spi { status = "okay"; at86rf233@0 { compatible = "atmel,at86rf233"; reg = <0>; interrupts = <23 4>; interrupt-parent = <&gpio>; reset-gpio = <&gpio 24 1>; sleep-tpio = <&gpio 25 1>; spi-max-frequency = <7500000>; }; }; |
Then make dtbs:
1 |
CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm make dtbs |
We need to copy files to the sdcard on the Pi. For this I have the Raspbian image booted on the Pi itself, and the network is running so I can ssh/scp etc. My Pi has IPv4 address 192.168.1.186, and I’ve enabled root login.
Save original files first.
1 2 3 4 5 |
ssh root@192.168.1.186 cd /boot sudo cp config.txt orig-config.txt sudo cp bcm2835-rpi-b-plus.dtb orig-bcm2835-rpi-b-plus.dtb sudo cp bcm2835-rpi-b.dtb orig-bcm2835-rpi-b.dtb |
You will only have one of the dtb files, which one depends on which version of the Pi you are using.
Now copy
1 2 3 4 5 |
scp arch/arm/boot/zImage root@192.168.1.186:/boot/zImage scp arch/arm/boot/dts/bcm2835-rpi-b-plus.dtb root@192.168.1.186:/boot/zImage.dtb scp arch/arm/boot/dts/bcm2835-rpi-b.dtb root@192.168.1.186:/boot/zImage.dtb scp arch/arm/boot/zImage root@192.168.1.186:/boot/kernel.img rsync -rlhic .mods/lib/modules/ root@192.168.1.186:/lib/modules/ |
Note: as before, you will only have to copy one to these dtb files above, depending on your are running a Pi B or Pi B+.
Now we need u-boot.bin and it’s configuration. I simply download a pre-built binary for Raspberry Pi from Beyond Logic extract and put the pre-built u-boot.bin in /boot/u-boot.bin on the sdcard.
To enable u-boot, the existing /boot/config.txt needs to be changed to use u-boot.
1 2 |
rm config.txt echo 'kernel=u-boot.bin' > config.txt |
Create uEnv.txt in /boot
1 |
vi uEnv.txt |
Enter this configuration:
1 2 |
bootargs=earlyprintk console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootwait dwc_otg.lpm_enable=0 bootcmd=load mmc 0:1 ${kernel_addr_r} zImage; load mmc 0:1 ${fdt_addr_r} zImage.dtb; bootz ${kernel_addr_r} - ${fdt_addr_r} |
Now boot your new kernel.