Difference between revisions of "Create a boot option for easy nvidia or nouveau display driver switching"

(initial)
 
(8 intermediate revisions by one other user not shown)
Line 1: Line 1:
This howto describes how to use nvidia and nouveau drivers on the same computer and kernel.  
+
This howto describes how to use nvidia and nouveau drivers on the same computer and kernel.
 +
<br>
 +
{{Fancynote|You must know how to install {{Package|x11-drivers/nvidia-drivers}} and {{package|x11-drivers/nouveau}} (references at the end of the page). First, you need to configure your kernel and install nvidia drivers and nouveau. We assume that this stage is successfully passed.}}
  
=Create a boot option for easy nvidia or nouveau display driver switching=
+
== boot-update ==
 +
Next, the most important change. Edit <tt>/etc/boot.conf</tt>:
  
You must know how to install nvidia drivers and nouveau(references at the end of the page). First you need to configure your kernel and install nvidia drivers and nouveau. We assume that this stage is successfully passed.
+
<pre>
 
+
=boot-update=
+
 
+
Next the actual most important change:
+
 
+
<pre># cat /etc/boot.conf
+
 
boot {
 
boot {
 
generate grub
 
generate grub
Line 43: Line 40:
 
</pre>
 
</pre>
  
After boot-update with the new settings, you should have something like
+
After boot-update with the new settings, you should have something like:
 
+
<console>
<pre>#grep menuentry /boot/grub/grub.cfg | wc -l
+
###i## grep menuentry /boot/grub/grub.cfg | wc -l
 
2
 
2
#grep menuentry /boot/grub/grub.cfg
+
###i## grep menuentry /boot/grub/grub.cfg
 
menuentry "Funtoo Linux [nouveau] - vmlinuz-2.6.32.71_p14-rh" {
 
menuentry "Funtoo Linux [nouveau] - vmlinuz-2.6.32.71_p14-rh" {
menuentry "Funtoo Linux [nvidia] - vmlinuz-2.6.32.71_p14-rh" {</pre>
+
menuentry "Funtoo Linux [nvidia] - vmlinuz-2.6.32.71_p14-rh" {
 +
</console>
  
=xcfgmaker deamon=
+
== xcfgmaker deamon ==
  
<pre>mkdir /etc/X11/video/;  
+
<console>
cd /etc/X11/video/;
+
###i## mkdir /etc/X11/video/;
nano 10-monitor.conf.nouveau # make default config for nouveau. or copy existing config…  
+
###i## cd /etc/X11/video/;
nano 10-monitor.conf.nvidia # also for nvidia</pre>
+
###i## nano 10-monitor.conf.nouveau # make default config for nouveau. or copy existing config…  
 +
###i## nano 10-monitor.conf.nvidia # also for nvidia
 +
</console>
  
Then create a new daemon
+
Then create a new daemon. Edit the file <tt>/etc/init.d/xcfgmaker</tt>:
  
<pre># cat /etc/init.d/xcfgmaker
+
<pre>
 
#!/sbin/runscript
 
#!/sbin/runscript
  
Line 106: Line 106:
 
</pre>
 
</pre>
  
And do not forget
+
Do not forget:
 
+
<console>
<pre>chmod +x /etc/init.d/xcfgmaker
+
###i## chmod +x /etc/init.d/xcfgmaker
rc-update add xcfgmaker boot</pre>
+
###i## rc-update add xcfgmaker boot
 
+
</console>
That's all kids ;)
+
  
=Additional links=
+
== Additional Resources ==
  
 
*[http://en.gentoo-wiki.com/wiki/Nvidia Nvidia how-to on gentoo-wiki]
 
*[http://en.gentoo-wiki.com/wiki/Nvidia Nvidia how-to on gentoo-wiki]
Line 120: Line 119:
  
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
 +
[[Category:First Steps]]

Revision as of 19:31, 4 March 2014

This howto describes how to use nvidia and nouveau drivers on the same computer and kernel.

Note

You must know how to install NVIDIA Linux Display Drivers and x11-drivers/nouveau (package not on wiki - please add) (references at the end of the page). First, you need to configure your kernel and install nvidia drivers and nouveau. We assume that this stage is successfully passed.

boot-update

Next, the most important change. Edit /etc/boot.conf:

boot {
	generate grub
	default "Funtoo Linux [nvidia]" 
	# or
	# default "Funtoo Linux [nouveau]"
	timeout 3 
}

color {
	normal cyan/blue
	highlight blue/cyan
}

display {
	#gfxmode 1280x800
	#font unifont.pf2
}

"Funtoo Linux [nvidia]" {
	kernel vmlinuz[-v]
	params += ro console=tty1 quiet <other standard boot options>
	params += nouveau.blacklist=true vga=791 # nouveau.blacklist=true is important
	# or
	# params += nouveau.blacklist=true video=uvesafb:1440x900-8,mtrr:2
}

"Funtoo Linux [nouveau]" {
	kernel vmlinuz[-v]
	params += ro console=tty1 quiet <other standard boot options>
	params += nvidia.blacklist=true # nvidia.blacklist=true is important
} 

After boot-update with the new settings, you should have something like:

# grep menuentry /boot/grub/grub.cfg | wc -l
2
# grep menuentry /boot/grub/grub.cfg
menuentry "Funtoo Linux [nouveau] - vmlinuz-2.6.32.71_p14-rh" {
menuentry "Funtoo Linux [nvidia] - vmlinuz-2.6.32.71_p14-rh" {

xcfgmaker deamon

# mkdir /etc/X11/video/;
# cd /etc/X11/video/;
# nano 10-monitor.conf.nouveau # make default config for nouveau. or copy existing config… 
# nano 10-monitor.conf.nvidia # also for nvidia

Then create a new daemon. Edit the file /etc/init.d/xcfgmaker:

#!/sbin/runscript

# by http://wiki.sabayon.org/index.php?title=HOWTO:_Create_a_boot_option_for_easy_dual_to_single_display_switching
# To be placed in /etc/init.d/
# Run Command: rc-update add xcfgmaker boot

depend()
{
   need localmount
   before xdm-setup
   before xdm
   before alsasound
}

start()
{

   cmdline_display_mode_exist=$(cat /proc/cmdline | grep -e "nouveau.blacklist=" -e "nvidia.blacklist=")
   display_mode_nvidia_exist=$(ls /etc/X11/video/ | grep "10-monitor.conf.nvidia")
   display_mode_nouveau_exist=$(ls /etc/X11/video/ | grep "10-monitor.conf.nouveau")
   cmdline_display_mode=$(cat /proc/cmdline | awk -Fnvidia.blacklist= '{print $2}' | awk '{print $1}')
   if [ -n "$cmdline_display_mode_exist" ]; then
      if [ -n "$display_mode_nvidia_exist" ] && [ -n "$display_mode_nouveau_exist" ]; then
            #Choose the xorg file to be copied over
            if [ "$cmdline_display_mode" == "true" ]; then
               ebegin "Configuring X display with nouveau"
               cp /etc/X11/video/10-monitor.conf.nouveau /etc/X11/xorg.conf.d/10-monitor.conf
               eselect opengl set xorg-x11 >/dev/null 2>&1;
            else
               ebegin "Configuring X display with nvidia"
               cp /etc/X11/video/10-monitor.conf.nvidia /etc/X11/xorg.conf.d/10-monitor.conf
               eselect opengl set nvidia >/dev/null 2>&1;
            fi
         sleep 5
         eend 0
      else
         ebegin "Xorg file missing. Exitting"
         eend 0
      fi
   fi

}

Do not forget:

# chmod +x /etc/init.d/xcfgmaker
# rc-update add xcfgmaker boot

Additional Resources