Reverse Engineering the BIOS

lexxmac

Member
Nov 25, 2003
85
0
0
I've been wanting to ask this question for a long time, but for some reason held off;

What's to keep you from writing your own BIOS?

I know its complicated. I know that there are many problems involved in it. But wouldn't it be nice to write a bios with the feature you always wanted? Say, an A64 board with a real AGP/PCI lock? Or that nifty feature apple implemented that they call target disk mode? I have no idea what I'm getting into here, but I can just image the possiblities... Any one a BIOS programmer for a living? Is everything written in assembly, straight binary, or does it use something else entirely?

EDIT:
I'm seriosuly interested in putting a great deal of time into this. I'd even be willing to start a 'project' with a domain name and so on...
 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
The biggest problem is that how the BIOS interacts with a board depends on the hardware configuration of the board. It's much like assembler; the actual binary instructions depend on how the hardware is set up. It *should* be possible, given a lot of time and effort, to trace out all the BIOS pins and see what they connect to, and thus to reverse-engineer a motherboard BIOS. Then, presumably, you could modify the existing one or try to write a new one.

I'm not sure you can "write" an AGP/PCI lock into an AGP/PCI controller that doesn't support that feature in hardware (if it was that easy, I suspect all boards would have one). Adding things like USB boot support or better overclocking options might be possible, though. However, you still can't make the hardware do things it's not physically capable of -- if the vDIMM is hardwired to 2.6V, or the PCI/AGP speed is clocked in hardware off the FSB, there's nothing you can do short of physical modification to change that.

I suspect this project would be a huge amount of work for very little (if any) effective gain, although I'm sure you'd learn an unbelievable amount about how PC BIOSes work. Your call. :p

 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Originally posted by: lexxmac
I've been wanting to ask this question for a long time, but for some reason held off;

What's to keep you from writing your own BIOS?
Documentation. Hardware manufacturers are generally unwilling to provide complete datasheets explaining all the ways to talk to their products (specifically north and south bridges). I traced through my BIOS and after a couple dozen instructions you start seeing stuff like "OUT <port> <value>", and there isn't really any easy way to figure out what that does without datasheets.

I know its complicated. I know that there are many problems involved in it. But wouldn't it be nice to write a bios with the feature you always wanted? Say, an A64 board with a real AGP/PCI lock?
Doens't that require hardware support, not just BIOS support?

Or that nifty feature apple implemented that they call target disk mode? I have no idea what I'm getting into here, but I can just image the possiblities... Any one a BIOS programmer for a living? Is everything written in assembly, straight binary, or does it use something else entirely?
You'd write it in assembly, though some of it could probably be done in C (see linuxbios).

EDIT:
I'm seriosuly interested in putting a great deal of time into this. I'd even be willing to start a 'project' with a domain name and so on...
You might consider looking at linuxbios - it's open source so you can take a look at it.

I bet Peter knows all the details ;)
 

borealiss

Senior member
Jun 23, 2000
913
0
0
usually bios' are written in assembly and ASL to my knowledge. reverse engineering a bios would be a tremendous undertaking with little gain. theoretically all you would need to do to write your own bios is to know how to set up all the hardware in the configurations that they're meant to be in. most bios' that i've worked with have been compressed in some type of package, usually from ami or phoenix. so if you could get the raw image file from the rom chip, you could have a field day. have fun looking through 2-3 Mbits of dissassembly! seriously though, i'd look into another higher level interface than the bios. a lot of the bios settings that are set up in hardware get destroyed by windows anyways when it boots up. your best chances of success probably lie in overwriting registers to whatever you want them to do after the bios kickstarts the system and before the OS of your choice loads up. a bootloader would be a perfect place to do this.
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
BIOS engineer? Who? Me? ;)

Your biggest problem: Documentation. Next biggest is going to be documentation, and then documentation.

BIOS consists mainly of two parts: (1) Firing the hardware up, and (2) providing runtime interfaces that let the operating system handle the machine.

For task (1) you're going to need documentation on every single chip on the mainboard, from the big obvious core chipset chunks down to the wee bits like temperature sensors. That's going to get you a lot of Non-Disclosure Agreement signing before you even get started. Then you're going to need the technical documentation on the mainboard implementation - schematics, contents of programmable logic chips, timing specifications, bugs, everything.

For task (2) you're going to need documentation about the established runtime interfaces and their standards. This is going to get you a lot more NDA signing and becoming member of certain groups and committees like PCISIG. And then there's the grown legacy "standards" there isn't ANY agreed standards documentation about, you just have to get it right "the way we've always done it".

And all that without copying the least bit of code from someone who's done it before you.

Good luck. It's a man's job. ;)
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
The alternate way is to license everything you need from an established BIOS vendor like Phoenix or AMI, and then implement everything you want the way you want it.

That's how mainboard manufacturers that write their own BIOSes do it (and that's what I'm doing). You still need all the NDA stuff and the mainboard documentation though - and a source code level license from those BIOS vendors easily costs you six-figure dollars.

And then you'll find that implementing e.g. asynchronous core/AGP/PCI clock frequencies is something that the hardware (core chipset, clock synthesizer, mainboard layout) needs to support before the BIOS can even think of implementing it. So your next question will then be, "Anyone designing their own mainboards?"
 

lexxmac

Member
Nov 25, 2003
85
0
0
"Anyone designing their own mainboards?"

Designing a mainboard is something I've wanted to do for a long time, but I simply don't know enough about it to get done. Of course there's that minor issue of financing. Peter, just out of curiosity, who do you design BIOSes for?
 

