Yocto:cp无法统计文件:没有这样的文件或目录

时间:2018-10-02 05:53:08

标签: yocto openembedded

我正在尝试在目标rootfs中复制两个文件夹(包含一些脚本)。我已经在其中创建了一个自定义层和一个自定义配方。  我的目录结构是这样的:

../sources/meta-company/recipes-bla_2.06/
└── bla
    ├── bla
    │   ├── dir1
    │   │   ├── dir
    │   │   │   └── files.sh
    │   └── dir2
    │       ├── dir
    │       │   ├── files.sql
    │       ├── test.sh
    └── bla_2.06.bb

我的.bb文件如下:

DESCRIPTION = " bla "

LICENSE = "CLOSED"

SRC_URI = "file://dir1/ \
           file://dir2/ "

do_install() {
    install -d ${D}/root/dir1
    install -d ${D}/root/dir2
    cp -r --no-dereference --preserve=mode,links -v ${S}/dir1/ ${D}/root/dir1
    cp -r --no-dereference --preserve=mode,links -v ${S}/dir2/ ${D}/root/dir2/
}

FILE_$PN = "/root/"

我得到的错误:

> Log data follows: | DEBUG: Executing shell function do_install | cp:
> cannot stat
> '/home/amol/test/fsl-arm-yocto-bsp/build-cl-som-imx7-fsl-imx-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/bla/1.0-r0/bla-1.0/dir1':
> No such file or directory | WARNING: exit code 1 from a shell command.
> | ERROR: Function failed: do_install (log file is located at
> /home/amol/test/fsl-arm-yocto-bsp/build-cl-som-imx7-fsl-imx-x11/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/seriald/1.0-r0/temp/log.do_install.49808)
> NOTE: recipe bla-1.0-r0: task do_install: Failed NOTE: Tasks Summary:
> Attempted 334 tasks of which 333 didn't need to be rerun and 1 failed.

我是yocto的新手,我的.bb文件正确吗?谢谢!

1 个答案:

答案 0 :(得分:1)

您的do_install部分有两个问题,

  1. ${S}指向源目录,但是SRC_URI将您的内容复制到${WORKDIR}中。因此,您应该在安装部分中使用${WORKSIR}
  2. 您正在尝试在${S}/dir1/内复制${D}/root/dir1,这意味着您的最终结构为/root/dir1/dir1/。您可能不想要这个。

所以修改后的版本看起来像

do_install() {
    install -d ${D}/root/dir1
    install -d ${D}/root/dir2
    cp -r --no-dereference --preserve=mode,links -v ${WORKDIR}/dir1/* ${D}/root/dir1/
    cp -r --no-dereference --preserve=mode,links -v ${WORKDIR}/dir2/* ${D}/root/dir2/
}