Create IPK Packages for the BeagleBone Black

on

If you are running the Linux distribution in TI’s Processor SDK, you’ve probably noticed that adding new packages using the apt-get utility is not an option. This post will show you how to use existing BitBake recipes and the OpenEmbedded framework to create software packages and install them on your BeagleBone Black.

The TI provided Linux distribution and Software Development Kit for the BeagleBone Black is created and packaged using the OpenEmbedded framework. In order to keep the file system size to a minimum, only a subset of the available packages are in the pre-built file system images. The ‘tree‘ program is an example of a package that does not exist on the BeagleBone Black out-of-the-box.

So, let’s build the ‘tree’ package and install it on our BeagleBone Black. The following steps come mainly from this wiki page and are being performed on a Ubuntu 14.04 development machine for the 3.0.0.4 version of the Linux Processor SDK.

Prepare your Ubuntu development machine to build packages:

  1. Install the necessary build tools using apt-get.
    sudo apt-get install git build-essential python diffstat texinfo gawk chrpath dos2unix wget unzip socat doxygen libc6:i386 libncurses5:i386 libstdc++6:i386 libz1:i386
  2. Download the Linaro cross-compile toolchain and install it. This allows your x86 Ubuntu machine to compile code for the Cortex-A8 processor in the BeagleBone Black.
    wget https://releases.linaro.org/components/toolchain/binaries/5.3-2016.02/arm-linux-gnueabihf/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz
    tar -Jxvf gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz -C $HOME
  3. Clone the OpenEmbedded layer setup repo and change to the cloned directory.
    git clone git://arago-project.org/git/projects/oe-layersetup.git tisdk_3_0_0_4
    cd tisdk_3_0_0_4
  4. Run the layer setup script using the Processor SDK v3.0.0.4 configuration.
    ./oe-layertool-setup.sh -f configs/processor-sdk/processor-sdk-03.00.00.04-config.txt

Take a look inside the ‘configs/processor-sdk/processor-sdk-03.00.00.04-config.txt’ file we used above. This file contains a list of repositories along with specific branch names and commit IDs. The ‘oe-layertool-setup.sh’ script goes through this list of repositories, downloads them to the ’tisdk_3_0_0_4/sources/’ directory, and then checks out the commit ID specified in the configuration file. These repositories are full of BitBake recipes that specify the build process for everything from an individual package all the way up to a full SDK. The ‘processor-sdk-03.00.00.04.txt’ file also allows our Ubuntu development machine to return to the exact state of the repositories as when the Linux Processor SDK v3.0.0.4 was created so we can ensure that any packages we build will be compatible with our BeagleBone Black (since it using the file system provided in the Linux Processor SDK v3.0.0.4).

At this point, your Ubuntu development machine has all of the tools and repositories that it needs to BitBake new packages for the BeagleBone Black. The following steps can now be used to build any package that has an existing BitBake recipe in any of the repositories in the ’tisdk_3_0_0_4/sources/’ directory. Let’s BitBake the tree package:

  1. Configure bash as the default system shell
    sudo dpkg-reconfigure dash
    (Select "no" when prompted)
  2. Change into the tisdk_3_0_0_4/build/ directory and run the environment setup script
    cd build
    . conf/setenv
  3. Add the cross-compile toolchain bin directory to your PATH
    export PATH=$HOME/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin:$PATH
  4. Use the BitBake utility to build the tree package for the BeagleBone Black
    MACHINE=am335x-evm bitbake tree

Now that we have built the tree package, we need to take the corresponding ipk file and copy it over to our BeagleBone Black and install it:

  1. List the contents of the ‘cortexa8hf-neon-linux-gnueabi’ folder to see all of the packages that have been built.
    cd tisdk_3_0_0_4/build/arago-tmp-external-linaro-toolchain/work/cortexa8hf-neon-linux-gnueabi/
    ls
  2. Now navigate into the tree directory to find the ipk file we need.
    cd tree/1.7.0-r0/deploy-ipks/cortexa8hf-neon/
    ls
  3. Copy the tree_1.7.0-r0_cortexa8hf-neon.ipk file to your BeagleBone Black home directory. I will use scp since both my Ubuntu development machine and BeagleBone Black are on the same local network but you can use any method you’d like to get the ipk file onto your board.
    scp tree_1.7.0-r0_cortexa8hf-neon.ipk root@192.168.1.112:/home/root/
  4. Now switch over to your BeagleBone Black prompt and use opkg to install the tree package.
    opkg install tree_1.7.0-r0_cortexa8hf-neon.ipk

That’s it! Now you have the tree program on your BeagleBone Black and you have the ability to BitBake hundreds of other packages. If you’d like to build and install a different package, just rerun the BitBake command, copy the ipk file to your BeagleBone Black, and install it using opkg.

Leave a Reply

Your email address will not be published. Required fields are marked *