Saturday, February 06, 2016

Steps involved in Yocto while building a package

The steps involved in building a package is almost similar to the steps involved in building a package manually with the addition of a few steps.

Manual Build:

The manual building of a package involves the below steps which are pretty straightforward.
1) Download
2) Extract
3) Patch ( If needed)
4) Configure
5) Compile
6) Install

Yocto Build:

In Yocto the following steps are usually involved in building a package. To know the exact list of tasks you can run the below command.

bitbake <packagename> -c listtasks

1) Fetch or download
The source of the package mentioned in the variable SRC_URI, in the recipe file is fetched. Depending on the source the method to fetch is determined ( wget, git, svn, ftp etc). The download directory is either the one created in the build directory or the one mentioned in the DL_DIR variable.

2) Unpack or Extract
The downloaded package is then extracted to the working directory.

3) Patch
The extracted source is patched if any patch is mentioned in the SRC_URI variable. The patch file is searched for in a set of directories in the location where the recipe is found. The default is files , then a combination of the package names. If you want to have the patches in a directory name of your choice it should be mentioned in the variable  FILESEXTRAPATHS_prepend.

4) Configure
The package is configured with all the necessary options and information such as CC, CXX etc.
The EXTRA_OECONF(autotools) or the EXTRA_OECMAKE(cmake) variable can be used to pass additional arguments to configure or the configure can be entirely overrided by implementing do_configure.

5) Compile
The package is compiled as per the configuration. EXTRA_OEMAKE passes additional options to the make command. The compile function can be overrioverrided by implementing do_compile.

6) Install
The compiled package is installed. Similar to configure and compile do_install can be used to implement our own install function.

7) Package and QA
In these steps the package is packaged as per the package class. Then it is checked for any future issues it may cause in the QA. Also the package status is added to cache file in package_setscene.

If the package needs to be added to the sysroot that would be done.

I hope I have shed some light into the steps involved in building a package in Yocto.

No comments:

Post a Comment