Bitbake not installing my file in the rootfs image

2020-02-25 22:30发布

问题:


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 \
"

回答1:

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.



标签: yocto bitbake