From 6861647b8c06e1ccd8e612b6ef83e82943ef860b Mon Sep 17 00:00:00 2001 From: Bill Traynor Date: Fri, 21 Jun 2013 11:42:16 -0400 Subject: user-manual-hello: Building out the helloworld example. - expanded the information regarding environment setup - added the step through from first principles bits up to adding the conf files and successfully running the bitbake command Signed-off-by: Bill Traynor --- doc/user-manual/user-manual-hello.xml | 163 +++++++++++++++++++++++++++++++++- 1 file changed, 161 insertions(+), 2 deletions(-) diff --git a/doc/user-manual/user-manual-hello.xml b/doc/user-manual/user-manual-hello.xml index 410548727..51ae94fac 100644 --- a/doc/user-manual/user-manual-hello.xml +++ b/doc/user-manual/user-manual-hello.xml @@ -67,7 +67,34 @@ You're now ready to use BitBake. - + A final step to make development easier is to add the executable + binary to your environment PATH. + First, have a look at your current PATH variable. + If I check mine, I get: + $ echo $PATH + /home/wmat/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin: + /usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games + + Now add the directory location for the BitBake binary to the PATH + with: + $ export PATH={path to the bitbake executable}:$PATH + + This will add the directory to the beginning of your PATH environment + variable. + For example, on my machine: + $ export PATH=/media/wmat/Backups/dev/bitbake/bin:$PATH + $ echo $PATH + /media/wmat/Backups/dev/bitbake/bin:/home/wmat/bin: + /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin: + /usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games + + Now, you should be able to simply enter the bitbake + command at the command line to run bitbake. + For a more permanent solution and assuming you are running the BASH + shell, edit ~/.bashrc and add the following to the end + of that file: + PATH={path to the bitbake executable}:$PATH + Note that if you're a Vim user, you will find useful Vim configuration contributions in the contrib/vim @@ -107,9 +134,141 @@ +
+ A Reverse Walkthrough - + One of the best means to understand anything is to walk + through the steps to where we want to be by observing first + principles. + BitBake allows us to do this through the -D or Debug command + line parameter. + We know we want to eventually compile a HelloWorld example, but + we don't know what we need to do that. + Remember that BitBake utilizes three types of metadata files: + Configuration Files, Classes, and Recipes. + But where do they go, how does BitBake find them, etc. etc.? + Hopefully we can use BitBake's error messaging to figure this + out and better understand exactly what's going on. + + + First, let's begin by setting up a directory for our HelloWorld + project. + I'll do this in my home directory and change into that + directory: + $mkdir ~/dev/hello && cd ~/dev/hello + Within this new, empty directory, let's run BitBake with + Debugging output and see what happens: + $bitbake -DDD + The BBPATH variable is not set + DEBUG: Removed the following variables from the environment: + GNOME_DESKTOP_SESSION_ID, LESSOPEN, WINDOWID, + GNOME_KEYRING_CONTROL, DISPLAY, SSH_AGENT_PID, LANG, + XDG_SESSION_PATH, XAUTHORITY, LANGUAGE, SESSION_MANAGER, + SHLVL, MANDATORY_PATH, COMPIZ_CONFIG_PROFILE, TEXTDOMAIN, + GPG_AGENT_INFO, SSH_AUTH_SOCK, XDG_RUNTIME_DIR, + COMPIZ_BIN_PATH, GDMSESSION, DEFAULTS_PATH, TEXTDOMAINDIR, + XDG_SEAT_PATH, XDG_CONFIG_DIRS, XDG_CURRENT_DESKTOP, + DBUS_SESSION_BUS_ADDRESS, _, XDG_SESSION_COOKIE, + DESKTOP_SESSION, LESSCLOSE, GNOME_KEYRING_PID, + UBUNTU_MENUPROXY, OLDPWD, GTK_MODULES, XDG_DATA_DIRS, + COLORTERM, LS_COLORS + + The majority of this output is specific to environment variables + that are not directly relevant to BitBake. However, the very + first message The BBPATH variable is not set + is and needs to be rectified. So how do we set the BBPATH + variable? + + + When BitBake is run it begins looking for metadata files. + The BBPATH variable is what tells BitBake where to look. + It is possible to set BBPATH as an environment variable as you + did above for the BitBake exexcutable's PATH. + However, it's much more flexible to set the BBPATH variable for + each project, as this allows for greater flexibility. + + + Without BBPATH Bitbake will not find any conf/.conf + files or recipe files at all. + It will also not find bitbake.conf. + Note the reference to conf/. + It is standard practice to organize the project's directory tree + to include a conf/ and a classes/ directory. + Add those now to your project directory. + $ mkdir conf classes + Now let's copy the sample configuration files provided in the + BitBake source tree to their appropriate conf and classes + directory. Change to the BitBake source tree directory and: + cp conf/bitbake.conf ~/dev/hello/conf/ + cp classes/base.bbclass ~/dev/hello/classes/ + + At this point your project directory structure should look like + the following: + + ~/dev/hello$ tree + . + ├── classes + │   └── base.bbclass + └── conf + └── bitbake.conf + + + + But what about BBPATH, we still haven't set it? + + + The first configuration file that BitBake looks for is always + bblayers.conf. + With this knowledge we know that to resolve our BBPATH error we + can add a conf/bblayers.conf file to our + project source tree and populate it with the BBPATH variable + declaration. + From your project source tree: + $ vim conf/bblayers.conf + Add the following to the empty bblayers.conf file: + BBPATH := "${TOPDIR}" + + + Now from the root of our project directory, let's run BitBake + again and see what happens: + :~/dev/hello$ bitbake -DDD + Nothing to do. Use 'bitbake world' to build everything, or run + 'bitbake --help' for usage information. + DEBUG: Removed the following variables from the environment: + GNOME_DESKTOP_SESSION_ID, LESSOPEN, WINDOWID, + GNOME_KEYRING_CONTROL, DISPLAY, SSH_AGENT_PID, LANG, + XDG_SESSION_PATH, XAUTHORITY, LANGUAGE, SESSION_MANAGER, + SHLVL, MANDATORY_PATH, COMPIZ_CONFIG_PROFILE, TEXTDOMAIN, + GPG_AGENT_INFO, SSH_AUTH_SOCK, XDG_RUNTIME_DIR, + COMPIZ_BIN_PATH, GDMSESSION, DEFAULTS_PATH, TEXTDOMAINDIR, + XDG_SEAT_PATH, XDG_CONFIG_DIRS, XDG_CURRENT_DESKTOP, + DBUS_SESSION_BUS_ADDRESS, _, XDG_SESSION_COOKIE, + DESKTOP_SESSION, LESSCLOSE, GNOME_KEYRING_PID, UBUNTU_MENUPROXY, + OLDPWD, GTK_MODULES, XDG_DATA_DIRS, COLORTERM, LS_COLORS + DEBUG: Found bblayers.conf (/home/wmat/dev/hello/conf/ + bblayers.conf) + DEBUG: LOAD /home/wmat/dev/hello/conf/bblayers.conf + DEBUG: LOAD /home/wmat/dev/hello/conf/bitbake.conf + DEBUG: BB configuration INHERITs:0: inheriting /home/wmat/dev/ + hello/classes/base.bbclass + DEBUG: BB /home/wmat/dev/hello/classes/base.bbclass: handle + (data, include) + DEBUG: LOAD /home/wmat/dev/hello/classes/base.bbclass + DEBUG: Clearing SRCREV cache due to cache policy of: clear + DEBUG: Using cache in '/home/wmat/dev/hello/tmp/cache/ + local_file_checksum_cache.dat' + DEBUG: Using cache in '/home/wmat/dev/hello/tmp/cache/ + bb_codeparser.dat' + + NOTE: From this point forward, the environment variable + removal messages will be ignored and omitted. + Let's examine the relevant DEBUG messages: + + + +
+ -- cgit 1.2.3-korg