diff options
author | Scott Murray <scott.murray@konsulko.com> | 2021-06-07 18:26:50 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2021-06-07 19:02:32 -0400 |
commit | 1f63a80ae9380317f11417819aa8f8656a4e5ef2 (patch) | |
tree | 6c360e04b91e21304921c0622312d83f398e2d6a /meta-agl-lxc/recipes-platform | |
parent | bbb4918e770a536784f8e5573737f0afade4fdb2 (diff) |
Add meta-agl-lxc
Add meta-agl-lxc layer with LXC container integration recipes, and
"agl-lxc" feature to enable its use. The changes are based on the
previous prototypes by Tadao Tanikawa and the updates done for the
trial integration layers on the agl-ic-eg github by Naoto Yamaguchi,
Hiroyuki Ishii, and Jan-Simon Moeller.
The layer can be used by running aglsetup.sh with just the "agl-lxc"
feature, then building lxc-host-image-demo with bitbake.
Notes:
- The agl-lxc feature enables a "agl-container-guest" multiconfig
configuration for building the guest image(s). This suffices for
demonstrating integrated builds with multiconfig, but may change
in the future with extension of aglsetup.sh to add more
flexibility.
- There are guest-image-minimal and guest-image-cluster-demo recipes
that are intended as a base container template and a demo of its
use. The cluster-demo image contains the demo cluster reference
UI application, and is roughly equivalent to what is named
cluster-guest in the agl-ic-eg trial integration configuration.
- There are likewise lxc-host-image-minimal and lxc-host-image-demo
images. The host demo is configured to pull in the cluster-demo
guest image, and configuration has been added such that it will
automatically boot and start the cluster reference UI application.
- Unlike previous work where the guest container image is added to
the host image via a recipe that packages up the guest image's
contents, a more direct scheme is used where the guest image is
unpacked inside the host image rootfs via the use of the
ROOTFS_POSTPROCESS_COMMAND mechanism. This avoids some hassles
around potentially mismatched user and group id lists in the host
and guest images, with the additional benefit of being faster.
However, using this scheme is to some degree only necessary due to
the use of LXC with unpacked guest image hierarchies. With other
container tooling that uses e.g. OCI images, a revert to using
packages may be preferable.
- The reusable logic in the lxc-host-image-minimal recipe makes some
assumptions wrt naming. They are:
- guest image names have the format guest-image-<name>
- guest images have a corresponding LXC configuration file recipe
with the name lxc-config-<name>
The intent is to simplify reuse of the base minimal recipes, but
this can be reworked if deemed too restrictive.
- packagegroups for e.g. pipewire and weston have purposefully not
been defined at this time. It seems better to wait until it is
more obvious how useful they would be.
Limitations:
- The host image is currently rebuilt every time to work around an
issue with multiconfig dependencies that is being investigated
upstream. This can hopefully be removed in the near future.
- The demo images are currently in meta-agl-lxc for convenience.
It may make more sense for them to reside in another location to
ease shifting some things into meta-agl.
- At the moment, only qemux86-64 has been tested. The changes to
enable host and guest configuration tweaks for the rcar3 BSP need
further investigation and discussion on where they should be
maintained.
Bug-AGL: SPEC-3953, SPEC-3955
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I69d41f1d1c736f05cf3b4997dbda147879e2e25d
Diffstat (limited to 'meta-agl-lxc/recipes-platform')
4 files changed, 87 insertions, 0 deletions
diff --git a/meta-agl-lxc/recipes-platform/images/guest-image-cluster-demo.bb b/meta-agl-lxc/recipes-platform/images/guest-image-cluster-demo.bb new file mode 100644 index 00000000..c07b8f7d --- /dev/null +++ b/meta-agl-lxc/recipes-platform/images/guest-image-cluster-demo.bb @@ -0,0 +1,11 @@ +SUMMARY = "LXC cluster demo guest image" +LICENSE = "MIT" + +require guest-image-minimal.bb + +IMAGE_INSTALL += " \ + weston \ + weston-init \ + weston-ini-conf-landscape \ + refgui \ +" diff --git a/meta-agl-lxc/recipes-platform/images/guest-image-minimal.bb b/meta-agl-lxc/recipes-platform/images/guest-image-minimal.bb new file mode 100644 index 00000000..7b6af7ee --- /dev/null +++ b/meta-agl-lxc/recipes-platform/images/guest-image-minimal.bb @@ -0,0 +1,7 @@ +SUMMARY = "A minimal container guest image" + +require recipes-platform/images/agl-image-boot.inc + +IMAGE_LINGUAS = " " + +IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}" diff --git a/meta-agl-lxc/recipes-platform/images/lxc-host-image-demo.bb b/meta-agl-lxc/recipes-platform/images/lxc-host-image-demo.bb new file mode 100644 index 00000000..59bda426 --- /dev/null +++ b/meta-agl-lxc/recipes-platform/images/lxc-host-image-demo.bb @@ -0,0 +1,12 @@ +SUMMARY = "LXC host demo image" +LICENSE = "MIT" + +require lxc-host-image-minimal.bb + +CONTAINER_IMAGES ?= "agl-container-guest:guest-image-cluster-demo" + +IMAGE_INSTALL += " \ + kernel-modules \ + pipewire pipewire-alsa alsa-utils \ + ${@bb.utils.contains('AGL_FEATURES', 'agl-drm-lease', 'drm-lease-manager', '', d)} \ +" diff --git a/meta-agl-lxc/recipes-platform/images/lxc-host-image-minimal.bb b/meta-agl-lxc/recipes-platform/images/lxc-host-image-minimal.bb new file mode 100644 index 00000000..f702da18 --- /dev/null +++ b/meta-agl-lxc/recipes-platform/images/lxc-host-image-minimal.bb @@ -0,0 +1,57 @@ +SUMMARY = "A minimal container host image" + +require recipes-platform/images/agl-image-boot.inc + +IMAGE_INSTALL += " \ + lxc \ + ${LXC_CONTAINER_CONFIGS} \ +" + +CONTAINER_IMAGES ??= "" + +LXC_CONTAINER_CONFIGS ?= "" + +IMAGE_LINGUAS = " " + +NO_RECOMMENDATIONS = "1" + +python __anonymous() { + for c in (d.getVar('CONTAINER_IMAGES') or "").split(): + (mc, image) = c.split(':') + dependency = 'mc::' + mc + ':' + image + ':do_image_complete' + d.setVarFlag('do_rootfs', 'mcdepends', dependency) + + # Assume there is a X-lxc-config package for guest-image-X + config = image + if config.startswith('guest-image-'): + config = config[len('guest-image-'):] + d.appendVar('LXC_CONTAINER_CONFIGS', 'lxc-config-' + config) +} + +install_container_images() { + for c in ${CONTAINER_IMAGES}; do + config=${c%:*} + image=${c#*:} + name=${image#guest-image-} + rm -rf ${IMAGE_ROOTFS}/var/lib/machines/${name} + install -m 0755 -d ${IMAGE_ROOTFS}/var/lib/machines/${name} + src="${TOPDIR}/tmp-${config}/deploy/images/${MACHINE}/${image}-${MACHINE}.tar.bz2" + bbnote "Installing ${src}" + tar -C ${IMAGE_ROOTFS}/var/lib/machines/${name} -xf ${src} + done +} + +# +# Force rebuild of rootfs on every build to work around mcdepends issue +# +# NOTE: +# This is currently required as bitbake fails to trigger do_rootfs +# sometimes even when the guest image has in fact rebuilt. This is +# being investigated with upstream. +# +do_rootfs[nostamp] = "1" + +ROOTFS_POSTPROCESS_COMMAND += "install_container_images; " + +IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}" + |