Search code examples
linuxyoctobitbake

How to properly add files to target rootfs using Yocto?


I am trying to add a single file (index.html file) to my rootfs on target device. To do so, I have created seperate recipe called "webpage". I have another recipe called "apache2" in my recipes-httpd folder. As follows:

.
└── recipes-httpd/
    ├── apache2/
    │   ├── apache2_%.bbappend
    │   └── apache2/
    │       └── (some configuration files)
    └── webpage/
        ├── webpage_%.bb
        └── webpage/
            └── index.html

The content of webpage_%.bb file is:

SUMMARY = "Webpage files recipe"
DESCRIPTION = "Recipe to put webpage files into target device rootfs"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://index.html"

do_install() {
 install -d ${D}/usr/share/apache2/default-site/htdocs
 install -m 0755 ${WORKDIR}/index.html ${D}/usr/share/apache2/default-site/htdocs/index.html
}

FILES:${PN} += "/usr/share/apache2/default-site/htdocs/index.html"

But when I run bitbake, I get following error:

ERROR: webpage-%-r0 do_package: Fatal errors occurred in subprocesses:
Command '['/home/mateuszm/Projects/yocto/build-mp1/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/webpage/%-r0/recipe-sysroot-native/usr/lib/rpm/rpmdeps', '--alldeps', '--define', '__font_provides %{nil}', '/home/mateuszm/Projects/yocto/build-mp1/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/webpage/%-r0/packages-split/webpage/usr/share/apache2/default-site/htdocs/index.html']' returned non-zero exit status 1.
Subprocess output:error: No file attributes configured

ERROR: Logfile of failure stored in: /home/mateuszm/Projects/yocto/build-mp1/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/webpage/%-r0/temp/log.do_package.25703
ERROR: Task (/home/mateuszm/Projects/yocto/meta-custom/recipes-httpd/webpage/webpage_%.bb:do_package) failed with exit code '1'

Tried lot of things, but still I can't make it work. I will be grateful for any help

I tried putting the file to directory not related with apache2, just to see if that's the problem. But the error was still the same.


Solution

  • Give the webpage recipe a version, not %.

    % is used with bbappend files to match all versions of the original bb file.

    Set a correct version, example: webpage_0.1.bb.