xorg-server: simplyfing Xorg start by start via udev

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-02-24 23:07:38 +01:00
parent e1a5fb4337
commit 0fc1ca126d
5 changed files with 123 additions and 107 deletions

View File

@ -1,50 +0,0 @@
################################################################################
# Copyright (C) 2009-2010 OpenELEC.tv
# http://www.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.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
# starting xorg
#
# runlevels: openelec
XORG_ARGS="-s 0 -nr -noreset -allowMouseOpenFail -nocursor -nolisten tcp"
[ "$DEBUG" = yes ] && XORG_ARGS="$XORG_ARGS -logverbose 6 -verbose 6"
(
progress "creating directories needed for Xorg"
mkdir -p /var/cache/xkb
mkdir -p /var/lib
mkdir -m 1777 -p /tmp/.ICE-unix
chown root:root /tmp/.ICE-unix
if [ "$GPUTYPE" = "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
XORG_ARGS="$XORG_ARGS -ignoreABI"
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
progress "starting xorg"
XORG_ARGS="$XORG_ARGS -config $XORG_CONF"
Xorg $DISPLAY vt01 $XORG_ARGS > /dev/null 2>&1
)&

View File

@ -30,6 +30,9 @@ XORG_DST="$INSTALL/$XORG_PATH_MODULES"
mkdir -p $INSTALL/usr/bin
cp $XORG_SRC/Xorg $INSTALL/usr/bin
mkdir -p $INSTALL/lib/udev
cp $PKG_DIR/scripts/xorg_start $INSTALL/lib/udev
mkdir -p $XORG_DST
cp -P $XORG_SRC/exa/.libs/libexa.so $XORG_DST
cp -P $XORG_SRC/dixmods/.libs/libfb.so $XORG_DST

View File

@ -30,63 +30,6 @@
DISPLAY=":0.0"
export DISPLAY
################################################################################
# setup xorg.conf paths
################################################################################
XORG_CONF_DEFAULT="/etc/X11/xorg.conf"
XORG_CONF_INTEL="/etc/X11/xorg-intel.conf"
XORG_CONF_NVIDIA="/etc/X11/xorg-nvidia.conf"
XORG_CONF_NVIDIA_CHD="/etc/X11/xorg-nvidia-chd.conf"
XORG_CONF_NOUVEAU="/etc/X11/xorg-nouveau.conf"
XORG_CONF_RADEON="/etc/X11/xorg-radeon.conf"
XORG_CONF_USER="/storage/.config/xorg.conf"
################################################################################
# setup driver paths
################################################################################
XORG_DRIVER_INTEL="/usr/lib/xorg/modules/drivers/intel_drv.so"
XORG_DRIVER_NVIDIA="/usr/lib/xorg/modules/drivers/nvidia_drv.so"
XORG_DRIVER_NOUVEAU="/usr/lib/xorg/modules/drivers/nouveau_drv.so"
XORG_DRIVER_RADEON="/usr/lib/xorg/modules/drivers/radeon_drv.so"
################################################################################
# Identify GPU, other by default
################################################################################
GPUDEVICE=$(lspci -n | grep 0300)
GPUTYPE="OTHER"
[ "$(echo $GPUDEVICE | grep 8086)" -a -f "$XORG_DRIVER_INTEL" ] && GPUTYPE="INTEL" # 8086 == INTEL
[ "$(echo $GPUDEVICE | grep 10de)" -a -f "$XORG_DRIVER_NVIDIA" ] && GPUTYPE="NVIDIA" # 10de == NVIDIA
[ "$(echo $GPUDEVICE | grep 10de)" -a -f "$XORG_DRIVER_NOUVEAU" ] && GPUTYPE="NOUVEAU" # 10de == NVIDIA
[ "$(echo $GPUDEVICE | grep 1002)" -a -f "$XORG_DRIVER_RADEON" ] && GPUTYPE="AMD" # 1002 == AMD
################################################################################
# Identify any Mediadevice, like Broadcom's CrystalHD cards
################################################################################
MEDIADEVICE=$(lspci -n | grep 0480)
MEDIATYPE="NO"
[ "$(echo $MEDIADEVICE | grep 14e4)" ] && MEDIATYPE="CRYSTALHD" # 14e4 == BROADCOM
################################################################################
# setup xorg.conf
################################################################################
[ "$GPUTYPE" = "INTEL" ] && XORG_CONF="$XORG_CONF_INTEL"
[ "$GPUTYPE" = "NVIDIA" ] && XORG_CONF="$XORG_CONF_NVIDIA"
[ "$GPUTYPE" = "NOUVEAU" ] && XORG_CONF="$XORG_CONF_NOUVEAU"
[ "$GPUTYPE" = "RADEON" ] && XORG_CONF="$XORG_CONF_RADEON"
[ "$GPUTYPE" = "OTHER" ] && XORG_CONF="$XORG_CONF_DEFAULT"
# check if we have an Broadcom CrystalHD card installed, so we can disable
# the use of shared memory
[ "$GPUTYPE" = "NVIDIA" -a "$MEDIATYPE" = "CRYSTALHD" ] && XORG_CONF="$XORG_CONF_NVIDIA_CHD"
# load user defined xorg.conf, if exist
[ -f "$XORG_CONF_USER" ] && XORG_CONF="$XORG_CONF_USER"
################################################################################
# setup functions
################################################################################

View File

@ -0,0 +1,90 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. /etc/profile
if [ "$RUNLEVEL" = openelec ]; then
logger -t Xorg "### starting Xorg with driver $1 ###"
##############################################################################
# setup xorg.conf paths
##############################################################################
logger -t Xorg "### setup xorg.conf paths ###"
XORG_CONF_DEFAULT="/etc/X11/xorg.conf"
XORG_CONF_DRIVER="/etc/X11/xorg-$1.conf"
XORG_CONF_USER="/storage/.config/xorg.conf"
##############################################################################
# creating start options
##############################################################################
logger -t Xorg "### creating start options ###"
XORG_ARGS="-s 0 -nr -noreset -allowMouseOpenFail -nocursor -nolisten tcp"
if [ "$DEBUG" = yes ]; then
XORG_ARGS="$XORG_ARGS -logverbose 6 -verbose 6"
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_DRIVER" ]; then
XORG_ARGS="$XORG_ARGS -config $XORG_CONF_DRIVER"
elif [ -f "$XORG_CONF_DEFAULT" ]; then
XORG_ARGS="$XORG_ARGS -config $XORG_CONF_DEFAULT"
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 [ "$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
XORG_ARGS="$XORG_ARGS -ignoreABI"
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,30 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
# only does something with "drivers" subsystem devices and supported hardware.
SUBSYSTEM!="drivers", GOTO="end"
KERNEL!="i915", KERNEL!="nouveau", KERNEL!="nvidia", KERNEL!="radeon", \
KERNEL!="vmware", GOTO="end"
# Start Xorg based on the loaded drm driver
ACTION=="add|change", RUN+="/lib/udev/xorg_start %k"
LABEL="end"