Run agl-compositor in system scope for QEMU+KVM demo image 32/28432/2
authorScott Murray <scott.murray@konsulko.com>
Thu, 19 Jan 2023 01:47:11 +0000 (20:47 -0500)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Sun, 29 Jan 2023 14:29:37 +0000 (14:29 +0000)
To allow usefully depending on the native-shell-client "homescreen"
application from the systemd units running QEMU, tweak things to
drop the use of agl-session from the agl-kvm-demo-platform host
image.  The motivation for this is to have the VM guest start up
ordering work as expected, avoiding unnecessary delays from race
failures on boot.

Changes:
- Rework agl-kvm template to use conf/include/agl-kvm.inc include
  file to match other featurs and simplify development.
- Add include files for the host ("default" in BitBake) and guest
  (so agl-kvm-guest) multiconfigs to allow disabling the agl-demo
  feature in the host build, which disables agl-session.
- Update native-shell-client systemd unit to run at system scope
  and depend upon agl-compositor directly.
- Update agl-qemu-runner systemd template unit to depend directly
  on native-shell-client.

Note that a consequence of these changes is that building images
other than agl-kvm-demo-platform when the "agl-kvm" feature is used
will likely not yield the desired results.  Future work will
investigate avoiding this problem, or forcing explicit compatibility
errors to avoid user confusion.

Bug-AGL: SPEC-4618

Change-Id: I295caf2969c5f4179c93f1b57afa703f1a866457
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
(cherry picked from commit 94ee287730b16820003aece648e790923a9a5b79)

conf/include/agl-kvm.inc [new file with mode: 0644]
conf/include/mc-conf-agl-kvm-guest.inc [new file with mode: 0644]
conf/include/mc-conf-default.inc [new file with mode: 0644]
recipes-demo/native-shell-client/files/native-shell-client.service
recipes-demo/native-shell-client/native-shell-client_agldemo.inc
recipes-extended/agl-qemu-runner/files/agl-qemu-runner.sh
recipes-extended/agl-qemu-runner/files/agl-qemu-runner@.service
templates/feature/agl-kvm/50_local.conf.inc
templates/feature/agl-kvm/README_feature_agl-kvm.md

diff --git a/conf/include/agl-kvm.inc b/conf/include/agl-kvm.inc
new file mode 100644 (file)
index 0000000..12d8ae1
--- /dev/null
@@ -0,0 +1,15 @@
+DISTRO_FEATURES:append = " virtualization"
+
+BBMULTICONFIG = "agl-kvm-guest"
+
+AGL_FEATURES:append = " agl-kvm"
+
+# Override remote display network configuration to use KVM demo's
+# network configuration
+TRANSMITTER_OUTPUT_HOST = "172.16.10.3"
+
+# Override cluster dashboard VIS server host for KVM demo's network
+# configuration
+CLUSTER_DEMO_VISS_HOSTNAME = "172.16.10.2"
+
+include mc-conf-${BB_CURRENT_MC}.inc
diff --git a/conf/include/mc-conf-agl-kvm-guest.inc b/conf/include/mc-conf-agl-kvm-guest.inc
new file mode 100644 (file)
index 0000000..6777b2c
--- /dev/null
@@ -0,0 +1,3 @@
+# Override the default virtio-can configuration, as we do not have
+# a backend to be able to use it.
+CANBUS_NETWORK_CONFIG:virtio-all = "canbus-can.network"
diff --git a/conf/include/mc-conf-default.inc b/conf/include/mc-conf-default.inc
new file mode 100644 (file)
index 0000000..c60c999
--- /dev/null
@@ -0,0 +1,3 @@
+# We don't want the app framework bits (specifically the user session) in
+# the KVM host image.
+AGL_FEATURES:remove = "agl-app-fw"
index 4d77513..d7a2fe6 100644 (file)
@@ -1,11 +1,12 @@
 [Unit]
-Requires=agl-compositor.service
-After=agl-compositor.service
+Requires=weston.service
+After=weston.service
 
 [Service]
 Type=simple
+Environment=XDG_RUNTIME_DIR=/run/user/200
 ExecStart=/usr/bin/native-shell-client
 Restart=on-failure
 
 [Install]
-WantedBy=agl-session.target
+WantedBy=multi-user.target
index 5e2538e..4c1dc10 100644 (file)
@@ -2,12 +2,12 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
 
 SRC_URI += "file://native-shell-client.service"
 
+inherit systemd
+
+SYSTEMD_SERVICE:${PN} = "${BPN}.service"
+
 do_install:append() {
-    install -d ${D}${systemd_user_unitdir}/agl-session.target.wants
-    install -m0644 ${WORKDIR}/native-shell-client.service ${D}${systemd_user_unitdir}/native-shell-client.service
-    ln -s ../native-shell-client.service ${D}${systemd_user_unitdir}/agl-session.target.wants/native-shell-client.service
+    install -D -m 0644 ${WORKDIR}/native-shell-client.service ${D}${systemd_system_unitdir}/native-shell-client.service
 }
 
-FILES:${PN} += " ${systemd_user_unitdir}"
-
 RCONFLICTS:${PN} = "homescreen"
index ab3a02c..d050bdb 100755 (executable)
@@ -37,7 +37,7 @@ if [ -n "$QEMU_TASKSET_CPUS" ]; then
 fi
     
 export SDL_VIDEODRIVER=wayland 
-export XDG_RUNTIME_DIR=/run/user/1001
+export XDG_RUNTIME_DIR=/run/user/200
 # The following may be needed if the socket is not wayland-0, as SDL
 # seems to lack detection logic for that case.
 #export WAYLAND_DISPLAY=wayland-1
index a9e9f33..95b1fe0 100644 (file)
@@ -1,6 +1,6 @@
 [Unit]
-Requires=agl-session@agl-driver.service
-After=agl-session@agl-driver.service
+Requires=native-shell-client.service
+After=native-shell-client.service
 
 [Service]
 Type=simple
index dc586ea..2798116 100644 (file)
@@ -1,4 +1,2 @@
-DISTRO_FEATURES:append = " virtualization"
-
-BBMULTICONFIG = "agl-kvm-guest"
-
+#see meta-agl-demo/conf/include/agl-kvm.inc
+require conf/include/agl-kvm.inc
index 83c0a0c..46ab155 100644 (file)
@@ -12,3 +12,6 @@ authors: Scott Murray <scott.murray@konsulko.com>
 The following features are pulled:
 
 * agl-demo
+
+Note that enabling this feature results in a configuration where building images
+other than agl-kvm-demo-platform will likely not give the desired results.