Difference between pages "Create a boot option for easy nvidia or nouveau display driver switching" and "Template:Ebuild"

(Difference between pages)
 
 
Line 1: Line 1:
This howto describes how to use nvidia and nouveau drivers on the same computer and kernel. 
+
<noinclude>
<br>
+
This is the "Ebuild" template.
{{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.}}
+
It should be called in the following format:
 
+
<pre>
== boot-update ==
+
{{Ebuild
The most important change: edit <tt>/etc/boot.conf</tt>:
+
|Summary=
 
+
|CatPkg=
{{file|name=/etc/boot.conf|desc= |body=
+
|Maintainer=
boot {
+
|Homepage=
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
+
}
+
 
}}
 
}}
Next, run [[Boot-Update | <tt>boot-update</tt>]].
+
</pre>
 
+
Edit the page to see the template text.
After boot-update has been run, you should have something like:
+
</noinclude><includeonly>{{#widget:AddThis}}<div class="container"><div class="row">
<console>
+
<div class="col-md-3 col-md-push-9">
###i## grep menuentry /boot/grub/grub.cfg | wc -l
+
<b>[[CatPkg::{{{CatPkg|}}}]]</b>
2
+
<hr>{{#vardefine:cat|{{#explode:{{{CatPkg}}}|/|0}}}}{{#vardefine:pkg|{{#explode:{{{CatPkg}}}|/|1}}}}{{#get_web_data:url=http://ports.funtoo.org/packages.xml|format=xml|use xpath|data=repo_id=/packages/category[@name='{{#var:cat}}']/package[@name='{{#var:pkg}}']/@repository}}{{#vardefine:repoid|{{#if:{{#external_value:repo_id}}|{{#external_value:repo_id}}|gentoo}}}}{{#set:RepoID={{#var:repoid}}}}
###i## grep menuentry /boot/grub/grub.cfg
+
<table border="0" width="100%">
menuentry "Funtoo Linux [nouveau] - vmlinuz-2.6.32.71_p14-rh" {
+
{{#if: {{{Maintainer|}}} |<tr><td><i>Current Maintainer(s):</i></td><td>{{#arraymaptemplate:{{{Maintainer|}}}|MaintainerDisplay|,|<br>}}</td></tr> |}}<tr><td><i>Source Repository:</i></td><td>{{#ask:[[Category:Repositories]] [[Repository ID::{{#var:repoid}}]]}}</td></tr>   {{#if: {{{Homepage|}}} |<tr><td></td><td>[[Homepage::{{{Homepage|}}}|Homepage]]</td></tr> |}}</table><hr>
menuentry "Funtoo Linux [nvidia] - vmlinuz-2.6.32.71_p14-rh" {
+
<b>Summary:</b> [[Summary::{{{Summary|}}}]]
</console>
+
{{#get_web_data:url=http://127.0.0.1:8888/portage/meta/{{{CatPkg}}}|format=xml|use xpath|data=use=/package/@use}}{{#set:Use={{#external_value:use}}}}{{#if: {{#external_value:use}}|
 
+
== Use Flags ==
== xcfgmaker deamon ==
+
{{#arraymaptemplate:{{#external_value:use}}|ExternUse|,|}}
 
+
}}
<console>
+
<div class="bs-head" style="text-decoration: underline; margin-bottom: 15px;">Funtoo News</div>
###i## mkdir /etc/X11/video/;
+
{{NewsList|3}}
###i## cd /etc/X11/video/;
+
[[News|View More News...]]
###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. Edit the file <tt>/etc/init.d/xcfgmaker</tt>:
+
<syntaxhighlight lang="bash">
+
#!/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
+
 
+
}
+
</syntaxhighlight>
+
 
+
Do not forget:
+
<console>
+
###i## chmod +x /etc/init.d/xcfgmaker
+
###i## rc-update add xcfgmaker boot
+
</console>
+
 
+
== Additional Resources ==
+
*[http://en.gentoo-wiki.com/wiki/Nvidia Nvidia how-to on gentoo-wiki]
+
*[http://en.gentoo-wiki.com/wiki/Nouveau Nouveau how-to on gentoo-wiki]
+
*[http://sudormrf.wordpress.com/2011/02/14/create-a-boot-option-for-easy-nvidia-or-nouveau-display-driver-switching The same text on my blog(in Russian)]
+
  
[[Category:HOWTO]]
+
</div><div class="col-xs-12 col-md-9 col-md-pull-3">{{DISPLAYTITLE:{{PAGENAME}}}}
[[Category:First Steps]]
+
<div id="ebuild_header"><div id="ebuild_logo" style="padding-bottom: 1em;">[[File:ebuild.png|link=|frameless|class=img-responsive]]</div><div id="ebuild_title">
 +
= {{PAGENAME}} =
 +
</div></div>
 +
{{#seo:
 +
|title=Package: {{PAGENAME}} ({{{CatPkg}}})
 +
|keywords={{{CatPkg}}},ebuild,gentoo,funtoo
 +
|description=A Funtoo Linux ebuild for {{{CatPkg}}}: {{{Summary|}}}
 +
}}{{Tip|This is a wiki page. To edit it, {{CreateAccount}}. Then [[{{#special:userlogin}}|log in]] and then {{#formlink:form=Ebuild|link text=click here to edit this page|target={{FULLPAGENAME}}}}. See our [[Help:Funtoo_Editing_Guidelines|editing guidelines]] to becoming a wiki-editing pro.}}
 +
</includeonly>

Revision as of 17:16, January 12, 2015

This is the "Ebuild" template. It should be called in the following format:

{{Ebuild
|Summary=
|CatPkg=
|Maintainer=
|Homepage=
}}

Edit the page to see the template text.