A BitBake Hello World
BitBake Hello World The simplest example commonly used to demonstrate any new programming language or tool is the Hello World example. This chapter demonstrates, in tutorial form, Hello World within the context of BitBake. This tutorial describes how to create a new Project and the applicable metadata files necessary to allow BitBake to build it.
Obtaining BitBake Please refer to Chapter 1 Section 1.7 for the various methods to obtain BitBake. Once the source code is on your machine the BitBake directory will appear as follows: $ ls -al total 100 drwxrwxr-x. 9 wmat wmat 4096 Jan 31 13:44 . drwxrwxr-x. 3 wmat wmat 4096 Feb 4 10:45 .. -rw-rw-r--. 1 wmat wmat 365 Nov 26 04:55 AUTHORS drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 bin drwxrwxr-x. 4 wmat wmat 4096 Jan 31 13:44 build -rw-rw-r--. 1 wmat wmat 16501 Nov 26 04:55 ChangeLog drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 classes drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 conf drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 contrib -rw-rw-r--. 1 wmat wmat 17987 Nov 26 04:55 COPYING drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 doc -rw-rw-r--. 1 wmat wmat 69 Nov 26 04:55 .gitignore -rw-rw-r--. 1 wmat wmat 849 Nov 26 04:55 HEADER drwxrwxr-x. 5 wmat wmat 4096 Jan 31 13:44 lib -rw-rw-r--. 1 wmat wmat 195 Nov 26 04:55 MANIFEST.in -rwxrwxr-x. 1 wmat wmat 3195 Jan 31 11:57 setup.py -rw-rw-r--. 1 wmat wmat 2887 Nov 26 04:55 TODO At this point you should have BitBake extracted or cloned to a directory and it should match the directory tree above. Please note that you'll see your username wherever "wmat" appears above.
Setting Up the BitBake Environment The recommended method to run BitBake is from a directory of your choice. The directory can be within your home directory or in /usr/local, depending on your preference. Let's run BitBake now to make sure it's working. From the BitBake source code directory issue the following command: $ ./bin/bitbake --version BitBake Build Tool Core version 1.19.0, bitbake version 1.19.0 You're now ready to use BitBake. Note that if you're a Vim user, you will find useful Vim configuration contributions in the contrib/vim directory. Copy the files from that directory to your /home/yourusername/.vim directory. If it doesn't exist, create it, and restart Vim.
The Hello World Example The following example leaps directly into how BitBake works. Every attempt is made to explain what is happening, however, further information can be found in the Metadata chapter. The overall goal of this exercise is to create a Hello World example utilizing concepts used to build and construct a complete example application including Tasks and Layers. This is how modern projects such as OpenEmbedded and the Yocto Project utilize BitBake, therefore it provides an excellent starting point for understanding BitBake. It should be noted that this chapter was inspired by and draws heavily from several sources: Mailing List post - The BitBake equivalent of "Hello, World!" Hambedded Linux blog post - From Bitbake Hello World to an Image