Search code examples
embedded-linuxyoctobitbakeyocto-recipe

Integrated a custom recipe but don't see any changes in rootfs after flashing


I created a custom recipe which includes some service files to be a part of sysfs, and even though I'm able to build the entire image and flash it, I just don't see any changes in the rootfs.

bitbake-layers show-recipes | grep <recipe-name>
// i see the newly added recipe here

The following is the do_install_append() in the recipe bb file:

do_install_append() {
   if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
      install -d ${D}/etc/initscripts
      install -d ${D}${systemd_unitdir}/system
      mv ${D}/etc/init.d/<daemon_file> ${D}/etc/initscripts/<daemon_file>
      install -m 0644 ${WORKDIR}/<recipe>/<service_file> ${D}${systemd_unitdir}/system/<service_file>

      install -d ${D}${systemd_unitdir}/system/multi-user.target.wants/
      ln -sf ${systemd_unitdir}/system/<service_file>  ${D}${systemd_unitdir}/system/multi-user.target.wants/<service_file>
  fi
}

I go into /etc/initscripts/ and don't see <daemon_file> for instance.

Is there anything else I should be looking into to debug the issue because the build itself runs fine?


Solution

  • There is nothing wrong with your recipe.

    Here are some points to consider:

    • Your do_install_append copies the file only if systemd is in DISTRO_FEATURES.

    To make sure of that, check:

    bitbake -e | grep ^DISTRO_FEATURES=
    

    or add bbwarn "Message" into your recipe to make sure that the block is executed.

    • Make sure to add the files to FILES_${PN}:
    FILES_${PN} += "/etc/initscripts/<daemon_file> \
                    ${systemd_unitdir}/system/<service_file> \
                    ${systemd_unitdir}/system/multi-user.target.wants/<service_file>"
    
    • Check the ${D} folder of the recipe before building the full image.
    $ bitbake -e <recipe> | grep ^D=
    D=".../tmp/work/.../<recipe>/<version>/image"
    
    $ cd <path>
    $ tree .
    

    To activate systemd use:

    INIT_MANAGER = "systemd"