Framebuffer in Gentoo with uvesafb and nvidia-drivers without initrd
Warning
This is a historical article from 2015 about old Gentoo settings, uvesafb, GRUB2 and the proprietary NVIDIA drivers.
The material is no longer relevant for modern systems and has only historical value.
As you may know, when using the proprietary nvidia-drivers driver, it is impossible to use a framebuffer through nouveau
or the in-kernel framebuffer for NVIDIA, because they conflict with the driver used by the X server. The only way to get a working
console framebuffer without crutches like unloading nouveau before starting the X server is to use
uvesafb. However, the vast majority of guides describe configuring uvesafb in combination with initrd, which
is useless if the kernel is built without its support. Naturally, you need to follow all the
instructions that are required
for the NVIDIA drivers to work without conflicts:
- Enable module support
[*] Enable loadable module support --->- Enable MTRR
Processor type and features --->
[*] MTRR (Memory Type Range Register) support- Disable the built-in kernel framebuffer drivers for NVIDIA video cards
Device Drivers --->
Graphics support --->
Frame buffer Devices --->
<*> Support for frame buffer devices --->
< > nVidia Framebuffer Support
< > nVidia Riva support- Build DRM as a module or turn it off in the kernel entirely (NVIDIA uses its own DRM)
Device drivers --->
Graphics support --->
< > Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)On my system, with DRM built into the kernel, dmesg showed errors and a conflict with the nvidia driver, but, strangely enough,
everything ended up working. When I removed the module, the errors disappeared along with it.
This is where the path diverges from the usual guide, since we do not use initrd at boot. The kernel needs uvesafb support enabled as a module:
Device Drivers --->
<*> Connector - unified userspace <-> kernelspace linker --->
Graphics support --->
[*] Support for frame buffer devices --->
[*] Enable firmware EDID
<M> Userspace VESA VGA graphics support
[*] Simple framebuffer supportAnd build the packages required by uvesafb:
emerge -aq v86dNow we configure the uvesafb module to load with parameters:
# ...
modules="uvesafb"
# ...
module_uvesafb_args="mode_option=1920x1080-24 mtrr=2 scroll=ywrap"An alternative to module_uvesafb_args is creating a config in /etc/modprobe.d/ with the same parameters:
options uvesafb mode_option=1920x1080-24 mtrr=2 scroll=ywrapHere it is important to set the parameters matching your current system configuration:
mode_option - resolution and color depth (you can also specify the refresh rate as
1920x1080-24@60, but it is better to keep the automatic value)mtrr - the available MTRR mode. You can find out which modes are available in the
/proc/mtrrfile. The mapping table looks like this:
0 - Disabled (equivalent to nomtrr) (default)
1 - Uncacheable
2 - Write-back
3 - Write-combining
4 - Write-through- scroll - the scrolling mode. The typical value is ywrap. See the documentation for details.
You can now build the kernel and install it. If you have a separate partition for /boot, you need to mount it first:
mount /boot. Also, if some modules were removed and the kernel version did not change, it may be a good idea to also delete the currently installed modules from /lib64/modules/. This can be done, for example, like this:
rm -rf /lib64/modules/`uname -r`In /usr/src/linux run:
make -j4 && make modules_install && make installNow let’s tweak the GRUB2 config (for the first version of GRUB the settings will be different):
# ...
GRUB_GFXMODE=1920x1080
# ...
GRUB_GFXPAYLOAD_LINUX=keepBy the way, with the first parameter we have also set a high resolution in GRUB2. All that remains is to generate a new config for GRUB2:
grub2-mkconfig -o /boot/grub/grub.cfgDon’t forget that it is also a good idea to rebuild the drivers - especially if the kernel version has changed:
emerge -aq nvidia-driversUnmount /boot and reboot to check.

Good luck! Useful information: