Yocto拷贝文件到文件系统

wmwdgq
  • 65

因项目中需要opencv, 所以使用交叉编译工具链编译了opencv。项目使用Yocto管理所有的模块, 想把编译好的opencv变成板载镜像, 这样就不用每次都移植opencv了。所以我写了如下 bb文件。

SUMMARY = "Install opencv 3.4.14 libraries"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

SRC_URI = "\
        file://etc \
        file://usr \
"

S = "${WORKDIR}"


## prebuilt library don't need following steps
do_configure[noexec] = "1"
do_compile[noexec] = "1"
do_package_qa[noexec] = "1"
do_install[nostamp] += "1"

do_install() {
    install -d ${D}/usr/local/bin
    cp -rf ${S}/usr/bin/*  ${D}/usr/local/bin/

    install -d ${D}/usr/local/lib
    cp -rf ${S}/usr/lib/*  ${D}/usr/local/lib/

    install -d ${D}/usr/local/include
    cp -rf ${S}/usr/include/*  ${D}/usr/local/include/

    install -d ${D}/usr/local/share
    cp -rf ${S}/usr/share/*  ${D}/usr/local/share/
}

# let the build system extends the FILESPATH file search path
FILESEXTRAPATHS_prepend := "${THISDIR}/prebuilts:"

FILES_${PN} += " \
    /usr/local/bin/* \
    /usr/local/lib/* \
    /usr/local/include/* \
    /usr/local/share/* \
"
# INSANE_SKIP_${PN} += "installed-vs-shipped"

我的recipes目录结构

wb@ubuntu:~/Yocto/meta-semidrive/recipes-test/opencv-gl$ tree -L 3
.
├── opencv-gl.bb
└── prebuilts
    ├── etc
    │   └── ld.so.conf
    ├── LICENSE
    └── usr
        ├── bin
        ├── include
        ├── lib
        └── share

7 directories, 3 files

使用bitbake执行任务是通过的, 但是最终烧写板载镜像启动系统后, 文件系统中却没有这些文件。究竟哪里写错了??

回复
阅读 832
1 个回答
✓ 已被采纳

bb文件是OK的, 要在meta-xxx下的conf配置文件中的 IMAGE_INSTALL_append中加上这个recipes就可以了。

宣传栏