HOWTO: Using Custom Framebuffer Resolution with GRUB2

From Sabayon Wiki
Jump to: navigation, search
i18n: en it



This article is intended for Grub2 users who experience problems with default framebuffer settings and/or simply want to use custom resolution for the Sabayon bootsplash/console and Grub2 menu.

note A) Grub2 uses a set of scripts in order to build your configuration located in /etc/grub.d/ folder. Your configuration settings will be passed through the file /etc/default/grub. The kernel parameters you are booted are also present in the file /proc/cmdline. So, it's preferable avoid directly modifying the file /boot/grub/grub.cfg unless you are sure what you are doing.
Refer to Grub2 documentation for further information GrubWiki.
note B) Although this method, in most cases, seems to work very well, it is important that you know that the bootsplash image resizing operations should be made "technically correct" by performing an additional step (not discussed here) in order to rebuild initramfs bootsplash with your custom resolution.
note C) VESA framebuffer support is very dependent on your hardware configuration; although it should be an international standards the implementations may vary from different manufacturers.
Suggested readings: VESA BIOS Extensions

This HOWTO tries to implement a safe approach to the modification and customization of some important files for your operating system, so that you can restore the previous conditions easily. Ok, we can start now.

Discover VESA framebuffer modes supported by your hardware

We will use Grub2 to discover the VESA modes supported by our VGA-Monitor configuration.
Reboot the system and when Grub2 is loaded switch to command line by pressing "c" key.
At the grub prompt enter the command:

> vbeinfo

We can see a list of supported modes retrieved from our VGA bios extension; it's only a subset of all modes that should to match the capabilities of our monitor.
Identify the mode we want to use for bootsplash inside this list, a good idea with LCD panel should be to choose our native (maximum) resolution. A resolution/mode that is not in this list is unlikely to have any chance of working.
Suppose, as an example, that our choice has fallen on the resolution of "1680x1050x32".

Prepare your new configuration

We will making, for now, only temporary changes to our configuration, a simple reboot will restore our starting configuration.
Press "ESC" key to go back to Grub2 menu, move over your "normal" Sabayon kernel entry and press "e" key in order to temporary modify the boot options.
Add, on top, a new line by pressing "Enter" containing:

set gfxpayload=1680x1050

Please note that if the color depth isn't set, seems that the highest VESA mode available will be used (if doesn't, try with 1680x1050x32 or the desired bpp).
After that, we must search inside kernel parameters, which are present after the word "linux", and delete the default entry "vga=791" or any other entry that begins with "video=xxx" (remember that any kernel parameters are seperated with space symbol as a delimiter).
This is a key point of the proceedings because "vga" or "video" kernel parameter will conflict with "gfxpayload" statement above.

Test your new configuration

Let's start our custom booting sequence by simultaneusly press "Ctrl+x".
If the bootsplash and the progress bar seems correctly visualized, we wait for the fully loaded system. We need to check also that the various consoles appears normal by performing at least one "Ctrl+Alt+F1-F7" switching cycle.
If something is not working as we expect, we can try to change resolution by repeating from first step of procedure.
While, if we are satisfied, continue to the next section in order to save our new configuration.

Update Grub2 configuration

Open a terminal and with the superuser privileges editing the file /etc/default/grub with our preferred text editor (for example):

$ sudo gedit /etc/default/grub

Find the line containing: GRUB_GFXMODE=1024x768, replace with our desired resolution for the Grub2 menu:


Now add a line below containing our as soon as tested resolution for the bootsplash and ttys console:


We can also use two different resolutions, among those as supported.
Save the file and rebuild Grub2 configuration:

$ su
# grub-mkconfig -o /boot/grub/grub.cfg

Now we need to check that the /boot/grub/grub.cfg file was created without the kernel parameter "vga=791" or any other entry that begins with "video=xxx".
If they were to be present we need to edit /boot/grub/grub.cfg file in order to remove them (consider that this practice is not recommended but a fast way to remove entries) remember to make a back-up of this file before proceeding.

Enjoy Sabayon bootsplash in your custom resolution.

--alonsoty 17:43, 1 January 2011 (UTC)