NOTE: if you read the tutorial and are still experiencing difficulties and would like help, you are asked to start a new topic on the forums.
Please do NOT reply to this thread to ask a technical question. Replies to THIS thread should be corrections and enhancements on the tutorial/howto only.
Thanks in advance for your co-operation.
After having answered/noticed quite a few questions concerning setup of XFree86 (or X.org), I thought I'd write a short tutorial on how to manually write your own XF86Config. This guide is by no means complete, and is only written so that the most basic problems may be resolved. There are a _LOT_ of options you could put in your XF86Config, and most of them will not be covered in this tutorial. If you want to know try man XF86Config, man X and all the other man:s. And don't forget : most distros come with an XF86Config.example or similar, that is often worth checking out.
The XF86Config file is divided into different Sections. The main outline is this
Sometimes there may also be a subsection stuck in there, which works in the same way.
First out is the files section:
In this section you specify where your rgb, fonts and modules reside respectively. The rgb setting will probably never need to be changed. For fonts you can add however many fontpaths you want, in case you installed them somewhere unusual. Finally, modulepath, which most often isn't needed either, since if you don't specify, it assumes /usr/X11R6/lib/modules. If you have some weird X module lying around somewhere else than /usr/X11R6/lib/modules, feel free to add the directory path like this.
Next section is Module:
Here, you specify all modules you want the Xserver to load. "type1" and "freetype" are modules that add support for fonts, "glx" adds support for the glx graphics extension, "extmod" is a general extension module and there can also go a lot of other mysterious things here. Just make sure you have the modules available in your module directory.
Movin on, here comes keyboard stuff :
This section is REALLY important, although fortunately, most people don't seem to have much problem with it. Identifier can be whatever you want to call your keyboard, driver will exclusively be "keyboard", and the rest is optional:
Option "autorepeat" "500 5"
Option "XkbModel" "pc102"
Option "XkbLayout" "se"
autorepeat sets the keyboard autorepeat rate
CoreKeyboard if this it the main keyboard of the computer(probably is) then use this option
XkbModel the keyboard model
XkbLayout the keyboard layout, usually your country code
If you are really interested you could always check /usr/X11R6/lib/X11/doc/README.xkb for more keyboard info. (for even more pointless reading, check out the /usr/X11R6/lib/X11/xkb directory, for complete listings of different keyboard layouts and such, the rest of us usually just go for "pc102" or "pc104" or "p105")
Here goes mouse!
The first two require no explanation. Identifier is whatever you like, Driver is always mouse. And now, for the options:
Option "Protocol" "PS/2"
Option "Device" "/dev/psaux"
Option "ZAxisMapping" "5" "6"
Protocol "PS/2" or "auto" or "IMPS/2" or "usb" or "IntelliMouse"
PS/2 means a ps2 mouse. Always try this first. You can also try setting it to "auto" which is most often supported. For USB-mice, you may want to set it to "IMPS/2" or "usb". For IntelliMice, use "IntelliMouse" For more options, check /usr/X11R6/lib/X11/doc/README.mouse
Device "/dev/mouse" or "dev/psaux" or ...
/dev/mouse for PS/2 mice, usually /dev/psaux for USB-mice.
Buttons "2" or "3" or "4" or "5" or "6" ot ...
One guess what this means. Don't forget that the mousewheel sometimes counts as three buttons, one for when you press it, and one for each direction.
ZAxisMapping "3" "4" or "4" "5" or ...
The two "mouse buttons" that make up the mouse-wheel. If it doesn't work, try changing it around for a bit, but for a three-button mouse(with either a separate third button or clickable wheel), the usual answer is "4" "5".
This should cover most of the situations in which might find yourself in.
Worth noticing is also, of course, that a USB Mouse won't work without USB-support.
Check your kernel-config for usbcore, usb-uhci(or ohci, or ehci) and hid.
CorePointer Means this is the main pointing device.
On to the Monitors:
VendorName and Modelname are highly irrelevant. HorizSync and VertRefresh should be checked in you monitor manual.
ModelName "SuperMonitor 2000"
HorizSync 30.0 - 70.0
VertRefresh 50.0 - 160,0
(the values in this example are fairly common for 17" monitors)
And on to the graphics card:
Driver "nv" or "nvidia" or "ati" or "ativga" or ...
BoardName "Geforce2 GTS"
Driver can be set to a few different things here. As far as I know, for nvidia cards there is either "nvidia" or "nv". "nv" is the default XFree86 nvidia driver, while "nvidia" is nVidias own driver. For ATI cards, the default value is "ati", the XFree86 ATI driver. "ativga" will do the same, except without graphics acceleration.
BusID should be set to whatever PCI bus(or AGP bus) your card is located at. Most often it is PCI:1:0:0. (mine is on AGP, but the AGP is actually "PCI:1:0:0")
this section should start of with the ID:s of the card and monitor you have specified higher up (you can of course have multiple screens if you have multiple cards and monitors.
This really isn't that tricky. DefaultDepth tells the Xserver what color depth to start at. The different "Display"-subsections tells the server what capabilities your card/monitor configuration has. You do not _NEED_ to specify all capabilites of your card/monitor. I usually just specify the highest colordepth and a few of the highest resolutions, and then one emergency mode with colordepth 8 and modes 800x600 and 64x480.
Modes "800x600" "640x480"
Modes "1600x1200" "1152x864" "1024x768"
These values are legal for Depth (and DefaultDepth):
1, 2, 4, 8, 15, 16, 24, (32)
although I have read that 32 is just pseudo for 24. Anyway, your graphics card might not support all these, so be sure to check
your manual which of these combinations of resolution and color-depth are legal. Oh, and I forgot, you can if you absolutely haven't got anything better to do, insert these kind of "Display"-subsections in the Monitor section as well.
There are two more Sections that I won't talk about("ServerFlags and "ServerLayout"), because if you have gotten this far, your Xserver should be up and running, and you can find it out for your self. Google!
I have an XF86Config-4 file, but not an XF86Config file. What's going on with that? Is there some difference, is the -4 there for some reason?
In the beginning of XFree86 version 4, many distributions shipped with both version 4 and an older version 3.3 for video cards that did not yet have drivers in version 4.
In order for their config files not to be mistaken for each other, XFree86 version 4 was made to prefer the XF86Config-4 file, if it existed (it uses XF86Config if there is no XF86Config-4), while version 3.3 always used the XF86Config file.
Now that no distros ship version 3 anymore, you can still name the config file XF86Config-4, and some distros still do for unknown reasons, but you can equally well name it XF86Config. It's the same now.
XFree86 4 tries many other config file names as well. See the XF86Config manpage to see all the file names it tries.
For x.org 6.8.1 you'll need to change the driver for keyboard to kbd or you won't load a keyborad. i.e.
Option "autorepeat" "500 5"
Option "XkbModel" "pc102"
Option "XkbLayout" "se"
In fact, that's the only change I had to make from xfree86 to x.org.