Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is best practice to do small changes in source code in Yocto

Tags:

yocto

bitbake

Is it good practice to edit source code in poky/build/tmp/work directory ? because if we accidentally cleansstate ,the changes will be erased.

Alternatively we can edit source code in "files" directory along with recipe file but since mostly code here is in zipped form due to large number of files , so we will need to unzip and zip again just to change one line of code.

So what is best way to edit source code in yocto ?

like image 472
waqas Avatar asked Nov 26 '15 13:11

waqas


People also ask

What is the difference between BB and Bbappend?

bbappend file resides in your layer, while the main . bb recipe file to which you are appending Metadata resides in a different layer. Being able to append information to an existing recipe not only avoids duplication, but also automatically applies recipe changes from a different layer into your layer.

What is .BB file in yocto?

BitBake Recipes, which are denoted by the file extension . bb , are the most basic metadata files. These recipe files provide BitBake with the following: Descriptive information about the package.

What is BitBake in yocto?

While BitBake is key to the build system, BitBake is maintained separately from the Yocto Project. BitBake is a generic task execution engine that allows shell and Python tasks to be run efficiently and in parallel while working within complex inter-task dependency constraints.


1 Answers

If your question is about permanent changes, then Dan's answer is the one to follow. I.e. add a <recipe name>.bbappend to the recipe in your own layer, in which you add SRC_URI += "file://mypatch1.patch \ file://mypatch2.patch \ " enumerating all the patches you need.

If there's a large number of patches, it might make sense to fork the upstream repository, and maintain your own branch in your fork. In that case, you'll likely want to reference your own repository, instead of either the upstream repository or tarball.

OTOH, if your question was more about work-in-progress; then sure, doing it in oky/build/tmp/workoky/build/tmp/work/xxxx will work. (And quite likely, it's what most people have been doing for a long time).

However, there's a much better way in recent releases (from 1.8, fido). The new tool is called devtool. You can use it as follows:

devtool modify -x <recipe-name> <path-to-unpack-source> unpacks the source and creates a new bbappend to build from the unpacked source. It also creates a git repo in the source directory.

Now you can modify the source. You can test-build your modified source by running devtool build <recipe-name>. Once you're satisfied, use git add ... and git commit to commit your changes to the local repo. Once you've commited the changes to the local repo, you can run: devtool update-recipe <recipe-name> to update the recipe in question. When you're satisfied, you can run devtool reset <recipe-name> to remove the temporary bbappend.

See also: Yocto manual on modifying source code

like image 143
Anders Avatar answered Nov 17 '22 11:11

Anders