当前位置: 代码迷 >> 综合 >> Yocto Bitbake 多版本bb文件存在,如何决定“Preferred Version”?
  详细解决方案

Yocto Bitbake 多版本bb文件存在,如何决定“Preferred Version”?

热度:41   发布时间:2024-02-06 16:30:43.0

  对于刚接触Bitbake编译工具的人来说,很多功能和方式都不是很清楚。(中间是分析过程,可以直达蓝色字看结论。)

  最近就有同事问我,一个recipes中有多个版本的bb文件,比如下面这样:

-rw-rw-r--  1 root root 2664 7月  31 20:22 openssl_1.0.2o.bb
-rw-rw-r--  1 root root 8219 7月  31 20:22 openssl10.inc
-rw-rw-r--  1 root root 4266 7月  31 20:22 openssl_1.1.0h.bb

  你以为你编译的是1.1版本,错,实际上你编译的是1.0,那么从哪能确认呢?看看下面: 


Recipe Name                                    Latest Version         Preferred Version
===========                                    ==============         =================
nativesdk-openssl                                  :1.1.0h-r0                :1.0.2o-r0
openssl                                            :1.1.0h-r0                :1.0.2o-r0
openssl-native                                     :1.1.0h-r0                :1.0.2o-r0

  我X,明明Yocto知道最新版本是1.1,但是还是优先使用1.0,为毛。。

  灵光一闪,去Yocto官网查“https://www.yoctoproject.org/docs/2.4/ref-manual/ref-manual.html#”。

  使用PV关键字,查到了一个BBFILE_PRIORITY,然后看了项目中的,bb文件,没有这个关键字的使用。弃!

  既然是Preferred Version,所以我就继续在官网搜索“Preferred ”。果然,被我找到了PREFERRED_VERSION内容:

If there are multiple versions of recipes available, this variable determines which recipe should be given preference. You must always suffix the variable with the PN you want to select, and you should set the PV accordingly for precedence. You can use the "%" character as a wildcard to match any number of characters, which can be useful when specifying versions that contain long revision numbers that could potentially change. Here are two examples:

     PREFERRED_VERSION_python = "3.4.0"PREFERRED_VERSION_linux-yocto = "4.12%"

  太像了,就是他,我又从项目中搜索这个关键字,找到如下:

\poky\meta\conf\distro\include\ default-versions.inc

PREFERRED_VERSION_openssl = "1.0.%"
PREFERRED_VERSION_openssl-native = "1.0.%"
PREFERRED_VERSION_nativesdk-openssl = "1.0.%"

  如果你不指定版本和优先级,Yocto是默认最新版的。

  以上,请点赞!!

  

  相关解决方案