Using BitBake

BitBake usage examples

Most BitBake commands used when developing are either intended to build (or rebuild) a particular package, or to build a new rootfs image for flashing the device. Here are some examples of the most common commands.

bitbake package-name
Build the “package-name” package.

bitbake -s
List available packages after parsing all recipes. This will generate a lot of output due to sheer number of packages in the system! Best to redirect output to a file bitbake -s > packages.txt

bitbake --help
Print usage help.

Running specific tasks

BitBake supports running individual tasks on a package using the -c flag. See below for examples of running specific tasks using the lighttpd package. If no task is specified, the “build” task is run. This is a generic task that depends on all the other necessary tasks to build a package (fetch, configure, compile, install, etc).

bitbake lighttpd -c listtasks
View a list of possible tasks to run on the lighttpd package.

bitbake lighttpd -c clean
bitbake lighttpd

Clean a package, removing all source code, binaries, etc and rebuild it.

Copy resulting package to target device and install it:

cd ${OETREE}/build/tmp/deploy/eglibc/ipk/armv5te
scp lighttpd_1.4.28-r0.10_armv5te.ipk root@192.168.2.1:/var/tmp/
ssh root@192.168.2.1
opkg install /var/tmp/lighttpd_1.4.28-r0.10_armv5te.ipk

bitbake lighttpd -c compile -f
Force bitbake to run the compile task (perhaps you changed the source after compiling).

bitbake lighttpd -c devshell
Open a new shell with the environment configured for development on the package. This can be very useful for debugging issues with compiling a package.

bitbake -b openembedded/recipes/lighttpd/lighttpd_1.4.28.bb
Runs BitBake on a single recipe file. This bypasses parsing all other recipes and operates only on the specified recipe. This can be useful to speed up development on a particular package when the package is being rebuilt frequently. Note that this skips building any dependencies and therefore they must already be built.