-
Notifications
You must be signed in to change notification settings - Fork 1
Create a generic Raspbian image with 6LoWPAN support
+++UPDATE+++UPDATE+++UPDATE+++
The text below is outdated, please refer to these guides and its associated repo
+++UPDATE+++UPDATE+++UPDATE+++
##1. Objectives
This guide shows how to create a modified Raspbian Image that supports 6LoWPAN and runs on any variant of the Raspberry Pi, namely B, B+, and 2B. Step-by-step we will do the following:
- prepare an initial Raspbian image for any Raspberry Pi
- configure and build Linux Kernels for Pi B,B+, and 2B
- install these WPAN capable Kernels into Raspbian
- install WPAN tools and configure 6LoWPAN devices
##2 Prepare Raspbian Image
###2.1 Get and install Raspbian
- First, we need the latest Raspbian Image, downlowd here
- there are 2 variants, namely Raspbian Jessie and Raspbian Jessie Lite, choose wisely:
- if your Pi will be a server and a shell is all you need, go for the lite version
- if you need a full fledged desktop GUI, e.g. with web browser, take standard Raspian
- under the hood they are basically the same, no worries here!
- Second, we need to write the Image to a SDcard, OS specific guides are available here
- for the impatient, it boils down to this:
# OSX, use diskutil to find right disk
sudo dd if=<path/to/raspbian.img> of=/dev/rdisk<N> bs=1m
# Linux, check 'ls /dev' for any new '/dev/sdX'
sudo dd if=<path/to/raspbian.img> of=/dev/sdX bs=4M
- but a take a look at the guides!
###2.2 Preconfigure Raspbian
- plug the SDcard into your Pi and boot
- login into the Pi with user
pi
and passwordraspberry
-
Note: standard keyboard layout is english so beware
y
andz
!
- login into the Pi with user
- first some initial configurations, run
sudo raspi-config
, and:- expand filesystem
- change default password
- fix keyboard layout, locals and timezone
- if you need help
- if you have Internet connectivity:
- update Raspbian
sudo apt-get update && sudo apt-get upgrade
- install your favorite editor, that is VIM:
sudo apt-get install vim
- update Raspbian
- done, unplug the Pi, eject the SD card and proceed
##3 New Linux Kernels for the Pi
###3.1 Download sources
- create a base directory and change owner to your user:
sudo mkdir -p /opt/src/rpi_wpan
sudo chown <your-username> /opt/src/rpi_wpan
cd /opt/src/rpi_wpan
- clone Raspberry Pi Linux-Kernel from Github
git clone --depth 1 https://github.com/raspberrypi/linux.git linux-rpi
- we don't want to mix things between Pi B,B+ and Pi 2B, so just do it again
git clone --depth 1 https://github.com/raspberrypi/linux.git linux-rpi2
- we also need latest firmware files
git clone --depth 1 https://github.com/raspberrypi/firmware.git firmware
- now we should have 3 directories under
/opt/src/rpi_wpan/
namelyfirmware
,linux-rpi
, andlinux-rpi2
###3.2 Configure the Kernel
- change directory to
/opt/src/raspi-wpan/linux-rpi
- initials Kernel configuration with:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2835_defconfig
- edit
arch/arm/boot/dts/bcm2835-rpi-b.dts
, and append at the followingspi0
configuration:
&spi0 {
status="okay";
spidev@0{
status = "disabled";
};
spidev@1{
status = "disabled";
};
at86rf233@0 {
compatible = "atmel,at86rf233";
reg = <0>;
interrupts = <23 4>;
interrupt-parent = <&gpio>;
reset-gpio = <&gpio 24 1>;
sleep-gpio = <&gpio 25 1>;
spi-max-frequency = <6000000>;
xtal-trim = /bits/ 8 <0x0F>;
};
};
- do the same for B+, in file
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
- change directory to
/opt/src/raspi-wpan/linux-rpi2
- initials Kernel configuration with:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
- edit
arch/arm/boot/dts/bcm2709-rpi-2-b.dts
, and modify sectionspi0
as follows:
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;
status="okay";
spidev@0{
compatible = "spidev";
reg = <0>; /* CE0 */
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <500000>;
status = "disabled";
};
spidev@1{
compatible = "spidev";
reg = <1>; /* CE1 */
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <500000>;
status = "disabled";
};
at86rf233@0 {
compatible = "atmel,at86rf233";
reg = <0>;
interrupts = <23 4>;
interrupt-parent = <&gpio>;
reset-gpio = <&gpio 24 1>;
sleep-gpio = <&gpio 25 1>;
spi-max-frequency = <6000000>;
xtal-trim = /bits/ 8 <0x0F>;
};
};
- Note: do not append this section, you have to modify it inline!!
With the previous steps we configured the SPI for the Atmel IEEE 802.15.4 transceiver, now we have add Kernel support for IEEE 802.15.4 and 6LoWPAN.
- run Kernel configuration with
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
- enable general support for 802.15.4 and 6LoWPAN, goto:
Networking support
--> Networking options
--> IEEE Std 802.15.4 Low-Rate Wireless Personal Area Networks support
- check all boxes (submenu too) and set them to
<M>
to build the required Kernel module - go back to top menu using
<EXIT>
in the bottom menu - next we add the network driver support, i.e., for the Atmel transceiver; goto:
Device Drivers
--> Network device support
--> IEEE 802.15.4 drivers
- again check all boxes with
<M>
, submenus too and go back to the top menu - finally we set some boot options, goto:
Boot options
--> () Default kernel command string
- in the popup box enter:
console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
- go back to the top menu again and exit, saving the configuration with ```
- do this for both Pi configurations
###3.3 build Kernel and modules (all Pi variants)
- compile the modified Linux Kernels by running the following commands in both directories:
CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm make zImage modules dtbs -j4
- you can modify parameter
-j
to match number of cpu cores of your system: the more, the better - afterwards compile and install all Kernel modules, running:
CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm INSTALL_MOD_PATH=.mods make modules_install
###3.4 release the Kraken ... aehm Kernels
- plug the SD-card with the prepared Raspbian Image into a card reader of your Linux system
- likely your system will automount the
boot
androot
partition somewhere, check where - first we deploy the Kernel for Pi B and B+
cd /opt/src/rpi_wpan/linux-rpi
sudo cp arch/arm/boot/dts/*.dtb <path/to/boot-mount>/
sudo cp arch/arm/boot/dts/overlays/*.dtb* <path/to/boot-partition>/overlays
sudo scripts/mkknlimg arch/arm/boot/zImage <path/to/boot-partition>/kernel.img
- next copy the Kernel modules to the root partition (not boot!):
sudo cp -r .mods/lib/* <path/to/root-mount>/lib
- now, we copy the Kernel for Pi 2B:
cd /opt/src/rpi_wpan/linux-rpi2
sudo cp arch/arm/boot/dts/*.dtb <path/to/boot-mount>/
sudo cp arch/arm/boot/dts/overlays/*.dtb* <path/to/boot-partition>/overlays
sudo scripts/mkknlimg arch/arm/boot/zImage <path/to/boot-partition>/kernel7.img
-
Note: the Kernel image name is
kernel7.img
! - finally we copy the new firmware files to the
root
partition:
cd ..
cd /opt/src/rpi_wpan/firmware
sudo rm -rf <path/to/root-mount>/opt/vc
sudo cp -r hardfp/opt/* <path/to/root-mount>/opt
- that's it, now unmount both partitions an eject the Raspbian SD-card
##4 Install WPAN tools and configure 6LoWPAN devices
RIOT - The friendly Operating System for the Internet of Things
Homepage | [GitHub] (https://github.com/RIOT-OS/) | Developers Mailing List | Users Mailing List | Twitter @RIOT_OS
- Family: ARM
- Board: Airfy Beacon
- Board: Arduino Due
- Board: CC2538DK
- Board: CC2650STK
- Board: HikoB Fox
- Board: IoT LAB M3
- Board: LimiFrog-v1
- Board: mbed_lpc1768
- Board: MSB-IoT
- Board: MSBA2
- Board: Nucleo-L1
- Board: Nucleo-F334
- Board: Nucleo-F303
- Board: Nucleo-F091
- Board: Mulle
- Board: OpenMote
- Board: PCA1000x (nRF51822 Development Kit)
- Board: Phytec phyWAVE-KW22
- Board: RFduino
- Board: SAMR21-xpro
- Board: SAML21-xpro
- Board: Spark Core
- Board: STM32F0discovery
- Board: STM32F3discovery
- Board: STM32F4discovery
- Board: UDOO
- Board: yunjia-nrf51822
- Board: Zolertia remote
- Family: ATmega
- Board: Arduino Mega2560
- Family: MSP430
- Board: MSB-430H
- Board: TelosB
- Board: WSN430
- Board: Zolertia Z1
- Board: eZ430-Chronos
- Family: native
- Board: native
- Family: x86
- Board: Intel Galileo