将带有文件的一些文件夹复制到配方中的目录中

时间:2017-05-04 11:30:08

标签: yocto recipe

我正在创建一个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
}

我检查了日志,但是我没有看到有关错误的任何有用信息。

2 个答案:

答案 0 :(得分:0)

之前我已回答过这个问题,您可以在此处找到: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}
}

答案 1 :(得分:0)

此食谱对我有用,并复制了我拥有的所有文件:$ {THISDIR} / wlbin /

<a href="javascript:void%200;">