Yocto rebuild image after modifying source code
Asked Answered
T

3

6

How can I rebuild the image after making some modifications to driver source code?

I have tried bitbake -f -c compile and bitbake but I coudn't find the modified settings in the driver. Can someone tell me how can i rebuild the image with the modified code.

Transilluminate answered 28/5, 2019 at 22:34 Comment(0)
V
2

If you did your modifications not directly in the ${WORKDIR}, you have to set the SRCREV to your new hash and increase your PR. Then enter the command

bitbake <image-name>

Which compiles the one package again and creates the new image with your changes.

If you did your changes in the ${WORKDIR}, please add, commit and push them to your repository and then follow my steps above. This is the cleanest solution.

The command suggested by other solutions:

bitbake <image-name> -c cleansstate 

Will cause all of the packages to rebuild, which can take very long if you don't have an sstate mirror.

Vachell answered 29/5, 2019 at 11:36 Comment(0)
H
10

I guess that you want to re-generate the whole image, don't you? If so, you can try the following commands to ensure that bitbake won't use the sstate cache:

bitbake image-name -c cleansstate && bitbake image-name

In the case you just want to rebuild the kernel, substitute image-name by virtual/kernel (or the name of whatever recipe you want to rebuild).

Note that the do_cleansstate task is going to remove the recipe ${WORKDIR}!

For further information: https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#ref-tasks-cleansstate

In the case you're doing such modifications directly in the ${WORKDIR}, which you shouldn't unless you're testing, the execution of the following command would be enough:

bitbake virtual/kernel -f -c compile

or

bitbake virtual/kernel -C compile (to invalidate the stamps and force all tasks starting from do_compile)
Huddersfield answered 29/5, 2019 at 7:18 Comment(0)
P
3

Since changes in ${WORKDIR} will be rewritten after cleaning, you can put your code to external workspace by command devtool modify <recipe-name>

By default your recipe code will be put into tmp/workspace/source/ directory Now you can freely modify your code and simply build using bitbake <recipe-name> as usual.

When your modification are OK you can easily save your changes as patches to original recipe code (as far as it is likely open-source and downloaded):

  • commit your changes in your workspace
  • in order to automatically create patches and append they to recipe use command devtool recipe-update -a <layer-path> <recipe-name>
Peevish answered 30/5, 2019 at 13:33 Comment(0)
V
2

If you did your modifications not directly in the ${WORKDIR}, you have to set the SRCREV to your new hash and increase your PR. Then enter the command

bitbake <image-name>

Which compiles the one package again and creates the new image with your changes.

If you did your changes in the ${WORKDIR}, please add, commit and push them to your repository and then follow my steps above. This is the cleanest solution.

The command suggested by other solutions:

bitbake <image-name> -c cleansstate 

Will cause all of the packages to rebuild, which can take very long if you don't have an sstate mirror.

Vachell answered 29/5, 2019 at 11:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.