LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-18-2006, 10:31 PM   #1
shadowsa
Member
 
Registered: Jul 2005
Posts: 149

Rep: Reputation: 15
Grub: 2 entrys for 2 different xorg.conf files


hi all to explain it easy,

i have xorg.conf1 and xorg.conf2 in my etc/X11/ directory,

and i would like to make an entry or better say would like to have the option to select during startup in GRUB xorg.conf1 or xorg.conf2

i had the imagination that a simple cp comand would do the thing but since this seems not to be able with grub because i cant find a simple cp command,because in that case i would simply add an entry like
"cp /etc/X11/xorg.conf2 /etc/X11/xorg.conf"
if there is any good way, please help.

thank you all in advance
 
Old 12-18-2006, 10:51 PM   #2
OEP
Member
 
Registered: Apr 2004
Location: AL, USA
Distribution: FC4, Gentoo
Posts: 58

Rep: Reputation: 15
I'm not so sure it's so much Grub you should be dealing with. If anything, I think it might be better done to the init scripts. You can specify which init level to start the kernel in from Grub as an argument to the kernel command. You might be able to do it by starting the kernel in different init levels (the default is 5, and you could have a special one by another number) and then have the init scripts take it from there. Granted, I have little idea what the specifics would be in all this, and do know there are reserved init levels that you couldn't use. And it might just be plain insecure to do it my way.
 
Old 12-18-2006, 10:57 PM   #3
shadowsa
Member
 
Registered: Jul 2005
Posts: 149

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by OEP
I'm not so sure it's so much Grub you should be dealing with. If anything, I think it might be better done to the init scripts. You can specify which init level to start the kernel in from Grub as an argument to the kernel command. You might be able to do it by starting the kernel in different init levels (the default is 5, and you could have a special one by another number) and then have the init scripts take it from there. Granted, I have little idea what the specifics would be in all this, and do know there are reserved init levels that you couldn't use. And it might just be plain insecure to do it my way.
hrmm i have no idea about init scripts, what would be a safe way, anybody
 
Old 12-18-2006, 11:31 PM   #4
zhangmaike
Member
 
Registered: Oct 2004
Distribution: Slackware
Posts: 376

Rep: Reputation: 31
There's a file /proc/cmdline that contains all options passed to the kernel.

I'm pretty sure that the kernel will ignore all invalid parameters, but keep them in /proc/cmdline... so, if you're careful to choose a parameter that isn't being used, you could pass whatever you want in the kernel options, and then parse it out in your init scripts, etc.
 
Old 12-19-2006, 08:05 AM   #5
shadowsa
Member
 
Registered: Jul 2005
Posts: 149

Original Poster
Rep: Reputation: 15
my apologies, but i dont really understand what you mean, it would be nice and i would very apriciate if you could explain me maybe step by step what to do.

thank you very much in advance

Quote:
Originally Posted by zhangmaike
There's a file /proc/cmdline that contains all options passed to the kernel.

I'm pretty sure that the kernel will ignore all invalid parameters, but keep them in /proc/cmdline... so, if you're careful to choose a parameter that isn't being used, you could pass whatever you want in the kernel options, and then parse it out in your init scripts, etc.
 
