Here are the steps I used to get the latest version of Linux 6LoWPAN stack running on BeagleBone Black (BBB). The steps below are a BBB version of what Openlabs did for the Raspberry Pi B. The goal here is to use the Openlabs 802.15.4 radio on BBB.
First, I loaded the Debian 2015-03-01 Release on my sdcard following the steps found here.
I strongly suggest that you get that image booted on your BBB first. This rules out any issues with your setup prior to using the steps below. You can also go back to the stock Debian image if needed. This Debian release sets the sdcard up such that we can u-boot different kernels by changing just one line in /boot/uEnv.txt.
One running, we’ll replace the Debian kernel with what is built via the steps below.
1 2 3 4 5 6 |
mkdir openlabs cd openlabs sudo apt-get install autoconf automake gawk g++ git-core lzop 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/ wget http://arago-project.org/git/projects/?p=am33x-cm3.git\;a=blob_plain\;f=bin/am335x-pm-firmware.bin\;hb=HEAD -O firmware/am335x-pm-firmware.bin |
The file “beaglebone_defconfig” doesn’t seem to be in this repo. I copied “beaglebone_defconfig” from “someplace” into the “arch/arm/configs/beaglebone_defconfig” directory. IIRC I got the file from the “patch” for 3.8 kernel, see http://beagleboard.org/linux. You only need the beaglebone_defconfig file which will be available after running the patch.sh script.
Now make beaglebone_defconfig:
1 |
CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm make beaglebone_defconfig |
Configure the kernel for 6LoWPAN. If you are using the Openlabs radio, you will want to enable that in the kernel too.
1 |
CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm make menuconfig |
I enabled the following via menuconfig, as kernel modules:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
CONFIG_IEEE802154=m CONFIG_IEEE802154_SOCKET=m CONFIG_IEEE802154_6LOWPAN=m CONFIG_IEEE802154_DRIVERS=m CONFIG_IEEE802154_AT86RF230=m CONFIG_IEEE802154_MRF24J40=m CONFIG_IEEE802154_CC2520=m CONFIG_IEEE802154_6LOWPAN=m CONFIG_6LOWPAN=m CONFIG_6LOWPAN_NHC=m CONFIG_6LOWPAN_NHC_DEST=m CONFIG_6LOWPAN_NHC_FRAGMENT=m CONFIG_6LOWPAN_NHC_HOP=m CONFIG_6LOWPAN_NHC_IPV6=m CONFIG_6LOWPAN_NHC_MOBILITY=m CONFIG_6LOWPAN_NHC_ROUTING=m CONFIG_6LOWPAN_NHC_UDP=m CONFIG_BT_6LOWPAN=m |
Now make the kernel and modules:
1 2 3 |
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 |
We need to append this to the am335x-boneblack.dts file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
&am33xx_pinmux { spi1_pins: pinmux_spi1_pins { pinctrl-single,pins = < 0x190 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcasp0_aclkx.spi1_sclk */ 0x194 (PIN_INPUT | MUX_MODE3) /* mcasp0_fsx.spi1_d0 */ 0x198 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* mcasp0_axr0.spi1_d1 */ 0x19c (PIN_OUTPUT_PULLUP | MUX_MODE3) /* mcasp0_ahclkr.spi1_cs0 */ 0x1a4 (PIN_INPUT | MUX_MODE7) /* IRQ: mcasp0_fsr.gpio3_19 */ 0x1ac (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* SLP_TR: mcasp0_ahclkx.gpio3_21 */ 0x044 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* RESET: gpmc_a1.gpio1_17 */ >; }; }; &spi1 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&spi1_pins>; at86rf233@0 { compatible = "atmel,at86rf233"; spi-max-frequency = <7500000>; reg = <0>; interrupts = <19 4>; interrupt-parent = <&gpio3>; reset-gpio = <&gpio1 17 1>; sleep-gpio = <&gpio3 21 1>; xtal-trim = /bits/ 8 <0xF>; }; }; |
then make the dts file:
1 2 |
vi arch/arm/boot/dts/am335x-boneblack.dts CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm make dtbs |
Unlike Pi, we do not need to add u-boot. We can also use the existing u-boot configuration in uEnv.txt. We just need to put our stuff on the BBB with the same names that BBB and u-boot already use to boot and load etc. The name to use is based on the build. I find it bylooking at the name of the directory given to the modules just built:
1 |
ls .mods/lib/modules/4.0.0-rc7-244801-g35ef6e9/ |
Now use that suffix as shown below:
1 2 3 4 |
scp System.map root@172.16.8.123:/boot/System.map-4.0.0-rc7-244801-g35ef6e9 scp .config root@172.16.8.123:/boot/config-4.0.0-rc7-244801-g35ef6e9 scp arch/arm/boot/Image root@172.16.8.123:/boot/initrd.img-4.0.0-rc7-244801-g35ef6e9 scp arch/arm/boot/zImage root@172.16.8.123:/boot/vmlinuz-4.0.0-rc7-244801-g35ef6e9 |
Edit /boot/uEnv.txt, comment out the current uname variable created by the original Debian image. Add a new value for your uname, in my case it was “4.0.0-rc7-244801-g35ef6e9”
1 2 |
#uname_r=3.8.13-bone70 uname_r=4.0.0-rc7-244801-g35ef6e9 |
I also disabled HDMI on BBB. I’ve read that the BBB P9 header uses some of the pins for HDMI. Depending on what you read, this is/isn’t an issue unless you plug in the HDMI cable. Just to be safe, I turned it off. My full /boot/uEnv.txt is below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0 #uname_r=3.8.13-bone70 uname_r=4.0.0-rc7-244801-g35ef6e9 #dtb= cmdline=quiet init=/lib/systemd/systemd ##Example #cape_disable=capemgr.disable_partno= #cape_enable=capemgr.enable_partno= ##Disable HDMI/eMMC cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN,BB-BONE-EMMC-2G ##Disable HDMI #cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN ##Disable eMMC #cape_disable=capemgr.disable_partno=BB-BONE-EMMC-2G ##Audio Cape (needs HDMI Audio disabled) #cape_disable=capemgr.disable_partno=BB-BONELT-HDMI #cape_enable=capemgr.enable_partno=BB-BONE-AUDI-02 ##enable BBB: eMMC Flasher: ##make sure, these tools are installed: dosfstools rsync #cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh |
Now copy the modules over to the BBB:
1 |
rsync -rlhic .mods/lib/modules/ root@172.16.8.123:/lib/modules/ |
Finally, copy dts files over to BBB:
1 |
rsync -rlhic arch/arm/boot/dts/ root@172.16.8.123:/boot/dtbs/4.0.0-rc7-244801-g35ef6e9/ |
Now reboot! When you logon, “uname -a” should show you the image you just built.
The Openlabs 802.15.4 radio was built for Raspberry Pi B. To work with the BBB, you need to connect the J1 pins of the Openlabs radio to the BBB P9 header as shown here.
In a future post, I’ll talk about installing the wpan-tools that make use of the 802.15.4 radio.