Bitbake not installing my file in the rootfs image
Asked Answered
B

2

18

I have created a bitbake recipe that would copy 2 of my files (firmware binaries for VPU) into `/lib/firmware/` directory on targets root filesystem.

I have tried many options so I'm now not sure what in my recipe is unnecessary/redundant and what is needed. I think that FILESEXTRAPATHS.., SRC_URI.. and do_install.. should be enough but it doesn't work with just it and neither with all other stuff.

DESCRIPTION = "VPU libraries provided by fsl"

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"

PACKAGE_ARCH = "all"
ALLOW_EMPTY_${PN} = "1"

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += " \
    file://vpu_fw_imx6d.bin \
    file://vpu_fw_imx6q.bin \
"

INSANE_SKIP_${PN} += "installed-vs-shipped"

do_install () {
    install -d ${D}${base_libdir}/firmware/
    cp ${WORKDIR}/vpu_fw_imx6d.bin ${D}${base_libdir}/firmware/
    cp ${WORKDIR}/vpu_fw_imx6q.bin ${D}${base_libdir}/firmware/
    chmod 755 ${D}${base_libdir}/firmware/vpu_fw_imx6d.bin
    chmod 755 ${D}${base_libdir}/firmware/vpu_fw_imx6q.bin
}
PACKAGES = "${PN}"
FILES_${PN} += " \
        ${D}${base_libdir}/firmware/vpu_fw_imx6d.bin \
        ${D}${base_libdir}/firmware/vpu_fw_imx6q.bin \
"

Could you please point me what I do wrong?

EDIT:
Anders answer really helped and resolved the issue.

I'm posting "fixed" recipe in case someone finds it helpful.

DESCRIPTION = "VPU libraries provided by fsl"

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"

PACKAGE_ARCH = "all"

SRC_URI += " \
    file://vpu_fw_imx6d.bin \
    file://vpu_fw_imx6q.bin \
"

do_install () {
    install -d ${D}${base_libdir}/firmware/
    install -m 755 ${WORKDIR}/vpu_fw_imx6d.bin ${D}${base_libdir}/firmware/
    install -m 755 ${WORKDIR}/vpu_fw_imx6q.bin ${D}${base_libdir}/firmware/
}

FILES_${PN} += " \
        ${base_libdir}/firmware/vpu_fw_imx6d.bin \
        ${base_libdir}/firmware/vpu_fw_imx6q.bin \
"
Biomedicine answered 3/12, 2015 at 13:56 Comment(0)
P
14

Remove all lines that aren't necessy, just to be on the safe side.

FILESEXTRAPATHS is not necessary; it's only used when you're writing a .bbappend file to modify a recipe in another layer.

ALLOW_EMPT_${PN} is also not needed. It's used to allow PN to be empty, which is only useful if you're creating other packages. In your case, you wnat the firmware files in PN, thus it's better to have bitbake error out while building your package if the files can't be installed.

INSANE_SKIP_${PN} += "installed-vs-shipped" is also not needed. It's only required if you install files in your do_install that you're not putting in a package. Normally, you're advised to not install them or delete the files instead.

Your do_install() should work fine; though I'd recommend to use install instead of cp and chmod. That way you're also ensured that the owner and group will be correct. (Checks for this are added as a new QA check in Jethro).

PACKAGES = "${PN}" is not needed.

Remove ${D} from you FILES_${PN} definition. The paths in FILES should be the path on the target (i.e. not including the D-directory).

This should get you up'n'running.

Philae answered 4/12, 2015 at 7:29 Comment(4)
FILESEXTRAPATHS used only in bbappend is not entirely true, it can add the path where one one to search for there files. It can be useful in bb files tooGoulder
Sure if could be used, but is there really any real benefit of it? There's already three directories that are used to find files, in which case would you need more?Philae
I have made a layer for my project in the existing yocto framework. The catch is, I am not open sourcing my "source code", we are providing that as a tar ball to customers. I want to give flexibility to user to keep that code anywhere in machine, locally. Now in order to tell where locally my changes are kept I have to use it. If there is a better way please let me know, I will be happy to use that.Goulder
Ok, sure that's one way to handle it. I'd say that most layers likely solve this by adding the closed source tarball in SRC_URI using a invalid URL. Then the user of the layer have two options, either putting the tarball directly in DL_DIR, or changing the SRC_URI in a beautiful.Philae
R
3

Thanks, good starting point. I finally did it this way for installing two .sh scripts.

I created this file structure (the folder name "files" is automatically known by Yocto and can best be kept as is):

    > bitbake-layers create-layer meta-mylayer
    > cp -r meta-mylayer ../sources/yocto/meta-layers/
    > cat >> conf/bblayers.conf << EOF
    > ${BSPDIR}/sources/meta-mynetworklayer \
    > EOF
    > pwd
    /yocto/meta-layers/meta-mylayer/recipes-tools/somename
    > tree .
    .
    ├── files
    │   ├── somescript1.sh
    │   └── somescript2.sh
    └── somename.bb

I added the refenrence to "somename" to the local.conf:

IMAGE_INSTALL_append = " somename"

And the somename.bb file looks this way:

DESCRIPTION = "Some description"

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI += " file://somescript1.sh \
             file://somescript2.sh \
           "

inherit allarch
do_compile[noexec] = "1"

do_install() {
    install -d ${D}${bindir}
    install -m 0770 ${WORKDIR}/somescript*.sh ${D}/${bindir}
}

Yocto will find the files in the folder "files" automatically, it will copy them to the temporary ${WORKDIR} and the second "install" line makes sure that both files will later on the target be present in the folder /usr/bin. Because ${bindir} (e.g. /usr/bin) is used as copy target no FILES_${PN} is needed in this case.

Riarial answered 22/5, 2020 at 13:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.