fnx_qt
fnx_qt

Reputation: 91

Add files to system image in Yocto

I try to add two files to my system image using Yocto. I use the following code that does not give errors and is added to the conf/local.conf configuration file:

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

SRC_URI += " \
    file://rootfs.tar.gz;unpack=0 \
    file://Dockerfile \
"

do_install () {
    install -d ${D}${datadir}
    install -m 755 ${WORKDIR}/rootfs.tar.gz ${D}${datadir}
    install -m 755 ${WORKDIR}/Dockerfile ${D}${datadir}
}

FILES_${PN} += " \
        ${datadir}/rootfs.tar.gz \
        ${datadir}/Dockerfile \
"

However, my files are not present in the generated root filesystem, do you have any ideas why ? I already read a lot of posts on different forums but none of the solution worked.

EDIT : The code is in a file called "nested-containers.bb" inside a custom meta-layer. Here is the tree :

../sources/meta-custom
├── COPYING.MIT
├── README
├── conf
│   ├── bblayers.conf.sample
│   ├── layer.conf
│   ├── local.conf.sample
│   └── machine
├── recipes-core
│   ├── nested-containers
│   │   ├── files
│   │   └── nested-containers.bb

The following line was added to conf/local.conf : IMAGE_INSTALL_append = " nested-containers" inside the build directory.

Upvotes: 0

Views: 6299

Answers (2)

fnx_qt
fnx_qt

Reputation: 91

Finally, the answer to this question was found. After research, it seems that the recipe needs a little more information:

DESCRIPTION = "Import nested containers to system image"

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

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

SRC_URI += " \
    file://rootfs.tar.gz;unpack=0 \
    file://Dockerfile \
"

FILES_${PN} += " \
        ${datadir}/rootfs.tar.gz \
        ${datadir}/Dockerfile \
"

do_install () {
    install -d ${D}${datadir}/
    install -m 755 ${WORKDIR}/rootfs.tar.gz ${D}${datadir}
    install -m 755 ${WORKDIR}/Dockerfile ${D}${datadir}
}

Unfortunately, I still don't really understand why the previous recipe didn't work. It seems that the FILES_${PN} must be described before the do_install().

Upvotes: 1

Praveen Muthusamy
Praveen Muthusamy

Reputation: 174

Create a recipe with your code, and use IMAGE_INSTALL to install the package into an image(rootfs) as shown below. Refer Yocto ref-manual for more usage

IMAGE_INSTALL_append = " package-name"

Upvotes: 0

Related Questions