Search code examples
yocto

Yocto recipe to update /etc/fstab


I'm having trouble updating the /etc/fstab of my Linux distribution, when building it with Yocto. I'm pretty new to Yocto, so maybe I'm off my rocker.

My latest attempt is to add a recipe named base-files_%.bbappend.

mount_smackfs () {
    cat >> ${IMAGE_ROOTFS}/etc/fstab <<EOF

# Generated from smack-userspace
smackfs /smack smackfs smackfsdefault=* 0 0 

EOF
} 

ROOTFS_POSTPROCESS_COMMAND += "mount_smackfs; "

But, the output /etc/fstab on the distribution hasn't changed. So the questions are:

  1. Is there a better way to do this?
  2. How can I tell if my .bbappend file was actually executed?

Solution

  • ROOTFS_POSTPROCESS_COMMAND is handled in image recipes and not in package recipes. You have 2 possibilities.

    • Update your fstab in base-files_%.bbappend:

      do_install_append () {
          cat >> ${D}${sysconfdir}/fstab <<EOF
      
      # Generated from smack-userspace
      smackfs /smack smackfs smackfsdefault=* 0 0 
      
      EOF
      }
      
    • Update the fstab in your image's recipe: In this case, you just append what you wrote above (in your post) in the image's recipe.