From c2b21450b28e7c1acdee42f38e5db4f4e15a07ab Mon Sep 17 00:00:00 2001 From: Tom Hochstein Date: Mon, 25 Jun 2018 21:11:45 -0500 Subject: [PATCH] weston-init: Fix inoperable Weston desktop For an image configured with pam and systemd, Weston apps would fail to run. For example: $ weston-terminal failed to connect to Wayland display: No such file or directory failed to create display: No such file or directory This fix is based on a proposal by Daniel Diaz to OE-core. The main part of the fix is the use of a new, manually created tty. The original proposal called weston directly, but that didn't seem to work where weston-launch did. Signed-off-by: Tom Hochstein Signed-off-by: Otavio Salvador (cherry picked from commit 6c50f608063f673f8763d2baebf1c486cb5ed63a) --- recipes-graphics/wayland/weston-init.bbappend | 20 ++++++++++ .../wayland/weston-init/imxdrm/weston.config | 3 ++ .../wayland/weston-init/mx8mm/weston.config | 3 ++ .../wayland/weston-init/weston.config | 2 + .../wayland/weston-init/weston.service | 38 +++++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 recipes-graphics/wayland/weston-init/imxdrm/weston.config create mode 100644 recipes-graphics/wayland/weston-init/mx8mm/weston.config 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 index ce1482d9..76aadf94 100644 --- a/recipes-graphics/wayland/weston-init.bbappend +++ b/recipes-graphics/wayland/weston-init.bbappend @@ -1,5 +1,25 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + # OpenGL is not required for parts with GPU support for 2D but not 3D IMX_REQUIRED_DISTRO_FEATURES_REMOVE = "" IMX_REQUIRED_DISTRO_FEATURES_REMOVE_imxgpu2d = "opengl" IMX_REQUIRED_DISTRO_FEATURES_REMOVE_imxgpu3d = "" REQUIRED_DISTRO_FEATURES_remove = "${IMX_REQUIRED_DISTRO_FEATURES_REMOVE}" + +SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd wayland x11', 'file://weston.config', '', d)}" + +HAS_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}" +HAS_XWAYLAND = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland x11', 'true', 'false', d)}" + +do_install_append() { + if ${HAS_SYSTEMD}; then + 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 + fi +} diff --git a/recipes-graphics/wayland/weston-init/imxdrm/weston.config b/recipes-graphics/wayland/weston-init/imxdrm/weston.config new file mode 100644 index 00000000..5693d6cb --- /dev/null +++ b/recipes-graphics/wayland/weston-init/imxdrm/weston.config @@ -0,0 +1,3 @@ +#!/bin/sh +OPTARGS="--xwayland" +DESKTOP_SHELL_WINDOW=1920x1080 diff --git a/recipes-graphics/wayland/weston-init/mx8mm/weston.config b/recipes-graphics/wayland/weston-init/mx8mm/weston.config new file mode 100644 index 00000000..eb990e40 --- /dev/null +++ b/recipes-graphics/wayland/weston-init/mx8mm/weston.config @@ -0,0 +1,3 @@ +#!/bin/sh +OPTARGS="--xwayland --use-g2d=1" +DESKTOP_SHELL_WINDOW=1920x1080 diff --git a/recipes-graphics/wayland/weston-init/weston.config b/recipes-graphics/wayland/weston-init/weston.config new file mode 100644 index 00000000..7c92cf11 --- /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 00000000..44c5a82f --- /dev/null +++ b/recipes-graphics/wayland/weston-init/weston.service @@ -0,0 +1,38 @@ +[Unit] +Description=Weston Wayland Compositor (on tty7) +RequiresMountsFor=/run +Conflicts=getty@tty7.service plymouth-quit.service +After=systemd-user-sessions.service getty@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 + -- 2.40.1