Search code examples
yoctobitbakeopenembedded

YoctoProject: change ownership of all files in a recipe


For the YoctoProject (v2.0, Jethro) the ownership of files inside the image defaults to user and group root unless I do explicitly change them by chown and chgrp in the do_install step for the given recipe.

I have a few recipes for which all files should be owned by another group and user than root. Is there a (cleaner/smarter) way to achieve this without calling chown and chgrp in do_install?


Solution

  • BSP vendors do usually provide example recipes to solve basic tasks.
    Usually folder is called "recipes-skeleton"

    User/Group add recipe sample path for freescale BSP:
    ~/yocto/fsl-community-bsp/sources/poky/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb

    Same can be found on github:
    https://github.com/dirtybit/gumstix-yocto/blob/master/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb

    For changing root user info look up EXTRA_USERS_PARAMS flag. Need to inherit "extrausers" class first. Documentation on class is at:
    http://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#ref-classes-extrausers