Yocto配方:如何在特定文件夹中安装

sur*_*erd 4 recipe embedded-linux yocto

我为我的程序创建了Yocto配方.什么是从配方构建图像的默认文件夹?在构建图像时,我想将我的文件移动到另一个文件夹,如

"/选择/ XYZ".

我应该简单地做"mv"还是有其他选择吗?

谢谢

flo*_*flo 10

我想你想把你编译的程序复制到一个文件夹,如${bindir}:

引用Yocto参考手册1.1:
当指定路径作为CONFFILES变量的一部分时,最好使用适当的路径变量.例如,$ {sysconfdir}而不是/ etc或$ {bindir}而不是/ usr/bin.您可以在源目录中的meta/conf/bitbake.conf文件的顶部找到这些变量的列表.

您可以将工作目录中的文件复制到目标文件系统中的任何目录.例如,请参阅hello-world示例(请注意,该示例来自1.1参考手册,但我还没有在较新版本中找到它):

 DESCRIPTION = "Simple helloworld application"
 SECTION = "examples"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
 PR = "r0"

 SRC_URI = "file://helloworld.c"

 S = "${WORKDIR}"

 do_compile() {
    ${CC} helloworld.c -o helloworld
 }

 do_install() {
    install -d ${D}${bindir}
    install -m 0755 helloworld ${D}${bindir}
 }
Run Code Online (Sandbox Code Playgroud)

在此示例中,helloworld二进制文件将复制到/usr/bin您的映像上(也可以/opt,请参阅源目录以获取变量定义).


yoc*_*com 5

do_install(){
  install -d ${D}{base_prefix}/opt/xyz/          
  install -m ${WORKDIR}/yourbinary    ${D}${base_prefix}/opt/xyz/
}

FILES_${PN} = "${base_prefix}/opt/*"
Run Code Online (Sandbox Code Playgroud)

上面第一行在 opt/xvz/ 中的 imagedir 中创建目录

第二行将二进制文件复制到 opt/xyz/dir

第三行用于将 opt/xyz/binary 复制到 yocto rootfs。