Re: Can this be possible (or BIOS api)

2007-01-22 Thread Michael Vasiliev
On Monday January 22 2007 09:44, Dan Shimshoni wrote:
> Hello linux il ,
>
> I had been playing with the idea of writing a small
> utility in "C" on linux which will enable me to change boot
> prioirity on a linux machine, so that I will be able to toggle
> the boot sequence (boot from CD/ not boot from CD).
> I mean the boot sequence which the BIOS saves in CMOS.
Why not leave it to the bootloader to take care of El-Torito bootable CD-ROMs? 
There are bin files that take care of that both for lilo and grub, last time 
I checked, and a Gentoo howto on the topic.

-- 
Sincerely Yours,
Michael Vasiliev

Confidence is the feeling you have before you understand the situation.

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: Can this be possible (or BIOS api)

2007-01-22 Thread Peter


In DOS days I wrote such a thing. It would boot into DOS and then select 
based on the contents of a file whether to stay in DOS, go on to windows 
or boot linux using loadlin. The DOS step was necessary because of sound 
drivers. The utility was also accessible from linux and from windows, 
each allowing the 'next' OS to be selected at reboot. I am not aware of 
a portable API for selecting the boot device. The BIOS boot device 
selection is buried deep in NVRAM and different by manufacturer etc. 
Tinkering with NVRAM is dangerous. It is possible at least on certain 
boards to select a CPU multiplier or supply voltage that will fry it or 
the chipset. The BIOS normal UI settings prevent that but devious 
hacking can end up in *pow*!


Peter


=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: Can this be possible (or BIOS api)

2007-01-22 Thread Shachar Shemesh
Ori Idan wrote:
> Remember that the CMOS also holds the time so doing such an operation
> will reset the time.
>
I find it highly unlikely that the CMOS holds the real time clock. It's
not the sort of thing you save in memory.

> sunlap:~# cp /dev/nvram /tmp/dump1 ; sleep 10 ; cp /dev/nvram
> /tmp/dump2 ; diff /tmp/dump{1,2} && echo "identical"
> identical
No, it does not seem to be part of the CMOS.

Shachar

-- 
Shachar Shemesh
Lingnu Open Source Consulting ltd.
Have you backed up today's work? http://www.lingnu.com/backup.html


=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: Can this be possible (or BIOS api)

2007-01-22 Thread Ori Idan

Remember that the CMOS also holds the time so doing such an operation will
reset the time.

--
Ori Idan


On 1/22/07, Shachar Shemesh <[EMAIL PROTECTED]> wrote:


Dan Shimshoni wrote:
> Is there an API which enable me to perform such a task ?
> Did anybody tried a thing like that ? and in case it is possible -
> how much complex is it ?
How about this (never tried it myself):
Make sure /dev/cmos exists, and that the relevant kernel module is
available.
Set your bios to boot from CD
copy /dev/cmos to a file
Set your bios to not boot from CS
copy /dev/cmos to another file

Copy the relevant file to /dev/cmos.

Warning:
If, as a result of following this procedure, you lose all of your bios
settings, your machine becomes unbootable, your power supply catches
fire and your wife leaves you, preferring your cat, do not hold me liable.

Shachar

--
Shachar Shemesh
Lingnu Open Source Consulting ltd.
Have you backed up today's work? http://www.lingnu.com/backup.html


=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]




Re: Can this be possible (or BIOS api)

2007-01-22 Thread Yedidyah Bar-David

2007/1/22, Dan Shimshoni <[EMAIL PROTECTED]>:


Hello linux il ,

I had been playing with the idea of writing a small
utility in "C" on linux which will enable me to change boot
prioirity on a linux machine, so that I will be able to toggle
the boot sequence (boot from CD/ not boot from CD).
I mean the boot sequence which the BIOS saves in CMOS.

This is a task which I do quite frequently by entering the BIOS.

Is there an API which enable me to perform such a task ?
Did anybody tried a thing like that ? and in case it is possible -
how much complex is it ?



There is a module/driver/device called /dev/nvram (modprobe nvram)
which gives you read/write access to the cmos ram. As far as I know,
it's not completely documented - it might as well completely
undocumented, I did not do a thorough search. You can dump it to
a file before and after making the desired change in your BIOS's setup,
and cmp to find what changed. Then you can write a small script
(probably something like
cat some1bytefile | dd bs=1 of=/dev/nvram seek=NN
but might be a bit more complex) that does this change.

I used such a technique to do some other change to the cmos ram
of a class of machines, and it usually, but IIRC not always, worked.
--
Didi


Re: Can this be possible (or BIOS api)

2007-01-22 Thread Shachar Shemesh
Dan Shimshoni wrote:
> Is there an API which enable me to perform such a task ?
> Did anybody tried a thing like that ? and in case it is possible -
> how much complex is it ?
How about this (never tried it myself):
Make sure /dev/cmos exists, and that the relevant kernel module is
available.
Set your bios to boot from CD
copy /dev/cmos to a file
Set your bios to not boot from CS
copy /dev/cmos to another file

Copy the relevant file to /dev/cmos.

Warning:
If, as a result of following this procedure, you lose all of your bios
settings, your machine becomes unbootable, your power supply catches
fire and your wife leaves you, preferring your cat, do not hold me liable.

Shachar

-- 
Shachar Shemesh
Lingnu Open Source Consulting ltd.
Have you backed up today's work? http://www.lingnu.com/backup.html


=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Can this be possible (or BIOS api)

2007-01-21 Thread Dan Shimshoni

Hello linux il ,

I had been playing with the idea of writing a small
utility in "C" on linux which will enable me to change boot
prioirity on a linux machine, so that I will be able to toggle
the boot sequence (boot from CD/ not boot from CD).
I mean the boot sequence which the BIOS saves in CMOS.

This is a task which I do quite frequently by entering the BIOS.

Is there an API which enable me to perform such a task ?
Did anybody tried a thing like that ? and in case it is possible -
how much complex is it ?


Regards,
DAN