Search code examples
yoctobitbakeyocto-recipe

How do I package installed files for Yocto?


I'm trying to create a simple Hello World recipe for yocto and failing. I'm just trying to create a directory on the root files system and copy a file there. My recipe layout looks like this:

meta-hw
meta-hw/conf
meta-hw/conf/layer.conf
meta-hw/recipes-main
meta-hw/recipes-main/hello-world
meta-hw/recipes-main/hello-world/hello-world.bb
meta-hw/recipes-main/hello-world/files
meta-hw/recipes-main/hello-world/files/hello-world.txt

This is my layer.conf:

BBPATH .= ":${LAYERDIR}"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_PATTERN_yoctobsp = "^${LAYERDIR}/"
BBFILE_PRIORITY_yoctobsp = "5"
LAYERVERSION_yoctobsp = "4"

This is my hello-world.bb:

DESCRIPTION = "Hello world recipe"
LICENSE = "CLOSED"

SRC_URI = "file://hello-world.txt"

do_install() {
        install -d ${D}/hw
        cp ${WORKDIR}/hello-world.txt ${D}/hw/
}

FILES_${PN} += "/hw"
FILES_${PN} += "/hw/hello-world.txt"

And this is the output I get from bitbake hello-world, telling me I haven't packaged the /hw and /hw/hello-world.txt files, though I thought that's what the FILES_${PN} lines were doing.

ERROR: hello-world-1.0-r0 do_package: QA Issue: hello-world: Files/directories were installed but not shipped in any package:
  /hw
  /hw/hello-world.txt
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
hello-world: 2 installed and not shipped files. [installed-vs-shipped]
ERROR: hello-world-1.0-r0 do_package: Fatal QA errors were found, failing task.
ERROR: Logfile of failure stored in: /data/toradex/build/tmp/work/cortexa53-tdx-linux/hello-world/1.0-r0/temp/log.do_package.130751
ERROR: Task (/home/user/meta-hw/recipes-main/hello-world/hello-world.bb:do_package) failed with exit code '1'

I'm not sure what to try next as every example I've found looks basically like this.


Solution

  • @skandigraun was right. I'm using kirkstone so it needs to be FILES:${PN} +=