Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux綜合 >> Linux資訊 >> 更多Linux

XWindow 顯卡支援不足時的完整解法

新顯卡上市初期常常還沒被 XFree86 支援,X Window 的設定因此卡關。解法是繞道而行:Linux 2.2.x 的 frame buffer 裝置可以透過 VESA VBE 2.0 標準直接驅動顯卡的 Super VGA 能力,再搭配 XFree86 的 frame buffer Server(XF86_FBDev),就能拿到高解析度與高/真彩色。當時市面上絕大部分新顯卡都符合 VESA 2.0,因此在專用 Server 出現之前,這條路值得一試。

需要準備的檔案

Linux 2.2.x 核心原始碼(要自行編譯核心才需要)、XFree86 的 frame buffer Server(XF86_FBDev,可自 Turbo Linux 中文版、RedHat 6.0 CD 或 ftp.xfree86.org 取得),以及 gcc 等編譯工具。

步驟一:編譯支援 VESA frame buffer 的核心

若已有現成支援的核心(如 Mandrake 6.0 內建者)可跳過。否則在 /usr/src/linux 下執行 make xconfig 或 make menuconfig,勾選下列項目:

Code maturity level options → Prompt for development and/or incomplete code/drivers
Console drivers → Video mode selection support
Console drivers → Support for frame buffer devices
Console drivers → VESA VGA graphics console
Console drivers → Advanced low level driver options → 8/16/24 bpp packed pixels support

接著編譯安裝:

# cd /usr/src/linux
# make bzImage
# make modules
# make modules_install
# cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.2.5-fb

步驟二:建立 frame buffer 裝置

major 為 29,minor 依序是 0(fb0)、32(fb1)……224(fb7):

# mknod /dev/fb0 c 29 0

步驟三:設定 lilo 開機選項

典型的 /etc/lilo.conf:

boot = /dev/hda2
timeout = 500
prompt
read-only
image = /boot/vmlinuz-2.2.x
 label = linux
 root = /dev/hda2
other = /dev/hda1
 label = dos

新增一組 entry,補上 image、label、root 與 vga 四項:

image = /boot/vmlinuz-2.2.5-fb
 label = linuxfb
 root = /dev/hda2
 vga = 0x314

vga 值換算:Linux_kernel_mode_number = VESA_mode_number + 0x200。常用對照如下:

解析度  256 色  32K 色  64K 色  16M 色
640x480  0x301  0x310  0x311  0x312
800x600  0x303  0x313  0x314  0x315
1024x768 0x305  0x316  0x317  0x318
1280x1024 0x307  0x319  0x31A  0x31B

改完執行 lilo 更新開機程式,重啟時在 lilo: 提示下輸入 linuxfb。若畫面切進圖形模式並出現企鵝 logo,就成功了。

步驟四:配置 frame buffer Server

先在 XF86Config(/etc/X11 或 /usr/X11R6/lib)裡找到 vga16 的 Screen 區段當範本:

Section "Screen"
 Driver "vga16"
 Device "My Video Card"
 Monitor "MAG XJ500T"
 Subsection "Display"
  Modes "640x480" "800x600"
  ViewPort 0 0
 EndSubsection
EndSection

改 Driver、Modes、Depth 三項即可:

Section "Screen"
 Driver "fbdev"
 Device "My Video Card"
 Monitor "MAG XJ500T"
 Subsection "Display"
  Depth 16
  Modes "default"
  ViewPort 0 0
 EndSubsection
EndSection

Depth 必須與開機時所選的顯示模式色深一致,否則畫面會怪。

步驟五:把 X 指向 XF86_FBDev

將 XF86_FBDev 複製到 /usr/X11R6/bin。/usr/X11R6/bin 與 /etc/X11 中各有一個名為 X 的檔案,它其實是個類似捷徑的東西,指向真正的 X Server(如 XF86_VGA16);startx 腳本呼叫的是 X,並不管背後是哪一支 Server。所以這兩處的 X 都要改指向 XF86_FBDev(不同版本可能只用到其中一處):

cd /etc/X11
mv X X.old
ln -s /usr/X11R6/bin/XF86_FBDev X

重啟 X 即可。之後若 XFree86 推出了你顯卡的專用 Server,只要把 X 的連結指回去,就能切換回原生驅動,前面所有設定都不必推翻。

Copyright © Linux教程網 All Rights Reserved