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

时间:2015-07-08 12:57:28

标签: embedded-linux yocto recipe

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

“/选择/ XYZ”。

我应该只做“mv”还是有其他选择?

谢谢

2 个答案:

答案 0 :(得分:10)

我想你想把你编译的程序复制到${bindir}

这样的文件夹中
  

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

您可以将工作目录中的文件复制到目标文件系统中的任何目录。例如,请参阅hello-world example(请注意,该示例来自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}
 }

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

答案 1 :(得分:1)

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

FILES_${PN} = "${base_prefix}/opt/*"
上述

第一行在opt / xvz /

中在imagedir中创建目录

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

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