为什么yocto bblayers.conf文件使用绝对路径?

Taf*_*afT 8 configuration-files absolute-path bitbake yocto

Yocto计划允许在大多数的配置文件,但没有内使用相对路径的./build/conf/bblayers.conf文件.什么是阻止使用的任何东西,但对于绝对路径的原因BBLAYERSBBLAYERS_NON_REMOVABLE变量?

我查看了yocto 2.0版(当前版本)的BitBake用户手册,但这并没有解释推理.我还检查了一些较旧的手动版本,但在谈论bblayers.conf文件或BBLAYERS变量时似乎没有提到推理.同样的文件还包含BBPATH = "${TOPDIR}"至少动态分配的文件,而不是远离根yotco目录.

我最好的猜测是bblayers.conf文件特定于它正在运行的系统.这将使它不适合通过源代码控制在开发人员之间共享,绝对路径会强制人们在收到副本时编辑文件.这似乎不是一个很好的理由,因此这个问题.

Mar*_*cke 9

我找到了一种使用相对路径的方法.

您可以使用内联python来遍历文件系统.以下脚本使用提供的TOPDIR变量,然后通过python的os.pathapi 导航到其父级.

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "6"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

YOCTOROOT = "${@os.path.abspath(os.path.join("${TOPDIR}", os.pardir))}"

BBLAYERS ?= " \
  ${YOCTOROOT}/poky/meta \
  ${YOCTOROOT}/poky/meta-yocto \
  ${YOCTOROOT}/poky/meta-yocto-bsp \
"

BBLAYERS_NON_REMOVABLE ?= " \
  ${YOCTOROOT}/poky/meta \
  ${YOCTOROOT}/poky/meta-yocto \
"
Run Code Online (Sandbox Code Playgroud)

参考


gbm*_*ter 5

我设法bblayers.conf通过替换获得工作文件中的“相对路径”

BBLAYERS ?= " \
  /home/username/poky/meta \
  ...
Run Code Online (Sandbox Code Playgroud)

BBLAYERS ?= " \
  ${TOPDIR}/../meta \
  ...
Run Code Online (Sandbox Code Playgroud)

我猜想这种方法的一个警告是,我依赖meta-XXX图层目录始终位于的父文件夹中TOPDIR。使用yocto的默认方法似乎是这种情况,但对于更多定制化的构建设置可能并非如此。


Éti*_*nne 3

所有现有答案都在回答“如何使用相对路径”,但问题是“为什么使用绝对路径”。据我所知,“为什么”很简单,这样做是为了使构建目录可以移动到文件系统上的任何位置。想想看:您可以从文件系统上的任何位置获取 poky/oe-init-build-env ,并且构建目录将在那里创建,因此依赖相对于构建目录的路径是非常脆弱的。

编辑:

也许这更清楚,我认为您假设文件 bblayers.conf 始终位于其中poky/build/conf/bblayers.conf,因此您可以使用类似的路径../../meta-layer-foo来引用某个位于 中的层poky/meta-layer-foo,但如果我实例化“build”,则不会找到该层” 在另一条路径中poky/foo/bar

etienne@ubuntu:~/repos/poky-tx2$ mkdir -p foo/bar
etienne@ubuntu:~/repos/poky-tx2$ cd foo/bar/
etienne@ubuntu:~/repos/poky-tx2/foo/bar$ ls
etienne@ubuntu:~/repos/poky-tx2/foo/bar$ source ../../oe-init-build-env 
You had no conf/local.conf file. This configuration file has therefore been
created for you with some default values. You may wish to edit it to, for
example, select a different MACHINE (target hardware). See conf/local.conf
for more information as common configuration options are commented.

You had no conf/bblayers.conf file. This configuration file has therefore been
created for you with some default values. To add additional metadata layers
into your configuration please add entries to conf/bblayers.conf.

The Yocto Project has extensive documentation about OE including a reference
manual which can be found at:
    http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:
    http://www.openembedded.org/


### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'
etienne@ubuntu:~/repos/poky-tx2/foo/bar/build$ ls
conf
Run Code Online (Sandbox Code Playgroud)