Gomu
Gomu

Reputation: 1064

Bitbake -c clean removed source

I'm beginner for 'BitBake'. I need to modify source code and build it. I found the sources to be located at build/tmp/work/ within a directory which has git commit id as its name. I wanted to rebuild the source. So I gave bitbake -c clean <package_name>, followed by bitbake <package_name>. The image got built. But, when I went back to modify the source, the git repository seems to be missing in its location.

1) How do I get the source back?

2) What is the safe way of rebuilding the source after making modifications?

Thanks in advance.

Upvotes: 15

Views: 50267

Answers (3)

Abhishek Dwivedi
Abhishek Dwivedi

Reputation: 7406

bitbake -c cleansstate <package name>

will not remove the source, so do_fetch content will be as it is. And next time

bitbake <package name>

So, do_fetch will not execute next time but rest of the. Such as do_patch, do_metadata, do_compile, etc. If you want to try with some changes at the source level, you can also have a try of

bitbake <package name> -c devshell

I found devshell a convenient way to try with some source or inpackage level changes and tryout. It does open a new shell at the package location. Where you can give the commands locally. As simple as make.

Upvotes: 4

iksajotien
iksajotien

Reputation: 1051

In addition to great jku's answer:

ad.1) How do I get the sources back?

You can just simply fetch the source code, no other tasks are going to be executed:

bitbake -c fetch -f <package_name>

Generally by passing:

bitbake -c clean <package_name>

or with force option:

bitbake -c clean -f <package_name>

You have triggered the task do_clean from recipe responsible for this package. By checking the tasks code (directly in recipe or in inherited recipe) what exactly will be done. Also in the same directory build/tmp/work/ you can find a /temp/ with logs for each executed tasks. e.g.: log.do_fetch will contain output of task do_fetch() for this specific package.

Upvotes: 3

Jussi Kukkonen
Jussi Kukkonen

Reputation: 14587

1) How do I get the source back?

bitbake -ccleansstate <package_name>
bitbake <package_name>

This will make sure bitbake won't use shared state and will have to actually do all the tasks during the second command (including unpack and patch, which will populate sources in a directory in $WORKDIR).

2) What is the safe way of rebuilding the source after making modifications?

If you want to modify sources in $WORKDIR as a quick hack, then

bitbake -f -ccompile <package_name>
bitbake <package_name>

will mark the compile task as dirty and when the next command builds the recipe, all tasks from compile onwards will be executed. Note that bitbake will warn you about the dirty state until you do a cleansstate, and also that cleansstate will wipe the $WORKDIR alongside your changes: so this is only useful for quick tests.

If you're looking for a way to do more development and still quickly test things with a yocto/OE build alongside the development, take a look at devtool. I expect part 4.3.1.2. (Use devtool modify to Enable Work on Code Associated with an Existing Recipe) might be relevant for you.

Upvotes: 20

Related Questions