aboutsummaryrefslogtreecommitdiffstats
path: root/meta-agl-ic-container/classes
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2022-08-09 11:33:17 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2022-08-09 15:43:04 +0200
commit13169c3265ba75d783eb3723504298a08e768110 (patch)
tree9f30b921d3491ad9bc8a55d58fd3bf6f3db8800e /meta-agl-ic-container/classes
parentce87122d195d3a1fea454cfa4acd91e22ccea264 (diff)
Rename Instrument Cluster Container layer
meta-agl-lxc is no longer reflecting the actual content and use of the layer. Rename it to 'meta-agl-ic-container' and the feature to 'agl-ic-container'. Also rename the main image to 'agl-cluster-demo-lxc-host' to match the pattern used by all other images e.g. agl-<ivi,cluster,telematics>-demo-* . But keep the names of the underlying images as-is. Bug-AGL: SPEC-4464 Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> Change-Id: I898c786ca884331b302a3be8e150379fcf5bdc9b
Diffstat (limited to 'meta-agl-ic-container/classes')
-rw-r--r--meta-agl-ic-container/classes/guest-kernel-module.bbclass21
-rw-r--r--meta-agl-ic-container/classes/lxc-config.bbclass58
2 files changed, 79 insertions, 0 deletions
diff --git a/meta-agl-ic-container/classes/guest-kernel-module.bbclass b/meta-agl-ic-container/classes/guest-kernel-module.bbclass
new file mode 100644
index 00000000..6c8da4a2
--- /dev/null
+++ b/meta-agl-ic-container/classes/guest-kernel-module.bbclass
@@ -0,0 +1,21 @@
+DEPENDS:remove:aglcontainerguest = "${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/kernel", "linux-dummy", "linux-renesas", "", d)}"
+
+do_configure[depends] = "${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/kernel", "linux-dummy", "", "make-mod-scripts:do_compile", d)}"
+
+python __anonymous () {
+ # Need to use inline python here as, contrary to the BitBake docs,
+ # having noexec set at all disables the task, so using
+ # oe.utils.conditional to set it to "0" still ends up with the task
+ # disabled.
+ if d.getVar("PREFERRED_PROVIDER_virtual/kernel") == "linux-dummy":
+ d.setVarFlag("do_compile", "noexec", "1")
+}
+
+do_install:aglcontainerguest() {
+ # Create destination directory
+ install -d ${D}/${includedir}/
+}
+
+# Guest doesn't build the module, so go ahead and quiet warnings about
+# double '/' in base recipe definition
+FILES:${PN}:aglcontainerguest = ""
diff --git a/meta-agl-ic-container/classes/lxc-config.bbclass b/meta-agl-ic-container/classes/lxc-config.bbclass
new file mode 100644
index 00000000..921aaf92
--- /dev/null
+++ b/meta-agl-ic-container/classes/lxc-config.bbclass
@@ -0,0 +1,58 @@
+# 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://basic.in' \
+ + ' file://mount.in' \
+ + ' file://network.in' \
+ + ' file://environment.in' \
+ + ' file://misc.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 () {
+ rm -f ${WORKDIR}/config.${LXC_CONFIG_NAME}.in
+ files="basic.in mount.in network.in environment.in misc.in"
+ for f in ${files}; do
+ cat ${WORKDIR}/$f >> ${WORKDIR}/config.${LXC_CONFIG_NAME}.in
+ done
+
+ 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/"