Difference between revisions of "Using devtool to modify recipes in Yocto"

From KoanSoftware Wiki
Jump to: navigation, search
(Created page with "== Creating Using devtool to modify recipes in Yocto == Suppose you have a requirement of customizing an existing sources for a recipe, <code>devtool</code> will be the best...")
 
Line 1: Line 1:
 
== Creating Using devtool to modify recipes in Yocto ==
 
== Creating Using devtool to modify recipes in Yocto ==
  
Suppose you have a requirement of customizing an existing sources for a recipe, <code>devtool</code> will be the best option to go, as it will do all the steps required to create a patch, bbappend file etc.
+
Suppose you have a requirement of customizing an existing sources for a recipe, <code>devtool</code> will be the best option to go, as it will do all the steps required to create a patch, <code>bbappend</code> file etc.
 +
 
 +
As part of building a recipe, Yocto/OE creates a tmp/work/<architecture>/<recipe>/<version> directory, known as the "work directory".
 +
This is where all of the work done to build a recipe takes place.
 +
One of the things you'll find in this directory is the source, usually under a subdirectory named <recipename>-<version> or "git" (depending on how the fetched source is provided).
 +
The temptation (and what people used to do in the past) is to simply make changes here and then recompile, but there are several reasons why that's not a good idea:
 +
 
 +
* It's awkward - you have to use <code>bitbake -c compile -f</code> or <code>bitbake -C compile</code> to force recompilation, since the build system doesn't know that you've made any changes
 +
* You can easily lose your changes if you're not careful e.g. running <code>bitbake -c clean</code> will wipe the directory out
 +
 
 +
Luckily there's a much better method using the <code>devtool</code> command:

Revision as of 16:08, 30 November 2020

Creating Using devtool to modify recipes in Yocto

Suppose you have a requirement of customizing an existing sources for a recipe, devtool will be the best option to go, as it will do all the steps required to create a patch, bbappend file etc.

As part of building a recipe, Yocto/OE creates a tmp/work/<architecture>/<recipe>/<version> directory, known as the "work directory". This is where all of the work done to build a recipe takes place. One of the things you'll find in this directory is the source, usually under a subdirectory named <recipename>-<version> or "git" (depending on how the fetched source is provided). The temptation (and what people used to do in the past) is to simply make changes here and then recompile, but there are several reasons why that's not a good idea:

  • It's awkward - you have to use bitbake -c compile -f or bitbake -C compile to force recompilation, since the build system doesn't know that you've made any changes
  • You can easily lose your changes if you're not careful e.g. running bitbake -c clean will wipe the directory out

Luckily there's a much better method using the devtool command: