From c83393ca448961d8bb7754ef1ef36fb7ff3bcd21 Mon Sep 17 00:00:00 2001 From: Bastian Wissler Date: Thu, 4 Sep 2008 19:34:33 +0000 Subject: * added stage3 nvidia setup * added linkage.sh-skript to link all relevant libs (if they are not conflicting) -- xserver -plugin -- git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2204 95ad53e4-c205-0410-b2fa-d234c58c8868 --- os-plugins/plugins/xserver/XX_xserver.sh | 59 +++++++++---- os-plugins/plugins/xserver/files/linkage.sh | 124 ++++++++++++++++------------ 2 files changed, 113 insertions(+), 70 deletions(-) (limited to 'os-plugins') diff --git a/os-plugins/plugins/xserver/XX_xserver.sh b/os-plugins/plugins/xserver/XX_xserver.sh index 5cce1499..2638e7d5 100644 --- a/os-plugins/plugins/xserver/XX_xserver.sh +++ b/os-plugins/plugins/xserver/XX_xserver.sh @@ -38,6 +38,11 @@ if [ -e /initramfs/plugin-conf/xserver.conf ]; then sed "s/.*v4 Server Module: //") # proprietary ATI/NVidia modules listed a different way with hwinfo [ -z "$xmodule" ] || error "${hcfg_hwsetup}" nonfatal + + +###################################################################### +# begin proprietary drivers section +###################################################################### set -x if [ $(grep -i -m 1 'Driver Activation Cmd: "modprobe fglrx"' \ @@ -45,28 +50,46 @@ if [ -e /initramfs/plugin-conf/xserver.conf ]; then then # we have an ati card here ATI=1 - MODULE_PATH="/opt/openslx/plugin-repo/xserver/ati/usr/lib/xorg/modules/\,\ -/opt/openslx/plugin-repo/xserver/ati/usr/X11R6/lib/modules/\," + PLUGIN_ROOTFS="/opt/openslx/plugin-repo/xserver/ati" + + # this will be written before standard module path + # into xorg.conf + MODULE_PATH="${PLUGIN_ROOTFS}/usr/lib/xorg/modules/\,\ +${PLUGIN_ROOTFS}/usr/X11R6/lib/modules/\," xmodule="fglrx" - LINKAGE="/mnt/var/lib/X11R6/xserver/usr/lib/" - cp -r /mnt/opt/openslx/plugin-repo/xserver/ati/etc/* /mnt/etc/ - ln -s \ - /mnt/opt/openslx/plugin-repo/xserver/ati/usr/lib/libGL.so.1.2 \ - ${LINKAGE}libGL.so.1 - ln -s \ - /mnt/opt/openslx/plugin-repo/xserver/ati/usr/lib/libGL.so.1.2 \ - ${LINKAGE}libGL.so.1.2 - - # TODO: This is probably Ubuntu-specific - echo "/opt/openslx/plugin-repo/xserver/ati/usr/lib/\n\ -/opt/openslx/plugin-repo/xserver/ati/usr/X11R6/lib/" \ - > /mnt/etc/ld.so.conf.d/999opengl.conf - ldsc="1" # regenerate ld.so.cache + PLUGIN_PATH="/mnt${PLUGIN_ROOTFS}" + LINK_PATH="/mnt/var/lib/X11R6/lib/" + + # we need some database for driver initialization + cp -r ${PLUGIN_PATH}/etc/* /mnt/etc/ + # this is the most important thing + ln -s ${PLUGIN_PATH}/usr/lib/libGL.so.1.2 \ + ${LINK_PATH}libGL.so.1 + ln -s ${PLUGIN_PATH}/usr/lib/libGL.so.1.2 \ + ${LINK_PATH}libGL.so.1.2 fi + if [ $(grep -i -m 1 'Driver Activation Cmd: "modprobe nvidia"' \ + /etc/hwinfo.data | wc -l) -eq "1" -a $xserver_prefnongpl -eq 1 ] + then + # we have an ati card here + NVIDIA=1 + PLUGIN_ROOTFS="/opt/openslx/plugin-repo/xserver/nvidia" + MODULE_PATH="${PLUGIN_ROOTFS}/usr/lib/xorg/modules/\,\ +${PLUGIN_ROOTFS}/usr/X11R6/lib/modules/\," + xmodule="nvidia" + PLUGIN_PATH="/mnt${PLUGIN_ROOTFS}" + LINK_PATH="/mnt/var/lib/X11R6/lib/" + ln -s ${PLUGIN_PATH}/usr/lib/libGL.so.1.2 \ + ${LINK_PATH}libGL.so.1 + ln -s ${PLUGIN_PATH}/usr/lib/libGL.so.1.2 \ + ${LINK_PATH}libGL.so.1.2 + fi set +x +###################################################################### +# end proprietary drivers section +###################################################################### - # TODO: nvidia module echo -e "# $xfc\n# autogenerated X hardware configuration by the xserver \ plugin in OpenSLX stage3\n# DO NOT EDIT THIS FILE BUT THE PLUGIN INSTEAD" \ @@ -193,7 +216,7 @@ a\ \ InputDevice\ \ "Synaptics TP"\ \ \ \ \ \ "SendCoreEvents" }' -i $xfc fi - + # ModulePath for proprietary drivers if [ "$xserver_prefnongpl" -eq "1" ]; then sed -e "s,ModulePath \",ModulePath \"${MODULE_PATH},g" \ -i $xfc diff --git a/os-plugins/plugins/xserver/files/linkage.sh b/os-plugins/plugins/xserver/files/linkage.sh index edf89305..4bdbfd80 100755 --- a/os-plugins/plugins/xserver/files/linkage.sh +++ b/os-plugins/plugins/xserver/files/linkage.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash + # # @@ -6,25 +7,26 @@ # # -PLUGIN_FOLDER="/opt/openslx/plugin-repo/xserver/" -MESA_FOLDER="${PLUGIN_FOLDER}mesa/" -# this has to be writable in stage3 - any folder is possible -LINK_FOLDER="/var/lib/X11R6/xserver/" +PLUGIN_PATH="/opt/openslx/plugin-repo/xserver/" +MESA_PATH="${PLUGIN_PATH}mesa/" + +# this has to be writable in stage3 +LINK_PATH="/var/lib/X11R6/lib/" # these are to link libs to -ATIROOT="${PLUGIN_FOLDER}ati/atiroot" -NVROOT="${PLUGIN_FOLDER}nvidia/nvroot" +ATIROOT="${PLUGIN_PATH}ati" +NVROOT="${PLUGIN_PATH}nvidia" # declare array of conflicting libs # TODO: add conflicting libs for opengl here -declare -a CONFLIBS=("/usr/lib/libGL.so.1.2" "/usr/lib/libGL.so.1") +declare -a CONF_LIBS=("/usr/lib/libGL.so.1.2" "/usr/lib/libGL.so.1") -if [ ! -d "${MESA_FOLDER}usr/lib/" ]; then - mkdir -p "${MESA_FOLDER}usr/lib/" +if [ ! -d "${MESA_PATH}usr/lib/" ]; then + mkdir -p "${MESA_PATH}usr/lib/" fi -if [ ! -d "${LINK_FOLDER}usr/lib/" ]; then - mkdir -p "${LINK_FOLDER}usr/lib/" +if [ ! -d "${LINK_PATH}" ]; then + mkdir -p "${LINK_PATH}" fi @@ -38,20 +40,24 @@ fi function linkMesa { file=$1 + l_path="${file/$(basename $file)/}" + if [ ! -d "${LINK_PATH}${l_path}" ]; then + mkdir -p ${LINK_PATH}${l_path} + fi if [ -f "/${file}" ]; then - # move file to the mesa implementation folder - mv "${file}" "${MESA_FOLDER}${file}" - # create links from link-folder to mesa-folder - ln -s "${MESA_FOLDER}${file}" "${LINK_FOLDER}${file}" - # create links from sys-folder to link-folder - ln -s "${LINK_FOLDER}${file}" "${file}" + # move file to the mesa implementation PATH + mv "${file}" "${MESA_PATH}${file}" + # create links from link-PATH to mesa-PATH + ln -s "${MESA_PATH}${file}" "${LINK_PATH}${file}" + # create links from sys-PATH to link-PATH + ln -s "${LINK_PATH}${file}" "${file}" else # ${file} is a link here rm -rf "${file}" case ${file} in /usr/lib/libGL.so.1) - ln -s "${LINK_FOLDER}${file}.2" "${LINK_FOLDER}${file}" + ln -s "${LINK_PATH}${file}.2" "${LINK_PATH}${file}" ;; *) ;; @@ -60,45 +66,59 @@ function linkMesa { } +# saves a link of all conflicting +# libraries into ${LINK_PATH} +# and into system root +function divert { + + # root PATH + # as first argument + ROOT="$1" + # files to compare + CMPROOT="$2" + + # get files (withouth module-path - which we set in xorg.conf) + local -a LIB_ARRAY=($(find ${ROOT} -type f -wholename \ + ".*[^/xorg/modules/].*so.*"|xargs)) + + # go through all libs and see if they are conflicting + for lib in ${LIB_ARRAY[@]}; do + # strip leading root and add comparing root + cmplib="${lib#${ROOT}}" + if [ -e "${cmplib}" -a -e "${lib}" ]; then + # system conflicts with root + # - first we copy to MESA_PATH + # - and create a link to LINK_PATH + linkMesa ${cmplib} + continue + fi + if [ -e "${lib}" -a -e "${CMPROOT}${cmplib}" ]; then + # two roots are conflicting + # create a link into LINK_PATH + l_path="${cmplib/$(basename $lib)/}" + if [ ! -d "${LINK_PATH}${l_path}" -o ! -d "${l_path}" ]; then + mkdir -p ${LINK_PATH}${l_path} ${l_path} + fi + touch ${LINK_PATH}${cmplib} + ln -s ${LINK_PATH}${cmplib} $cmplib + else + # just link library to root folder + l_path="${cmplib/$(basename $lib)/}" + if [ ! -d "${l_path}" ]; then + mkdir -p ${l_path} + fi + ln -s $lib $cmplib + fi + done +} +divert $NVROOT $ATIROOT +divert $ATIROOT $NVROOT -# we create links for all of the binary drivers here -# - as long as it's possible -# - if not, add to array of link files - -# ATI -declare -a ATILIBS=($(find ${ATIROOT} -name "*\\.so*" | xargs)) -# with stripped ATIROOT path -declare -a UATILIBS=(${ATILIBS[@]#${ATIROOT}}) -for lib in ${UATILIBS[@]}; do - if [ -e $lib ]; then - # this is a conflicting MESA-Library - linkMesa $lib - fi -done -# NVIDIA -for lib in $(find ${NVROOT} -name "*\\.so*" | xargs); do - -done - - - - - - - -# go through conflicting libs and link them accordingly -for file in ${CONFLIBS[@]}; do - linkMesa $file -done - - - - -- cgit v1.2.3-55-g7522