Rework images to support some integration types 50/28750/6
authorNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
Tue, 2 May 2023 11:01:14 +0000 (20:01 +0900)
committerNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
Mon, 8 May 2023 23:13:10 +0000 (08:13 +0900)
Existing lxc-host-image-minimal support multiconfig based
single root filesystem integration.  On the other hand,
when we want to use multi partition integration, we need
to fully replace lxc-host-image-minimal recipe.

This patch divide lxc-config installation and
single root filesystem integration feature from
lxc-host-image-minimal to agl-lxc-install-single-imgage.inc
and agl-lxc-autostart.inc.
This change realize to support integration types
using lxc-host-image-minimal.

Bug-AGL: SPEC-4777

Change-Id: I95d866ff6eaddf793927aacb056334e573389804
Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
meta-agl-ic-container/recipes-platform/images/agl-cluster-demo-lxc-host.bb
meta-agl-ic-container/recipes-platform/images/agl-lxc-autostart.inc [new file with mode: 0644]
meta-agl-ic-container/recipes-platform/images/agl-lxc-install-single-image.inc [new file with mode: 0644]
meta-agl-ic-container/recipes-platform/images/lxc-host-image-minimal.bb

index d26e6a6..66e8b62 100644 (file)
@@ -2,6 +2,8 @@ SUMMARY = "LXC host demo image"
 LICENSE = "MIT"
 
 require lxc-host-image-minimal.bb
+require recipes-platform/images/agl-lxc-install-single-image.inc
+require recipes-platform/images/agl-lxc-autostart.inc
 
 CONTAINER_IMAGES ?= "agl-container-cluster:guest-image-cluster-demo \
                      agl-container-ivi:guest-image-ivi-demo \
@@ -17,7 +19,6 @@ IMAGE_INSTALL += " \
 
 # packages required for network bridge settings via lxc-net
 IMAGE_INSTALL += " \
-    lxc-autostart \
     lxc-networking \
     iptables-modules \
     dnsmasq \
diff --git a/meta-agl-ic-container/recipes-platform/images/agl-lxc-autostart.inc b/meta-agl-ic-container/recipes-platform/images/agl-lxc-autostart.inc
new file mode 100644 (file)
index 0000000..41a925e
--- /dev/null
@@ -0,0 +1,19 @@
+# Integration type support for lxc autostart based startup.
+
+IMAGE_INSTALL += " \
+    ${LXC_CONTAINER_CONFIGS} \
+    lxc-autostart \
+"
+
+LXC_CONTAINER_CONFIGS ?= ""
+
+python __anonymous() {
+    for c in (d.getVar('CONTAINER_IMAGES') or "").split():
+        (mc, image) = c.split(':')
+
+        # 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)
+}
diff --git a/meta-agl-ic-container/recipes-platform/images/agl-lxc-install-single-image.inc b/meta-agl-ic-container/recipes-platform/images/agl-lxc-install-single-image.inc
new file mode 100644 (file)
index 0000000..de2ea5c
--- /dev/null
@@ -0,0 +1,36 @@
+# Integration type support for install guest root filesystem into host image.
+
+# Handle modification of IMAGE_LINK_NAME done by ULCB builds with Kingfisher support
+MACHINE_SUFFIX = "${@bb.utils.contains('AGL_FEATURES', 'kingfisher', '-kf', '', d)}"
+
+python __anonymous() {
+    for c in (d.getVar('CONTAINER_IMAGES') or "").split():
+        (mc, image) = c.split(':')
+        dependency = 'mc::' + mc + ':' + image + ':do_image_complete'
+        d.appendVarFlag('do_rootfs', 'mcdepends', ' ' + dependency)
+}
+
+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}${MACHINE_SUFFIX}.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; "
index 38fc7b2..1b4f7a2 100644 (file)
@@ -5,58 +5,13 @@ require recipes-platform/images/agl-image-boot.inc
 IMAGE_INSTALL += " \
     kernel-image \
     lxc \
-    ${LXC_CONTAINER_CONFIGS} \
     drm-lease-manager \
 "
 
 CONTAINER_IMAGES ??= ""
 
-LXC_CONTAINER_CONFIGS ?= ""
-
-IMAGE_LINGUAS = " "
+IMAGE_LINGUAS ?= " "
 
 NO_RECOMMENDATIONS = "1"
 
-# Handle modification of IMAGE_LINK_NAME done by ULCB builds with Kingfisher support
-MACHINE_SUFFIX = "${@bb.utils.contains('AGL_FEATURES', 'kingfisher', '-kf', '', d)}"
-
-python __anonymous() {
-    for c in (d.getVar('CONTAINER_IMAGES') or "").split():
-        (mc, image) = c.split(':')
-        dependency = 'mc::' + mc + ':' + image + ':do_image_complete'
-        d.appendVarFlag('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}${MACHINE_SUFFIX}.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)}"
-