Re: cannot bring global environment var into a recipe


codusnocturnus
 

I think what you need to do is add the environment variable to BB_ENV_WHITELIST or BB_ENV_EXTRAWHITE:

https://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html#var-BB_ENV_WHITELIST

Thanks,

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Tuesday, August 4, 2020 9:54 AM, Rob Prowel <rprowel@comcast.net> wrote:

I don't want to get into a discussion about why it is a good or bad
idea, but I need to use a global shell variable as follows:

using "sumo"...that's all I can use.

$ export PM1_DEVEL_IMAGE=1

or

$ PM1_DEVEL_IMAGE=1 bitbake my-image

and reference that global var in a kernel bbappend such as

SRC_URI += "${@ 'file://rootnfs.cfg' if d.getVar('PM1_DEVEL_IMAGE') else
' '}"

to include the required fragment that supports rootnfs.

If I define the var right in the bbappend then it works as expected:
undefined skips the SRC_URI append, and if defined then it adds my
fragment. I need this to work for a var that is defined (or not) in the
global work shell, not depend upon the definition being IN a recipe file.

I tried using

export PM1_DEVEL_IMAGE

right in the bbappend, but then as far as the recipe is concerned it's
defined and the conditional always succeeds.

is d.getVar not the right function? What function behaves the same but
uses real shell variables?

Suggestions?

Join yocto@lists.yoctoproject.org to automatically receive all group messages.