烘烤食谱-对图像进行简单复制 [英] bitbake recipe - doing a simple copy of the image

查看:74
本文介绍了烘烤食谱-对图像进行简单复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个配方,以在构建整个映像时将两个文件(MyfileA,MyfileB)简单地复制到特定目录.这是我的目录结构:

I am attempting to write a recipe that would simple copy two files (MyfileA , MyfileB) to a specific directory when the overall image is built. This is what my directory structure looks like:

MyDir/MyRecipe.bb
MyDir/files/MyfileA
MyDir/files/MyfileB

我希望将这两个文件复制到home的一个文件夹中(该文件夹最初将不存在,因此应创建目录).该文件夹可以称为"Testfolder" 这就是我的bitbake文件的样子

I would like the two files to be copied to a folder in home (which would not exist initially hence the directories should be created)The folder lets say is called "Testfolder" This is what my bitbake file looks like

DESCRIPTION = "Testing Bitbake file"
PR = "r0"

SRC_URI = "file://MyfileA \
           file://MyfileB "

do_install() {
        install -d  MyfileA ~/TestFolder/
}

请让我知道我在这里做错了什么吗? 当我对此进行bitbake时,得到以下内容

Kindly let me know if I am doing something wrong here? When i run bitbake on this I get the following

The BBPATH variable is not set and bitbake did not find a conf/bblayers.conf file in the expected location.
Maybe you accidentally invoked bitbake from the wrong directory?
DEBUG: Removed the following variables from the environment: LANG, LS_COLORS, LESSCLOSE, XDG_RUNTIME_DIR, SHLVL, SSH_TTY, OLDPWD, LESSOPEN, SSH_CLIENT, MAIL, SSH_CONNECTION, XDG_SESSION_ID, _, BUILDDIR

在这方面的任何帮助将不胜感激.

Any help in this regard would be appreciated.

推荐答案

首先,要创建自己的元层,应在Yocto环境中运行命令yocto-layer create MyRecipe.这是为了确保您在meta层中具有所有必要的元素.确保将新的元层放入conf/bblayers.conf

First of all, to create your own meta-layer, you should run command yocto-layer create MyRecipe in your Yocto Environment. This is to make sure that you have all the necessary element in your meta layer. Make sure to put the new meta-layer into conf/bblayers.conf

可以在此处

第二,将文件从一个目录复制到另一个目录.

Second, to copy a file from one to another directories.

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
}

要获得更多详细信息,这是我对文件在Yocto中如何移动的理解.

To get more in details, this is my understanding of how the files move around in Yocto.

您有一个目录,该目录将元数据存储在/sourced/meta-mylayer/recipes-myRecipe/中.在该目录中,将有一个与配方同名的文件夹. IE. myRecipe/ myRecipe_001.bb.

You have a directory that stored metadata in /sourced/meta-mylayer/recipes-myRecipe/. In that directory, there would be a folder with the same name as the recipe. I.E. myRecipe/ myRecipe_001.bb.

您会将与myRecipe.bb相关的文件(通常是补丁程序)存储在myRecipe/中,以便SRC_URI进入该myRecipe/目录中以获取文件. IE. myFileAmyFileB

You would store the files that are related to myRecipe.bb (usually it is a patch) in myRecipe/ so that SRC_URI will get into that myRecipe/ directory to grab files. I.E. myFileA, myFileB

然后,指定S.这是解压配方源代码所在的构建目录"中的位置.这样,myRecipe构建时,myFileAmyFileB会被移动/复制到那里.

Then, you specify the S. This is the location in the Build Directory where unpacked recipe source code resides. By that mean, myFileA and myFileB are moved/copied to there when myRecipe builds.

通常,S等于${WORKDIR},这等效于${TMPDIR}/work/${MULTIMACH_TARGET_SYS}/${PN}/${EXTENDPE}${PV}-${PR}

Usually, S is equal to ${WORKDIR}, this is equivalent to ${TMPDIR}/work/${MULTIMACH_TARGET_SYS}/${PN}/${EXTENDPE}${PV}-${PR}

实际目录取决于几件事:

The actual directory depends on several things:

TMPDIR:顶级构建输出目录

TMPDIR: The top-level build output directory

MULTIMACH_TARGET_SYS:目标系统标识符

MULTIMACH_TARGET_SYS: The target system identifier

PN:食谱名称

EXTENDPE:时期-(如果未指定PE,通常在大多数配方中都是这种情况,则EXTENDPE为空白)

EXTENDPE: The epoch - (if PE is not specified, which is usually the case for most recipes, then EXTENDPE is blank)

PV:配方版本

PR:配方修订

之后,我们inherit allarch. 此类用于与体系结构无关的配方/数据文件(通常是脚本).

然后,我们要做的最后一件事就是复制文件.

Then, the last thing we have to do is copy the files.

${D}是Build Directory中通过do_install任务安装组件的位置.此位置默认为${WORKDIR}/image

${D} is the location in the Build Directory where components are installed by do_install task. This location defaults to ${WORKDIR}/image

${WORKDIR}/image也可以描述为目标系统中的/目录.

${WORKDIR}/image can also be described as the / directory in the target system.

转到${D}目录并创建一个文件夹调用TestFolder 然后,将myFileA从${WORKDIR}复制到${D}/TestFolder

Go to ${D} directory and create a folder call TestFolder Then, copy myFileA from ${WORKDIR} to the ${D}/TestFolder

P.S.请添加评论以进行修复.这里可能有错误的信息,因为我是自己学到这一切的.

P.S. Please add comment to fix. There might be mistaken information here, cause I learned all this by myself.

这篇关于烘烤食谱-对图像进行简单复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