Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Boot option to run fglrx or mesa?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
tipp98
Tux's lil' helper
Tux's lil' helper


Joined: 28 Jan 2007
Posts: 113

PostPosted: Mon Jan 24, 2011 8:40 pm    Post subject: [Solved] Boot option to run fglrx or mesa? Reply with quote

I've recently started using softlevels for booting alternate environments, such as console only, or booting up with NetworkManager as an alternate to using the more static /etc/init.d/net.*. Now, as the open source ati drivers are improving, I'd like to be able to toggle between the two depending on my needs or wants. I understand I'll probably need two separate kernels, separate xorg.conf's, and the mysterious eselect opengl. I can deal with these issues on a downward slope.

1) The kernel will be easy. Just need two.
2) Mesa with run with no xorg.conf but fglrx needs one. Instead of creating a boot script to copy or delete xorg.conf as needed I'd prefer to run with a sole xorg.conf.fglrx and ask gdm to start x with the xorg.conf.fglrx file depending on my runlevel. The variable $XORGCONFIG should be able to accomplish this but I don't know where to put it. I tried XORGCONFIG=xorg.conf.fglrx in /etc/conf.d/xdm.fglrx, but that didn't work.
3) I have no idea what eselect opengl does. Could someone explain this?

Any insight on doing this would be awesome.
Kyle


Last edited by tipp98 on Thu Jan 27, 2011 1:02 am; edited 1 time in total
Back to top
View user's profile Send private message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Tue Jan 25, 2011 2:25 pm    Post subject: Reply with quote

I think XORGCONFIG=xorg.conf.fglrx should be placed in /etc/profiles. Then do an env-update.

What that eselect module does... even I would love to know.
_________________
My blog
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Tue Jan 25, 2011 5:36 pm    Post subject: Reply with quote

Explanation of what eselect opengl set ati|nvidia|xorg-x11 does:

http://www.thinkwiki.org/wiki/Problems_with_fglrx#Gentoo

Symlinks libGL.so.* to either the X.Org OpenGL libraries or closed-source OpenGL libraries.
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
tipp98
Tux's lil' helper
Tux's lil' helper


Joined: 28 Jan 2007
Posts: 113

PostPosted: Wed Jan 26, 2011 11:45 pm    Post subject: Reply with quote

Thanks for the link Fitz. eselect takes so long I thought it did more.

So now I've got this whipped. Setting XORGCONFIG in /etc/profile does not work because it is blocked out by start-stop-daemon. /etc/init.d/xdm calls /etc/X11/startDM.sh, which does source /etc/profile, but then runs start-stop-daemon to start the display manager. The --env option must be used to pass variables to the executed binary.

I decided to edit /etc/init.d/xdm instead of creating a separate script, or two. I did this because I was not finding a way to prevent the script from running if xdm was already started. The upside to editing this system script is that it eliminates the need for runlevel configuration as the setup is done based on which kernel is running. A couple caveats here though...

1) The video driver must be built as a module as /proc/modules is used for detection. I'm sure there is a better way of doing this to support in kernel drivers, but this is as smart as I could get. I thought about using /proc/fb, but that requires a frame buffer to be in use.
2) Care must be taken that startx not be run under the wrong setup while in a console only environment.

addition to /etc/init.d/xdm...


Code:

...
setup_x() {
        DRIVER=$(cut -d" " -f1 /proc/modules | grep -E 'fglrx|radeon')

        ebegin "Setting userspace to use driver $DRIVER"

        case $DRIVER in
        fglrx)
        save_options "xconfig" "XORGCONFIG=xorg.conf.fglrx"
        test "`ls -l /usr/lib/libGL.so|grep ati`" || (eselect opengl set ati)

        ;;
        radeon)
        test "`ls -l /usr/lib/libGL.so|grep xorg`" || (eselect opengl set xorg-x11)

        ;;
        *)
        echo "No driver module detected, check that video drivers are built as modules and that they are defined in /etc/init.d/xdm"
        false
        ;;
        esac
        eend $?
}

#start() {
#        local EXE NAME PIDFILE
#        setup_dm
        setup_x
...

and to /etc/X11/startDM.sh
Code:
...

#export SVCNAME=xdm
#EXEC="$(get_options service)"
#NAME="$(get_options name)"
#PIDFILE="$(get_options pidfile)"
XORGCONFIG="$(get_options xconfig)"

start-stop-daemon --start --env ${XORGCONFIG} --exec ${EXEC} \
${NAME:+--name} ${NAME} ${PIDFILE:+--pidfile} ${PIDFILE} || \
eerror "ERROR: could not start the Display Manager"



EDIT: So, I was making the links to libGL manually for speed, but decided using eselect was the more bullet proof method. Also, this may be better off as a separate script run before xdm, but I like it like this. startDM.sh still needs preserved anyway. Hope this is useful to someone else.

Cheers,
Kyle
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum