Bitbake - build engine
- Basically it is a Python program which, driven by user created configuration, can execute user created tasks for user specified targets, so called recipes.
- It is concerned with building and deploying the packages
- It needs to deploy all the packages that are needed to satisfy run-time dependencies on the target system
- Built tool primary by the OpenEmbedded and Yocto Project, to build Linux distributions.
NOTE: https://a4z.bitbucket.io/docs/BitBake/guide.html Tutorial to create the smallest possible project and extend it step by step to show and explain how BitBake works
Build-time dependency
within T.bb (recipe of T)
DEPEND:= P
- P must be built before T; as T can’t be built without P
- P::do_populate_sysroot() –> T::do_configure()
Example,
in tar.bb
DEPEND:= gcc
Here it is DEPEND, because
- tar can’t be built without gcc (C compiler)
- but there is no need gcc (C compiler) to use tar; tar can be deployed without deploying gcc (C compiler)
Run-time dependency
within T.bb (recipe of T)
RDEPEND:= P
- P must be deploy to the target system if it deploys T; as T can’t be used without P
- P::do_package_write() –> T::do_build()
Example,
in tar.bb
RDEPEND:= libc
Here it is RDEPEND, because
- tar can’t be used without libc (C run-time library)
- if tar is deployed then libc (C run-time library) must also be deployed
Bitbake Command Line options
Bitbake tasks
task examples: listtasks, fetch, fetchall, devshell, compile, clearall, clearstate etc
Each task has resp function, like compile task function is do_compile() [with/without _append() or _prepend()]
- BitBake stores the output of each task in a directory, the shared state cache. Its location is controlled by the SSTATE_DIR variable.
- This cache is use to speed up compilation
- Over time, as compile more recipes, it can grow quite big It is possible to clean old data with:
$ ./scripts/sstate-cache-management.sh –remove-duplicated -d \–cache-dir=<SSTATE_DIR>
Bitbake commands
Typical useful commands
References
- http://stackoverflow.com/questions/30802811/bitbake-runtime-vs-build-dependency
- https://community.nxp.com/docs/DOC-94953
- http://free-electrons.com/doc/training/yocto/yocto-slides.pdf “The power of BitBake” Slides from 78
- https://elinux.org/Bitbake_Cheat_Sheet