Building for BeagleBone Black on Linux

Table of Contents

ArduPilot on Beagle Bone Black


To start with, get your BeagleBone running Debian.

(this process was run on a UBUNTU PC)

BBB tiltle picture

BBB tiltle picture

Get prebuilt image:

Verify Image with:

md5sum BBB-eMMC-flasher-debian-7.1-2013-10-08.img.xz
706322a17e5f2251892ad19bec1e5829  BBB-eMMC-flasher-debian-7.1-2013-10-08.img.xz

before plugging your SD card into your computer, type

 df -h

this will list the current mounted drives.

Now plug in your SD card and type

df -h

and see what the drive that was added is called.

In my case it was /dev/sdd1

in which case in the command below, the it is writtern dd of=/dev/sdd  replace this with the correct address for your SD card.

IF YOU GET THIS WRONG   YOU CAN WIPE YOUR HDD……..

then xzcat it to your SD card in your Ubuntu computer…

xzcat BBB-eMMC-flasher-debian-7.1-2013-10-08.img.xz | dd of=/dev/sdd bs=1M

when this is finished, remove the SD Card and place it into your BBB.

Press the boot button, and hold it down while booting, until all four blue lights are solid.

Let go, and wait…..

the lights will flicker a lot at this stage, you will know it is complete when the four lights return to solid Blue (no flickering)

now ssh into the BeagleBone Black by typing

 ssh root@192.168.1.3

(replace IP address with the correct address for the BBB)

password is

 root

Making the rt kernel

(taken from http://wiki.beyondlogic.org/index.php/BeagleBoneBlack_Building_Kernel)

modified for the RT version, and to simplify.


Compiling the BeagleBone Black Kernel

The following contains instructions for building the BeagleBone Black kernel on Ubuntu 13.04.


to make it simple, run

sudo su

you may need to put in your password here…

if you do not have this already, make the following directory

 mkdir /home/YOUR_USERNAME/export
mkdir /home/YOUR_USERNAME/export/rootfs

Prerequisites

ARM Cross Compiler

To compile the linux kernel for the BeagleBone Black, you must first have an ARM cross compiler installed. I use gcc-4.7-arm-linux-gnueabi-base that comes with Ubuntu 13.04. To install the compiler run:

apt-get install gcc-arm-linux-gnueabi
GIT

The Beaglebone patches and build scripts are stored in a git repository. Install git:

apt-get install git

And configure with your identity.

git config --global user.email "your.email@here.com"
lzop Compression

The kernel is compressed using lzo. Install the lzop parallel file compressor:

apt-get install lzop
uBoot mkimage

The bootloader used on the BeagleBone black is u-boot. u-boot has a special image format called uImage. It includes parameters such as descriptions, the machine/architecture type, compression type, load address, checksums etc. To make these images, you need to have a mkimage tool that comes part of the u-Boot distribution. Download u-boot, make and install the u-boot tools:

wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
tar -xjf u-boot-latest.tar.bz2
cd u-boot-2013.10   (look to see what this is called, it may have changed)
make tools
install tools/mkimage /usr/local/bin
Compiling the BeagleBone Black Kernel

Here we compile the BeagleBone Black Kernel, and generate an uImage file with the DTB blob appended to the kernel for ease of use.

git clone git://github.com/beagleboard/kernel.git
cd kernel
git checkout 3.8-rt
./patch.sh
cp configs/beaglebone kernel/arch/arm/configs/beaglebone_defconfig
wget http://arago-project.org/git/projects/?p=am33x-cm3.git\;a=blob_plain\;f=bin/am335x-pm-firmware.bin\;hb=HEAD -O kernel/firmware/am335x-pm-firmware.bin
cd kernel
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- beaglebone_defconfig -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage dtbs -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage-dtb.am335x-boneblack -j4

Now we build any kernel modules:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4

And if you have your rootfs ready, you can install them:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/home/YOUR_USERNAME/export/rootfs modules_install

 Installing the RT kernel

After you have made the Linux kernel…

ensure you have Debian installed on the beaglebone and ssh into the Beaglebone from Linux….

ssh root@192.168.1.3

(my ip address, adjust for your beaglebone)

Go to folder /boot/uboot/

cd /boot/uboot/

make sure there is a backup folder there..

if not

mkdir backup

then backup your zImage

cp zImage uInitrd backup/

then

ls /lib/modules

it should show 3.8.13-bone28 or similar

now we need to go to our Ubuntu computers terminal

go to your export folder that you made

cd /home/YOUR_USER_NAME/export/rootfs/lib/modules

and run

rsync -avz 3* root@192.168.1.3:/lib/modules/

then run

rsync /home/proficnc/u-boot-2013.10/kernel/kernel/arch/arm/boot/zImage 192.168.1.3 :/boot/uboot/

back on your Beaglebone run the following

 ls /lib/modules

you should now have both the old file and the new rt folder.

Now type

sync
reboot
Some useful tips…..

Hooking up the sensors

When hooking up your Sensor board it connects as follows (using SHORT wires)

i2c connection

i2c connection


I2c Debug

To detect if the i2c is working, you can use the following command

     i2cdetect -r 1
i2c check

i2c check

The numbers:  1e, 53, 69, 77 are the MAG, Gyro, Accel, and Baro.(not in that order)


Hooking up your GPS

To be added


Hooking up your Receiver

To be added


Hooking up your servos

To be added


Hooking up your Airspeed sensor

To be added


Adjusting the BBB clock

cpufreq-info

shows your current frequency

clock check

clock check

Edit /etc/default/cpufrequtils (you might need to create it if it doesn’t exist). Specify the governor with the GOVERNOR variable:

nano /etc/default/cpufrequtils

add the following……

# valid values: userspace conservative powersave ondemand performance
# get them from cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
GOVERNOR="performance"

CTRL-X to exit

Y to save

Reboot, and check to see that it has worked


Installing and Making ArduPilot on BBB

install git, make, gawk, g++, arduino-core on your BBB

apt-get install git make gawk g++ arduino-core
git clone git://github.com/diydrones/ardupilot.git

then open

cd ardupilot/ArduPlane

or

 cd ardupilot/ArduCopter

or

 cd ardupilot/ArduRover2

then type

 make configure

then

make linux

from this directory, run the tmp/ArduPlane.elf (or ArduCopter, or ArduRover)

 tmp/ArduPlane.elf

Connecting to GCS

To be added……………

Comments are closed.