[meta-freescale] [PATCH v4 8/8] weston-init: Fix weston 2.0 startup for pam, systemd case

Tom Hochstein tom.hochstein at nxp.com
Thu Dec 7 09:31:02 PST 2017


The weston-start script for starting Weston does not work
well for Weston 2.0.

Daniel Diaz's proposal [1] for the systemd case with pam
seems to work, except that starting an xterm under XWayland
causes the desktop to crash. Using weston-launch instead of
weston works better.

[1] http://lists.openembedded.org/pipermail/openembedded-core/2016-December/129986.html

Signed-off-by: Tom Hochstein <tom.hochstein at nxp.com>
---
 recipes-graphics/wayland/weston-init.bbappend      | 23 ++++++++++++++
 recipes-graphics/wayland/weston-init/weston.config |  2 ++
 .../wayland/weston-init/weston.service             | 37 ++++++++++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 recipes-graphics/wayland/weston-init.bbappend
 create mode 100644 recipes-graphics/wayland/weston-init/weston.config
 create mode 100644 recipes-graphics/wayland/weston-init/weston.service

diff --git a/recipes-graphics/wayland/weston-init.bbappend b/recipes-graphics/wayland/weston-init.bbappend
new file mode 100644
index 0000000..8a5d9a8
--- /dev/null
+++ b/recipes-graphics/wayland/weston-init.bbappend
@@ -0,0 +1,23 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+REQUIRED_DISTRO_FEATURES_REMOVE_IMXGPU          = ""
+REQUIRED_DISTRO_FEATURES_REMOVE_IMXGPU_imxgpu2d = "opengl"
+REQUIRED_DISTRO_FEATURES_REMOVE_IMXGPU_imxgpu3d = ""
+REQUIRED_DISTRO_FEATURES_remove = "${REQUIRED_DISTRO_FEATURES_REMOVE_IMXGPU}"
+
+SRC_URI_append = \
+    "${@bb.utils.contains('DISTRO_FEATURES', 'wayland x11', \
+        ' file://weston.config', '', d)}"
+
+HAS_XWAYLAND = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland x11', 'true', 'false', d)}"
+
+do_install_append() {
+    sed -i \
+        -e 's,/usr/bin,${bindir},g' \
+        -e 's,/etc,${sysconfdir},g' \
+        -e 's,/var,${localstatedir},g' \
+        ${D}${systemd_system_unitdir}/weston.service
+    if ${HAS_XWAYLAND}; then
+        install -Dm0755 ${WORKDIR}/weston.config ${D}${sysconfdir}/default/weston
+    fi
+}
diff --git a/recipes-graphics/wayland/weston-init/weston.config b/recipes-graphics/wayland/weston-init/weston.config
new file mode 100644
index 0000000..7c92cf1
--- /dev/null
+++ b/recipes-graphics/wayland/weston-init/weston.config
@@ -0,0 +1,2 @@
+#!/bin/sh
+OPTARGS="--xwayland"
diff --git a/recipes-graphics/wayland/weston-init/weston.service b/recipes-graphics/wayland/weston-init/weston.service
new file mode 100644
index 0000000..e3938c9
--- /dev/null
+++ b/recipes-graphics/wayland/weston-init/weston.service
@@ -0,0 +1,37 @@
+[Unit]
+Description=Weston Wayland Compositor (on tty7)
+RequiresMountsFor=/run
+Conflicts=getty at tty7.service plymouth-quit.service
+After=systemd-user-sessions.service getty at tty7.service plymouth-quit-wait.service
+
+[Service]
+User=root
+PermissionsStartOnly=true
+
+# Log us in via PAM so we get our XDG & co. environment and
+# are treated as logged in so we can use the tty:
+PAMName=login
+
+# Grab tty7
+UtmpIdentifier=tty7
+TTYPath=/dev/tty7
+TTYReset=yes
+TTYVHangup=yes
+TTYVTDisallocate=yes
+
+# stderr to journal so our logging doesn't get thrown into /dev/null
+StandardOutput=tty
+StandardInput=tty
+StandardError=journal
+
+EnvironmentFile=-/etc/default/weston
+
+# Weston does not successfully change VT, nor does systemd place us on
+# the VT it just activated for us. Switch manually:
+ExecStartPre=/usr/bin/chvt 7
+ExecStart=/usr/bin/weston-launch -- --log=/var/log/weston.log $OPTARGS
+
+IgnoreSIGPIPE=no
+
+[Install]
+WantedBy=multi-user.target
-- 
1.9.1



More information about the meta-freescale mailing list