Digital Hermit  -- Unix and Linux Solutions  About    Linux    Mathematics    Science    The Project   
 

Introduction

Updated December 8, 2001
URL: http://www.digitalhermit.com/linux/hiresconsole.html

This is a guide to getting a high-resolution console (non-X based) on your Linux machine. Besides allowing much more information to be presented at once, it also looks a lot cooler than that 80x25 screen. :)

Please be aware that enabling any of these features could potentially damage your hardware. Though I've used these changes personally on dozens of monitors and LCD displays, there is the possibility that a particular mode or refresh rate or carelessness or divine intervention may damage the monitor or video card. I am in now way responsible if this happens.

There are three main ways to get a high-res console:

  • Type vga=ask at the bootprompt.
  • Install SVGATextMode.
  • Configure the framebuffer console.

VGA=ASK

This is the quickest and easiest way. At the LILO prompt, add vga=ask to the boot options. You'll be presented with a menu to select the video mode. The main problem with this method is that the font tends to look crowded on the screen and, except for the greater number of rows and columns, is not more readable.

SVGATextMode

From the SVGATextMode package description:

SVGATextMode is a utility for reprogramming (S)VGA hardware, to improve the appearance of text consoles. SVGATextMode uses a configuration file (the default is /etc/TextConfig) with a syntax similar to X Window System's configuration file (Xconfig or XF86Config) to set up textmodes with higher resolution, larger font sizes, higher display refresh rates, etc. Theoretically, SVGATextMode can be used to program any text mode size, but your results will depend upon your VGA card.

An advantage of SVGATextMode is that it's probably the fastest option. Text scroll speed is very good and characters are readable even with smaller fonts.

Setup

First, install the package. This, of course, varies with the distribution and version of Linux that you run. In most cases, it's simply:

      rpm -ivh SVGATextMode-VERSION.rpm
    

The next step is to gather information about your hardware. As the root user, type:

lspci

You'll get output similar to the following:

      00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 02)
      00:01.0 PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 02)
      00:07.0 ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 02)
      00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01)
      00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01)
      00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02)
      00:10.0 Ethernet controller: 3Com Corporation 3c905B 100BaseTX [Cyclone] (rev 64)
      00:14.0 VGA compatible controller: Matrox Graphics, Inc. MGA 2064W [Millennium] (rev 01)
    

The information you'll need is the VGA device. In this case a Matrox Millennium MGA 2064W card.

Next, determine the Horizontal Sync and Vertical Refresh capabilities of your monitor. If you already have X configured, you can easily look through your XF86Config or XMetroConfig (if using Metro-X) files for the HorizSync and VertRefresh lines. For example:

      [kwan@omicron]  egrep -i 'horizsync|vertrefresh' /etc/X11/XF86Config
      HorizSync    30-0 - 97.0
      VertRefresh  48.0 - 129.0
    

You can also do a search on the Net Monitor Database, located at:

http://www.griffintechnology.com/archive/monitor.html

For example, a search on Magnavox returns several matches. Drilling down, I choose the 20CM64 and find that it supports:

      H Frequency   30-64 KhZ
      V Frequency   50-120 Hz
    

Configure the /etc/TextConfig file

Open the /etc/TextConfig file in your favorite editor. The default TextConfig will contain a standard, "works on anything" configuration to edit. Look for the following lines and comment them out by placing a # at the beginning of the line:

      # Chipset "VGA"
      # Clocks  25.175 28.322
    

Also, comment out the warning message:

      # echo "The SVGATextMode config file is configured as `standard VGA' by default."
      # echo "This is highly sub-optimal on modern VGA cards."
      # echo "Edit the TextConfig file for your VGA card to enable the many extra features."
      # echo "(and then you can also get rid of this message...)."
      # echo ""
    

The next step is to scroll down through the TextConfig file and select your chipset. Unfortunately, it may not always be obvious. Try to choose a chipset based on the output from the previous lspci command. Among the supported chipsets are:

"VGA" "S3" "ET4000" "TVGA8900" "TVGA8900" "WDC90C3x" "WDC90C0x" "ATI" "ATIMACH32" "ATIMACH64" "Cirrus" "Video7" "ALI" "AL2101" "OTI67" "OTI77" "OTI87" "SiS" "RealTek" "ARK" "ics5342" "NCR77C22E" "NCR77C32" "GVGA" "MX" "et6000" "tgui" "matrox" "NeoMagic"

