Configuration of Linux Kernel Video Mode

By: Zhiqiang Ma In: Linux

The Linux kernel has a generic driver for a graphic framebuffer named vesafb on intel boxes. It provides a nice large console for most of modern displays.

Switching VESA modes of Linux kernel at boot time can be done by using the “vga=… kernel boot parameter. This parameter accept the decimal value of Linux video mode numbers instead of VESA video mode numbers. The Linux video mode number can be easily derived from the VESA number.

The video mode number of the Linux kernel is the VESA mode number plus 0×200.

Linux_kernel_mode_number = VESA_mode_number + 0x200

Here are some of the VESA mode numbers:

    | 640x480  800x600  1024x768 1280x1024
----+-------------------------------------
256 |  0x101    0x103    0x105    0x107
32k |  0x110    0x113    0x116    0x119
64k |  0x111    0x114    0x117    0x11A
16M |  0x112    0x115    0x118    0x11B

So the table for the Kernel mode numbers are:

    | 640x480  800x600  1024x768 1280x1024
----+-------------------------------------
256 |  0x301    0x303    0x305    0x307
32k |  0x310    0x313    0x316    0x319
64k |  0x311    0x314    0x317    0x31A
16M |  0x312    0x315    0x318    0x31B

The decimal value of the Linux kernel video mode number can be passed to the kernel in the form “vga=XXX“, where XXX is the decimal value.

Instead of the XXX decimal value, the “vga” parameter also accept “ask” which will list all the Linux kernel mode numbers and let the user select one. You can used it if you want to be asked every time booting Linux. It can also be used to find the best Linux video mode on your console.

The best way for configuring the “vga=XXX” parameter is following these steps.

First, add “vga=ask” parameter to the Linux kernel entry in grub configuration file /boot/grub/grub.conf. Like this:

kernel /vmlinuz-2.6.32.16-141.fc12.i686 ro root=/dev/mapper/VolGroup-LogVol00 vga=ask 

Second, reboot Linux and hit return when the kernel ask for the vga mode. Then select one mode from the list and remember the Linux mode number which is a hexdecimal value in the format YYY. You can also get more choice by entering “scan“.

Last, calculate the decimal value of the Linux video mode number. This simple python command can be used:

python -c "print 0xYYY"

YYY is the hexdecimal value you got.

Then change “ask” in grub configuration file to the decimal value calculated.

Here is a list of usually used Linux mode number and the decimal value if you like to choose one directly:


320×200 640×400 640×480 800×500 800×600 896×672 1024×640 1024×768 1280×1024
4 bits 770 (302) 774 (306)
8 bits 768 (300) 769 (301) 879 (36F) 701 (303) 815 (32F) 874 (36A) 773 (305) 775 (307)
15 bits 781 (30D) 801 (321) 784 (310) 880 (370) 787 (313) 816 (330) 875 (36B) 790 (316) 793 (319)
16 bits 782 (30E) 802 (322) 785 (311) 881 (371) 788 (314) 817 (331) 876 (36C) 791 (317) 794 (31A)
24 bits 783 (30F) 803 (323) 786 (312) 882 (372) 789 (315) 818 (332) 877 (36D) 792 (318) 795 (31B)
32 bits 804 (324) 809 (329) 883 (373) 814 (32E) 819 (333) 878 (36E) 824 (338) 829 (33D)
Author: Zhiqiang Ma Last updated on: Apr 3, 2011 Posted on: Jul 23, 2010 Views: 3,891
Tags: , , , , ,
Add your comments, share your thoughts

Be nice. Keep it clean. Stay on topic. No spam.