sob
sob

Reputation: 1088

yocto jethro: Is it possible to set DEFAULTTUNE dynamically

I have two machine conf files, where I am adding the required conf file from meta layer. As follows: # mymachine32.conf require conf/machine/include/tune-cortexa7.inc

and

# mymachine64.conf require conf/machine/include/arm/arch-armv8.inc

The above works fine, but I am attempting to consolidate into a single conf file as follows:

Approach #1

# mymachine.conf DEFAULTTUNE ?= "${@base_contains('MYTUNE', 'arm', 'armv7a-neon', 'aarch64', d)}" require conf/machine/include/arm/arch-armv8.inc

With Approach #1 in my conf file, I see following error:

ExpansionError: Failure expanding variable DEFAULTTUNE, expression was ${@base_contains('MYTUNE', 'arm', 'armv7a-neon', 'aarch64', d)} which triggered exception NameError: name 'base_contains' is not defined

Approach #2

# mymachine.conf DEFAULTTUNE ?= "${@bb.utils.contains('MYTUNE', 'arm', 'armv7a-neon', 'aarch64', d)}" require conf/machine/include/arm/arch-armv8.inc

Whereas with Approach #2 I always get the 'falsevalue' (i.e., aarch64) set to DEFAULTTUNE

Please note that in both cases I am exporting the MYTUNE in my shell

export MYTUNE=arm

Can you please point out what I am doing wrong? Thanks in advance for the help.

Upvotes: 0

Views: 724

Answers (1)

Richard Purdie
Richard Purdie

Reputation: 2368

For approach #1, the code is parsed and executed before base.bbclass so base_contains is not available.

For approach #2, I suspect MYTUNE is not set when the expression is evaluated. I think this is because whilst you set it in the environment, you don't indicate to bitbake it should allow it into the datastore. Try adding:

export BB_ENV_EXTRAWHITE=MYTUNE

which should allow MYTUNE into the datastore. You can test this by greping the output of bitbake -e for MYTUNE to check if it gets set as expected.

Upvotes: 1

Related Questions