For our example, we uncomment the Matrox-relevant stuff:

      Chipset "matrox"
      clockchip "ti3026"     # for the Millennium
      #clockchip "mystique"   # for the Mystique
    

Continue to scroll down. You'll find various Option lines that you can uncomment to activate. Read the descriptions for more information. Eventually you'll see the HorizSync and VertRefresh lines.

      #HorizSync 30-32
      #VertRefresh 50-80
    

Change these to the values you determined previously from the X configuration file or from the monitor database. It's critical that you do not just make up numbers here. Pushing monitors beyond spec, especially the older ones, will release the magic smoke and send the monitor to the service of that great video card in the sky. I change mine to :

      HorizSync 30-64
      VertRefresh 50-120
    

Next, you'll see a line for DefaultMode. This one is important, as it specifies the resolution SVGATextMode will try when called without any parameters. It's best to leave it as is. Further down are the rest of the modelines. Take a look at some of the valid modes that you can choose. Which ones are available depend upon your monitor capabilities and video card. Once you're done, save the file and exit.

Testing the configuration

Now it's time to test. We can get a list of all available modelines with:

      [kwan@omicron] grep '^"[0-9]' /etc/TextConfig
    

You'll get a long list. E.g.

      "116x32x8"         36   928  944 1088 1144    480  490  492  525 font  8x15
      "116x32x9"         40   928  944 1080 1128    480  490  492  525 font  9x15
      "116x33x8"         36   928  944 1088 1144    396  412  414  449 font  8x12
      "116x33x9"         40   928  944 1080 1128    396  412  414  449 font  9x12
      "116x34x8"         36   928  944 1088 1144    480  490  492  525 font  8x14
      "116x34x9"         40   928  944 1080 1128    480  490  492  525 font  9x14
      "116x40x8"         36   928  944 1088 1144    480  490  492  525 font  8x12
      "116x40x9"         40   928  944 1080 1128    480  490  492  525 font  9x12
      "116x43x8"         36   928  944 1088 1144    480  490  492  525 font  8x11
      "116x43x9"         40   928  944 1080 1128    480  490  492  525 font  9x11
      "116x50x8"         36   928  944 1088 1144    400  412  414  449 font   8x8
      "116x50x9"         40   928  944 1080 1128    400  412  414  449 font   9x8
      "116x60x8"         36   928  944 1088 1144    480  490  492  525 font   8x8
      "116x60x9"         40   928  944 1080 1128    480  490  492  525 font   9x8
      "100x37"           50   800  872  976 1040    600  632  638  670 font  8x16
      "100x37x9"         56   800  872  976 1040    600  632  638  670 font  9x16
      "100x40"           50   800  848  952 1040    640  672  678  700 font  8x16
    

Try one of the modelines with:

      [kwa@omicron] SVGATextMode 116x32x8
    

