Explanation
In this article I am using VGA mode to reference to the command line graphic capabilities, when in fact the video system is called the Linux frame-buffer, the reason for this use of terms is to help new users since most configurations use the VGA flags to set the frame-buffer mode to use.
The frame-buffer system in Linux based systems is used to pass a video mode to your kernel on boot, which is generally used set your monitor’s resolution for boot-loaders and CLI (Command Line interface) mode. Although the uses are limited, many users can find reasons to modify the frame-buffer mode and resolution including wanting to view more lines and character on the screen when in CLI Mode.
Your options for setting the VGA mode are limited because of the limited uses. You are limited to setting the mode in the configuration file for your chosen bootloader. In this post we will discuss the available modes and how to set them in lilo, grub legacy and grub2.
Supported Drivers
In most cases the vesafb driver is used in the kernel for frame-buffer support, but in rare cases on specific video cards and chipsets, you may need to use another frame-buffer driver. The alternate drivers will not be covered here, but if you need assistance with those you can visit the tldp.prg page on frame-buffer drivers (http://tldp.org/HOWTO/frame-buffer-HOWTO/x168.html) or ask on the Linux.com forum.
Frame-Buffer Modes
When choosing a frame-buffer mode to use, you will have values to consider, the color depth, and the resolution. You will need to choose the correct value to correspond with your desired parameters and to support your video card and monitor.
Listed below are the VGA values as they correspond to the color depth and resolution:
- 8 bit – 256 colors
- 1024×768 = 773
- 1152×864 = 353
- 1280×1024 = 775
- 1600×1200 = 796
- 16-bit – 65,536
- 1024×768 = 791
- 1152×864 = 355
- 1280×1024 = 794
- 1600×1200 = 798
- 32-bit – 16.8 million colors
- 1024×768 = 792
- 1152×864 = 356
- 1280×1024 = 795
- 1600×1200 = 799
- 64-bit
- 800×600 = ?
- 1024×768 = 791
- 1152×864 = ?
- 1280×1024 = ?
- 1600×1200 = ?
As you may have noticed I left some designations out because I have seen references to the modes being used, but could not locate the specific values necessary for the bootloaders to use, if you know of any missing values please share them in the comments.
Configuring lilo
The legacy lilo bootloader is not used by many distros anymore, but it very simple to configure and fast, so it still has a place in modern distros.
It is very simple to set the frame-buffer modes in Lilo, to pass the chosen frame-buffer mode to the kernels in all installed Linux/Unix-like operating systems, or you can choose specific values to pass to specific installed operating systems.
To set the frame-buffer mode for lilo to use and to pass to your OS kernels you need to do the following:
- Open the file /etc/lilo.conf with admin rights in yli>our favorite text editor
- Find the OS you wish to pass the option to, for example OS configuration set would be:
image = /boot/vmlinuz
root = /dev/sda6
label = Slackware-safe
read-only - In the image line, which identified the kernel to use, add vga={chosen mode} on the end of the line, such as:
image = /boot/vmlinuz vga=791
root = /dev/sda6
label = Slackware-safe
read-only - Don’t forget to run the command lilo from the command line once the modifications are complete to write the modified bootloader configuration to the MBR.
You can find additional information pertaining to lilo options at http://linux.die.net/man/5/lilo.conf.
Configuring grub(legacy)
Grub(legacy) is not being used by many distros anymore because a new version (grub2) has been released which caused development to stop on the old version, but for those that prefer the old configuration method it is still an available option.
To set the frame-buffer mode for grub to use and pass to your OS kernels you need to do the following:
- Open /boot/grub/menu.lst as the admin user in your favorite text editor
- Locate the OS which you would like to modify, an example from one of my configurations is below:
title Slack64-current
root (hd0,1)
kernel /boot/s64-c/vmlinuz-generic root=/dev/sdb6 ro
initrd /boot/s64-c/initrd.gz - Add the vga={chosen mode} option to the end of the kernel line of the chosen operating system, such as:
title Slack64-current
root (hd0,1)
kernel /boot/s64-c/vmlinuz-generic root=/dev/sdb6 ro vga=791
initrd /boot/s64-c/initrd.gz - Save the menu.lst file
Configuring Grub2
Grub2 is the current version of the grub bootloader and is quickly obtaining approval from several distros. Grub2 is currently under development in which your distro will be receiving regular updates which may risk overwriting your custom configuration file, so be careful.
To set the frame-buffer mode for grub2 to use and pass to your OS kernels you need to do the following:
- Open the file /etc/default/grub with admin rights in your favorite text editor.
- In any line before _?_ add the line “GRUB_GFXMODE={resolution}x{color depth}“, the color depth is optional, so to set grub to 1024×768 you can enter “GRUB_GFXMODE=1024×768” or to set it to 32-bit mode (16.8 million colors) you can enter “GRUB_GFXMODE=1024x768x32“. You can also enter multitple modes separated by a comma.
- Optional: Enter “GRUB_GFXPAYLOAD_LINUX=keep” in the configuration file to tell the bootloader to push the chosen setting to the operating system kernels.
- Save the file and run the command update-grub to append the changes to the bootloader.
To set the frame-buffer mode for grub2 to pass to a specific OS kernel you need to do the following:
- Open the file /etc/lilo.conf with admin rights in your favorite text editor ind the OS you wish to pass the option to, an example of an OS configuration set would be:
title Start BackTrack frame-buffer (1024×768)
kernel /boot/vmlinuz BOOT=casper boot=casper rw quiet
initrd /boot/initrd.gz - In the image line, which identified the kernel to use, add vga={chosen mode} on the end of the line, such as:
title Start BackTrack frame-buffer (1024×768)
kernel /boot/vmlinuz BOOT=casper boot=casper rw quiet vga=791
initrd /boot/initrd.gz
If you have any issues implementing any of the instructions above please post your issues as a comment and I will try to assist you through your issues.