X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=meta-agl%2Frecipes-graphics%2Fwayland%2Fweston-init.bbappend;h=359cb76e5061f1dbc62f0c3e74101193dbe1978b;hb=6ca247d19f2a0d7cc0cb1beb8d26c99e7fac337b;hp=9b0f434e564544949ab7c9b87a323bbda8738b1e;hpb=7c227f30c8437d2f5a7b95622d97a86149a716c8;p=AGL%2Fmeta-agl.git diff --git a/meta-agl/recipes-graphics/wayland/weston-init.bbappend b/meta-agl/recipes-graphics/wayland/weston-init.bbappend index 9b0f434e5..359cb76e5 100644 --- a/meta-agl/recipes-graphics/wayland/weston-init.bbappend +++ b/meta-agl/recipes-graphics/wayland/weston-init.bbappend @@ -1,20 +1,54 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -WESTONTTY ??= "1" -WESTONUSER ??= "root" -WESTONARGS ?= "--idle-time=4294967" -WESTONLAUNCHARGS ??= "--tty /dev/tty${WESTONTTY} --user ${WESTONUSER}" +inherit agl-graphical + +WESTONSTART ??= "/usr/bin/weston --idle-time=4294967 --tty=${WESTONTTY}" +WESTONSTART_append = " ${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", " --log=${DISPLAY_XDG_RUNTIME_DIR}/weston.log", "",d)}" + +SRC_URI += " \ + file://weston_tmpfiles.conf \ + file://weston.service.add \ +" do_install_append() { - sed -e 's,launcher="weston-launch.*--",launcher="weston-launch ${WESTONLAUNCHARGS} --",g' \ - -e 's,exec openvt $openvt_args --,exec ,g' \ - -i ${D}${bindir}/weston-start + sed -i "/\[Unit\]/aConflicts=getty@tty${WESTONTTY}.service" \ + ${D}${systemd_system_unitdir}/weston.service + + sed -i "/\[Service\]/r ${S}/weston.service.add" \ + ${D}${systemd_system_unitdir}/weston.service sed -e 's,User=root,User=${WESTONUSER},g' \ - -e 's,$OPTARGS,${WESTONARGS} $OPTARGS,g' \ + -e 's,ExecStart=.*,ExecStart=${WESTONSTART},g' \ + -e 's,@WESTONTTY@,${WESTONTTY},g' \ + -e 's,@XDG_RUNTIME_DIR@,${DISPLAY_XDG_RUNTIME_DIR},g' \ -i ${D}${systemd_system_unitdir}/weston.service - sed -i "/\[Unit\]/aConflicts=getty@tty${WESTONTTY}.service" \ - ${D}${systemd_system_unitdir}/weston.service + # Add a rule to ensure the 'display' user has permissions to + # open the graphics device + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/udev/rules.d + cat >${D}${sysconfdir}/udev/rules.d/zz-dri.rules <<'EOF' +SUBSYSTEM=="drm", MODE="0660", GROUP="${WESTONGROUP}", SECLABEL{smack}="*" +EOF + + # user 'display' must own /dev/tty${WESTONTTY} for weston to start correctly + cat >${D}${sysconfdir}/udev/rules.d/zz-tty.rules <<'EOF' +SUBSYSTEM=="tty", KERNEL=="tty${WESTONTTY}", OWNER="${WESTONUSER}", SECLABEL{smack}="^" +EOF + + # user 'display' must also be able to access /dev/input/* + cat >${D}${sysconfdir}/udev/rules.d/zz-input.rules <<'EOF' +SUBSYSTEM=="input", MODE="0660", GROUP="input", SECLABEL{smack}="^" +EOF + + install -d ${D}${sysconfdir}/tmpfiles.d + install -Dm755 ${WORKDIR}/weston_tmpfiles.conf ${D}/${libdir}/tmpfiles.d/weston.conf + + sed -e 's,@WESTONUSER@,${WESTONUSER},g' \ + -e 's,@WESTONGROUP@,${WESTONGROUP},g' \ + -i ${D}/${libdir}/tmpfiles.d/weston.conf } +FILES_${PN} += "${libdir}/tmpfiles.d/*.conf" + +