注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

欢迎光临我的博客

 
 
 

日志

 
 

config X-server Xorg  

2008-04-04 18:01:07|  分类: unix |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

2.  Installing Xorg

Using emerge

Enough chitchat, let's get to business shall we? To install Xorg, you just need to run emerge xorg-x11. Installing Xorg does take a while though, so you might want to grab a snack while you are waiting.

Before installing Xorg you have to configure two important variables in the /etc/make.conf file.

The first one is VIDEO_CARDS. This is used to set the video drivers that you intend to use and is usually based on the kind and brand of card you have. The most common settings are nvidia for Nvidia cards or fglrx for ATI Radeon cards. Those are the proprietary drivers from Nvidia and ATI respectively. If you would like to use the open source versions, use nv rather than nvidia in the variable, but bear in mind that using this driver means no 3d acceleration at all. The free radeon driver for ATI cards supports full 3D acceleration on older Radeons but doesn't work at all with the newer ones. VIDEO_CARDS may contain more than one driver, in this case list of them should be separated with spaces.

The second variable is INPUT_DEVICES and is used to determine which drivers are to be built for input devices. In most cases setting it to keyboard mouse should work just fine.

Now you should decide which drivers you will use and add necessary settings to the /etc/make.conf file:

Code Listing 2.1: Sample make.conf entries

(For mouse and keyboard support)

INPUT_DEVICES="keyboard mouse"

(For Nvidia cards)

VIDEO_CARDS="nvidia"

(OR, for ATI Radeon cards)

VIDEO_CARDS="fglrx"

More instructions on how to configure Nvidia and ATI cards can be found in Gentoo Linux nVidia Guide and in Gentoo Linux ATI FAQ. If you don't know which drivers you should choose, refer to these guides for more information.

Note: If the suggested settings don't work for you, you should run emerge -pv xorg-server, check all the options available and choose those which apply to your system. The example is for the amd64 architecture and xorg-server-1.2.

Code Listing 2.2: Displaying all the driver options available

# emerge -pv xorg-serverThese are the packages that would be merged, in order:Calculating dependencies... done![ebuild R ] x11-base/xorg-server-1.2.0-r3 USE="dri nptl xorg (-3dfx) -debug-dmx -ipv6 -kdrive -minimal -sdl -xprint" INPUT_DEVICES="keyboard mouse -acecad-aiptek -calcomp -citron -digitaledge -dmc -dynapro -elo2300 -elographics -evdev-fpit -hyperpen -jamstudio -joystick -magellan -microtouch -mutouch -palmax-penmount -spaceorb -summa -synaptics -tek4957 -ur98 -vmmouse -void -wacom"VIDEO_CARDS="nvidia -apm -ark -chips -cirrus -cyrix -dummy -epson -fbdev -fglrx-glint -i128 (-i740) -i810 (-impact) (-imstt) -mach64 -mga -neomagic (-newport)(-nsc) -nv -r128 -radeon -rendition -s3 -s3virge -savage -siliconmotion -sis-sisusb (-sunbw2) (-suncg14) (-suncg3) (-suncg6) (-sunffb) (-sunleo) (-suntcx)-tdfx -tga -trident -tseng -v4l -vesa -vga -via -vmware -voodoo" 0 kB

After setting all the necessary variables you can install the Xorg package.

Code Listing 2.3: Installing Xorg

# emerge xorg-x11

When the installation is finished, you might need to re-initialise some environment variables before you continue. Just run env-update followed by source /etc/profile and you're all set.

Code Listing 2.4: Re-initialising the environment variables

# env-update# source /etc/profile

3.  Configuring Xorg

The xorg.conf File

The configuration file of Xorg is called xorg.conf and it resides in /etc/X11. The Xorg-X11 package provides an example configuration as /etc/X11/xorg.conf.example which you can use to create your own configuration. It is heavily commented, but if you are in need of more documentation regarding the syntax, don't hesitate to read the man page:

Code Listing 3.1: Reading the xorg.conf man page

# man 5 xorg.conf

Happy reading for those of you willing to. We surely don't so we'll continue with checking out how we can create the file automatically.

Default: Automatic Generation of xorg.conf

Xorg itself is able to guess most parameters for you. In most cases, you will only have to change some lines to get the resolution you want up and running. If you are interested in more in-depth tweaking, be sure to check the resources at the end of this chapter. But first, let us generate a (hopefully working) Xorg configuration file.

Code Listing 3.2: Generating an xorg.conf file

# Xorg -configure

Be sure to read the last lines printed on your screen when Xorg has finished probing your hardware. If it tells you it failed at some point, you're forced to manually write an xorg.conf file. Assuming that it didn't fail, it will have told you that it has written /root/xorg.conf.new ready for you to test. So let's test. :)

Code Listing 3.3: Testing the xorg.conf.new file

# X -config /root/xorg.conf.new

If all goes well, you should see a simple black and white pattern. Verify if your mouse works correctly and if the resolution is good. If you received errors about "/dev/mouse", try changing your mouse device to /dev/input/mice in the "InputDevice" section of xorg.conf. You might not be able to deduce the exact resolution, but you should be able to see if it's too low. You can exit any time by pressing Ctrl-Alt-Backspace.

Alternative: Semi-Automatic Generation of xorg.conf

Xorg provides a tool called xorgconfig which will ask you for various information regarding your system (graphical adapter, keyboard, ...). Based on your input it will create a xorg.conf file.

