From 1f63a80ae9380317f11417819aa8f8656a4e5ef2 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Mon, 7 Jun 2021 18:26:50 -0400 Subject: Add meta-agl-lxc 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- - guest images have a corresponding LXC configuration file recipe with the name lxc-config- 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 Change-Id: I69d41f1d1c736f05cf3b4997dbda147879e2e25d --- meta-agl-devel.md | 3 ++ meta-agl-lxc/classes/lxc-config.bbclass | 48 ++++++++++++++++++ meta-agl-lxc/conf/layer.conf | 11 +++++ .../conf/multiconfig/agl-container-guest.conf | 16 ++++++ .../lxc-config/files/config.cluster-demo.in | 33 +++++++++++++ .../lxc-config/files/config.dummy.in | 22 +++++++++ .../lxc-config/files/system.conf.cluster-demo.in | 8 +++ .../lxc-config/files/system.conf.dummy.in | 2 + .../lxc-config/lxc-config-cluster-demo_1.0.bb | 7 +++ .../lxc-config/lxc-config-dummy_1.0.bb | 5 ++ .../recipes-container/lxc/lxc_4.%.bbappend | 11 +++++ .../recipes-demo/refgui/refgui/cluster.service | 11 +++++ meta-agl-lxc/recipes-demo/refgui/refgui_git.bb | 45 +++++++++++++++++ .../wayland/weston-ini-conf.bbappend | 2 + .../wayland/weston-ini-conf/shell.cfg | 3 ++ .../recipes-graphics/wayland/weston-init.bbappend | 40 +++++++++++++++ .../wayland/weston-init/drm-lease.conf.in | 4 ++ .../images/guest-image-cluster-demo.bb | 11 +++++ .../recipes-platform/images/guest-image-minimal.bb | 7 +++ .../recipes-platform/images/lxc-host-image-demo.bb | 12 +++++ .../images/lxc-host-image-minimal.bb | 57 ++++++++++++++++++++++ templates/feature/agl-lxc/50_bblayers.conf.inc | 4 ++ templates/feature/agl-lxc/50_local.conf.inc | 1 + .../feature/agl-lxc/README_feature_agl-lxc.md | 14 ++++++ templates/feature/agl-lxc/included.dep | 1 + 25 files changed, 378 insertions(+) mode change 100755 => 100644 meta-agl-devel.md create mode 100644 meta-agl-lxc/classes/lxc-config.bbclass create mode 100644 meta-agl-lxc/conf/layer.conf create mode 100644 meta-agl-lxc/conf/multiconfig/agl-container-guest.conf create mode 100644 meta-agl-lxc/recipes-container/lxc-config/files/config.cluster-demo.in create mode 100644 meta-agl-lxc/recipes-container/lxc-config/files/config.dummy.in create mode 100644 meta-agl-lxc/recipes-container/lxc-config/files/system.conf.cluster-demo.in create mode 100644 meta-agl-lxc/recipes-container/lxc-config/files/system.conf.dummy.in create mode 100644 meta-agl-lxc/recipes-container/lxc-config/lxc-config-cluster-demo_1.0.bb create mode 100644 meta-agl-lxc/recipes-container/lxc-config/lxc-config-dummy_1.0.bb create mode 100644 meta-agl-lxc/recipes-container/lxc/lxc_4.%.bbappend create mode 100644 meta-agl-lxc/recipes-demo/refgui/refgui/cluster.service create mode 100644 meta-agl-lxc/recipes-demo/refgui/refgui_git.bb create mode 100644 meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf.bbappend create mode 100644 meta-agl-lxc/recipes-graphics/wayland/weston-ini-conf/shell.cfg create mode 100644 meta-agl-lxc/recipes-graphics/wayland/weston-init.bbappend create mode 100644 meta-agl-lxc/recipes-graphics/wayland/weston-init/drm-lease.conf.in create mode 100644 meta-agl-lxc/recipes-platform/images/guest-image-cluster-demo.bb create mode 100644 meta-agl-lxc/recipes-platform/images/guest-image-minimal.bb create mode 100644 meta-agl-lxc/recipes-platform/images/lxc-host-image-demo.bb create mode 100644 meta-agl-lxc/recipes-platform/images/lxc-host-image-minimal.bb create mode 100644 templates/feature/agl-lxc/50_bblayers.conf.inc create mode 100644 templates/feature/agl-lxc/50_local.conf.inc create mode 100644 templates/feature/agl-lxc/README_feature_agl-lxc.md create mode 100644 templates/feature/agl-lxc/included.dep diff --git a/meta-agl-devel.md b/meta-agl-devel.md old mode 100755 new mode 100644 index fdc29972..5a1eda22 --- 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-' + +# - Corresponding files {config,system.conf}..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 +--- + +### 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 -- cgit 1.2.3-korg