summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--[-rwxr-xr-x]meta-agl-devel.md3
-rw-r--r--meta-agl-lxc/classes/lxc-config.bbclass48
-rw-r--r--meta-agl-lxc/conf/layer.conf11
-rw-r--r--meta-agl-lxc/conf/multiconfig/agl-container-guest.conf16
-rw-r--r--meta-agl-lxc/recipes-container/lxc-config/files/config.cluster-demo.in33
-rw-r--r--meta-agl-lxc/recipes-container/lxc-config/files/config.dummy.in22
-rw-r--r--meta-agl-lxc/recipes-container/lxc-config/files/system.conf.cluster-demo.in8
-rw-r--r--meta-agl-lxc/recipes-container/lxc-config/files/system.conf.dummy.in2
-rw-r--r--meta-agl-lxc/recipes-container/lxc-config/lxc-config-cluster-demo_1.0.bb7
-rw-r--r--meta-agl-lxc/recipes-container/lxc-config/lxc-config-dummy_1.0.bb5
-rw-r--r--meta-agl-lxc/recipes-container/lxc/lxc_4.%.bbappend11
-rw-r--r--meta-agl-lxc/recipes-demo/refgui/refgui/cluster.service11
-rw-r--r--meta-agl-lxc/recipes-demo/refgui/refgui_git.bb45
-rw-r--r--meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf.bbappend2
-rw-r--r--meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf/shell.cfg3
-rw-r--r--meta-agl-lxc/recipes-graphics/wayland/weston-init.bbappend40
-rw-r--r--meta-agl-lxc/recipes-graphics/wayland/weston-init/drm-lease.conf.in4
-rw-r--r--meta-agl-lxc/recipes-platform/images/guest-image-cluster-demo.bb11
-rw-r--r--meta-agl-lxc/recipes-platform/images/guest-image-minimal.bb7
-rw-r--r--meta-agl-lxc/recipes-platform/images/lxc-host-image-demo.bb12
-rw-r--r--meta-agl-lxc/recipes-platform/images/lxc-host-image-minimal.bb57
-rw-r--r--templates/feature/agl-lxc/50_bblayers.conf.inc4
-rw-r--r--templates/feature/agl-lxc/50_local.conf.inc1
-rw-r--r--templates/feature/agl-lxc/README_feature_agl-lxc.md14
-rw-r--r--templates/feature/agl-lxc/included.dep1
25 files changed, 378 insertions, 0 deletions
diff --git a/meta-agl-devel.md b/meta-agl-devel.md
index fdc29972..5a1eda22 100755..100644
--- a/meta-agl-devel.md
+++ b/meta-agl-devel.md
@@ -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
index 00000000..1aefccdc
--- /dev/null
+++ b/meta-agl-lxc/classes/lxc-config.bbclass
@@ -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
index 00000000..4030d6e9
--- /dev/null
+++ b/meta-agl-lxc/conf/layer.conf
@@ -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
index 00000000..d7b85ee5
--- /dev/null
+++ b/meta-agl-lxc/conf/multiconfig/agl-container-guest.conf
@@ -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
index 00000000..90c5a1e6
--- /dev/null
+++ b/meta-agl-lxc/recipes-container/lxc-config/files/config.cluster-demo.in
@@ -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
index 00000000..8a1d6477
--- /dev/null
+++ b/meta-agl-lxc/recipes-container/lxc-config/files/config.dummy.in
@@ -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
index 00000000..29a49b6c
--- /dev/null
+++ b/meta-agl-lxc/recipes-container/lxc-config/files/system.conf.cluster-demo.in
@@ -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
index 00000000..f496c589
--- /dev/null
+++ b/meta-agl-lxc/recipes-container/lxc-config/files/system.conf.dummy.in
@@ -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
index 00000000..5657785b
--- /dev/null
+++ b/meta-agl-lxc/recipes-container/lxc-config/lxc-config-cluster-demo_1.0.bb
@@ -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
index 00000000..9d7e3ce5
--- /dev/null
+++ b/meta-agl-lxc/recipes-container/lxc-config/lxc-config-dummy_1.0.bb
@@ -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
index 00000000..61dfa665
--- /dev/null
+++ b/meta-agl-lxc/recipes-container/lxc/lxc_4.%.bbappend
@@ -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
index 00000000..d0c1ba4e
--- /dev/null
+++ b/meta-agl-lxc/recipes-demo/refgui/refgui/cluster.service
@@ -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
index 00000000..0edf7890
--- /dev/null
+++ b/meta-agl-lxc/recipes-demo/refgui/refgui_git.bb
@@ -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
index 00000000..00057874
--- /dev/null
+++ b/meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf.bbappend
@@ -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
index 00000000..6fe34ea7
--- /dev/null
+++ b/meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf/shell.cfg
@@ -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
index 00000000..9951b2b3
--- /dev/null
+++ b/meta-agl-lxc/recipes-graphics/wayland/weston-init.bbappend
@@ -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
index 00000000..025cd58e
--- /dev/null
+++ b/meta-agl-lxc/recipes-graphics/wayland/weston-init/drm-lease.conf.in
@@ -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
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)}"
+
diff --git a/templates/feature/agl-lxc/50_bblayers.conf.inc b/templates/feature/agl-lxc/50_bblayers.conf.inc
new file mode 100644
index 00000000..766d1da3
--- /dev/null
+++ b/templates/feature/agl-lxc/50_bblayers.conf.inc
@@ -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
index 00000000..eeb6aa70
--- /dev/null
+++ b/templates/feature/agl-lxc/50_local.conf.inc
@@ -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
index 00000000..e5b5391c
--- /dev/null
+++ b/templates/feature/agl-lxc/README_feature_agl-lxc.md
@@ -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
index 00000000..df937c78
--- /dev/null
+++ b/templates/feature/agl-lxc/included.dep
@@ -0,0 +1 @@
+agl-virt agl-drm-lease