首页 > 解决方案 > 如何将可执行文件放入 yocto 构建下的指定目录(路径)

问题描述

SECTION = "devel"
LICENSE = "CLOSED"
EXTERNALSRC := "${THISDIR}/../../../sample-applications/sampleap/src"
inherit cmake externalsrc
inherit autotools gettext
do_compile() /*section to compile */
{
${CC} ${EXTERNALSRC}/sampleapp.c ${LDFLAGS} -o sample
}
/* To install executable in to specified D */
do_install() 
{
install -d ${D} ${bindir}## 
install -m 0755 sample  ${D} ${bindir}
}

我是 Yocto 的新手。我写了简单的 .bb 文件。这里我的问题是如何更改我的目标目录 ${D}。我想将我的可执行文件放在不同的路径中。

标签: yocto

解决方案


D变量表示目标 rootfs。您可以通过指定在bitbake.conf中定义的前缀之一或之后的相对路径来选择目标 rootfs 上的特定文件夹${D}。例子:

...
install -d ${D}/home/root/mySamples
install -m 0755 sample ${D}/home/root/mySamples
...

如果您想将工件放置在目标 rootfs之外,那么您实际上是在滥用 Yocto 项目。无论如何,你可以在<BUILD_DIR>/tmp/work/<DISTRO-TARGET>/<RECIPE_NAME>/<RECIPE_VERSION>/image目录下找到你的食谱的输出。


推荐阅读