how to create configfiles on the fly?
Henning Glawe
glaweh at physik.fu-berlin.de
Tue Sep 10 09:11:03 CEST 2002
On Mon, Sep 09, 2002 at 06:10:49PM +0200, Michael Renner wrote:
> not identical. I should create a XF86Config depending to the graphic card
> (and ideally also depending to the monitor or LCD) a modules.config depending
> to the soundcard and so on.
if you install 'discover' on your machines, kernel modules for a lot of
hardware (like network cards, soundcards ...) are detected and loaded at
boottime.
there are three pieces of hardware left, where you have to develop your
own solution:
-graphics card
-mouse
-monitor
we use fcopy for our XF86Config, copying only a kind of template and
inserting the data by using postinst, doing installtime detection there.
we use read-edid and hwinfo for this.
single problem: as hwinfo is a locally debianized SuSE-tool, in longterm
we have to replace it ;)
I attached the contents of $FAI/files/etc/X11/XF86Config-4/
--
c u
henning
-------------- next part --------------
#XF86Config-4 template
# $Id: XCLIENT,v 1.8 2002/07/05 09:57:06 glaweh Exp $
#
#Replace hash surrounded
# MOUSEDEVICE, MOUSEPROTOCOL
# HORIZSYNC, VERTREFRESH
# VIDEODRIVER, X_KEYMAP
#by appropriate values
Section "Files"
FontPath "unix/:7100" # local font server
# if the local font server has problems, we can fall back on these
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/cyrillic"
FontPath "/usr/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/TrueType"
FontPath "/usr/lib/X11/fonts/Type1"
FontPath "/usr/lib/X11/fonts/Speedo"
FontPath "/usr/lib/X11/fonts/100dpi"
FontPath "/usr/lib/X11/fonts/75dpi"
EndSection
Section "ServerFlags"
Option "AllowMouseOpenFail"
Option "DontZap"
EndSection
Section "Module"
Load "ddc"
Load "GLcore"
Load "dbe"
Load "dri"
Load "extmod"
Load "glx"
Load "pex5"
Load "record"
Load "xie"
Load "bitmap"
Load "freetype"
Load "speedo"
Load "type1"
Load "vbe"
Load "int10"
EndSection
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc102"
Option "XkbLayout" "#X_KEYMAP#"
# Option "XkbVariant" "nodeadkeys"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "#MOUSEDEVICE#"
Option "Protocol" "#MOUSEPROTOCOL#"
Option "Buttons" "5"
Option "Emulate3Buttons" "false"
Option "ZAxisMapping" "4 5"
EndSection
Section "Device"
Identifier "Generic Video Card"
Driver "#VIDEODRIVER#"
EndSection
Section "Monitor"
Identifier "Generic Monitor"
HorizSync #HORIZSYNC#
VertRefresh #VERTREFRESH#
Option "DPMS"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Depth 1
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 4
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 8
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 15
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
EndSection
Section "DRI"
Mode 0666
EndSection
# end of XF86Config
-------------- next part --------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<fcopyinfo>
<comment>Template der X11-Serverkonfiguration, das mit Hilfe von <tt>postinst</tt> aktualisiert wird.</comment>
<depend>
<package>xfree86-common</package>
</depend>
</fcopyinfo>
-------------- next part --------------
root root 0644
-------------- next part --------------
#!/bin/sh
# $Id: postinst,v 1.7 2002/02/05 23:14:32 glaweh Exp $
# Get keyboard configuration
[ -e $target/etc/config/keyboard ] && . $target/etc/config/keyboard
# Check for the XF86 Servermodule
VIDEODRIVER=`hwinfo --display | grep 'XFree86 v4 Server Module:' \
| sed -e 's/.*XFree86 v4 Server Module: *//' | head -n 1`
# Check for the XF86 Mouse
MOUSEDEVICE=`hwinfo --mouse | grep 'Device File:' \
| sed -e 's/.*Device File: *//'`
MOUSEPROTOCOL=`hwinfo --mouse | grep 'XFree86 Protocol:' \
| sed -e 's/.*Protocol: *//'`
# Check for the Monitor data
MONITORDATA=`get-edid 2>/dev/null | parse-edid 2>/dev/null \
| grep -e "HorizSync" -e "VertRefresh" \
| sed -e 's/.*HorizSync *//g' -e 's/.*VertRefresh *//g'`
HORIZSYNC=` echo ${MONITORDATA} | awk '{print $1}'`
VERTREFRESH=`echo ${MONITORDATA} | awk '{print $2}'`
[ -z "${VIDEODRIVER}" ] && VIDEODRIVER=vga
[ -z "${MOUSEDEVICE}" ] && MOUSEDEVICE=/dev/psaux
[ -z "${MOUSEPROTOCOL}" ] && MOUSEPROTOCOL=ps/2
[ -z "${HORIZSYNC}" ] && HORIZSYNC=30-100
[ -z "${VERTREFRESH}" ] && VERTREFRESH=48-160
[ -z "${X_KEYMAP}" ] && X_KEYMAP=us
export VIDEODRIVER MOUSEPROTOCOL MOUSEDEVICE HORIZSYNC VERTREFRESH X_KEYMAP
perl -pi -e 's/#VIDEODRIVER#/$ENV{VIDEODRIVER}/g;' \
-e 's/#MOUSEDEVICE#/$ENV{MOUSEDEVICE}/g;'\
-e 's/#MOUSEPROTOCOL#/$ENV{MOUSEPROTOCOL}/g;'\
-e 's/#HORIZSYNC#/$ENV{HORIZSYNC}/g;' \
-e 's/#VERTREFRESH#/$ENV{VERTREFRESH}/g;' \
-e 's/#X_KEYMAP#/$ENV{X_KEYMAP}/g;' $2
More information about the linux-fai
mailing list