Install BeagleBone C Build Environment and Write Hello World for BeagleBone Using C and a Makefile

All these instructions are to be run on the Beaglebone itself using putty.

Install the C Compiler, make and a few other bits and pieces with

opkg install task-native-sdk

Make a folder for your code by running

mkdir code

cd code

Now create a makefile using nano

nano Makefile

Paste the following code and then press ctrl+O and then ctrl+x

CC = gcc
CFLAGS = -Wall -g -O2
OBJECTS = main.o

all: $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o main

Now create the C source file by running

nano main.c

Paste the following code and then press ctrl+O and then ctrl+x

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main (int argc, char **argv)
printf (“Hello from BeagleBone”);
return 0;

To compile your new application run

make all

To run your application



Setup Time Service to Set the Clock on Angstrom BeagleBone

If you run the “date” command and see a date not far from Jan 1 2000 then you will need to set the date.

Update your Package List

opkg update

Get the ntp Package

opkg install ntp ntpdate

Remove the file that describes your local time

rm /etc/localtime

Add a symlink between the file that describes your timezone in the timezones folder to the localtime file.

If you do not live in the sydney nsw timezone you may need to look around in the /usr/share/zoneinfo folder for your timezone.

ln -s /usr/share/zoneinfo/Australia/Sydney /etc/localtime

Now we need to stop the ntpd service so we can request a manual update

/etc/init.d/ntpd stop

Now request the manual update


Confirm the correct time with the “date” command

Restart the ntp daemon with

/etc/init.d/ntpd start


  • Add insructions to start the service automatically on boot. If someone knows how to autostart an Angstrom Service please let me know.

How To Build Custom Angstrom Build for BeagleBone with Ubuntu or Debian

This guide details the process of building a systemd image from the Angstrom source on a ubuntu or debian host.

For the steps below I have used Debian 6.0.4 via a net install

Install Debian 6.0.4 net install choosing only Standard system utilites

From root command prompt run

sudo apt-get install openssh-server

This will allow us to access the machine remotely via ssh

Following instructions on

Install the mandatory packages as root

sudo apt-get install sed wget cvs subversion git-core coreutils unzip texi2html texinfo docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath dosfstools kpartx

Logout as root and return to regular user

Following instructions on in the section down the bottom on “how to reproduce”

Run the following commands

git clone git://

EDIT: I had trouble with this line since I posted this so I have since been using “git clone”

cd setup-scripts
./ config beaglebone/

MACHINE=beaglebone ./ bitbake systemd-image

When the build completes the files of interest will be stored in.

cd ~/setup-scripts/build/tmp-angstrom_2010_x-eglibc/deploy/images/beaglebone/

Insert the BeagleBone SD Card into the debian host.

Run dmesg

you should see the last few lines look like this
[28915.028000] mmc0: new SDHC card at address 1234
[28915.675869] mmcblk0: mmc0:1234 SA04G 3.63 GiB
[28915.675912] mmcblk0: p1 p2
The above notes show that we have an SD card mounted at /dev/mmc/blk0

We now want to format the SD card using the script file here

First get the script on the debian host


Rename the file

mv mkcard.txt

Login as root


Make the file executable

chmod +x

Run the script to format the SD card

./ /dev/mmcblk0

If this is runs nicely then write the Angstrom image to the BeagleBone SD card using
Create a place to mount the new file systems

cd /mnt/

mkdir boot

mkdir Angstrom

Mount the File systems

mount -t vfat /dev/mmcblk0p1 /mnt/boot/

mount /dev/mmcblk0p2 /mnt/Angstrom/

Now using df -h we can see the file systems are mounted and empty

Filesystem Size Used Avail Use% Mounted on

/dev/sda1 226G 9.3G 205G 5% /

tmpfs 1013M 0 1013M 0% /lib/init/rw

udev 1009M 212K 1009M 1% /dev

tmpfs 1013M 0 1013M 0% /dev/shm

/dev/mmcblk0p1 70M 512 70M 1% /mnt/boot

/dev/mmcblk0p2 3.6G 72M 3.3G 3% /mnt/Angstrom

Change directory back to the location of our build

cd /home/craig/setup-scripts/build/tmp-angstrom_2010_x-eglibc/deploy/images/beaglebone/

Copy the boot files to the first partition

cp u-boot.img /mnt/boot/

cp MLO /mnt/boot/

cp uImage-3.2-r5b+gitr09e9651bcf2ee8d86685f2a8075bc6557b1d3b91-beaglebone-20120311054152.bin /mnt/boot


Rename the uImage to just uImage

mv /mnt/boot/uImage-3.2-r5b+gitr09e9651bcf2ee8d86685f2a8075bc6557b1d3b91-beaglebone-20120311054152.bin /mnt/boot/uImage

Copy the root filesystem from the tarball we created earlier to the second partition

tar -xjv -C /mnt/Angstrom/ -f Angstrom-systemd-image-eglibc-ipk-v2012.03-core-beaglebone.rootfs.tar.bz2

Unmount the SD card

umount /mnt/boot

umount /mnt/Angstrom

Your SD card is now ready for booting.

Remove the SD card from the Debian host
Remove all cables from BeagleBone
Insert SD card into BeagleBone
Plug in Ethernet cable to BeagleBone
Plug in power adapter.

The LEDs on the BeagleBone should flash as the device is booting.

Once it has booted it should show up in your routers DHCP Client list with the hostname “beaglebone”

You should now have access to the BeagleBone via an SSH client.
Using the username “root” password “root”

To change the root password use the passwd command.

Now you have a systemd image running on your BeagleBone