From 710f6b4b6da9af46e94e386ca4e39dad6cfee45e Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Wed, 5 Dec 2007 22:55:25 +0000 Subject: Introduced completely new approach of xorg.conf setup into stage3 ... seems to work for me, but to be checked and reported :) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1422 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/initrd-stuff/bin/ddcprobe | 1 - initramfs/initrd-stuff/bin/hwautocfg | 216 ++--------------------------------- initramfs/initrd-stuff/bin/xconfig | 163 ++++++++++++++++++-------- initramfs/initrd-stuff/init | 11 +- initramfs/mkdxsinitrd | 7 +- 5 files changed, 136 insertions(+), 262 deletions(-) delete mode 120000 initramfs/initrd-stuff/bin/ddcprobe (limited to 'initramfs') diff --git a/initramfs/initrd-stuff/bin/ddcprobe b/initramfs/initrd-stuff/bin/ddcprobe deleted file mode 120000 index 3b3f146c..00000000 --- a/initramfs/initrd-stuff/bin/ddcprobe +++ /dev/null @@ -1 +0,0 @@ -../../../tools/ddcprobe.i586 \ No newline at end of file diff --git a/initramfs/initrd-stuff/bin/hwautocfg b/initramfs/initrd-stuff/bin/hwautocfg index 8b2612b9..6c997456 100755 --- a/initramfs/initrd-stuff/bin/hwautocfg +++ b/initramfs/initrd-stuff/bin/hwautocfg @@ -11,209 +11,10 @@ # General information about OpenSLX can be found under http://openslx.org # # Universal (distro independent) hardware autoconfiguration script for -# OpenSLX linux diskless clients, using hwconfig from knoppix as base tool +# OpenSLX linux stateless clients, using hwconfig from knoppix as base tool ############################################################################# -# local functions used within hwautocfg -displaysetup () { -# (temporary) configuration file -local xfc=$1 -# set variables representing the xorg.conf sections (version 6.9.x) -# variables might be overwritten via displayvars function -local Module='\tLoad\t\t"dbe"\n -\tLoad\t\t"extmod"\n -\tLoad\t\t"type1"\n -\tLoad\t\t"speedo"\n -\tLoad\t\t"freetype"\n -\tLoad\t\t"v4l"' -local ServerFlags='\tOption\t\t"AllowMouseOpenFail"\n -\tOption\t\t"blank time"\t\t"5"\n -\tOption\t\t"standby time"\t\t"10"\n -\tOption\t\t"suspend time"\t\t"15"\n -\tOption\t\t"off time"\t\t"20"' -# fixme: Do we really need FontPath, RgbPath!?! -local Files='\tRgbPath\t\t"/usr/X11R6/lib/X11/rgb"\n -\tModulePath\t"/etc/X11/modules"\n -\tModulePath\t"/usr/X11R6/lib/modules"\n -\tFontPath\t"/usr/X11R6/lib/X11/fonts/misc/:unscaled"\n -\tFontPath\t"/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"\n -\tFontPath\t"/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"' -local InputDevice='\tIdentifier\t"Keyboard1"\n -\tDriver\t\t"kbd"\n -\tOption\t\t"XkbRules"\t\t"xfree86"\n -\tOption\t\t"XkbLayout"\t\t"XKEYBOARD"\n -\tOption\t\t"XkbModel"\t\t"pc105"' -local InputMouseDef='\tIdentifier "Mouse1"\n -\tDriver\t\t"mouse"\n -\tOption\t\t"Protocol"\t\t"imps/2"\n -\tOption\t\t"Device"\t\t"/dev/input/mice"\n -\tOption\t\t"Emulate3Buttons"\n -\tOption\t\t"ZAxisMapping"\t\t"4 5"\n -\tOption\t\t"Buttons"\t\t"3"' -local InputMouseSyn='\tIdentifier "Mouse1"\n -\tDriver\t\t"synaptics"\n -\tOption\t\t"Protocol"\t\t"explorerps/2"\n -\tOption\t\t"Device"\t\t"/dev/input/mice"\n -\tOption\t\t"Emulate3Buttons"\t"on"\n -\tOption\t\t"Buttons"\t\t"5"\n -\tOption\t\t"InputFashion"\t\t"Mouse"\n -\tOption\t\t"SHMConfig"\t\t"on"\n -\tOption\t\t"ZAxisMapping"\t\t"4 5"' -local Monitor='\tIdentifier "Default"\n -\tModelName\t"MODEL"\n -\tOption\t\t"CalcAlgorithm"\t"CheckDesktopGeometry"\n -\tOption\t\t"DPMS"\t\t"true"' -local Device='\tIdentifier\t"StdGraphics"\n -\tVendorName\t"XDESC"\n -\tDriver\t\t"XMODULE"' -local Screen='\tIdentifier\t"Screen 1"\n -\tDevice\t\t"StdGraphics"\n -\tMonitor\t\t"Default"\n -\tDefaultColorDepth 24' -local ServerLayout='\tIdentifier\t"Simple Layout"\n -\tScreen\t\t"Screen 1"\n -\tInputDevice\t"Keyboard1"\t"CoreKeyboard"\n -\tInputDevice\t"Mouse1"\t"CorePointer"\n -\tOption\t\t"BlankTime"\t"5"\n -\tOption\t\t"StandbyTime"\t"10"\n -\tOption\t\t"SuspendTime"\t"20"\n -\tOption\t\t"OffTime"\t"30"' -local DRI='\tGroup\t\t"video"\n -\tMode\t\t0666' - -# displayvars may overwrite the above settings and define pathes below e.g. -# synapticsdrv -displayvars - -# run localizator and configure X11 keyboard -localization "${country}" -if [ -z "${XKEYBOARD}" ] ; then - error "${hcfg_keyb}" nonfatal - XKEYBOARD="de" -fi - -# check if hardware definition variables are set and overwrite autodetected -# values -if [ -n "${hw_graphic}" ] ; then - DRV=${hw_graphic% *} - if [ -z "$DRV" ] ; then error "${hcfg_gfxdrv}" nonfatal - XMODULE=vesa - fi -fi - -# deprecated stuff, needed primarily for CRT displays -if [ -n "${hw_monitor}" ] ; then - # just cut all starting from k(Hz) ... - HS=${hw_monitor%k*} - VS=${hw_monitor%Hz*} - [ "${hw_monitor}" == "$VS" ] && VS=${hw_monitor%hz*} - VS=${VS##* } - SCR_MODES="\"${hw_monitor##* }\"" -else - # gather information about the monitor capabilities - screenres > /tmp/screenres - VERTSR=`cat /tmp/screenres | sed -n \ - '/Vertical Frequency Range/s/[^0-9]* \([0-9-]*\)/\1/p'` - HORISR=`cat /tmp/screenres | sed -n \ - '/Horizontal Frequency Range/s/[^0-9]* \([0-9-]*\)/\1/p'` - HS=$HORISR - VS=$VERTSR - # compute max resolution - SCR_MODES=`cat /tmp/screenres | sed -n \ - '/Recommended Screen Modes:/s/[^"]*\(.*\)/\1/p'` -fi - -if [ -z "$HS" ] ; then #error "$hcfg_hfrq" nonfatal - HS=${HSYNCRANGE} -fi -if [ -z "$VS" ] ; then #error "$hcfg_vfrq" nonfatal - VS=${VSYNCRANGE} -fi -if [ -z "$SCR_MODES" ] ; then #error "$hcfg_res" nonfatal - SCR_MODES=${DEFAULTMODES} -fi -monmanual=yes - -# check for special X driver (fglrx, nvidia, ...) and enable tvout if variable -# tvout is not "no" -[ -z "$hw_graphic" ] && checkgraphix - -# finally write config file -echo -e "#\n# autogenerated X hardware configuration by $0\n# \ -OpenSLX.ORG Project , $date" >$xfc -echo -e "# DO NOT EDIT THIS FILE BUT '$0' INSTEAD!\n#" \ - >>$xfc -for section in Files ServerFlags Module InputDevice Monitor \ - Screen Device ServerLayout DRI ; do - echo "Section \"$section\"" >>$xfc - case "$section" in - Files) - echo -e ${Files} >>$xfc - # check for 64bit CPU/installation (fixme!!) - [ -d "/mnt/usr/X11R6/lib64/modules" ] && \ - echo -e '\tModulePath\t"/usr/X11R6/lib64/modules"\n' >>$xfc - for i in ${D_XFONTPATH} ; do - echo -e "\tFontPath\t\"$i/\"" >>$xfc ; done - ;; - ServerFlags) - echo -e ${ServerFlags} >>$xfc - ;; - Device) - echo -e ${Device} | \ - sed -e "s,XMODULE,${XMODULE}," -e "s%XDESC%${XDESC}%" >>$xfc - # write TV config - no problem, if no TV is connected - [ -n "$TVOUT" ] && echo -e $TVOUT >>$xfc - [ x$DRV = "xs3virge" ] && \ - echo -e "\tOption\t\t\"XVideo\" \"Off\"\n" >>$xfc - [ x$DRV = "xnvidia" ] && { - echo -e "\tOption\t\t\"NvAGP\" \"3\"" >>$xfc - echo -e "\tOption\t\t\"NoLogo\" \"1\"" >>$xfc ; } - ;; - Module) - echo -e ${Module} >>$xfc - #[ "x$DRM" = "xyes" ] && \ - echo -e "\tLoad\t\t\"dri\"" >>$xfc - [ x$GLX != "xno" ] && \ - echo -e "\tLoad\t\t\"glx\"" >>$xfc - ;; - Monitor) - echo -e ${Monitor} | \ - sed -e "s,HS,${HS},g" -e "s,VS,${VS},g" >>$xfc - ;; - InputDevice) - echo -e ${InputDevice} | sed -e "s,XKEYBOARD,${XKEYBOARD},g" \ - >>$xfc - [ "${XKEYBOARD}" = "de" ] && \ - echo -e '\tOption\t\t"XkbVariant"\t\t"nodeadkeys"' >>$xfc - echo -e "EndSection\n\nSection \"$section\"" >>$xfc - # if special synaptics touchpad was detected and specific driver - # is present - if strinfile "synaptics" /tmp/hwsetup.info && \ - test -e /mnt/${synapticsdrv} ; then - echo -e $InputMouseSyn >>$xfc - else - echo -e $InputMouseDef >>$xfc - fi - ;; - Screen) - echo -e ${Screen} >>$xfc - #for BPP in 15 16 24 - # do echo -e '\tSubSection "Display"\n\t\tDepth\t'\ - # $BPP'\n\t\tModes\t'$SCR_MODES'\n\tEndSubSection' >>$xfc - #done - ;; - ServerLayout) - echo -e ${ServerLayout} >>$xfc - ;; - DRI) - echo -e ${DRI} >>$xfc - ;; - esac - echo -e "EndSection\n" >>$xfc -done -} -############################################################################# -# pre part +# pre part, load USB modules and start hardware detection pci and monitor hwpre () { echo "0 0 0 0" >/proc/sys/kernel/printk # start the knoppix hardware autodetection tool @@ -224,6 +25,7 @@ for i in $driverlist ; do echo -e "alias\t$i\tusbcore" >> /etc/modprobe.conf done ( hwsetup -n -v > /tmp/hwsetup.info && echo "hwsetup" > /tmp/hwrun1 ) & +( usleep 8000; xconfig ) & ( for mod in usbcore uhci-hcd ohci-hcd usbhid; do modprobe -q $mod 2>/dev/null usleep 10000 @@ -453,11 +255,15 @@ else D_XF86CONFFILE="/mnt/etc/X11/xorg.conf" error "$hcfg_xcfg" nonfatal fi -if [ -f /rootfs${D_XF86CONFFILE#/mnt} ] ; then - echo "ready" > /tmp/xready -else +if [ ! -f /rootfs${D_XF86CONFFILE#/mnt} ] ; then . /etc/sysconfig/xserver >/dev/null 2>&1 || error "${hcfg_hwsetup}" nonfatal - ( displaysetup /etc/xorg.conf; echo "ready" > /tmp/xready ) & + # replace OSS 3D server with proprietary one + checkgraphix + sed -e "s/\"vesa\"/\"${XMODULE}\"/" -i /tmp/xorg.conf + # check for 64bit CPU/installation (fixme!!) + [ -d "/mnt/usr/X11R6/lib64/modules" ] && \ + sed -e "/Section \"Files\"/a\ \ ModulePath \"/usr/X11R6/lib64/modules\"" \ + -i $xfc fi # add entries to initialize keytable and consolefont to boot.slx diff --git a/initramfs/initrd-stuff/bin/xconfig b/initramfs/initrd-stuff/bin/xconfig index dce2a68f..8865674c 100755 --- a/initramfs/initrd-stuff/bin/xconfig +++ b/initramfs/initrd-stuff/bin/xconfig @@ -1,4 +1,20 @@ -#!/bin/ash +#!/bin/sh +# Copyright (c) 2007 - RZ Uni Freiburg +# Copyright (c) 2007 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found under http://openslx.org +# +# Universal (distro independent) xorg.conf preparation script for OpenSLX +# linux stateless clients, depending on ddcprobe + +############################################################################# +# local functions used within - check if the monitor might be an older crt iscrt () { local dim=$1 local year=$2 @@ -41,10 +57,35 @@ elif [ $year -ge 2004 ] ; then fi echo "$crt" } -xfc=xorg -echo -e ' + +############################################################################# +# main script + +# functions common for all distros +. /etc/functions +# functions common for all distros, messages contains all error and +# info output +. /etc/messages +# load distro specific configuration variables and functions. distro +# specific functions may overwrite functions defined in /etc/functions +. /etc/sysconfig/config +. /etc/distro-functions + +xfc="/tmp/xorg.conf" +echo "# ${D_XF86CONFFILE}" > $xfc +echo ' +## autogenerated X hardware configuration by $0 ## +## OpenSLX.ORG Project ## +## DO NOT EDIT THIS FILE BUT '$0' INSTEAD ## Section "Files" EndSection +Section "ServerFlags" + Option "AllowMouseOpenFail" + Option "blank time" "5" + Option "standby time" "10" + Option "suspend time" "15" + Option "off time" "20" +EndSection Section "Module" Load "i2c" Load "bitmap" @@ -53,6 +94,8 @@ Section "Module" Load "freetype" Load "int10" Load "vbe" + Load "glx" + Load "dri" EndSection Section "InputDevice" Identifier "Generic Keyboard" @@ -60,7 +103,7 @@ Section "InputDevice" Option "CoreKeyboard" Option "XkbRules" "xorg" Option "XkbModel" "pc105" - Option "XkbLayout" "de" + Option "XkbLayout" "XKEYBOARD" Option "XkbVariant" "nodeadkeys" EndSection Section "InputDevice" @@ -115,7 +158,7 @@ Section "ServerLayout" Identifier "Default Layout" Screen "Default Screen" InputDevice "Generic Keyboard" - InputDevice "Configured Mouse" + InputDevice "Generic Mouse" InputDevice "stylus" "SendCoreEvents" InputDevice "cursor" "SendCoreEvents" InputDevice "eraser" "SendCoreEvents" @@ -123,50 +166,70 @@ EndSection Section "DRI" Mode 0666 EndSection -'> /tmp/$xfc +'> $xfc -rm /tmp/res -cat $1|sed "/mode: /d"|while read line ; do - case $line in - ctiming*|dtiming*) - Res=$(echo $line|sed "s/.*:\ //;s/@.*//") - Width=${Res%%x*} - Height=${Res##*x} - # we need exact resolutions for tft displays only - [ "${IsCrt%% *}" = "TFT" -a $((${Width}00 / ${Height})) -ge 125 ] && echo $Res >> /tmp/res - [ "x${VendorName}" = "x" ] && VendorName="No vendor string detected" - grep ModelName /tmp/$xfc 2>&1 >/dev/null || \ - sed -e "/Section \"Monitor\"/a\ \ ModelName \"Display - ${IsCrt}\"" \ - -e "/Section \"Device\"/a\ \ VendorName \"${VendorName}\"" \ - -i /tmp/$xfc - ;; - monitorname*|monitorid*) - [ "x${line##monitor*:}" = "x" ] || sed "s/Display - /${line##monitor*: } - /" -i /tmp/$xfc - ;; - product*) - [ "$line" != "product:" ] && \ - sed "/Section \"Device\"/a\ \ BoardName \"${line##product: }\"" \ - -i /tmp/$xfc - ;; - oem*|vendor*) - [ "x${line##?e*:}" = "x" ] || VendorName="${line##?e*: }" - ;; - manufacture*) - Year=${line##* } - ;; - screensize*) - Dim=${line##screensize: } - Width=${Dim%% *} - Height=${Dim##* } - Dim=$(($Width * $Height)) - # check for geometry - no crt if no 4:3 ratio - if [ $((${Width}00 / $((${Height} + 1 )))) -lt 140 ] ; then - IsCrt="$(iscrt $Dim $Year)" - else - IsCrt="TFT WideScreen" - fi - ;; - esac +ddcprobe|sed "/mode: /d"|while read line ; do + case $line in + ctiming*|dtiming*) + Res=$(echo $line|sed "s/.*:\ //;s/@.*//") + Width=${Res%%x*} + Height=${Res##*x} + # we need exact resolutions for tft displays only + [ "${IsCrt%% *}" = "TFT" -a $((${Width}00 / ${Height})) -ge 125 ] && \ + echo $Res >> /tmp/res + [ "x${VendorName}" = "x" ] && VendorName="No vendor string detected" + grep ModelName $xfc 2>&1 >/dev/null || \ + sed -e "/Section \"Monitor\"/a\ \ ModelName \"Display - ${IsCrt}\"" \ + -e "/Section \"Device\"/a\ \ VendorName \"${VendorName}\"" \ + -i $xfc + ;; + monitorname*|monitorid*) + [ "x${line##monitor*:}" = "x" ] || sed "s/Display - /${line##monitor*: } - /" -i $xfc + ;; + product*) + [ "$line" != "product:" ] && \ + sed "/Section \"Device\"/a\ \ BoardName \"${line##product: }\"" \ + -i $xfc + ;; + oem*|vendor*) + [ "x${line##?e*:}" = "x" ] || VendorName="${line##?e*: }" + ;; + manufacture*) + Year=${line##* } + ;; + screensize*) + Dim=${line##screensize: } + Width=${Dim%% *} + Height=${Dim##* } + Dim=$(($Width * $Height)) + # check for geometry - no crt if no 4:3 ratio + if [ $((${Width}00 / $((${Height} + 1 )))) -lt 140 ] ; then + IsCrt="$(iscrt $Dim $Year)" + else + IsCrt="TFT WideScreen" + fi + ;; + esac done -for line in `sort -run /tmp/res` ; do Modes="$Modes \"$line\""; done -sed "s/Modes \"/Modes ${Modes} \"/" -i /tmp/$xfc + +# if predefined value is present otherwise use computed/detected stuff +if [ -n "${hw_monitor}" ] ; then + # just cut all starting from k(Hz) ... + #HS=${hw_monitor%k*} + #VS=${hw_monitor%Hz*} + Modes="\"${hw_monitor##* }\"" +else + for line in $(sort -run /tmp/res) ; do Modes="$Modes \"$line\""; done +fi +sed "s/Modes \"/Modes ${Modes} \"/" -i $xfc + +# run localizator and configure X11 keyboard +localization "${country}" +if [ -z "${XKEYBOARD}" ] ; then + error "${hcfg_keyb}" nonfatal + XKEYBOARD="us" +fi +sed "s/XKEYBOARD/${XKEYBOARD}/" -i $xfc +# displayvars +#displayvars +#sed "/Section \"Device\"/a\ \ ${Files}" -i $xfc diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init index b126a744..a4f48c87 100755 --- a/initramfs/initrd-stuff/init +++ b/initramfs/initrd-stuff/init @@ -765,9 +765,14 @@ fi waitfor /tmp/hwcfg 20000 || error "$init_errhw" [ -f /tmp/scanner-udev ] && cat /tmp/scanner-udev \ >> /mnt/etc/udev/rules.d/04-scanner.rules -# wait for completion of Xorg configuration and finalize it -waitfor /tmp/xready 10000 || error "$init_errxorg" nonfatal -mv /etc/xorg.conf /mnt/${D_XF86CONFFILE} +# move Xorg configuration to final destination depending if user or system +# generated +#waitfor /tmp/xready 10000 || error "$init_errxorg" nonfatal +if [ -f /rootfs${D_XF86CONFFILE#/mnt} ] ; then + mv /rootfs${D_XF86CONFFILE#/mnt} /mnt/${D_XF86CONFFILE} +else + mv /tmp/xorg.conf /mnt/${D_XF86CONFFILE} +fi # wait a while for services setup to complete waitfor /tmp/svcfg 10000 || error "$init_errsw" # IP configuration is complete and should not be updated automatically diff --git a/initramfs/mkdxsinitrd b/initramfs/mkdxsinitrd index 97243e13..45355660 100755 --- a/initramfs/mkdxsinitrd +++ b/initramfs/mkdxsinitrd @@ -388,7 +388,7 @@ if [ -z "$cdboot" ] ; then repco ${dirs##*initramfs/} done chmod 755 ${INSTDIR}/init \ - ${INSTDIR}/bin/{servconfig,hwautocfg,screenres,dhcpmkconfig} + ${INSTDIR}/bin/{servconfig,hwautocfg,xconfig,dhcpmkconfig} else cp ${SLX_SHARE_PATH}/cdboot/init ${INSTDIR}/init chmod 755 ${INSTDIR}/init @@ -401,10 +401,11 @@ else ARCH=i586 fi -# copy the proper busybox depending on architecture (i586 for 32bit and -# x86_64 for 64bit) +# copy the proper busybox, ddcprobe depending on architecture (i586 for 32bit +# and x86_64 for 64bit) # fixme: At the moment the busybox does not support ext2 filesystem tools cp ${SLX_SHARE_PATH}/busybox/busybox.${ARCH} ${INSTDIR}/bin/busybox +cp ${SLX_SHARE_PATH}/ramfstools/ddcprobe.${ARCH} ${INSTDIR}/bin/ddcprobe slxldd --root-path=${ROOTDIR} ${INSTDIR}/bin/busybox >>${INSTDIR}/tmp/libraries for bbins in [ ar arping ash bunzip2 cat chmod chown chroot cp cpio cut \ date dd df dmesg du echo env expr fdisk free grep gunzip hwclock \ -- cgit v1.2.3-55-g7522