如何将可执行文件放入yocto build下的指定目录(路径)

How to place executable in to specied directory (path) under yocto buils

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 build 的新手。我写了简单的 .bb 文件。 我的问题是如何更改目标目录 ${D}。 我想将我的可执行文件放在不同的路径中。

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

...
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 目录下找到您的食谱的输出。