回复: about virtual variable

周 远清 zhouyuanqing8 at outlook.com
Mon Jul 13 17:50:20 AEST 2020


Hi Adrian,

    Thank you very much, your explanation below is clear. There may have been a delay in my mail server last month and I have recently received mail.

harley

________________________________
发件人: Adrian Ambrożewicz <adrian.ambrozewicz at linux.intel.com>
发送时间: 2020年6月22日 21:55
收件人: zhouyuanqing8 at outlook.com <zhouyuanqing8 at outlook.com>; openbmc <openbmc at lists.ozlabs.org>
抄送: uperic at 163.com <uperic at 163.com>
主题: Re: about virtual variable

In other words - virtual/XYZ is exported by recipes delivering the same
stuff, conflicting with each other . In your system you have to choose
the compiler, kernel etc. While many recipes might deliver those
components, recipe creators use the same 'meta-name' (from 'virtual'
namespace), so then by choosing "PREFERRED_PROVIDER" you can decide
which of the 'implementations' you would like to actually use.

With 'virtual' variables you can use 'virtual/xyz' as a generic alias.
You can then introduce BitBake code depending on magic 'virtual/kernel'
instead of using concrete name of implementations (like linux-aspeed /
linux-nuvoton / linux-yocto / linux-yocto-rt).

Regards,
Adrian

W dniu 6/22/2020 o 15:43, Adrian Ambrożewicz pisze:
> I feel rude for pointing out link to StackOverflow, but this guy really
> nailed it when it comes to easy explanation of 'virtual/' variable
> namespace :)
>
> https://stackoverflow.com/a/37823742/8226884
>
> W dniu 6/22/2020 o 14:48, zhouyuanqing8 at outlook.com pisze:
>> Hi everyone,
>>
>>       I would like to ask, is virtual a variable defined by bitbake? I
>> did not find it in the bitbake manual. What is the use of the virtual
>> variable? What would be the problem without this variable?
>>
>>
>>     2.4. Preferences¶
>>
>> <https://www.yoctoproject.org/docs/latest/bitbake-user-manual/bitbake-user-manual.html#bb-bitbake-preferences>
>>
>>
>> The|PROVIDES|list is only part of the solution for figuring out a
>> target's recipes. Because targets might have multiple providers,
>> BitBake needs to prioritize providers by determining provider
>> preferences.
>>
>> A common example in which a target has multiple providers is
>> "virtual/kernel", which is on the|PROVIDES|list for each kernel
>> recipe. Each machine often selects the best kernel provider by using a
>> line similar to the following in the machine configuration file:
>>
>>       PREFERRED_PROVIDER_virtual/kernel = "linux-yocto"
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20200713/517d64ad/attachment-0001.htm>


More information about the openbmc mailing list