【问题标题】:copy some folders with files into a directory in recipe将一些带有文件的文件夹复制到配方中的目录中
【发布时间】:2017-10-02 13:29:26
【问题描述】:

我正在创建一个 yocto 配方来编译和安装我的 c++ 程序。这个程序需要一些我想部署在/home/root/my_folder中的文件

我想知道如何创建“my_folder”以及如何复制这些文件。假设这是我的食谱结构:

root folder/
    Recipe_0.1.bb
    Recipe-0.1/
             recipe.cpp
             my_folder/
                   another_folder/
                         multiple jpg files
                   another_folder1/
                         multiple png files
                   fileA.txt
                   fileB.txt

我必须做些什么才能让它工作?

这就是我现在正在尝试的:

我猜是这样的:

SRC_URI = "file://*"

我的文件夹中的所有内容(文件和其他文件夹...):

do_install(){
     install -d ${D}${bindir}
     install -d ${D}$/home/root/myFolder
     install -d ${D}$/home/root/myFolder/myImages
     install -d ${D}$/home/root/myFolder/myImages/dogs
     install -d ${D}$/home/root/myFolder/myImages/cats

     install -m 0777 MyApp ${D}${bindir}
     install -m 0777 ${WORKDIR}/myFolder ${D}/home/root/myFolder
     install -m 0777 ${WORKDIR}/myFolder ${D}/home/root/myFolder/myImages/dogs
     install -m 0777 ${WORKDIR}/myFolder ${D}/home/root/myFolder/myImages/cats
}

我检查了日志,但没有看到任何关于问题的有用信息。

【问题讨论】:

    标签: yocto recipe


    【解决方案1】:

    我之前回答过这个问题,你可以在这里找到它:bitbake recipe - doing a simple copy of the image

    Recipe_0.1.bb 需要SRC_URI 指向您需要复制的文件。

    DESCRIPTION = "Testing Bitbake file"
    SECTION = "TESTING"
    LICENSE = "MIT"
    LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
    PR = "r0"
    
    SRC_URI = "file://MyfileA \
               file://MyfileB "
    
    #specify where to get the files
    S = "${WORKDIR}"
    
    inherit allarch
    
    #create the folder in target machine
    #${D} is the directory of the target machine
    #move the file from working directory to the target machine
    
    do_install() {
            install -d ${D}/TestFolder 
            install -m ${WORKDIR}/MyfileA ${D}/TestFolder
    }
    

    您可以将内容存储在 Git 上,或将其制作成 tarball。下面的例子是 git;

    DESCRIPTION = "Example of data or configuration recipe"
    SECTION = "examples"
    LICENSE = "GPLv2"
    LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-
    2.0;md5=801f80980d171dd6425610833a22dbe6"
    SRCREV = "${AUTOREV}"
    SRC_URI = "git://github.com/yoctocookbook/examples.git \
    file://example.data"
    S = "${WORKDIR}/git"
    inherit allarch
    do_compile() {
    }
    do_install() {
        install -d ${D}${sysconfdir}
        install -d ${D}${sbindir}
        install -m 0755 ${WORKDIR}/example.data ${D}/${sysconfdir}/
        install -m 0755 ${S}/python-scripts/* ${D}/${sbindir}
    }
    

    【讨论】:

    • 谢谢。但我无法让这个工作。我不能一个一个地添加所有文件(我现在有大约 30-40 个图像,但我想添加大约一百个。我将添加我到目前为止尝试过的内容。我猜 -d 参数会创建一个文件夹和 - m参数复制文件。
    • 添加了添加文件夹的示例。
    【解决方案2】:

    这个食谱对我有用,并复制了我在:${THISDIR}/wlbin/ 中的所有文件

    FILESEXTRAPATHS_prepend := "${THISDIR}:"
    SRC_URI = "file://*"
    
    do_install() {
        install -d ${D}/lib/firmware/ti-connectivity
        install -m 0755 ${THISDIR}/wlbin/* ${D}/lib/firmware/ti-connectivity/
    }
    FILES_${PN} = "/lib/firmware/ti-connectivity/* "
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-06
      • 1970-01-01
      • 2014-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-05
      相关资源
      最近更新 更多