Code to change BIOS boot sequence

Only for programmers and BIOS gurus with technical questions.
Post Reply
cjjoy1980
New visitors - please read the rules.
Posts: 1
Joined: Tue May 06, 2008 7:49 am

Hi,
I have written a code to change boot sequence (sometimes want my system to boot from network) using C program, using port 70 h and 71H. I followed the following procedure:

1. Dumped the CMOS contents with the current boot sequence into a file.
2. Changed the boot sequence manually and again read the CMOS contents into a file.
3. From these two file contents I observed values are being changed at 3 locations ( 1 for boot sequence and other 2 boot sequence).
4. wrote C code to write into these 3 locations
5. I was able to write successfully
6. When I restarted, I got the error. System CMOS checksum error and BIOS was updated with default value.

Can anybody help me out with this.. Is this the correct method or is their any other way??
cp
BIOS Guru
Posts: 1914
Joined: Mon Oct 21, 2002 9:07 pm
Location: Germany

almost everything correct. except you obviously forgot to calculate the cmos checksum and write it back into the cmos.
i don't know if there's a standard way to calculate the checksum over the cmos contents.
If you email me include [WIMSBIOS] in the subject.
prostar
New visitors - please read the rules.
Posts: 4
Joined: Tue May 27, 2008 3:59 pm

For many of leagacy bios, your design may work as expected if you re-compute the cmos checksum to the correct value.

But for newly UEFI based bios, your design won't work as expcted. Because these bios store the seetings in system flash directly.
fzabkar
BIOS Newbie
Posts: 28
Joined: Sun May 18, 2008 8:11 am

I once analysed an old AMI 386 BIOS with 128-bytes of CMOS RAM. In that particular case there were two 2-byte checksums.

The first was at CMOS RAM addresses 2E-2F. It summed the contents of addresses 10h to 2Dh.

The second was at 3E-3F and summed the contents of addresses 34h to 3Dh and 40h to 7Fh.

I don't know if this regime still applies.
indianoutlaw187
New visitors - please read the rules.
Posts: 6
Joined: Tue Jun 12, 2007 6:09 am

The above statement is correct and the checksum is stored in 2e,2f, and 3e, 3f for non-EFI BIOS. EFI based BIOS store everything to flash.

So to help you, you need to understand the checksum method your BIOS uses and which locations are used to compute the checksum. This can vary from one BIOS to another. Simply change some of the BIOS options and see how it affects the contents of 2e,2f,3e,3f. Keep in mind that on Intel based systems, locations above the first 128 bytes are accessed using IO ports 72 and 73.
zwzzhh
New visitors - please read the rules.
Posts: 1
Joined: Tue Jul 15, 2008 1:48 pm

I agree with prostar. Because I use this method to test in UEFI based bios platform. But, it doesn't work.
However, I am not sure whether the bios store the setting in system flash directly or not. Because I haven't got any evidence about it.

I will be thankful, if who can give me evidence about it.
Post Reply