summaryrefslogtreecommitdiffstats
path: root/meta-agl-ic-container/classes
diff options
context:
space:
mode:
authorNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2023-05-04 20:56:06 +0900
committerNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2023-05-09 08:13:10 +0900
commit839dcdeb3073c094bf171d7107d81955feeb3dea (patch)
tree03925aaa2e78a5f626abda9784b8b6b1e8a42458 /meta-agl-ic-container/classes
parent17973ca81893157d82b9bd91db833bc0451e2b93 (diff)
Reworking config creation for lxc and container manager
At "Add initial container manager config for r-car gen3" add container manager config recipes. But it is not support dynamic drm lease configuration, it require to static configuration in each guest. This patch enable dynamic drm lease configuration similar to lxc-config. Bug-AGL: SPEC-4777 Change-Id: I6161c5ff3d93ddbbde866c1c28d107d8f524d40b Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
Diffstat (limited to 'meta-agl-ic-container/classes')
-rw-r--r--meta-agl-ic-container/classes/cm-config.bbclass34
1 files changed, 34 insertions, 0 deletions
diff --git a/meta-agl-ic-container/classes/cm-config.bbclass b/meta-agl-ic-container/classes/cm-config.bbclass
new file mode 100644
index 00000000..60dec951
--- /dev/null
+++ b/meta-agl-ic-container/classes/cm-config.bbclass
@@ -0,0 +1,34 @@
+# Helper class for container manager config creation.
+# Assumes that:
+# - Recipe name is 'cm-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
+
+python __anonymous() {
+ bpn = d.getVar('BPN')
+ if not bpn.startswith('cm-config-'):
+ bb.error('Recipe name does not start with \'cm-config-\'')
+ config = bpn[10:]
+ d.setVar('CM_CONFIG_NAME', config)
+}
+
+S = "${WORKDIR}"
+
+inherit allarch
+
+DRM_LEASE_DEVICE ??= "card0-HDMI-A-1"
+
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+do_install:append () {
+ install -m 0755 -d ${D}/opt/container/guests/${CM_CONFIG_NAME}
+ for f in system.conf.${CM_CONFIG_NAME}.in; do
+ sed -e 's|@DRM_LEASE_DEVICE@|${DRM_LEASE_DEVICE}|g' \
+ ${WORKDIR}/$f > ${D}/opt/container/guests/${CM_CONFIG_NAME}/${f%.${CM_CONFIG_NAME}.in}
+ done
+}
+
+FILES:${PN}:append = "/opt/container/guests/${CM_CONFIG_NAME}"