Add meta-agl-lxc 19/26419/1
authorScott Murray <scott.murray@konsulko.com>
Mon, 7 Jun 2021 22:26:50 +0000 (18:26 -0400)
committerScott Murray <scott.murray@konsulko.com>
Mon, 7 Jun 2021 23:02:32 +0000 (19:02 -0400)
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

25 files changed:
meta-agl-devel.md [changed mode: 0755->0644]
meta-agl-lxc/classes/lxc-config.bbclass [new file with mode: 0644]
meta-agl-lxc/conf/layer.conf [new file with mode: 0644]
meta-agl-lxc/conf/multiconfig/agl-container-guest.conf [new file with mode: 0644]
meta-agl-lxc/recipes-container/lxc-config/files/config.cluster-demo.in [new file with mode: 0644]
meta-agl-lxc/recipes-container/lxc-config/files/config.dummy.in [new file with mode: 0644]
meta-agl-lxc/recipes-container/lxc-config/files/system.conf.cluster-demo.in [new file with mode: 0644]
meta-agl-lxc/recipes-container/lxc-config/files/system.conf.dummy.in [new file with mode: 0644]
meta-agl-lxc/recipes-container/lxc-config/lxc-config-cluster-demo_1.0.bb [new file with mode: 0644]
meta-agl-lxc/recipes-container/lxc-config/lxc-config-dummy_1.0.bb [new file with mode: 0644]
meta-agl-lxc/recipes-container/lxc/lxc_4.%.bbappend [new file with mode: 0644]
meta-agl-lxc/recipes-demo/refgui/refgui/cluster.service [new file with mode: 0644]
meta-agl-lxc/recipes-demo/refgui/refgui_git.bb [new file with mode: 0644]
meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf.bbappend [new file with mode: 0644]
meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf/shell.cfg [new file with mode: 0644]
meta-agl-lxc/recipes-graphics/wayland/weston-init.bbappend [new file with mode: 0644]
meta-agl-lxc/recipes-graphics/wayland/weston-init/drm-lease.conf.in [new file with mode: 0644]
meta-agl-lxc/recipes-platform/images/guest-image-cluster-demo.bb [new file with mode: 0644]
meta-agl-lxc/recipes-platform/images/guest-image-minimal.bb [new file with mode: 0644]
meta-agl-lxc/recipes-platform/images/lxc-host-image-demo.bb [new file with mode: 0644]
meta-agl-lxc/recipes-platform/images/lxc-host-image-minimal.bb [new file with mode: 0644]
templates/feature/agl-lxc/50_bblayers.conf.inc [new file with mode: 0644]
templates/feature/agl-lxc/50_local.conf.inc [new file with mode: 0644]
templates/feature/agl-lxc/README_feature_agl-lxc.md [new file with mode: 0644]
templates/feature/agl-lxc/included.dep [new file with mode: 0644]

old mode 100755 (executable)
new mode 100644 (file)
index fdc2997..5a1eda2
@@ -17,6 +17,7 @@ The `meta-agl-devel` layer contains the following files and sub-layers:
 ├── LICENSE.MIT
 ├── meta-agl-devel.md
 ├── meta-agl-jailhouse
+├── meta-agl-lxc
 ├── meta-oem-production-readiness
 ├── meta-speech-framework
 ├── README.md
@@ -31,6 +32,8 @@ The following list provides a summary of these sub-layers:
 * `meta-agl-jailhouse`: Provides Jailhouse partitioning hypervisor and
   supporting packages.
 
+* `meta-agl-lxc`: Provides LXC container support and example images.
+
 * `meta-oem-production-readiness`: Provides libraries and software packages of
   IVI product readiness
 
