Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to pass in command line variables to a bitbake build?

Tags:

I have an OpenEmbedded environment using bitbake to do some builds. I wanted to get something "interactive" going on where bitbake would pause and ask for input then continue with the build but I've found out that's not possible.

Since I can't do that I'm looking for some way to pass in extra flags for the build. Is there any way to pass in flags to a bitbake build sort of like gcc's -D option?

ie:

bitbake -Dfoo=bar oe-myimage 

Thus during the build process of oe-myimage the variable foo will be set to bar.

like image 625
Mike Avatar asked Jun 28 '13 14:06

Mike


People also ask

What does BitBake command do?

The bitbake command builds platform projects, application source, and packages. BitBake is the overall control program, which manages builds of all the packages and of the overall system. It builds platform projects, application source, and packages.

What BitBake option is used to see the environment variables?

You can find information on how to pass environment variables into the BitBake execution environment in the "Passing Information Into the Build Task Environment" section. The base configuration metadata is global and therefore affects all recipes and tasks that are executed.

What is recipe in BitBake?

BitBake recipes specify how a particular package is built. Recipes consist of the source URL (http, https, ftp, cvs, svn, git, local file system) of the package, dependencies and compile or install options. They also store the metadata for the package in standard variables.

What is inherit in yocto?

In contrast, the inherit keyword looks for a . bbclass class file in much the same way as it locates the . bb files, and inherits all the detials from them (sort of like #include <stdio.


1 Answers

bitbake -Dfoo=bar oe-myimage 

-D flag is not recognized by bitbake. So, using above method will not work. Instead you could specify flags from command line using following steps -

Say you want to export variable foo and expect it be recognized by bitbake.

export foo="foobar" 

You will need to export this and inform bitbake via BB_ENV_EXTRAWHITE variable after sourcing oe-init-build-env. This means

. oe-init-build-env export foo="foobar" export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE foo"       

This whitelists variable 'foo' for bitbake and thus makes it visible to any recipe and subprocess during the build.

After this you can invoke any bitbake operations using variable foo within bitbake via expressions like -

${foo} 
like image 126
mrvulcan Avatar answered Oct 21 '22 01:10

mrvulcan