Le mardi 15 février 2005 à 12:40, Voronkov Konstantin a écrit:
> Hello, All!
> 
> We need to load different setups depending on OS selected in GRUB
> while booting. We need to load the same OS but make some pre-configuration
> so that OS runs initial script depending on OS selected in GRUB. Is it 
> possible?
> Would you be so kind to provide information how to do that.

I can't give a general answer, but I will explain what I do for the
GNU/Linux OS (the following is Linux specific):

I use several stanza in the menu.lst config file with only one difference:

kernel (hd0,0)/boot/vmlinuz ... myparam=1
kernel (hd0,0)/boot/vmlinuz ... myparam=2

I use a non-standard parameter: "myparam".

When my Linux boots, I parse the /proc/cmdline file from some rc files
in order to get the variable "myparam". Example (with bash):

|for word in $(cat /proc/cmdline) ; do
|        case $word in
|                myparam=*)
|                eval $word
|                ;;
|        esac
|done
|echo "myparam = ${myparam}"

The Linux' "init" parameter may also be useful (depending on what you
want to do), see doc in your linux kernel sources:
/usr/src/linux/Documentation/kernel-parameters.txt


> In mine opinion I have next scenario. E.g. GRUB modifies some file on load
> on hard disk depending on OS selection. Is it possible? Maybe there is 
> other
> way to perform this?

Grub is able to modify one file on the hard disk depending on OS
selection. See the Grub's documentation from the CVS and look for the
"savedefault" feature. I don't know if it is a good idea to use this.

If you use this:

title MyOS
kernel ...
savedefault 1

Grub will save the number "1" in the file "default", located in the same
directory and the same partition than your file menu.lst.

Warning: The aim of the savedefault command is NOT to store anything in
the file "default". If you use the command "default saved", my ugly tip
will have some side effects... ;) If you use Linux, I advice you not to
use this and to add a "myparam" variable in the cmdline.

-- 
Alban






_______________________________________________
Bug-grub mailing list
Bug-grub@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-grub

Reply via email to