How to write a BIOS program that runs before the OS?

2.2k views Asked by At

I am trying to write a script that is executed before Windows is booted on my Computer.

I have already developed a simple Linux bash script to accomplish this, but I would like to improve and take it further. The problem with using a Linux script is that it adds quite a bit of time to the boot sequence as Linux has to start/initialize then execute it, which is obviously undesirable.

What I would like to do is write a low-level program (assembly? machine code?) which BIOS would read, execute, and then continue to Windows(or any other OS).

Is there a way to run scripts in that fashion without the presence of a OS and if so what language or resources should I consider.

1

There are 1 answers

2
David Hoelzer On BEST ANSWER

No, there is no way to write "scripts" to do what you describe.

It is, however, possible to create a chain loader and have the chain loader do anything you want it to in the first stages before loading Windows. The accepted answer to this question will get you started down this road.

You would want to consider Assembly Language. You didn't specify an architecture, but saying "Windows" implies x86 or x86_64.

All of that said, I suspect your question will be closed since it is enormously broad.