xorg-server: add initial systemd support

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2013-08-05 03:33:06 +02:00
parent 3aa3d8b75d
commit 1bfe7bba0d
7 changed files with 149 additions and 124 deletions

View File

@ -56,6 +56,12 @@ get_graphicdrivers
PKG_DEPENDS="$PKG_DEPENDS xf86-video-$drv"
done
# Drivers
PKG_DEPENDS="$PKG_DEPENDS xf86-input-evdev"
for drv in $XORG_DRIVERS; do
PKG_DEPENDS="$PKG_DEPENDS xf86-video-$drv"
done
if [ "$COMPOSITE_SUPPORT" = "yes" ]; then
PKG_DEPENDS="$PKG_DEPENDS libXcomposite"
PKG_BUILD_DEPENDS_TARGET="$PKG_BUILD_DEPENDS_TARGET libXcomposite"
@ -164,8 +170,8 @@ pre_configure_target() {
post_makeinstall_target() {
rm -rf $INSTALL/var/cache/xkb
mkdir -p $INSTALL/lib/udev
cp $PKG_DIR/scripts/xorg_start $INSTALL/lib/udev
mkdir -p $INSTALL/lib/systemd
cp -P $PKG_DIR/scripts/xorg-configure $INSTALL/lib/systemd
if [ -f $INSTALL/usr/lib/xorg/modules/extensions/libglx.so ]; then
mv $INSTALL/usr/lib/xorg/modules/extensions/libglx.so \
@ -184,4 +190,8 @@ post_makeinstall_target() {
rm -rf $INSTALL/usr/bin/cvt
rm -rf $INSTALL/usr/bin/gtf
fi
}
}
post_install() {
enable_service xorg-server.service
}

View File

@ -0,0 +1,98 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
################################################################################
# creating needed directories and symlinks
################################################################################
logger -t Xorg "creating needed directories and symlinks for driver: "$1""
mkdir -p /var/lib
mkdir -p /var/run
logger -t Xorg "### starting Xorg with driver $1 ###"
##############################################################################
# setup xorg.conf paths
##############################################################################
logger -t Xorg "### setup xorg.conf paths ###"
XORG_CONF_USER="/storage/.config/xorg.conf"
XORG_CONF_USER_DRV="/storage/.config/xorg-$1.conf"
XORG_CONF_DEFAULT="/etc/X11/xorg.conf"
XORG_CONF_DEFAULT_DRV="/etc/X11/xorg-$1.conf"
##############################################################################
# creating start options
##############################################################################
logger -t Xorg "### creating start options ###"
XORG_ARGS="-s 0 -noreset -allowMouseOpenFail"
if [ "$DEBUG" = yes -o -f $HOME/.config/debug.xorg ]; then
XORG_ARGS="$XORG_ARGS -logverbose 6 -verbose 6"
else
XORG_ARGS="$XORG_ARGS -logverbose 0 -verbose 0"
fi
# load user defined xorg.conf, if exist
if [ -f "$XORG_CONF_USER" ]; then
XORG_ARGS="$XORG_ARGS -config $XORG_CONF_USER"
elif [ -f "$XORG_CONF_USER_DRV" ]; then
XORG_ARGS="$XORG_ARGS -config $XORG_CONF_USER_DRV"
elif [ -f "$XORG_CONF_DEFAULT" ]; then
XORG_ARGS="$XORG_ARGS -config $XORG_CONF_DEFAULT"
elif [ -f "$XORG_CONF_DEFAULT_DRV" ]; then
XORG_ARGS="$XORG_ARGS -config $XORG_CONF_DEFAULT_DRV"
fi
##############################################################################
# creating needed directories and symlinks
##############################################################################
logger -t Xorg "### creating needed directories and symlinks ###"
if [ "$1" = "nvidia" ]; then
ln -sf /usr/lib/libGL_nvidia.so.1 /var/lib/libGL.so
ln -sf /usr/lib/xorg/modules/extensions/libglx_nvidia.so /var/lib/libglx.so
elif [ "$1" = "fglrx" ]; then
ln -sf /usr/lib/fglrx /var/run/fglrx
ln -sf /usr/lib/libGL_fglrx.so.1 /var/lib/libGL.so
ln -sf /usr/lib/xorg/modules/extensions/libglx_fglrx.so /var/lib/libglx.so
elif [ "$1" = "fglrx-legacy" ]; then
ln -sf /usr/lib/fglrx-legacy /var/run/fglrx
ln -sf /usr/lib/libGL_fglrx.so.1 /var/lib/libGL.so
ln -sf /usr/lib/xorg/modules/extensions/libglx_fglrx.so /var/lib/libglx.so
else
ln -sf /usr/lib/libGL_mesa.so.1 /var/lib/libGL.so
ln -sf /usr/lib/xorg/modules/extensions/libglx_mesa.so /var/lib/libglx.so
fi
################################################################################
# setup xorg-settings.conf
################################################################################
logger -t Xorg "### starting Xorg with '$DISPLAY vt01 $XORG_ARGS' ###"
echo "X11_ARGS=\"$XORG_ARGS\"" >> /run/X11/xorg-settings.conf

View File

@ -1,107 +0,0 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. /etc/profile
if [ "$RUNLEVEL" = openelec ]; then
logger -t Xorg "### starting Xorg with driver ${xorg_driver} ###"
##############################################################################
# setup xorg.conf paths
##############################################################################
logger -t Xorg "### setup xorg.conf paths ###"
XORG_CONF_USER="/storage/.config/xorg.conf"
XORG_CONF_USER_DRV="/storage/.config/xorg-${xorg_driver}.conf"
XORG_CONF_DEFAULT="/etc/X11/xorg.conf"
XORG_CONF_DEFAULT_DRV="/etc/X11/xorg-${xorg_driver}.conf"
##############################################################################
# creating start options
##############################################################################
logger -t Xorg "### creating start options ###"
XORG_ARGS="-s 0 -noreset -allowMouseOpenFail"
if [ "$DEBUG" = yes -o -f $HOME/.config/debug.xorg ]; then
XORG_ARGS="$XORG_ARGS -logverbose 6 -verbose 6"
else
XORG_ARGS="$XORG_ARGS -logverbose 0 -verbose 0"
fi
# load user defined xorg.conf, if exist
if [ -f "$XORG_CONF_USER" ]; then
XORG_ARGS="$XORG_ARGS -config $XORG_CONF_USER"
elif [ -f "$XORG_CONF_USER_DRV" ]; then
XORG_ARGS="$XORG_ARGS -config $XORG_CONF_USER_DRV"
elif [ -f "$XORG_CONF_DEFAULT" ]; then
XORG_ARGS="$XORG_ARGS -config $XORG_CONF_DEFAULT"
elif [ -f "$XORG_CONF_DEFAULT_DRV" ]; then
XORG_ARGS="$XORG_ARGS -config $XORG_CONF_DEFAULT_DRV"
fi
##############################################################################
# creating needed directories and symlinks
##############################################################################
logger -t Xorg "### creating needed directories and symlinks ###"
mkdir -p /var/cache/xkb
mkdir -p /var/lib
mkdir -m 1777 -p /tmp/.ICE-unix
chown root:root /tmp/.ICE-unix
if [ "${xorg_driver}" = "nvidia" ]; then
export __GL_SHADER_DISK_CACHE=1
export __GL_SHADER_DISK_CACHE_PATH="/tmp/GLCache"
ln -sf /usr/lib/libGL_nvidia.so.1 /var/lib/libGL.so
ln -sf /usr/lib/xorg/modules/extensions/libglx_nvidia.so /var/lib/libglx.so
XORG_ARGS="$XORG_ARGS -ignoreABI"
elif [ "${xorg_driver}" = "fglrx" ]; then
mkdir -p /var/run
ln -sf /usr/lib/fglrx /var/run/fglrx
ln -sf /usr/lib/libGL_fglrx.so.1 /var/lib/libGL.so
ln -sf /usr/lib/xorg/modules/extensions/libglx_fglrx.so /var/lib/libglx.so
elif [ "${xorg_driver}" = "fglrx-legacy" ]; then
mkdir -p /var/run
ln -sf /usr/lib/fglrx-legacy /var/run/fglrx
ln -sf /usr/lib/libGL_fglrx.so.1 /var/lib/libGL.so
ln -sf /usr/lib/xorg/modules/extensions/libglx_fglrx.so /var/lib/libglx.so
else
ln -sf /usr/lib/libGL_mesa.so.1 /var/lib/libGL.so
ln -sf /usr/lib/xorg/modules/extensions/libglx_mesa.so /var/lib/libglx.so
fi
##############################################################################
# starting Xorg
##############################################################################
logger -t Xorg "### starting Xorg with '$DISPLAY vt01 $XORG_ARGS' ###"
Xorg $DISPLAY vt01 $XORG_ARGS > /dev/null 2>&1 &
fi
exit 0

View File

@ -0,0 +1,8 @@
[Unit]
Description=Xorg Server configuration
Before=graphical.target
[Service]
ExecStart=/lib/systemd/xorg-configure %I
RemainAfterExit=yes
Type=oneshot

View File

@ -0,0 +1,19 @@
[Unit]
Description=Xorg Server
Conflicts=rescue.service rescue.target installer.target
Requisite=graphical.target
After=multi-user.target
# On OpenELEC X11 is on tty1. We explicitly cancel the getty here to
# avoid any races around that.
#Conflicts=getty@tty1.service
#After=getty@tty1.service
[Service]
Environment=DISPLAY=:0.0
EnvironmentFile=/run/X11/xorg-settings.conf
ExecStart=/usr/bin/Xorg vt01 $X11_ARGS
Restart=always
[Install]
WantedBy=graphical.target

View File

@ -20,3 +20,4 @@
d /var/cache/xkb 0755 root root 10d -
d /var/lib 0755 root root - -
d /run/X11 0755 root root - -

View File

@ -27,24 +27,20 @@ GOTO="end_video"
# check for drivers dont use the pci substem
LABEL="subsystem_drivers"
KERNEL=="dovefb", ENV{xorg_driver}="dove", GOTO="start_xorg"
KERNEL=="fglrx_pci", ENV{xorg_driver}="fglrx", GOTO="start_xorg"
KERNEL=="fglrx_legacy_pci", ENV{xorg_driver}="fglrx-legacy", GOTO="start_xorg"
KERNEL=="nvidia", ENV{xorg_driver}="nvidia", GOTO="start_xorg"
KERNEL=="vboxvideo", ENV{xorg_driver}="vboxvideo", GOTO="start_xorg"
KERNEL=="vmwgfx", ENV{xorg_driver}="vmware", GOTO="start_xorg"
KERNEL=="dovefb", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@dove.service"
KERNEL=="fglrx_pci", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@fglrx.service"
KERNEL=="fglrx_legacy_pci", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@fglrx-legacy.service"
KERNEL=="nvidia", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@nvidia.service"
KERNEL=="vboxvideo", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@vboxvideo.service"
KERNEL=="vmwgfx", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@vmware.service"
GOTO="end_video"
# check for drivers using the pci substem
LABEL="subsystem_pci"
DRIVER=="i915", ENV{xorg_driver}="i915", GOTO="start_xorg"
DRIVER=="nouveau", ENV{xorg_driver}="nouveau", GOTO="start_xorg"
#DRIVER=="nvidia", ENV{xorg_driver}="nvidia", GOTO="start_xorg"
DRIVER=="radeon", ENV{xorg_driver}="radeon", GOTO="start_xorg"
DRIVER=="i915", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@i915.service"
DRIVER=="nouveau", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@nouveau.service"
#DRIVER=="nvidia", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@nvidia.service"
DRIVER=="radeon", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@radeon.service"
GOTO="end_video"
# start Xorg
LABEL="start_xorg"
ENV{xorg_driver}=="?*", RUN+="xorg_start"
LABEL="end_video"