diff --git a/meta-agl-lxc/classes/lxc-config.bbclass b/meta-agl-lxc/classes/lxc-config.bbclass
new file mode 100644 (file)
index 0000000..1aefccd
--- /dev/null
@@ -0,0 +1,48 @@
+# Helper class for installing LXC guest configuration.
+# Assumes that:
+# - Recipe name is 'lxc-config-' + <guest name>
+# - Corresponding files {config,system.conf}.<guest name>.in are in
+#   the file search path
+# - That references to the DRM lease device name are parameterized
+#   with @DRM_LEASE_DEVICE@ in the .in files
+# As well:
+# - The .in files can optionally use the @LXC_AUTO_START@ parameter
+#   to pick up the value of the LXC_AUTO_START variable for use in
+#   defining lxc.start.auto.  The default value is "0", so recipes
+#   need to assign the variable to "1" to have the associated
+#   container start automatically.
+
+python __anonymous() {
+    bpn = d.getVar('BPN')
+    if not bpn.startswith('lxc-config-'):
+        bb.error('Recipe name does not start with \'lxc-config-\'')
+    config = bpn[11:]
+    d.setVar('LXC_CONFIG_NAME', config)
+    src_uri = 'file://config.' + config + \
+              '.in file://system.conf.' + config + '.in'
+    d.setVar('SRC_URI', src_uri)
+}
+
+S = "${WORKDIR}"
+
+inherit allarch
+
+DRM_LEASE_DEVICE ??= "card0-HDMI-A-1"
+
+DRM_LEASE_DEVICE_qemuall ?= "card0-Virtual-1"
+
+LXC_AUTO_START ??= "0"
+
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+do_install () {
+    install -m 0755 -d ${D}/var/lib/lxc/${LXC_CONFIG_NAME}
+    for f in config.${LXC_CONFIG_NAME}.in system.conf.${LXC_CONFIG_NAME}.in; do
+        sed -e 's|@DRM_LEASE_DEVICE@|${DRM_LEASE_DEVICE}|g' \
+            -e 's|@LXC_AUTO_START@|${LXC_AUTO_START}|g' \
+            ${WORKDIR}/$f > ${D}${localstatedir}/lib/lxc/${LXC_CONFIG_NAME}/${f%.${LXC_CONFIG_NAME}.in}
+    done
+}
+
+FILES_${PN} = "${localstatedir}/lib/lxc/"
diff --git a/meta-agl-lxc/conf/layer.conf b/meta-agl-lxc/conf/layer.conf
new file mode 100644 (file)
index 0000000..4030d6e
--- /dev/null
@@ -0,0 +1,11 @@
+# We have a conf and classes directory, add to BBPATH
+BBPATH =. "${LAYERDIR}:"
+
+# We have recipes-* directories, add to BBFILES
+BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
+            ${LAYERDIR}/recipes-*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "aglcontainermc"
+BBFILE_PATTERN_aglcontainermc = "^${LAYERDIR}/"
+BBFILE_PRIORITY_aglcontainermc = "100"
+LAYERSERIES_COMPAT_aglcontainermc = "dunfell"
diff --git a/meta-agl-lxc/conf/multiconfig/agl-container-guest.conf b/meta-agl-lxc/conf/multiconfig/agl-container-guest.conf
new file mode 100644 (file)
index 0000000..d7b85ee
--- /dev/null
@@ -0,0 +1,16 @@
+OVERRIDES_append = ":aglcontainerguest"
+
+TMPDIR = "${TOPDIR}/tmp-${BB_CURRENT_MC}"
+
+# Can be blank as container image type results in a .tar.bz2
+AGL_DEFAULT_IMAGE_FSTYPES_aglcontainerguest = ""
+AGL_EXTRA_IMAGE_FSTYPES_aglcontainerguest = ""
+
+IMAGE_FSTYPES_aglcontainerguest = "container"
+
+IMAGE_LINGUAS_append_aglcontainerguest = " en-us"
+
+PREFERRED_PROVIDER_virtual/kernel = "linux-dummy"
+
+# We assume rngd is running on the host, so unnecessary in container
+VIRTUAL-RUNTIME_rngd = ""
diff --git a/meta-agl-lxc/recipes-container/lxc-config/files/config.cluster-demo.in b/meta-agl-lxc/recipes-container/lxc-config/files/config.cluster-demo.in
new file mode 100644 (file)
index 0000000..90c5a1e
--- /dev/null
@@ -0,0 +1,33 @@
+lxc.rootfs.path = dir:/var/lib/machines/cluster-demo
+lxc.signal.halt = SIGRTMIN+3
+lxc.signal.reboot = SIGTERM
+lxc.uts.name = "cluster"
+lxc.tty.max = 1
+lxc.pty.max = 1
+lxc.cap.drop = sys_module mac_admin mac_override sys_time
+
+lxc.mount.entry = /var/lib/lxc/cluster-demo/system.conf etc/systemd/system.conf.d/10-environment.conf none bind,optional,create=file
+
+lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
+lxc.mount.entry = shm /dev/shm tmpfs defaults 0 0
+lxc.mount.entry = /sys/kernel/security sys/kernel/security none ro,bind,optional 0 0
+
+lxc.cgroup.devices.allow = c 226:* rwm
+lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
+
+#lxc.mount.entry = /lxc/share lxc/share none bind,optional,create=dir
+lxc.mount.entry = /run/drm-lease-manager/@DRM_LEASE_DEVICE@ var/display/drm-lease-manager/@DRM_LEASE_DEVICE@ none bind,create=file
+
+lxc.cgroup.devices.allow = c 10:* rwm
+lxc.mount.entry = /dev/pvr_sync dev/pvr_sync none bind,optional,create=file
+
+lxc.net.0.type = empty
+
+lxc.environment = QT_QPA_PLATFORM=wayland
+lxc.environment = QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/plugins/
+#lxc.environment = QT_DEBUG_PLUGINS=1
+lxc.environment = QML_IMPORT_PATH=/usr/lib/qml/
+lxc.environment = QML2_IMPORT_PATH=/usr/lib/qml/
+lxc.environment = QT_WAYLAND_SHELL_INTEGRATION=xdg-shell
+
+lxc.start.auto = @LXC_AUTO_START@
diff --git a/meta-agl-lxc/recipes-container/lxc-config/files/config.dummy.in b/meta-agl-lxc/recipes-container/lxc-config/files/config.dummy.in
new file mode 100644 (file)
index 0000000..8a1d647
--- /dev/null
@@ -0,0 +1,22 @@
+lxc.rootfs.path = dir:/var/lib/machines/dummy
+lxc.signal.halt = SIGRTMIN+3
+lxc.signal.reboot = SIGTERM
+lxc.uts.name = "guest-dummy"
+lxc.tty.max = 1
+lxc.pty.max = 1
+lxc.cap.drop = sys_module mac_admin mac_override sys_time
+
+lxc.mount.entry = /var/lib/lxc/dummy/system.conf etc/systemd/system.conf.d/10-environment.conf none bind,optional,create=file
+
+lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
+lxc.mount.entry = shm /dev/shm tmpfs defaults 0 0
+lxc.mount.entry = /sys/kernel/security sys/kernel/security none ro,bind,optional 0 0
+
+#lxc.cgroup.devices.allow = c 226:* rwm
+#lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
+
+#lxc.mount.entry = /lxc/share lxc/share none bind,optional,create=dir
+
+lxc.net.0.type = empty
+
+lxc.start.auto = @LXC_AUTO_START@
diff --git a/meta-agl-lxc/recipes-container/lxc-config/files/system.conf.cluster-demo.in b/meta-agl-lxc/recipes-container/lxc-config/files/system.conf.cluster-demo.in
new file mode 100644 (file)
index 0000000..29a49b6
--- /dev/null
@@ -0,0 +1,8 @@
+[Manager]
+DefaultEnvironment = DLM_RUNTIME_PATH=/var/display/drm-lease-manager
+DefaultEnvironment = DRM_LEASE_DEVICE=@DRM_LEASE_DEVICE@
+DefaultEnvironment = QT_QPA_PLATFORM=wayland
+DefaultEnvironment = QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/plugins/
+DefaultEnvironment = QML_IMPORT_PATH=/usr/lib/qml/
+DefaultEnvironment = QML2_IMPORT_PATH=/usr/lib/qml/
+DefaultEnvironment = QT_WAYLAND_SHELL_INTEGRATION=xdg-shell
diff --git a/meta-agl-lxc/recipes-container/lxc-config/files/system.conf.dummy.in b/meta-agl-lxc/recipes-container/lxc-config/files/system.conf.dummy.in
new file mode 100644 (file)
index 0000000..f496c58
--- /dev/null
@@ -0,0 +1,2 @@
+[Manager]
+#DefaultEnvironment =
diff --git a/meta-agl-lxc/recipes-container/lxc-config/lxc-config-cluster-demo_1.0.bb b/meta-agl-lxc/recipes-container/lxc-config/lxc-config-cluster-demo_1.0.bb
new file mode 100644 (file)
index 0000000..5657785
--- /dev/null
@@ -0,0 +1,7 @@
+DESCRIPTION = "AGL demo container LXC config"
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/BSD;md5=3775480a712fc46a69647678acb234cb"
+
+inherit lxc-config
+
+LXC_AUTO_START = "1"
diff --git a/meta-agl-lxc/recipes-container/lxc-config/lxc-config-dummy_1.0.bb b/meta-agl-lxc/recipes-container/lxc-config/lxc-config-dummy_1.0.bb
new file mode 100644 (file)
index 0000000..9d7e3ce
--- /dev/null
@@ -0,0 +1,5 @@
+DESCRIPTION = "AGL dummy container LXC config"
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/BSD;md5=3775480a712fc46a69647678acb234cb"
+
+inherit lxc-config
diff --git a/meta-agl-lxc/recipes-container/lxc/lxc_4.%.bbappend b/meta-agl-lxc/recipes-container/lxc/lxc_4.%.bbappend
new file mode 100644 (file)
index 0000000..61dfa66
--- /dev/null
@@ -0,0 +1,11 @@
+PACKAGECONFIG_remove = "templates"
+
+SYSTEMD_AUTO_ENABLE_${PN} = "enable"
+
+# NOTE:
+# This needs to be replaced with a rework of the upstream packaging
+# to do a proper split of core from the template support.
+RDEPENDS_${PN} = ""
+
+
+
diff --git a/meta-agl-lxc/recipes-demo/refgui/refgui/cluster.service b/meta-agl-lxc/recipes-demo/refgui/refgui/cluster.service
new file mode 100644 (file)
index 0000000..d0c1ba4
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=AGL Cluster Reference GUI
+After=weston@root.service
+Requires=weston@root.service
+
+[Service]
+Environment=XDG_RUNTIME_DIR=/run/user/0
+ExecStart=/opt/apps/cluster
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-agl-lxc/recipes-demo/refgui/refgui_git.bb b/meta-agl-lxc/recipes-demo/refgui/refgui_git.bb
new file mode 100644 (file)
index 0000000..0edf789
--- /dev/null
@@ -0,0 +1,45 @@
+DESCRIPTION = "AGL Cluster Reference GUI"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=d2e73358b6893b535d5dfc7e89dc9d67"
+
+DEPENDS = " \
+    qttools-native \
+    qtmultimedia \
+"
+
+BRANCH = "main"
+SRC_URI = "git://github.com/agl-ic-eg/refgui;protocol=https;branch=${BRANCH} \
+           file://cluster.service \
+"
+SRCREV = "e52dd81073154838e7f417e33debc8f6794fc683"
+
+S = "${WORKDIR}/git"
+
+inherit cmake cmake_qt5 systemd
+
+# NOTE:
+# The app currently assumes the mp4 video file is in the same
+# directory, so changing this to ${bindir} to better match FHS
+# requires code changes.
+APP_DIR = "/opt/apps"
+EXTRA_OECMAKE = "-DAPPS_INST_DIR=${APP_DIR}"
+
+SYSTEMD_SERVICE_${PN} = "cluster.service"
+
+do_install_append() {
+    install -d ${D}${systemd_unitdir}/system
+    install -m 0644 ${WORKDIR}/cluster.service ${D}${systemd_unitdir}/system/
+}
+
+FILES_${PN} += "${APP_DIR}/"
+
+RDEPENDS_${PN} = " \
+    qtbase \
+    qtdeclarative \
+    qt3d \
+    qtgraphicaleffects \
+    qtmultimedia \
+    qtquickcontrols \
+    qtquickcontrols2 \
+    qtwayland \
+"
diff --git a/meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf.bbappend b/meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf.bbappend
new file mode 100644 (file)
index 0000000..0005787
--- /dev/null
@@ -0,0 +1,2 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
+
diff --git a/meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf/shell.cfg b/meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf/shell.cfg
new file mode 100644 (file)
index 0000000..6fe34ea
--- /dev/null
@@ -0,0 +1,3 @@
+[shell]
+panel-position=none
+background-color=0xff000000
diff --git a/meta-agl-lxc/recipes-graphics/wayland/weston-init.bbappend b/meta-agl-lxc/recipes-graphics/wayland/weston-init.bbappend
new file mode 100644 (file)
index 0000000..9951b2b
--- /dev/null
@@ -0,0 +1,40 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
+
+AGL_DEFAULT_WESTONSTART ??= "/usr/bin/weston --config ${sysconfdir}/xdg/weston/weston.ini"
+WESTONARGS ?= "--idle-time=0 --drm-lease=\${DRM_LEASE_DEVICE}"
+
+WESTONSTART ??= "${AGL_DEFAULT_WESTONSTART} ${WESTONARGS}"
+WESTONSTART_append = " ${@bb.utils.contains("DISTRO_FEATURES", "agl-devel", " --debug", "",d)}"
+
+WIFILES = " \
+    file://drm-lease.conf.in \
+"
+
+SRC_URI_append = " ${WIFILES}"
+
+do_install_append() {
+    # Process ".in" files
+    files=$(echo ${WIFILES} | sed s,file://,,g)
+    for f in ${files}; do
+        g=${f%.in}
+        if [ "${f}" != "${g}" ]; then
+            sed -e "s,@WESTONUSER@,${WESTONUSER},g" \
+                -e "s,@WESTONGROUP@,${WESTONGROUP},g" \
+                -e "s,@XDG_RUNTIME_DIR@,${DISPLAY_XDG_RUNTIME_DIR},g" \
+                -e "s,@WESTONSTART@,${WESTONSTART},g" \
+                -e "s,@WESTON_DRM_DEVICE@,${WESTON_DRM_DEVICE},g" \
+                    ${WORKDIR}/${f} > ${WORKDIR}/${g}
+        fi
+    done
+
+    # Install weston drop-in
+    install -d ${D}${systemd_system_unitdir}/weston@.service.d
+    install -m644 ${WORKDIR}/drm-lease.conf ${D}/${systemd_system_unitdir}/weston@.service.d/
+
+    install -d ${D}${systemd_system_unitdir}/multi-user.target.wants
+    ln -s ../weston@.service ${D}${systemd_system_unitdir}/multi-user.target.wants/weston@root.service
+}
+
+FILES_${PN} += " \
+    ${systemd_system_unitdir}/ \
+"
diff --git a/meta-agl-lxc/recipes-graphics/wayland/weston-init/drm-lease.conf.in b/meta-agl-lxc/recipes-graphics/wayland/weston-init/drm-lease.conf.in
new file mode 100644 (file)
index 0000000..025cd58
--- /dev/null
@@ -0,0 +1,4 @@
+[Service]
+Type=notify
+ExecStart=
+ExecStart=@WESTONSTART@
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 (file)
index 0000000..c07b8f7
--- /dev/null
@@ -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 (file)
index 0000000..7b6af7e
--- /dev/null
@@ -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 (file)
index 0000000..59bda42
--- /dev/null
@@ -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 (file)
index 0000000..f702da1
--- /dev/null
@@ -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)}"
+
diff --git a/templates/feature/agl-lxc/50_bblayers.conf.inc b/templates/feature/agl-lxc/50_bblayers.conf.inc
new file mode 100644 (file)
index 0000000..766d1da
--- /dev/null
@@ -0,0 +1,4 @@
+BBLAYERS =+ " \
+  ${METADIR}/external/meta-qt5 \
+  ${METADIR}/meta-agl-devel/meta-agl-lxc \
+"
diff --git a/templates/feature/agl-lxc/50_local.conf.inc b/templates/feature/agl-lxc/50_local.conf.inc
new file mode 100644 (file)
index 0000000..eeb6aa7
--- /dev/null
@@ -0,0 +1 @@
+BBMULTICONFIG = "agl-container-guest"
diff --git a/templates/feature/agl-lxc/README_feature_agl-lxc.md b/templates/feature/agl-lxc/README_feature_agl-lxc.md
new file mode 100644 (file)
index 0000000..e5b5391
--- /dev/null
@@ -0,0 +1,14 @@
+---
+description: Feature agl-lxc
+authors: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
+---
+
+### Feature agl-lxc
+
+*Description is missing - please complete file meta-agl-devel/templates/feature/agl-lxc/README_feature_agl-lxc.md*
+
+### Dependent features pulled by agl-lxc
+
+The following features are pulled:
+
+* agl-container
diff --git a/templates/feature/agl-lxc/included.dep b/templates/feature/agl-lxc/included.dep
new file mode 100644 (file)
index 0000000..df937c7
--- /dev/null
@@ -0,0 +1 @@
+agl-virt agl-drm-lease