Linux ATI radeon KMS


Please note that this blog has been moved.

Now it has its own domain: mynixworld.info 🙂

If you want to read the latest version of this article (recommended) please click here and I open the page for you.

These days I had to install a Gentoo on a Compaq 6820s laptop that comes with a ATI Mobility Radeon X1350 (chipset RV515).

Although I followed all the guidelines from the following resources:

I encountered an unexpected error while loading the radeon module that was related to the Kernel Mode Setting (when KMS was disabled no error but no KMS too).

My steps:

First I configured the Linux kernel to embed the radeon driver within the kernel:

Linux kernel configuration - Graphics support

Linux kernel configuration – Graphics support

and thus the system freeze at boot time, exactly when the kernel tried to initialize the ATI GPU.

Later I changed the kernel configuration so that the “ATI Radeon” to be built as a kernel module. I have also blacklisted the radeon module to make sure it won’t get loaded, so I would load the module manually after the kernel boots successfully. So I booted the kernel with the KMS set “off” by default:

grub> kernel /KERNEL root=ROOT radeon.modeset=0

then, after everything loaded successfully I was trying to load the radeon module with the modeset option set “on”:

modprobe radeon modeset=1

when the system completely froze (no CPU activity or I/O responsiveness whatsoever).

Later, I un-blacklisted the radeon module in order to get it loaded automatically after the kernel is successfully loaded and everything loaded just fine, except the fact that I had no KMS whatsoever (of course, I booted the system with  radeon.modeset=0).

What I’ve done later was really tricky and it fixed my problem. I’ve unloaded the radeon module from memory and loaded back with modeset=1:

modprobe -r radeon
modprobe radeon modeset=1

If you do this while you’re on X then I’m pretty sure your screen will turn into black. What I did to avoid that was to logoff from X session, kill the SLIM login manager then to stop the XDM service. After that I unloaded/loaded back the radeon module (as shown above) and then started XDM (which in turn started automatically the login manager) so that I got an wonderful X session with a full support of framebuffer that improved both the screen resolution and the user experience.

Now the thing is: “how to automate this” so that I won’t do that every time I boot the system?

You could try to create a simple BASH script that, in principle, would do the trick shown above then would do what your /etc/inittab would normally is doing in the last step (like loading the login/window manager).

In my case I just hack the /etc/X11/startDM.sh script that would normally load the X session (whatever it is: xfce4, gnome, lxde, …,etc). So just before that script (startDM.sh) executes the default desktop environment I’ve inserted that “modprobe” thing.

Now, every time I boot the system, just when the xdm service is started, the system switchs automatically to a framebuffer-enabled graphic, resulting in a higher resolution graphic and a better user experience.

About Eugen Mihailescu

Always looking to learn more about *nix world, about the fundamental concepts of arithmetic, algebra and geometry. I am also passionate about programming, database and systems administration.
This entry was posted in kernel, linux, Uncategorized, X11 and tagged , . Bookmark the permalink.

6 Responses to Linux ATI radeon KMS

  1. jay says:

    how do i do this on crunchbang (i am new to linux)? what loads x-session on crunhbang?

    • crunchbang is a Debian based distro. You could find pertinent answers on Debian forum groups.

      Anyway, to load x-session on Linux one may run the following command: startx

  2. jay says:

    thanks for the reply, I am looking for the “startDM.sh” alternative in Cruchbang/Debian to make the same changes as you have done in startDM.sh. Could you please point me in the right direction. thanks.

    • Just check your /etc/inittab to see which is the script that is run automatically by the INIT process that in turn launches your default display manager (i.e. XDM, SLIM, GDM, KDM, LXDM or whatever comes with your distro). In my case, the last line of /etc/inittab is something like this:
      x:a:once:/etc/X11/startDM.sh
      so I decided to inject those “modprobe” commands into startDM.sh.
      You might follow a similar approach, just determine your display manager starting script then inject those “modprobe” commands at the beginning or alike. If your distro does not work like this then try to create a simple daemon script(http://wiki.debian.org/Daemon) that automatically starts at boot-time and which runs those modprobe commands.

  3. jay says:

    many thanks for your comments. I really appreciate. But being a linux noob, I may need more time to fix this. It looks like my linux distro (Crunchbang) does not have a script at /etc/inittab directing me to process which starts GDM (my default display manager). I will keep looking and I am sure I will find it. As for a daemon script, I would need a similar example without which I am likely to mess up. But I am positive that I need to borrow from your clever idea. Cheers and thanks again from the help.

Leave a comment