Adding custom files to Yocto image filesystem via .bbappend

Hi,

I am learning/trying to add custom files to a Boot2Qt image filesystem for an Apalis iMX6 using Yocto and following the tutorials on Toradex’s site. The image is built successfully so far and successfully deploys via TEZI.

Let’s say I’ve been building with the .bb file “b2qt-embedded-qt5-image.bb”, I created a file in the same directory named “b2qt-embedded-qt5-image.bbappend”. There is also a folder “files” containing 3 files I wish to copy to some folders around the file system.

My .bbappend file currently contains the following:

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

SRC_URI += " \
	file://gui.bin \
	file://startup.sh \
	file://fb.modes \	
"

do_install_append() {
  install -m 0755 ${WORKDIR}/gui.bin ${D}/home/root
  install -m 0755 ${WORKDIR}/startup.sh ${D}/home/root
  install -m 0755 ${WORKDIR}/fb.modes ${D}/etc
}

Upon building with bitbake, an image successfully builds, but none of the files are found in the image. I checked with bitbake-layers show-layers and am able to see the .bbappend in the list.

Is there anything obvious I seem to be missing?

Thanks in advance!
Anthony

Hey @anthonyabboud,

show-layers should be showing you the layers included, are you also able to verify the append file is included?

bitbake-layers show-appends | grep *b2qt-embedded-qt5-image*

This should show us the location to first make sure the appends is first being included in the build. If it is, it may be a file location/syntax error.

-Eric

Hi @eric.tx ,

My bad for the wrong command mentioned above.

Yes the layer is indeed shown upon “show-layers” execution.

Also, executing bitbake-layers show-appends | grep "b2qt-embedded-qt5-image" outputs the following, as expected:

~/oe-core/layers$ bitbake-layers show-appends | grep "b2qt-embedded-qt5-image"
b2qt-embedded-qt5-image.bb:
  /home/anthony/oe-core/build/../layers/meta-boot2qt/meta-boot2qt-distro/recipes-qt/images/b2qt-embedded-qt5-image.bbappend

I’m suspecting I may have some syntax missing either in the .bbappend or even in another file, but I can’t put my finger on it.

Thanks,
Anthony

Hi,

I ended up creating a different recipe instead of an append. Also to note that inserting S=${WORKDIR} is important (that’s what I was missing). See below a working code:


SUMMARY = "filesystem"
DESCRIPTION = "Copy gui and relevant scripts"
LICENSE = "CLOSED"

SRC_URI += " \
    file://qt_app \
    file://startup.sh \
    file://fb.modes \
"

S = "${WORKDIR}"

do_install() {
    install -d 0644 ${D}/home/root
    install -m 0755 ${WORKDIR}/qt_app ${D}/home/root
    install -d 0644 ${D}/etc/init.d
    install -m 0755 ${WORKDIR}/startup.sh ${D}/etc/init.d
    install -m 0755 ${WORKDIR}/fb.modes ${D}/etc
}

FILES_${PN} += " \
    /home/root/qt_app \
    /etc/init.d/startup.sh \
    /etc/fb.modes \
"

Then in build/local.conf:

CORE_IMAGE_EXTRA_APPEND += " filesystem "

Thanks,
Anthony

Hey @anthonyabboud,

Great solution. What you might find valuable too is The CONFFILE note here. It allows for a more dynamic referencing for file locations such as /etc as ${sysconfdif} and /home/root as ${ROOT_HOME}.

Also, for the build/local.conf append. I believe it should be:
CORE_IMAGE_EXTRA_INSTALL_append =
or
CORE_IMAGE_EXTRA_INSTALL +=

-Eric

1 Like