about virtual variable

Adrian Ambrożewicz adrian.ambrozewicz at linux.intel.com
Mon Jun 22 23:55:18 AEST 2020


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"
>>
>>


More information about the openbmc mailing list