DerwenArtos12

Diamond Member
Apr 7, 2003
4,278
0
0
Originally posted by: lexxmac
"Anyone designing their own mainboards?"

Designing a mainboard is something I've wanted to do for a long time, but I simply don't know enough about it to get done. Of course there's that minor issue of financing. Peter, just out of curiosity, who do you design BIOSes for?

That would be awesome. MY dream would be to get into a company like ECS and get a full turn aroudn in their production, though I think they have a couple people there kicking them in the a$$ right now based on their 755-A2.
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
Why? The A2 is the good one, the A has been the first attempt that won't do DDR400 RAM.
Shit like that happens - and when you've got to be as quick to market as you have to be in the desktop arena, it happens all the time.

Now, if it went wrong, what will you do? Scrap the production run, or downspec it and sell it anyway, at a discount? Sure, it isn't pretty when that happens ... but the same enthusiasts who are complaining about these things are at the same time fueling exactly this rushing to market of immature product. Remember, DDR400 is still not a properly standardized thing, and more than enough DIMMs aren't even following the proposed rules.

With the 755-A now going for 77 euros and everything else in the Athlon-64 arena being 100 or more, I reckon it'll find its customers anyway. I'd take it.
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Originally posted by: Peter
Why? The A2 is the good one, the A has been the first attempt that won't do DDR400 RAM.
Shit like that happens - and when you've got to be as quick to market as you have to be in the desktop arena, it happens all the time.

Now, if it went wrong, what will you do? Scrap the production run, or downspec it and sell it anyway, at a discount? Sure, it isn't pretty when that happens ... but the same enthusiasts who are complaining about these things are at the same time fueling exactly this rushing to market of immature product. Remember, DDR400 is still not a properly standardized thing, and more than enough DIMMs aren't even following the proposed rules.

With the 755-A now going for 77 euros and everything else in the Athlon-64 arena being 100 or more, I reckon it'll find its customers anyway. I'd take it.

You work for SBS? Would you consider enabling private messaging? ;)
 

DerwenArtos12

Diamond Member
Apr 7, 2003
4,278
0
0
Originally posted by: Peter
Why? The A2 is the good one, the A has been the first attempt that won't do DDR400 RAM.
Shit like that happens - and when you've got to be as quick to market as you have to be in the desktop arena, it happens all the time.

Now, if it went wrong, what will you do? Scrap the production run, or downspec it and sell it anyway, at a discount? Sure, it isn't pretty when that happens ... but the same enthusiasts who are complaining about these things are at the same time fueling exactly this rushing to market of immature product. Remember, DDR400 is still not a properly standardized thing, and more than enough DIMMs aren't even following the proposed rules.

With the 755-A now going for 77 euros and everything else in the Athlon-64 arena being 100 or more, I reckon it'll find its customers anyway. I'd take it.

That is what I meant. Someone went in, kicked them in the a$$ and a good board finally popped out. And do you mean youd take the A2, personally I have been very satisfied with my recent SIS chipsets and I look very forward to their intel 915/925 equivalent(can't remember the number)
 

borealiss

Senior member
Jun 23, 2000
913
0
0
Motherboard design is blah. I'd hate to do it. A lot of people that do do it that i know mostly end up working with the design guides and rules from the chipset and cpu vendor. The bringup process can be painful too. As a mobo designer, you'd probably spend most of your time getting the thing to work as the logical topology is largely dictated by the cpu and chipsets. Lots of reference design ... referencing. And again, this is going to be documentation documentation documentation. I can't count how many times a 3rd party chipset vendor I've worked with has messed up with a typo that might change something as drastic as slewrates.
 

Peter

Elite Member
Oct 15, 1999
9,640
1
0
borealiss, you need to do more interesting types of mainboards ... there IS a challenge in mainboard design if you push things "a little" beyond reference design copying. See links above ;)

Derwen, no, I'd take the 755A anytime, for the price it's going for right now. Besides, they did notice themselves that DDR400 is nogo on the A. It's only that in the desktop market, you just don't /get/ the time to do that kind of evaluation properly before marketing demands the stuff go out the door.
 

DerwenArtos12

Diamond Member
Apr 7, 2003
4,278
0
0
Originally posted by: Peter
borealiss, you need to do more interesting types of mainboards ... there IS a challenge in mainboard design if you push things "a little" beyond reference design copying. See links above ;)

Derwen, no, I'd take the 755A anytime, for the price it's going for right now. Besides, they did notice themselves that DDR400 is nogo on the A. It's only that in the desktop market, you just don't /get/ the time to do that kind of evaluation properly before marketing demands the stuff go out the door.

Ok I see where your coming from for the price it is a good board. But is the A2 really that much more expensive(I can't manage to find it anywhere)? And it depends on your demands. I demand 3200 on all my computers that have a 200fsb.
 

KalTorak

Member
Jun 5, 2001
55
0
0
Motherboard design is blah. I'd hate to do it. A lot of people that do do it that i know mostly end up working with the design guides and rules from the chipset and cpu vendor. The bringup process can be painful too. As a mobo designer, you'd probably spend most of your time getting the thing to work as the logical topology is largely dictated by the cpu and chipsets. Lots of reference design ... referencing. And again, this is going to be documentation documentation documentation. I can't count how many times a 3rd party chipset vendor I've worked with has messed up with a typo that might change something as drastic as slewrates.

That's why the fun job's creating the reference designs. ;)