Skip to contentSkip to conversation

restoring x86 BIOS state before reboot

DISCUSSION Bart Trojanowski 9 participants 10 messages Apr 6, 2007 – May 11, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

I am looking at a two stage boot where linux is loaded to do some system initialization before booting to Windows, which needs BIOS.

I am interested in bypassing the BIOS on the second boot.

I wanted to know if anyone has attempted to restore the BIOS memory such that this could be attempted. If not, I would love to get some pointers :)

My plan right now is to backup the 128k of memory under 0x10000 to some staging memory under 0x90000, temporarily while in real mode, and then move it up somewhere higher once the kernel is running.

Then on reboot I hope to undo the above and jump to 0x00007c00.

Does this approach have any merit?

Cheers,

-Bart

#1 lore raw
Quoted 10 lines · Bart Trojanowski

Hi all,

I am looking at a two stage boot where linux is loaded to do some system initialization before booting to Windows, which needs BIOS.

I am interested in bypassing the BIOS on the second boot.

I wanted to know if anyone has attempted to restore the BIOS memory such that this could be attempted. If not, I would love to get some pointers :)

Hmm.... minix3's "boot monitor" seems to be something in that direction. When typing "halt" on minix, the system is 'shut down' and control is passed to the boot monitor where you can select minix again.

Jan

#2 lore raw
In reply to Bart Trojanowski
Quoted 11 lines · Bart Trojanowski

Hi all,

I am looking at a two stage boot where linux is loaded to do some system initialization before booting to Windows, which needs BIOS.

I am interested in bypassing the BIOS on the second boot.

I wanted to know if anyone has attempted to restore the BIOS memory such that this could be attempted. If not, I would love to get some pointers :)

Quoted 7 lines

My plan right now is to backup the 128k of memory under 0x10000 to some staging memory under 0x90000, temporarily while in real mode, and then move it up somewhere higher once the kernel is running.

Then on reboot I hope to undo the above and jump to 0x00007c00.

Does this approach have any merit?

The primary problem isn't so much the BIOS memory. That is usually preserved. But rather the BIOS gets confused at the massive change in hardware state. At least I think that is what happens.

On some BIOS/kernel configuration it isn't a problem I think I got maybe a 20% success rate trying to use the 16bit linux entry point that starts the new kernel from kexec when I was investigating it.

You might get a little more success if you backup the BIOS memory I don't know.

As long as you are not coming out of a panic situation there is no theoretical reason why you shouldn't get the BIOS back and working again, but the how of it is a challenge.

The possibility I keep playing with is to load the Bochs BIOS or some other implementation of the basic boot services that I have control over so that if it doesn't work the code can be fixed. There has been some limited success with this technique in the context of LinuxBIOS.

The ACPI tables should be reusable as is.

It may also be worth investigating if it is possible to bypass the part of windows that uses BIOS calls. I really don't have a clue how a modern windows systems boots.

Eric

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw
Quoted 4 lines · Eric W. Biederman

It may also be worth investigating if it is possible to bypass the part of windows that uses BIOS calls. I really don't have a clue how a modern windows systems boots.

I think ReactOS has a bootlader that can also boot Windows, or at least they are close to booting the Windows kernel. That bootloader could be then used for booting Windows without BIOS calls.

I also heard that the 100-$-Laptop should now be able to use Windows. As it's using LinuxBIOS, this could also be interesting. However, maybe Microsoft simply modifies a special Windows for this, or they integrate a ClosedSource part in that LinuxBIOS, I don't know ... :-(

Thanks,
Bernhard

#4 lore raw
Quoted 6 lines · Bernhard Walle
Quoted 4 lines · Eric W. Biederman

It may also be worth investigating if it is possible to bypass the part of windows that uses BIOS calls. I really don't have a clue how a modern windows systems boots.

Quoted 8 lines

I think ReactOS has a bootlader that can also boot Windows, or at least they are close to booting the Windows kernel. That bootloader could be then used for booting Windows without BIOS calls.

I also heard that the 100-$-Laptop should now be able to use Windows. As it's using LinuxBIOS, this could also be interesting. However, maybe Microsoft simply modifies a special Windows for this, or they integrate a ClosedSource part in that LinuxBIOS, I don't know ... :-(

I know it isn't a ClosedSource part in LinuxBIOS.

In any particular case you can work through the details, and make it work.

The hard part is making the general case work.

Eric

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#5 lore raw
In reply to Bernhard Walle
Quoted 4 lines · Bernhard Walle

I also heard that the 100-$-Laptop should now be able to use Windows. As it's using LinuxBIOS, this could also be interesting. However, maybe Microsoft simply modifies a special Windows for this, or they integrate a ClosedSource part in that LinuxBIOS, I don't know ... :-(

You heard wrong. Microsoft have a few early test units and are trying to get Windows to boot on it. I believe their plan involves replacing LinuxBIOS with a 'normal' PC BIOS.

Signature · 7 lines
dwmw2


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#6 lore raw
In reply to Bernhard Walle

Hi!

Quoted 4 lines
Quoted 3 lines

It may also be worth investigating if it is possible to bypass the part of windows that uses BIOS calls. I really don't have a clue how a modern windows systems boots.

Quoted 8 lines

I think ReactOS has a bootlader that can also boot Windows, or at least they are close to booting the Windows kernel. That bootloader could be then used for booting Windows without BIOS calls.

I also heard that the 100-$-Laptop should now be able to use Windows. As it's using LinuxBIOS, this could also be interesting. However, maybe Microsoft simply modifies a special Windows for this, or they integrate a ClosedSource part in that LinuxBIOS, I don't know ... :-(

I do not think OLPC is using linuxBIOS these days. What they have certainly looks like Sun's ROM monitor.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#7 lore raw
Quoted 2 lines · Pavel Machek

I do not think OLPC is using linuxBIOS these days. What they have certainly looks like Sun's ROM monitor.

Yep, looks like they've got Mitch Bradley, (ex?) of Firmworks, doing their firmware. That means its pretty much exactly OpenFirmware. Lots of yummy, delicious Forth.

J

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#9 lore raw
Quoted 8 lines · H. Peter Anvin
Quoted 4 lines · Pavel Machek

I do not think OLPC is using linuxBIOS these days. What they have certainly looks like Sun's ROM monitor.

That would be OpenFirmware, then.

current kernel for x86 support OFW boot patch?

YH

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec