diff options
Diffstat (limited to 'initramfs/initrd-stuff/bin/hwautocfg')
-rwxr-xr-x | initramfs/initrd-stuff/bin/hwautocfg | 216 |
1 files changed, 11 insertions, 205 deletions
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 <openslx-users@openslx.org>, $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 |