BitBake

BitBake - What is it?

BitBake is a tool that "at its simplest, a tool for executing tasks and managing metadata." This is what drives the OpenEmbedded system. OpenEmbedded is really just a repository of configuration files and information that this tool, BitBake, uses for building and compiling everything.

BitBake handles the order of compiling for all the packages. Applications on Linux, especially manually compiling them, require a lot of extra dependent files. In order for each package to compile properly the dependent packages must be compiled first. BitBake takes care of all of this. Technically the configuration files tell BitBake in what order to compile all needed packages.

With the set of configuration files that come with OpenEmbedded you can build an entire distribution with just a single BitBake command.

BitBake - Where do I get it?

BitBake, like OpenEmbedded, is stored in a version control system. BitBake uses the Subversion version control system to store all its files. You will need to install Subversion in order to access the files. You can download subversion from http://subversion.tigris.org/. Most Linux distributions either come with subversion installed or have a pre-built package ready for you to download so check your distribution's package manager.

Once you have subversion installed you can get the BitBake files by typing the following command: svn co svn://svn.berlios.de/bitbake/branches/bitbake-1.8/ bitbake. BitBake is a python based program so in order to run it you will need to have a version of Python installed (2.4 or greater). Once you have the files you can either install BitBake using the setup.py file and it will be installed into different directories on your machine, or, the preferred way is just to keep the files inside the directory that is downloaded via Subversion and just run it from there. Most environment setup files, like the one shown on http://www.angstrom-distribution.org/building-angstrom, add the BitBake bin folder to the PATH environment variable, allowing them to run bitbake from wherever it is required.

BitBake - How do I install it?

There are two options when it comes to installing BitBake.

  1. The preferred method is to just checkout the files from the Subversion repository using the commands above and keep them where they were downloaded. All you need to do is to add the bitbake/bin folder to your PATH environment variables.
    • You can do this by using the following code
      • export PATH=$PATH:/path/to/bitbake/bin
    • This can be placed in your ~/.bashrc file, or a text file your can source anytime you want to run bitbake, or you can just run the command manually on the command line
  2. The other method is to use the setup.py file that is downloaded along with bitbake to install it to the python libraries.
    • Run the following command inside the bitbake directory:
      • python setup.py install

 

BitBake - How do I use it?

To use BitBake you will need to have your configuration files setup properly, since BitBake cannot do anything without the proper information. Please see the OpenEmbedded section for more information.

You will also need to have your environment variables set properly. This includes your BBPATH which is the location of all the *.bb files which contain the information for what BitBake needs to build.

Setting up your environment is the most important consideration. If you are using OpenEmbedded (http://www.pedersen-web.com/linuxhandheld/?h=2&p=12) then you should look at files in the "conf" folder to see what environment variables are being set and also pay special attention to your local.conf file and change things there as necessary.

Once you have your environment setup then you can call simple commands to build packages. The following are a few examples:

  • bitbake -e - This will not build anything but will output all the environment variables that will be set for whatever you are building.
  • bitbake nano - This will build the "nano" program for your device
  • bitbake -c clean nano - The -c option along with the clean parameter tells BitBake to clean up all the compiled files, in this case everything for the nano package. This is a good step to take if you are rebuilding a package.
  • bitbake -c clean world - This will clean up everything. The "world" package is a meta-package, it is not actually a program but it will clean up every package that was built. Be wise in using this as it takes a long time to clean every package in the OpenEmbedded system.
  • bitbake gpe-image - This will build an entire distribution for you based on the sources from OpenEmbedded. It will create an entire GUI based environment with all the packages, the kernel, and the HaRET startup.txt files you will need.
  • See http://oe.linuxtogo.org/wiki/UsefulTargets for more information on special packages/targets that can be built with OpenEmbedded.