Code Listing 3.4: Semi-Automatic Generation of xorg.conf

# xorgconfig

Another tool, also provided by Xorg, is xorgcfg, which will first attempt to run Xorg -configure and then start the X server for more final tweaking.

Code Listing 3.5: Using xorgcfg

# xorgcfg(In case X crashes or the configuration fails, try:)# xorgcfg -textmode

Copying over xorg.conf

Let us copy over the xorg.conf.new to /etc/X11/xorg.conf now, so we won't have to continuously run X -config -- typing just X or startx is easier. :)

Code Listing 3.6: Copying over xorg.conf

# cp /root/xorg.conf.new /etc/X11/xorg.conf

Using startx

Now try startx to start up your X server. startx is a script that executes an X session, that is, it starts the X servers and some graphical applications on top of it. It decides which applications to run using the following logic:

  • If a file named .xinitrc exists in the home directory, it will execute the commands listed there.
  • Otherwise, it will read the value of the XSESSION variable and will execute one of the sessions available in /etc/X11/Sessions/ accordingly (you can set the value of XSESSION in /etc/rc.conf to make it a default for all the users on the system).
  • If all of the above fail, it will fall back to a simple window manager, usually twm.

Code Listing 3.7: Starting X

# startx

If you see an ugly, loathsome, repulsive, deformed window manager, that's twm. To finish the twm session, type in exit or Ctrl-D in the upcoming xterms. You can also kill the X session using the Ctrl-Alt-Backspace combination. This will however make X exit disgracefully -- something that you might not always want. It doesn't hurt though. :)

4.  Tweaking xorg.conf

Setting your Resolution

If you feel that the screen resolution is wrong, you will need to check two sections in your configuration. First of all, you have the Screen section which lists the resolutions, if any that your X server will run at. By default, this section might not list any resolutions at all. If this is the case, Xorg will estimate the resolutions based on the information in the second section, Monitor.

What happens is that Xorg checks the settings of HorizSync and VertRefresh in the Monitor section to compute valid resolutions. For now, leave these settings as-is. Only when the changes to the Screen section (which we will describe in a minute) don't work, then you will need to look up the specs for your monitor and fill in the correct values. You can also use a tool that searches for your monitor's specs, such as sys-apps/ddcxinfo-knoppix.

Warning: Do not "just" change the values of these two monitor related variables without consulting the technical specifications of your monitor. Setting incorrect values lead to out-of-sync errors at best and smoked up screens at worst.

Now let us change the resolutions. In the next example from /etc/X11/xorg.conf we add the Modes lines and the DefaultDepth so that our X server starts with 24 bits at 1024x768 by default. Don't mind the given strings -- they are examples and will most likely differ from the settings on your system.

Code Listing 4.1: Changing the Screen section in /etc/X11/xorg.conf

Section "Screen" Identifier "Default Screen" Device "S3 Inc. ProSavage KN133 [Twister K]" Monitor "Generic Monitor" DefaultDepth 24 # Skipping some text to improve readability SubSection "Display" Depth 24 Modes "1024x768" EndSubSectionEndSection

Run X (startx) to discover it uses the resolution you want. :)

Configuring your Keyboard

To setup X to use an international keyboard, search for the InputDevice section that configures the keyboard and add the XkbLayout option to point to the keyboard layout you want. As an example, we show you how to apply for the Belgian layout. Just substitute the country-keycode with yours:

Code Listing 4.2: Changing the keyboard layout

Section "InputDevice" Identifier "Generic Keyboard" Driver "keyboard" Option "CoreKeyboard" Option "XkbRules" "xorg" Option "XkbModel" "pc105" Option "XkbLayout" "be"EndSection

Configuring your Mouse

If your mouse isn't working, you will first need to find out if it is detected by the kernel at all. Mice are (device-wise) seen as /dev/input/mouse0 (or /dev/input/mice if you want to use several mice). In some cases /dev/psaux is used. In either case you can check if the devices do represent your mouse by checking the output of those files when you move your mouse. You will usually see some junk on your screen. To end the session press Ctrl-C.

Code Listing 4.3: Checking the device files

# cat /dev/input/mouse0(Don't forget to press Ctrl-C to end this)

If your mouse isn't detected, verify if all the necessary modules are loaded.

If your mouse is detected, fill in the device in the appropriate InputDevice section. In the next example you'll see we also set two other options: Protocol (which lists the mouse protocol to be used -- most users will use PS/2 or IMPS/2) and ZAxisMapping (which allows for the mousewheel (if applicable) to be used).

Code Listing 4.4: Changing the mouse settings in Xorg

Section "InputDevice" Identifier "TouchPad Mouse" Driver "mouse" Option "CorePointer" Option "Device" "/dev/input/mouse0" Option "Protocol" "IMPS/2" Option "ZAxisMapping" "4 5"EndSection

Run startx and be happy about the result. :) Congratulations, you now (hopefully) have a working Xorg on your system. The next step is to remove this ugly lightweight window manager and use a high-feature one (or even a desktop environment) such as KDE or GNOME, but that's not part of this guide. :)

Google for more. :) As xorg.conf and XF86Config (the configuration file for the XFree86 project) use the same syntax for most configuration options and more information about XF86Config is available, we'll list those resources as well.

Migrating to Modular X HOWTO.

More information about configuring different packages to work in X environment can be found in the Gentoo Desktop Documentation Resources section of our documentation.

  评论这张
 
阅读(757)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017