关于传递给Linux内核的vga参数的值的意义
时间:2023-09-13 18:37:02
今天遇到的一个问题,就是刚安装完成的rhel6.进入字符模式的字体很大,屏幕上可以显示的内容太少。仔细想想,应该是分辨率小的原因,所以大部分都是在网上查询的grub的kernel后面加上 vga=xxx 可以做到,所以一开始就可以设置 vga=791 正常显示,但据网上介绍 791 = 1024 x 768 我的显示器是宽屏,显然这个分辨率比较小,然后会vga设置为 794,一对分辨率设置程序出现在结果开始时,其中vga和vesa相关的东东,经过苦苦寻找,终于明白了以下文章的原理:
原文出处
我的电脑是ATI X700Pro使用显卡fglrxX下1024x768@85Hz很正常,但是切换到控制台就有问题了!这就是图形模式到文本 这种模式的切换是由分辨率不一致引起的切换问题。有必要为核心指定一个分辨率参数。网上有很多现成的答案,比如1024x768,24位色就 是vga=0x318,如果使用lilo据说装载不能处理16进制vga=792,但是这个值是怎么得到的上查了很久才找到答案。
事实上,内核vga有参数值VESA(Vedio Electronic Standard Association)规定的SVGA由视频模式信号决定。计算公式如下:
Linux_kernel_mode_number = VESA_mode_number 0x200
VESA_mode_number在VESA标准文件规定如下:
4. Super VGA mode numbers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Standard VGA mode numbers are 7 bits wide and presently range from 00h to 13h.
OEMs have defined extended video modes in the range 14h to 7Fh. Values in the
range 80h to FFh cannot be used, since VGA BIOS function 00h (Set video mode)
interprets bit 7 as a flag to clear/not clear video memory.
Due to the limitations of 7 bit mode numbers, VESA video mode numbers are 15
bits wide. To initialize a Super VGA mode, its number is passed in the BX
register to VESA BIOS function 02h (Set Super VGA mode).
The format of VESA mode numbers is as follows:
D0-D8 = Mode number
If D8 == 0, this is not a VESA defined mode
If D8 == 1, this is a VESA defined mode
D9-D14 = Reserved by VESA for future expansion (= 0)
D15 = Reserved (= 0)
Thus, VESA mode numbers begin at 100h. This mode numbering scheme implements
standard VGA mode numbers as well as OEM-defined mode numbers as subsets of the
VESA mode number. That means that regular VGA modes may be initialized through
VESA BIOS function 02h (Set Super VGA mode), simply by placing the mode number
in BL and clearing the upper byte (BH). OEM-defined modes may be initialized in
the same way.
To date, VESA has defined a 7-bit video mode number, 6Ah, for the 800x600,
16-color, 4-plane graphics mode. The corresponding 15-bit mode number for this
mode is 102h.
The following VESA mode numbers have been defined:
GRAPHICS TEXT
15-bit 7-bit Resolution Colors 15-bit 7-bit Columns Rows
mode mode mode mode
number number number number
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100h - 640x400 256 108h - 80 60
101h - 640x480 256
109h - 132 25
102h 6Ah 800x600 16 10Ah - 132 43
103h - 800x600 256 10Bh - 132 50
10Ch - 132 60
104h - 1024x768 16
105h - 1024x768 256
106h - 1280x1024 16
107h - 1280x1024 256
VESA Super VGA Standard VS911022-8
10Dh - 320x200 32K (1:5:5:5)
10Eh - 320x200 64K (5:6:5)
10Fh - 320x200 16.8M (8:8:8)
110h - 640x480 32K (1:5:5:5)
111h - 640x480 64K (5:6:5)
112h - 640x480 16.8M (8:8:8)
113h - 800x600 32K (1:5:5:5)
114h - 800x600 64K (5:6:5)
115h - 800x600 16.8M (8:8:8)
116h - 1024x768 32K (1:5:5:5)
117h - 1024x768 64K (5:6:5)
118h - 1024x768 16.8M (8:8:8)
119h - 1280x1024 32K (1:5:5:5)
11Ah - 1280x1024 64K (5:6:5)
11Bh - 1280x1024 16.8M (8:8:8)
以上来自VESA官方文档
这很容易理解,1024x768,16.8M颜色代码为118h。因此,在内核参数中写入对应性vga=0x318或vga=792。