The screen should flicker for a second and you should have a high-res display. Or, if you chose a modeline that's beyond the spec of your monitor, you'll get a warning:

      Chipset = `VGA', Textmode clock = 110.00 MHz, 160x60 chars, CharCell = 8x16.
      Refresh = 64.86kHz/63.4Hz.
      SVGATextMode: ERROR: Pixel Clock (110.00 MHz) too high for this chipset
      max pixel clock = 45.00/50.62 MHz for 8/9 pixel wide font resp.
    

If, instead, your monitor suddenly goes berserk, type SVGATextMode by itself on the prompt. You may have to do this blindly if the display is unreadable. E.g.

      [kwan@omicron] SVGATextMode
    

Try other modelines too. Once you're satisfied that the mode works correctly, place it somewhere in your initialization scripts. For example:

 
      #!/bin/sh
      #
      #
      
      # See how we were called.
      case "$1" in
        start)
              # Start daemons.
              echo -n "Starting SVGATextMode: "
              /usr/sbin/SVGATextMode 116x34x9
              ;;
        stop)
              # Stop daemons.
              echo -n "Dropping into default 80x25 Mode: "
      	      /usr/sbin/SVGATextMode 80x25
              ;;
        restart|reload)
      	      $0 stop
      	      $0 start
      	      ;;
        *)
              echo "Usage: SVGATextMode {start|stop|restart|reload}"
              exit 1
      esac
      exit 0
    

Try to enable SVGATextMode as early in the boot cycle as you can. I've noticed problems with some cards when SVGATextMode is enabled after loading X.

Framebuffer Console

If SVGATextMode does not work correctly, try using the framebuffer console instead. NeoMagic chipsets, for example, are not well supported under SVGATextMode and can lock up your system. Most distributions now build frame buffer support by default and you can enable it by simply inserting a vga line to your /etc/lilo.conf file. If this is the case, skip to the end of this section where we configure lilo.

There are a couple ways to take advantage of framebuffer support for the console. If you have the fbset package installed you can set the framebuffer mode by using the fbset utility. The other method is to specify a vga line within your lilo configuration file and reboot the system. The best place to learn more about the Framebuffer console is at http://linuxdoc.org/HOWTO/Framebuffer-HOWTO-1.html.

(There I was doing research for this guide when I came across the above link. Go there, read, come back if you'd like :) ).

Starting fbset

To use fbset first verify that the package is installed. If you are using an RPM based distribution such as RedHat or Mandrake, you can do:

      [kwan@omega] rpm -q fbset 
      fbset-2.1-10mdk
    

Next, you'll need to load the appropriate framebuffer module if support is not compiled into the kernel. For the next example we'll use an ATI example. Begin by changing to the /lib/modules/KERNEL_VERSION/kernel/drivers/video directory.

  [kwan@omega] cd /lib/modules/2.4.8-31KLL/kernel/drivers/video
  [kwan@omega] ls
  aty/              fbcon-mfb.o.gz         mdacon.o.gz    tdfxfb.o.gz
  aty128fb.o.gz     fbcon-vga-planes.o.gz  pm2fb.o.gz     vga16fb.o.gz
  clgenfb.o.gz      fbgen.o.gz             radeonfb.o.gz
  cyber2000fb.o.gz  hgafb.o.gz             riva/
  fbcon-hga.o.gz    matrox/                sis/

  

Since I'm running an ATI card I load the aty128fb module with:

  [root@omega] modprobe aty128fb
  

Once the module is loaded you can then attempt to set the mode. The fbset package will install a list of modelines in /etc/fb.modes. If you peek at them you'll see that they are similar to the list of X11 modes. To list the valid modes do:

    [kwan@omega] grep ^mode /etc/fb.modes
  

You'll get a listing similar to this:

      mode "800x600-100"
      mode "1024x768-43-lace"
      mode "1024x768-60"
      mode "1024x768-70"
      mode "1024x768-72"
      mode "1024x768-75"
      mode "1024x768-90"
      mode "1024x768-100"
      mode "1152x864-43-lace"
      mode "1152x864-47-lace"
      mode "1152x864-60"
      mode "1152x864-70"
      mode "1152x864-75"
      mode "1152x864-80"
      mode "1280x1024-43-lace"
      mode "1280x1024-47-lace"
      mode "1280x1024-60"
      mode "1600x1200-76"
    

To install the mode, make sure that you are on a console screen and type:

      [root@omega] fbset 1024x768-75
    

Of course, substitute the mode that you want. With some cards there may be initial screen corruption. This can usually be fixed by switching to another console screen then switching back.

Configuring Lilo

The other method of enabling the framebuffer console is to specify the mode within your lilo configuration. As mentioned before, many of the distributions now build framebuffer support by default. If your initial bootup screen has a pretty penguin bitmapped logo (not the ASCII block pengiun) then you already have kernel support for framebuffer and can skip the kernel reconfiguration. Mandrake 8.x puts up a blue bootscreen that's also framebuffer based. In any case, try configuring the lilo first and if you get errors, then try the rebuild.

First, we must build framebuffer support into the kernel. For this document, we'll assume that you understand the basics of rebuilding the kernel. If not, please consult the Kernel Rebuild Guide elsewhere on this site.

Change to the /usr/src/linux directory and begin the configuration process with:

      make menuconfig
    

You'll get the kernel configuration menu. For the 2.4.x series of kernels, select the Console Drivers option. Enable both "VGA Text Console" and "Video Mode Selection Support" Then, press [ENTER] on "Frame Buffer Support".

On the next screen, enable the following options:

      Support for Frame Buffer Support (Experimental) 
       [*]   Advanced low level driver options    
        (*)     8 bpp packed pixels support    
        (*)     16 bpp packed pixels support  
        (*)     24 bpp packed pixels support  
        (*)     32 bpp packed pixels support    
       [*]   Select compiled-in fonts 
       [*]     VGA 8x8 font      
       [*]     VGA 8x16 font  
       [*]     Sparc console 8x16 font             
    

Once the kernel is compiled and the modules built, edit the lilo.conf entries and add the vga= line. The following table is from the linux kernel documentation for the vesafb.

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

Or, in a friendlier decimal format:

  640x480 800x600 1024x768 1280x1024
256 769 771 773 775
32K 784 787 790 793
64K 785 788 791 794
16M 786 789 792 795

To use the table, choose the resolution and color depth that works for your card. Experiment with the settings to find one that works well with your display. I.e., a laptop display often works best at 1024x768. My main monitor is set at 1280x1024. To get a 1024x768 resolution screen with 64K colors I choose 791. The relevant portion of my lilo.conf now looks like:

    image=/boot/vmlinuz
	label=linux
	root=/dev/hda3
	initrd=/boot/initrd.img
	append=" quiet"
	vga=791
	read-only
    

Notice that the vga=791 is added under the image section. It's a good idea to make two image sections -- one with the vga line set to normal, the other with the mode of your choice. This allows you to easily drop back in case there are problems. Note also that the default image is set to linux_fb.

     boot=/dev/hda
     map=/boot/map
     install=/boot/boot.b
     vga=normal
     default=linux_fb
     keytable=/boot/us.klt
     lba32
     prompt
     timeout=50
     message=/boot/message
     image=/boot/vmlinuz
     	label=linux
     	root=/dev/hda3
     	vga=normal
     	read-only
     image=/boot/vmlinuz
     	label=linux_fb
     	root=/dev/hda3
     	append=" quiet"
     	vga=791
     	read-only
    

Once you've edited the lilo.conf file, go ahead and re-run lilo to install your changes. You will need to reboot your system for the changes to take effect. If there are problems then reboot the system and choose the non-framebuffer image.

Matrox VideoCards

If you're lucky enough to have a Matrox videocard (Millenium, Mystique, G100/200) then there are a few other optimization options available. This step does require a kernel rebuild, however, since none of the stock kernels I've encountered build these options in correctly.

The relevant section of the kernel config is in Console Drivers | Frame Buffer Support. The following options are required:

       [*] VGA text console
       [*] Video mode selection support
       < > MDA text console (dual-headed) [EXPERIMENTAL]
      
       Frame-buffer support -->
       [*] Support for frame-buffer devices (EXPERIMENTAL)
       <M> VGA 16-color graphics console
       <*> Matrox acceleration (EXPERIMENTAL)
       [*]    Millenium I/II support
       [*]    Mystique support
       [*]    G100/G200/G400/G450 support
    

Make sure that VESA VGA graphics console is not selected. Once you make these changes, the lilo.conf stanza will look like this:

      image=/boot/vmlinuz-mgafb
        label=linux-247kll
        root=/dev/hda2
        read-only
   	append="video=matrox:vesa:286"
        optional
    

The following table is from the Matrox frame buffer documentation included with the kernel sources.

    [Graphic modes]

       bpp | 640x400  640x480  768x576  800x600  960x720 1024x768 1152x864 1280x1024 1408x1056 1600x1200
       ----+--------------------------------------------------------------------------------------------
         4 |            0x12             0x102            0x104             0x106
         8 |  0x100    0x101    0x180    0x103    0x188   0x105    0x190    0x107     0x198     0x11C
        15 |           0x110    0x181    0x113    0x189   0x117    0x192    0x11A     0x19A     0x11E  
        16 |           0x111    0x182    0x114    0x18A   0x1B8    0x194    0x1BB     0x19C     0x1BF  
        24 |           0x1B2    0x184    0x1B5    0x18C   0x1B8    0x194    0x1BB     0x19C     0x1BF
        32 |           0x112    0x183    0x115    0x18B   0x118    0x193    0x11B     0x19B 
    

Convert the values in the above table from hex to decimal and place it in your lilo configuration.

ATI Videocards

The ATI entry in the lilo.conf file has a slightly different syntax. Instead of using the table, you specify the mode directly on the "append=" line. For example:

    boot=/dev/hda
    map=/boot/map
    install=/boot/boot.b
    vga=normal
    default=linux-2.4.8
    keytable=/boot/us.klt
    lba32
    prompt
    timeout=50
    message=/boot/message
    	
    image=/boot/bzImage-2.4.17
    	label=preemptible
    	root=/dev/hda3
    	read-only
    	optional
			append="video=aty128fb:1024x768"
  
 
© 2002, 2003     Kwan Lowe     DigitalHermit