Using devtool in Yocto to patch/customize recipe/package sources

When you build a particular recipe by running the command "bitbake <recipe_name>", yocto framework creates a tmp/work/<architecture>/<recipe>/<version> directory. Also known as "work" directory. This is the directory where Yocto performs all the tasks such as fetching the source, configuring, building and packaging etc.

Sometimes, you need to add customizations on top of downloaded recipe source code.
For example you have 'matchbox-terminal' recipe and you have a customization to hide the title bar.

You will find the work directory in 'build/tmp/work/corei7-64-poky-linux/matchbox-terminal/0.1-r0/' and source code in 'build/tmp/work/corei7-64-poky-linux/matchbox-terminal/0.1-r0/git/'



To add our customizations, we basically open main.c and add our customizations and then recompile it using bitbake command, and this is not the best approach in Yocto for making customizations, as  you can easily lose the changes


Yocto provides a tool/utility 'devtool' which allows you to make changes in the source code of a particular recipe, it creates a patch as well as bbappend file for us.

Steps to use devtool for customization:

1. Run 'devtool modify <recipename>' command, in our case it is 'devtool modify matchbox-terminal' . This command will fetch the sources and unpack them in 'build/workspace/sources/<recipename> directory.

2. Make the required changes in your source code

3. Build the recipe using 'bitbake <recipename>' to verify/test your changes
4. Once you are happy with the changes, you go to the source folder and commit your changes

5. Now run 'devtool update-recipe <recipename> -a <path to your layer>' command which will create a bbappend and patch of changes you made

6. Finally, you can delete the build/workspace/sources/<recipename> folder

Comments

Popular posts from this blog

bb.utils.contains yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig

PR, PN and PV Variable in Yocto