Old 12-19-2006, 08:25 AM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
From the boot prompt howto:
Quote:
2.5 Setting Environment Variables.
Anything of the form `foo=bar' that is not accepted as a setup function as described above is then interpreted
as an environment variable to be set. An example would be to use TERM=vt100 or
BOOT_IMAGE=vmlinuz.bak as a boot argument. These environment variables are typically tested for in
the initialization scripts to enable or disable a wide range of things.
So you could have a nearly duplicate grub entry that differs in a variable that you test for latter on. You could alter your kdmrc file for example, if that is what your system uses, so that the X server is started with the option '-config /etc/X11/xorg.conf2' or '-config /etc/X11/xorg.conf' depending on which grub selection you made.

From kdmrc:
Quote:
# Additional arguments for the X-servers for local sessions.
# This string is subject to word splitting.
# Default is ""
ServerArgsLocal=-nolisten tcp
So if you set a variable XORGCONFIG to '-config /etc/X11/xorg.conf2', then your alternate config will be used instead by changing this line to:
ServerArgsLocal=-nolisten tcp $XORGCONFIG

If the variable isn't set, then nothing is added.

Last edited by jschiwal; 12-19-2006 at 08:32 AM.
 
Old 12-19-2006, 10:31 AM   #7
shadowsa
Member
 
Registered: Jul 2005
Posts: 149

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jschiwal
From the boot prompt howto:


So you could have a nearly duplicate grub entry that differs in a variable that you test for latter on. You could alter your kdmrc file for example, if that is what your system uses, so that the X server is started with the option '-config /etc/X11/xorg.conf2' or '-config /etc/X11/xorg.conf' depending on which grub selection you made.

From kdmrc:


So if you set a variable XORGCONFIG to '-config /etc/X11/xorg.conf2', then your alternate config will be used instead by changing this line to:
ServerArgsLocal=-nolisten tcp $XORGCONFIG

If the variable isn't set, then nothing is added.
hrmm im not sure if i really understand that, and how i can select the preset in grub.

my apologies
 
Old 12-19-2006, 11:29 AM   #8
shadowsa
Member
 
Registered: Jul 2005
Posts: 149

Original Poster
Rep: Reputation: 15
probably i should be more specific, i have a sony vgn-u70p and it is a small handheld device with builtin touchscreen, i have 2 different xorg.conf files, and i would like when im not using my 2nd display, to be able to select wich mode i want (DualScreen) or (SingleScreen) when i turn on the computer, or is there any possibility to let xorg autodetect this? like for example Mac OS X or Windows?
oh i forgot to say when i take it with me then i dont take the keyboard usually, the device has arrowkeys like PAD and an enter button so that was my idea of a simple grub entry just up or down and enter, beside that i usually use the touchscreen. untill now i have to switch the xorg.conf files manually before i take the device with me and restart.

thank you all in advance and thank you for the replys

Last edited by shadowsa; 12-19-2006 at 11:36 AM.
 
Old 12-19-2006, 05:35 PM   #9
OEP
Member
 
Registered: Apr 2004
Location: AL, USA
Distribution: FC4, Gentoo
Posts: 58

Rep: Reputation: 15
Ah, okay. There's a keystroke on traditional desktop Xorg that allows you to switch screen modes (as in between different resolutions), but I'm not sure how it works on handheld devices. I'm looking at an example configuration for dual screens, and although I can't tell you for sure, I think you can do that with a simple keystroke. It was Ctrl/Alt/+ or Ctrl/Alt/- on regular computers.

Maybe if you show us the Screen sections or the ServerLayout section of your xorg configurations and something can be suggested.

--EDIT--
Actually, I took what zhangmaike said and I made a script which I think will work.

Code:
#!/bin/bash
if [[ `cat /proc/cmdline | grep 'double'` != "" ]]; then
        cp /etc/X11/xorg.conf.double /etc/X11/xorg.conf
        exit 0;
else
        cp /etc/X11/xorg.conf.single /etc/X11/xorg.conf
        exit 0;
fi
You'll have to just make this an executable script and have an init script that runs on bootup (maybe try adding it to /etc/rc.local?). Then edit your Grub entries like you originally wanted to so that one of them contains the parameter needed to invoke dual monitors - in this case it is 'double'.

Last edited by OEP; 12-19-2006 at 06:11 PM.
 
Old 12-19-2006, 08:42 PM   #10
shadowsa
Member
 
Registered: Jul 2005
Posts: 149

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by OEP
Ah, okay. There's a keystroke on traditional desktop Xorg that allows you to switch screen modes (as in between different resolutions), but I'm not sure how it works on handheld devices. I'm looking at an example configuration for dual screens, and although I can't tell you for sure, I think you can do that with a simple keystroke. It was Ctrl/Alt/+ or Ctrl/Alt/- on regular computers.

Maybe if you show us the Screen sections or the ServerLayout section of your xorg configurations and something can be suggested.

--EDIT--
Actually, I took what zhangmaike said and I made a script which I think will work.

Code:
#!/bin/bash
if [[ `cat /proc/cmdline | grep 'double'` != "" ]]; then
        cp /etc/X11/xorg.conf.double /etc/X11/xorg.conf
        exit 0;
else
        cp /etc/X11/xorg.conf.single /etc/X11/xorg.conf
        exit 0;
fi
You'll have to just make this an executable script and have an init script that runs on bootup (maybe try adding it to /etc/rc.local?). Then edit your Grub entries like you originally wanted to so that one of them contains the parameter needed to invoke dual monitors - in this case it is 'double'.
hrmm i understand, sounds nice but the problem is i cant even use those keystrokes, please take a look at this picture
http://bag03pr000.ac.yahoo.co.jp/use...6062800004.jpg
i can only use the buttons in the upper right corner, without the keyboard, the buttons are up, down, left, right, and the middle button (round) is enter, and usually im not taking the unfoldable keyboard with me wich is not in the picture
 
Old 12-20-2006, 08:51 PM   #11
shadowsa
Member
 
Registered: Jul 2005
Posts: 149

Original Poster
Rep: Reputation: 15
please help if something is unclear i will answer that as specific as possible
 
Old 12-21-2006, 07:36 PM   #12
shadowsa
Member
 
Registered: Jul 2005
Posts: 149

Original Poster
Rep: Reputation: 15
?/
Quote:
Originally Posted by shadowsa
please help if something is unclear i will answer that as specific as possible
please help if possible
 
Old 12-22-2006, 10:46 AM   #13
shadowsa
Member
 
Registered: Jul 2005
Posts: 149

Original Poster
Rep: Reputation: 15
please i want to make it work, i dont think im the only one interested in this
 
Old 12-22-2006, 01:48 PM   #14
zhangmaike
Member
 
Registered: Oct 2004
Distribution: Slackware
Posts: 376

Rep: Reputation: 31
You could try my suggestion, which does exactly what you asked for in the beginning.

If you want to simply resize the screen, and you want to do this while X is running, you can use xrandr.
 
Old 12-23-2006, 08:02 PM   #15
shadowsa
Member
 
Registered: Jul 2005
Posts: 149

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by zhangmaike
You could try my suggestion, which does exactly what you asked for in the beginning.

If you want to simply resize the screen, and you want to do this while X is running, you can use xrandr.
im really sorry i dont really understand what you exactly mean, it would be nice if you could exlain me more detailed, thank you in advance
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different xorg.conf-files for users zorolowski Linux - General 2 08-21-2005 10:27 AM
is there a program to automatically make xorg.conf files lowpingnoob Linux - Newbie 12 06-12-2005 04:08 PM
post xorg.conf files: if you have a geforce fx 5700 VE come HERE! mrchaos Linux - Hardware 6 05-24-2005 10:28 PM
Xorg Hard Crashes and corrupts xorg.conf Advocator Linux - General 0 07-15-2004 01:41 PM
lilo.conf and grub.conf no read access shanenin Linux - Software 1 10-02-2003 03:53 PM


All times are GMT -5. The time now is 01:06 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration