Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 22nd January 2012, 06:20 AM
yaconsult Offline
Registered User
 
Join Date: Nov 2004
Posts: 46
windows_7firefox
f16 - Switching graphics driver based on which grub entry is booted

I'm trying to figure out a good way to automatically use the nouveau driver when I boot the xen kernel but use the proprietary nvidia driver when I boot the non-xen kernel.

Have others done this? I was thinking I could use rdblacklist=nouveau in grub.cfg when booting xen and then have a startup script that checks if the nouveau driver is loaded. This script could symlink xorg.conf to the nvdia config file when the nouveau module is not loaded and remove the symlink if it exists when the nouveau module is loaded. Would this approach work? Is there a better way to do it?
Reply With Quote
  #2  
Old 22nd January 2012, 02:00 PM
jazzer Offline
Registered User
 
Join Date: May 2004
Location: Ontario, Canada
Posts: 62
linuxfirefox
Re: f16 - Switching graphics driver based on which grub entry is booted

Yes it should be possible. I used to have Ubuntu on my external drive and boot it up on two different machines. One of those machines had an ATI card and the other an NVIDIA so I can add a little into this.

In addition to the correct xorg.conf, you will also need to have one of the GL libraries installed in a different location than normal and then have the script set the environment label for the GL libraries (LIBGL_DRIVERS_PATH). Hope this gives you a tip in the right direction, I no longer have the script or I'd give you more.

It may be easier just to use the nouveau driver.
Reply With Quote
  #3  
Old 11th March 2012, 09:53 PM
yaconsult Offline
Registered User
 
Join Date: Nov 2004
Posts: 46
linuxrekonq
How to switch back and forth between nouveau and nvidia drivers - the solution

I finally had some time to get back to this and figure out how to do it.

The key to using either nouveau or nvidia drivers are whether two files exist and have the right content. These files are created when the nvidia rpms are installed from rpmforge. The files are:
/etc/X11/xorg.conf
/etc/X11/xorg.conf.d/00-nvidia.conf
If these two files do not exist, then the nouveau driver can be used. If they do exist, then they override the probing done by X when it starts. Rather then moving these in and out of place, I chose to rename them and then add or remove symbolic links to them depending on whether I want to run the nouveau or nvidia drivers. This approach will allso continue to work after the packages are updated by yum and the files replaced.

Of course, you also have to handle having the driver load if it's blacklisted, as happens when installing the nvdia driver from rpm forge. I wrote two scripts to make switching back and forth easier and to preserve the original files. Here they are to use or modify as you see fit. The noveau driver usually gets locked in memory once loaded, so expect to have to reboot after running one script or the other. Of course, the nouveau and nvidia driver RPMs must both be installed before using it.

[root@localhost ~]# cat nouv.sh
#!/bin/bash
# To use the nouveau driver, the files xorg.conf and 00-nvidia.conf
# should not exist. We rename the original files, if not already done,
# The renaming will only be done once.
if [ -f /etc/X11/xorg.conf.d/00-nvidia.conf ]
then
# If the nvidia .conf file is a file and not a link, rename and link it.
# Files in /etc/X11/xorg.conf.d are only read if they have the extension .conf
mv /etc/X11/xorg.conf.d/00-nvidia.conf /etc/X11/xorg.conf.d/00-nvidia.conf.nvidia
fi
if [ -f /etc/X11/xorg.conf ]
then
# If the xorg .conf file is a file and not a link, rename and link it.
# This file tells X11 to use the nvidia driver.
mv /etc/X11/xorg.conf /etc/X11/xorg.conf.nvidia
fi
# Remove the symbolic links, if they exist.
if [ -h /etc/X11/xorg.conf.d/00-nvidia.conf ]; then rm /etc/X11/xorg.conf.d/00-nvidia.conf; fi
if [ -h /etc/X11/xorg.conf ]; then rm /etc/X11/xorg.conf; fi
# Remove nvidia kernel module
modprobe -r nvidia
# Add nouveau kernel module
modprobe -a nouveau


[root@localhost ~]# cat nvid.sh
#!/bin/bash
# To use the nvidia driver, the files xorg.conf and 00-nvidia.conf have
# to exist and be in the right place. We rename the original files and
# create symbolic links to them. The renaming will only be done once.
#
# If the nvidia .conf file is a file and not a link, rename and link it.
# Files in /etc/X11/xorg.conf.d are only read if they have the extension .conf
if [ -f /etc/X11/xorg.conf.d/00-nvidia.conf ]
then
mv /etc/X11/xorg.conf.d/00-nvidia.conf /etc/X11/xorg.conf.d/00-nvidia.conf.nvidia
fi
#
# If the xorg .conf file is a file and not a link, rename and link it.
# This file tells X11 to use the nvidia driver.
if [ -f /etc/X11/xorg.conf ]
then
mv /etc/X11/xorg.conf /etc/X11/xorg.conf.nvidia
fi
# Create link so that nvidia .conf file is found.
ln -s /etc/X11/xorg.conf.d/00-nvidia.conf.nvidia /etc/X11/xorg.conf.d/00-nvidia.conf
# Create link so that xorg .conf file is found.
ln -s /etc/X11/xorg.conf.nvidia /etc/X11/xorg.conf
# Make sure the nvidia driver is loaded
modprobe -a nvidia
# My experience is that if the nouveau driver has been loaded, it can not
# be removed.
# Remove the nouveau driver
modprobe -r nouveau
Reply With Quote
Reply

Tags
based, booted, driver, entry, f16, graphics, grub, switching

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What I did was this;<booted into a GRUB>;root (hd0,0);reboot;<now wont boot old sys!> 33333 Installation and Live Media 7 14th July 2011 12:53 PM
Switching from a Debian to an RPM based system Xen Relay Fedora Focus 3 16th December 2009 05:34 AM
Revert to VGA driver when booted with rescue CD? rgparker77 Using Fedora 4 31st December 2006 06:03 PM
Help with FC6 Install (booted to grub) sm00nie EOL (End Of Life) Versions 1 24th October 2006 11:22 PM
nvidia drivers - switching from the manually downloaded ones to the yum-based ones le_random Using Fedora 1 7th April 2005 09:44 PM


Current GMT-time: 07:56 (Saturday, 25-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat