[yocto] Help me understand Openembedded variable expansion

Matt Schuckmann Matt.Schuckmann at planar.com
Mon Nov 3 14:38:01 PST 2014



> -----Original Message-----
> From: Richard Purdie [mailto:richard.purdie at linuxfoundation.org]
> Sent: Thursday, October 30, 2014 6:52 AM
> To: Matt Schuckmann
> Cc: Yocto Project
> Subject: Re: [yocto] Help me understand Openembedded variable expansion
> 
> On Tue, 2014-10-28 at 10:11 -0700, Matt Schuckmann wrote:
> > So there is something I just don't get about how variables get
> > created, expanded, interpreted, etc in Bitbake
> >
> > For example I'm trying to copy some of the techniques in the Poky
> Tiny
> > distribution to reduce my image size and build time.
> > One of the fragments is this one.
> >
> > # The mtrace script included by eglibc is a perl script. This means
> > the system # will build perl in case this package is installed. Since
> > we don't care about # this script, remove the dependency from here.
> > RDEPENDS_${PN}-mtrace_pn-eglibc = ""
> >
> > I put this in my distribution .conf file and I doesn't seem to do
> > anything perl is still getting built.
> > Of course it doesn't help that I don't understand what does,
> > especially in the context of the distribution .conf file.
> >
> > I also see hints in the code in debug output that the machine, image,
> > or distribution names can automatically get appended to paths, or
> > variables but I don't really understand how that works.
> >
> > I'm not even sure how to phrase a question around this, immediately
> > I'd like to figure out why Perl is still getting built but ultimately
> > I'd like to understand the variable rules better so I that I can
> > better take advantage of this power tool.
> 
> Perhaps have a look at "overrides" in the bitbake manual.
> 
> You can split RDEPENDS_${PN}-mtrace_pn-eglibc into components. Starting
> on the RHS, "_pn-eglibc" is an override that applies to recipes where
> PN = "eglibc". In those recipes, the variable becomes:
> 
> RDEPENDS_${PN}-mtrace = ""
> 
> and is basically overriding a dependency on perl that would other be
> there, something like:
> 
> RDEPENDS_${PN}-mtrace = "perl".
> 
> Does that help?
> 
> Cheers,
> 
> Richard

Thank you to both Peter Bergin and Richard Purdie, 

I'm "slightly" more knowledgeable now, Peter's suggestion of using bitbake -g -u depexp {image} and looking at the reverse depends for perl lead me to see that it was the external-linaro-toolchain recipe from the Arago layer that was bringing in perl. 
Doing some digging around I could see that meta-arago-extras/recipes-core/meta/external-arago-toolchain.bb is including recipes-core/eglibc/eglibc-package.inc which has the RDEPENDS line perl on mtrace. 

Richards explanation of the dependency override lead me to the following line in my own distribution.conf file. 
RDEPENDS_${PN}-mtrace_pn-external-linaro-toolchain = ""

Now when I run bitbake -g -u depexp {image} I no longer see perl in the list of packages. 

I'm still not sure why it's "pn-external-linaro-toolchain" since the recipe file that includes eglibc-package.inc is called external-arago-toolchain.bb. 

I also tried to take a look in the manual for a description of overrides of this form and I didn't immediately see anything that covered this _pn-foo-bar syntax. I did find this section but it is a bit light and doesn't seem to cover this case
http://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html#conditional-syntax-overrides

Am I missing something? 

Thanks, 
Matt S. 




More information about the yocto mailing list