[OE-core] [PATCH v2 2/3] image_overlay.bbclass: Add possibility to install overlays to image

Richard Purdie richard.purdie at linuxfoundation.org
Thu Feb 16 04:44:34 UTC 2017


On Wed, 2017-02-15 at 18:33 +0100, Geoffrey Levillain wrote:
> There is often a need to add configuration files specific to an
> image,
> to simplify this process we can use a task.
> 
> Fetching is set as noexec for images, but there is a need to fetch
> files
> here. This class permit to use do_fetch, do_unpack and do_patch in
> order
> to get your image-specific overlays to install.
> 
> Signed-off-by: Geoffrey Levillain <geoffrey.levillain at smile.fr>
> ---
>  meta/classes/image_overlay.bbclass | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>  create mode 100644 meta/classes/image_overlay.bbclass
> 
> diff --git a/meta/classes/image_overlay.bbclass
> b/meta/classes/image_overlay.bbclass
> new file mode 100644
> index 0000000000..93c1ea6f9f
> --- /dev/null
> +++ b/meta/classes/image_overlay.bbclass
> @@ -0,0 +1,24 @@
> +# Enable SRC_URI for images and use it to install overlays
> +
> +# Let these task be executed to fetch overlay
> +unset do_fetch[noexec]
> +unset do_unpack[noexec]
> +unset do_patch[noexec]

At the same time as you're submitting this, I'm seriously considering a
change where instead of noexec, we'd deltask these tasks. The reason
being I'm not very keen on subverting the package manager and I'm not
convinced this is a particularly desirable way to be altering the
rootfs.

> +# Add a task to install the overlay
> +# (content of folders listed in OVERLAY_ROOT_DIRS is copied in
> rootfs)
> +addtask install_overlay after do_unpack do_patch do_rootfs before
> do_image
> +fakeroot do_install_overlay() {
> +    for dir in ${OVERLAY_ROOT_DIRS}; do
> +        if [ ! -d "${WORKDIR}/${dir}" ] ; then
> +            bbfatal "${dir} not found, please check your
> OVERLAY_ROOT_DIRS and SRC_URI variables."
> +        fi
> +        cp -dr --no-preserve=ownership "${WORKDIR}/${dir}"/*
> "${IMAGE_ROOTFS}"
> +    done
> +}
> +do_install_overlay[depends] += "virtual/fakeroot-
> native:do_populate_sysroot"
> +do_install_overlay[dirs] = "${IMAGE_ROOTFS}"
> +do_install_overlay[umask] = "022"
> +do_install_overlay[vardeps] += "OVERLAY_ROOT_DIRS"
> +
> +SSTATETASKS += "do_install_overlay"

Except this isn't an sstate task? There is no setscene task variant of
the main task. There are no sstate variables set either...

Cheers,

Richard






More information about the Openembedded-core mailing list