[yocto] source an environment file in bitbake recipe.

Bas Mevissen abuse at basmevissen.nl
Thu Sep 12 02:42:17 PDT 2019


On 9/11/19 5:09 PM, Pandey, Kamal wrote:
> Hi,
> Is there any way by which I can use the source command inside a bitbake recipe for example if I need to source some environment file before compiling.
> source  <filename> doesn't seem to work
> Will  the command .  <filename> work
>   
> What exactly I need to inherit for source command to work

I ran into something similar in a Makefile. There the problem was that 
the default sub shell used is /bin/sh and does not support the "source" 
command. Solution for the Makefile I used is like:

SHELL=/bin/bash

MY_VAR = $(shell source func_defs.sh && call_func 1 2)

So maybe do something like (untested):

bash -c 'source source func_defs.sh && call_func 1 2'

in the bitbake recipe. You obviously depend on bash-native for that recipe.

Hope this helps,

-- Bas.


More information about the yocto mailing list