BBLayers.conf 使用环境变量指定路径
BBLayers.conf specify path using environment variable
我正在尝试配置 Yocto 构建,并希望能够通过环境变量在 bblayers.conf
中指定层的路径。这将允许工程师检出配置并构建,而无需手动修改 bblayers.conf
以便指定检出内核模块的绝对路径。
我尝试在我的 .zshrc
文件中导出一个变量,例如
export TRIALS=~/TRIALS
不幸的是,当我尝试在 bblayers.conf
中访问它时,未设置值:
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
TRIALS_DIR = "${@os.environ['TRIALS']}"
BBLAYERS ?= " \
/home/ahk/poky/meta \
/home/ahk/poky/meta-poky \
/home/ahk/poky/meta-yocto-bsp \
/home/ahk/poky/meta-amd/meta-amd-bsp \
/home/ahk/poky/meta-amd/meta-amd-distro \
/home/ahk/poky/meta-congatec-amd \
/home/ahk/poky/meta-dpdk \
/home/ahk/poky/meta-openembedded/meta-oe \
/home/ahk/poky/meta-openembedded/meta-networking \
/home/ahk/poky/meta-openembedded/meta-python \
${TRIALS_DIR}/hello-layer \
"
我得到的错误是
bb.BBHandledException
ERROR: Failure expanding variable TRIALS_DIR, expression was
${@os.environ['TRIALS']} which triggered exception KeyError: 'TRIALS'
如何在 shell 中设置可以从 belayers.conf
访问的环境变量
Bitbake 严格控制构建环境以防止不必要的污染。这可以通过包含您需要访问 BB_ENV_WHITELIST
.
的任何变量来覆盖
对于上面的示例,我通过
将$TRIALS
变量添加到BB_ENV_WHITELIST
export BB_ENV_WHITELIST="$BB_ENV_WHITELIST TRIALS"
设置 BB_ENV_WHITELIST
后,必须通过以下方式重新初始化 bitbake
:
cd ~/poky
source oe-init-build-env
然后可以在 bblayers.conf
:
中直接访问 $TRIALS
环境变量
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/home/ahk/poky/meta \
/home/ahk/poky/meta-poky \
/home/ahk/poky/meta-yocto-bsp \
/home/ahk/poky/meta-amd/meta-amd-bsp \
/home/ahk/poky/meta-amd/meta-amd-distro \
/home/ahk/poky/meta-congatec-amd \
/home/ahk/poky/meta-dpdk \
/home/ahk/poky/meta-openembedded/meta-oe \
/home/ahk/poky/meta-openembedded/meta-networking \
/home/ahk/poky/meta-openembedded/meta-python \
${TRIALS}/hello-layer \
"
我正在尝试配置 Yocto 构建,并希望能够通过环境变量在 bblayers.conf
中指定层的路径。这将允许工程师检出配置并构建,而无需手动修改 bblayers.conf
以便指定检出内核模块的绝对路径。
我尝试在我的 .zshrc
文件中导出一个变量,例如
export TRIALS=~/TRIALS
不幸的是,当我尝试在 bblayers.conf
中访问它时,未设置值:
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
TRIALS_DIR = "${@os.environ['TRIALS']}"
BBLAYERS ?= " \
/home/ahk/poky/meta \
/home/ahk/poky/meta-poky \
/home/ahk/poky/meta-yocto-bsp \
/home/ahk/poky/meta-amd/meta-amd-bsp \
/home/ahk/poky/meta-amd/meta-amd-distro \
/home/ahk/poky/meta-congatec-amd \
/home/ahk/poky/meta-dpdk \
/home/ahk/poky/meta-openembedded/meta-oe \
/home/ahk/poky/meta-openembedded/meta-networking \
/home/ahk/poky/meta-openembedded/meta-python \
${TRIALS_DIR}/hello-layer \
"
我得到的错误是
bb.BBHandledException
ERROR: Failure expanding variable TRIALS_DIR, expression was
${@os.environ['TRIALS']} which triggered exception KeyError: 'TRIALS'
如何在 shell 中设置可以从 belayers.conf
Bitbake 严格控制构建环境以防止不必要的污染。这可以通过包含您需要访问 BB_ENV_WHITELIST
.
对于上面的示例,我通过
将$TRIALS
变量添加到BB_ENV_WHITELIST
export BB_ENV_WHITELIST="$BB_ENV_WHITELIST TRIALS"
设置 BB_ENV_WHITELIST
后,必须通过以下方式重新初始化 bitbake
:
cd ~/poky
source oe-init-build-env
然后可以在 bblayers.conf
:
$TRIALS
环境变量
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/home/ahk/poky/meta \
/home/ahk/poky/meta-poky \
/home/ahk/poky/meta-yocto-bsp \
/home/ahk/poky/meta-amd/meta-amd-bsp \
/home/ahk/poky/meta-amd/meta-amd-distro \
/home/ahk/poky/meta-congatec-amd \
/home/ahk/poky/meta-dpdk \
/home/ahk/poky/meta-openembedded/meta-oe \
/home/ahk/poky/meta-openembedded/meta-networking \
/home/ahk/poky/meta-openembedded/meta-python \
${TRIALS}/hello-layer \
"