Post Single Template - EPTeck
devtool in yocto

What is Devtool in Yocto? How to Patch Recipe using Devtool

Devtool is undoubtedly one of the best tools in embedded Linux and Yocto. It allows developers to easily change or patch the source code of any recipe easily.  Suppose you have a calculator recipe in Yocto and want to change its code or functionality. You can easily do it via devtool. Similarly, if you want to modify other applications in Yocto, like u-boot or kernel, devtool can be your best friend. But there is a problem. Only a little material is available that simply explains the concept and usage of devtool. Therefore, many newcomers need help in using devtool. But don’t worry. We will tell you how to use devtool in the simplest words.

What is devtool?

  It is a tool in Yocto that fetches all your recipe sources in one place. You can modify any file you want until you get the desired results. Interesting, isn’t it?   You might be thinking that you already have all the sources available in your meta layer for many recipes. Why can’t you modify sources there? Ah! You can do it, but it's a very non-professional approach.   First of all, most of the meta-layers in Yocto come from Github or Gitlab. If they modify the code there, Yocto will re-fetch the meta layer from GitHub, and all your changes will be gone. To avoid this loss, you have to patch your source code. Developers usually create patches using the git diff command in the work directory, but it's a difficult approach. You can easily patch any source code using Devtool, which we will discuss later.   Furthermore, many recipes in Yocto have their source code on GitHub. Whenever you build the recipe, Yocto fetches the source code from there and then compiles it. So, you cannot modify the source code of such recipes easily. For example, the source code of kernel and u-boot comes from GitHub. This is where Devtool finds its importance.   In simple words, Devtool offers a simple and legitimate way to modify the sources of any recipe.   

How to Use Devtool?

  We have noticed that there is very little help available on using devtool. But we will ensure that you can use devtool in your projects after reading this tutorial. Let's get started!  

Step 1: Devtool Modify:

Use the devtool modify <recipe-name> command in the terminal where you are using bitbake. For example, if you want to change the kernel, you can simply use devtool modify virtual/kernel. In order to modify u-boot, you can use devtool modify uboot command. Similarly, you can modify custom recipes like devtool modify hello-world etc. devtool in yocto - step 1

Step 2: Go to Workspace:

After using the above command, you will see a workspace folder in the build directory. Here, you will find all the sources of the recipe that you want to modify in build/workspace/<recipe-name>/sources.  Make changes to your source code. Test your changes by bit baking your recipe and image devtool in yocto - step 2 Change the source code of the recipe in the workspace folder as long as you don’t get the desired functionality.  

Step 3: Commit Your Changes:

Commit your changes using the below commands. Note that you can only cmit changes in the build/workspace/<recipe-name>/sources directory. devtool in yocto - step 3

Step 4: Patch using Devtool:

Now, you can easily create a patch (.bbappend file) using the below command, and you are done. devtool in yocto - step 4 This command will automatically create bbappend files in your custom layer.  

Step 5: Delete Your Workspace:

Now simply delete your workspace. Your patch is ready. Enjoy! If you are facing any difficulties relating to embedded linux, feel free to Contact Us for any help. We have a professional team of embedded linux developers who are ready to face any challenge in this domain solve your problems.

Add a Comment

Your email address will not be published.