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

问题描述 投票:0回答:1

我正在尝试复制目标 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 文件正确吗?提前致谢。

yocto openembedded
1个回答
4
投票

您的

do_install
部分有两个问题,

  1. ${S}
    指向源目录,但
    SRC_URI
    会复制
    ${WORKDIR}
    中的内容。所以你应该在安装部分使用
    ${WORKDIR}
  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/
}
© www.soinside.com 2019 - 2024. All rights reserved.