Recipe - FrankBau/meta-marsboard-bsp GitHub Wiki
A recipe is, in it simplest form, a single text file with a syntax understood by the bitbake command.
A simple example is a recipe for CAN bus related utility programs
can-utils_git.bb
in folder $BSPDIR/sources/meta-openembedded/meta-oe/recipes-extended/socketcan
:
SUMMARY = "Linux CAN network development utilities"
DESCRIPTION = "Linux CAN network development"
LICENSE = "GPLv2 & BSD-3-Clause"
LIC_FILES_CHKSUM = "file://include/linux/can.h;endline=43;md5=390a2c9a3c5e3595a069ac1436553ee7"
DEPENDS = "libsocketcan"
SRC_URI = "git://github.com/linux-can/${BPN}.git;protocol=git;branch=master"
SRCREV = "67a2bdcd336e6becfa5784742e18c88dbeddc973"
PV = "0.0+gitr${SRCPV}"
S = "${WORKDIR}/git"
inherit autotools pkgconfig
A recipe describes the ingredients ("take the source code from the mentioned git repository") and build instructions ("bitbake it using autotools and pkgconfig").
With few exceptions, the result of bitbake
are one or more packages.
bitbake can-utils
builds three packages: One contining debug info (dbg), one for further software development on the target (dev) and, most importantly, the package containing the CAN utilities themselves.
In general, there is no 1:1 relation betwenn a recipe name and package names.
For example, the recipe $BSPDIR/sources/meta-openembedded/meta-networking/recipes-support/ntp/ntp_4.2.8p8.bb
for NTP related tools builds 8 packages, including one for the sntp
tool (sntp-4.2.8p8-r0.cortexa9hf_neon.rpm
). So you bitbake ntp, but install sntp.
The bitbake process takes place in a work folder below $BSPDIR/build/tmp/work
. In the example, that is $BSPDIR/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/can-utils/
. The work folder contains several subfolders. A typical folder structure is:
git/
: the downloaded sourcestemp/
: log files of the bitbake stagesbuild/
: intermediate files like compiled object files and librariesdeploy-rpms/
: the packages builtimage/
: the files form the packages as deployed on the target (i.e. you will find/usr/bin/candump
etc. in the root file system of the target if the recipe is included in the image recipe.)
Important Recipes
Image Recipe
A image recipe builds a whole root file system ready for installation on the target like image-multimedia-full.bb
in folder $BSPDIR/sources/meta-marsboard-bsp/recipes-images/image-multimedia-full
.
A copy of the root file system is in the work area of the recipe ($BSPDIR/build/tmp/work/marsboard-poky-linux-gnueabi/image-multimedia-full/1.0-r0/rootfs
). The final result is in $BSPDIR/build_X11/tmp/deploy/images/marsboard
, see Build a Linux image.
Kernel Recipe
There is a virtual recipe for building the Linux Kernel:
bitbake virtual/kernel
Boot Loader Recipe
There is a virtual recipe for building the Boot Loader, see Build the U Boot boot loader:
bitbake virtual/bootloader
Package Group Recipe
A package group recipe like $BSPDIR/sources/meta-openembedded/meta-oe/recipes-core/packagegroups/packagegroup-cli-tools.bb
contains a collection of related packages which can be included in an image recipe by referring to the package group.
Further Reading
- Portable (cross-)compilation and a bitbake recipe for an app written in C
- https://wiki.yoctoproject.org/wiki/Building_your_own_recipes_from_first_principles
- A skeleton for a kernel module recipe: http://git.yoctoproject.org/cgit.cgi/poky/plain/meta-skeleton/recipes-kernel/hello-mod/
- https://blogs.mentor.com/chrishallinan/blog/2012/04/27/more-on-yocto-terminology-recipes-and-packages/
- http://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html