How to distribute software with OPKG for Beaglebone black


OPKG for Beaglebone black

If you have made a cape for the BeagleBone (black), made the device tree to go along with it and you have flashed the EEPROM as you should, chances are that you also need some software to go along with it.

If you also have ambitions of distributing your cape, you soon run into the problem of how to also distribute the software. Since the standard Linux distro that comes with BeagleBone is Angstrom, the easiest (and best) is to use the OPKG packet handling system for distributing the software. That way, your users will have an easy way of staying up to date with the software changes you make. Chances are, there will be a lot of them, at least in the beginning.

I’m going to use Replicape as an example here, since that is the only cape I’ve made that will need software to be distributed. To clear up any confusion, the cape (hardware) is called Replicape, but the G-code daemon (software) has been forked to a separate repository and is now called Redeem. It’s just convenient to keep them separate as in RAMPS and Marlin.

What I want is for all the people that buy the cape to be able to write something like:

opkg install redeem

And everything will be peachy. And then when you have added a few patches to your software, you want everyone to write:

opkg update
opkg upgrade redeem

And all your shiny new patches are flawlessly applied. Better yet, I want the Toggle front end to do an automatic check for when new software is available.

On the back end you want to write something along the lines of:

make upload_redeem_ipk

or something like that, and a new ipk is uploaded to your server.

So starting form the back, here is how it can be done. Most of this work on the recipes was done by Tim Orling, and he is also the maintainer of the meta-replicape repository.

Make the bitbake recipe

Update: According to Koen (the Angstrom guru) placing packages in /opt is not right. To quote him:

“that’s for anti social binary only crap.”

Making Bitbake recipes can be difficult, and it’s beyond the scope of this blog post. Also, I’m not very good at it :p. But with a lot of help from Tim, I’ve managed to get it working. For a detailed list of how to do this, have look at the wiki:


Some of the parts have been left out since they are pulled in from the inc file, but what happens is that Bitbake fetches the git repository, compiles the braid module which is a C optimized part of the software and the copy the remaining Python files to /opt/Replicape/. All of this happens on the host btw.

include redeem.inc

LIC_FILES_CHKSUM = "file://../LICENSE;md5=d91509a59f42bb5341a8af8295f28211"

S .= "/software"

inherit distutils
export BUILD_SYS
export HOST_SYS
do_install_append () {
 install -d ${D}/opt
 install -d ${D}/opt/Replicape
 install -d ${D}/opt/Replicape/software
 install -d ${D}/opt/Replicape/software/config
 install -m 0644 ${S}/*.py ${D}/opt/Replicape/software
 install -m 0644 ${S}/*.c ${D}/opt/Replicape/software
 install -m 0644 ${S}/config/*.cfg ${D}/opt/Replicape/software/config
FILES_${PN} += " 

Make the IPK packets

When the recipe is ready, you Bitbake it. For Redeem, there are a few dependencies, but they should all be satisfied when installing the main redeem software:

MACHINE=beaglebone bitbake redeem

This makes the necessary packages and puts them in

It also creates all the dependency packages necessary, so expect the compilation to take a lot of time even though your own software is small.

For more background info there is also a great blog post on how to make a “hello world” example here: http://hambedded.org/blog/2012/11/24/from-bitbake-hello-world-to-an-image/

Make a packet feed file

Redeem has a few dependencies since it relies on SPI, I2C and the PRU.

It needs PyPRUSS for controlling the Programmable Realtime Unit (PRU) from Python.

PyPRUSS in turn needs PASM for compiling the firmware for the PRU and also the shared module libprussdrv.so in order to load and run the firmware.

The file to describe these dependencies and also list the packages available is called Packages or alternatively Packages.gz if it’s zipped.

This file is created by bitbake by issuing:

MACHINE=beaglebone bitbake package-index

The files appear in setup-scripts/deploy/eglibc/ipk/armv7ahf-vfp-neon/

Make sure you delete the packages files before re-issuing the command or they will not be updated.

Marcin has more in depth info: http://marcin.juszkiewicz.com.pl/2009/01/22/how-to-install-additional-software-into-your-oe-generated-rootfs/

Upload the packet

Once you have the IPK packet, you need to put it on a server. This is basically uploading all the packages to a directory you choose on a server you own:

scp  setup-scripts/deploy/eglibc/ipk/armv7ahf-vfp-neon/* username@feeds.thing-printer.com:feeds/v2013.06/ipk/eglibc/armv7ahf-vfp-neon/machine/beaglebone/

This can easily be put in a Makefile for later reference. Here is my feed: http://feeds.thing-printer.com/v2013.06/ipk/eglibc/armv7ahf-vfp-neon/machine/beaglebone/

Once the packet is on the server, you can, from your Beaglebone, install it directly by specifying the URL:

opkg install http://feeds.thing-printer.com/v2013.06/ipk/eglibc/armv7ahf-vfp-neon/machine/beaglebone/redeem_A4-r0.1.ipk

This is good for development, but if you want the full experience, there are a couple of more things to do:

 Add the packet repo to opkg

On your BeagleBone, write this in a shell:

echo 'src/gz replicape-base http://feeds.thing-printer.com/feeds/v2013.06/ipk/eglibc/armv7ahf-vfp-neon/machine/beaglebone' > /etc/opkg/replicape-base.conf

This will add your now new repository of files to the list for Opkg to fetch. So, still on your BeagleBone write:

opkg update
opkg install redeem

For more information, the Gumstix dev centre has a good post on how to add packages: http://gumstix.org/add-software-packages.html

That’s it! Really the hard part is learning to make recipes, the rest is a breeze : )


Similar Posts


Leave a Reply