Saturday, September 29, 2012

How to Correctly Flash a BIOS

Every computer comes with what is known as a BIOS (Basic Input/Output System). The BIOS contains startup and basic execution code that runs code before the CPU is handed control. In essence, it is the key piece of software on the computer that makes a computer start up in the first place.

Occasionally, motherboard manufacturers will release new versions of a BIOS, usually to correct manufacturing defects. Flashing the BIOS is a rather dangerous, but sometimes necessary operation. Doing this is also usually much more complex than it needs to be, which not only acts as a deterrent but also vastly increases the possibility of something going horribly wrong.

Before you go any further, heed this warning: Flashing a BIOS can brick your motherboard no matter how careful you are! Read everything two or three times and have a plan of action and a backup plan if flashing the BIOS fails spectacularly.

There is a right way and a wrong way to flash a BIOS. The wrong way is to do it from within Windows. Any motherboard manufacturer shipping a Windows EXE should be publicly shamed and humiliated. If you are a motherboard manufacturer, please just ship ZIP files - thank you.

The right way to flash a BIOS is to use a command-line flashing utility from a very minimalistic, single tasking OS with as few drivers loaded as possible (e.g. MS-DOS).

There are a few things that you will need to flash the BIOS:
  1. A correct BIOS ROM image file for your motherboard. If you bought the computer from a manufacturer like Dell or HP, visit their website and locate the BIOS in the downloads. If you built your own computer, you'll have to hope that the manufacturer and BIOS still exists. This has to be a 100% match or it will either brick the motherboard or simply not flash at all. You may have to extract the BIOS ROM image file from an EXE somehow if the manufacturer distributed it incorrectly. Ideally, this is a ZIP file consisting of a file such as "BIOS_01.IMG" and a "README.TXT" file that describes how to use the package. The latter file can be opened up with Notepad or another text viewer/editor. Also, locate the current version of the BIOS on the motherboard (if possible) so it can be reverted to if the update fails somehow.
  2. A DOS-based flashing utility that knows how to flash your hardware given a compatible BIOS image as input. The best manufacturers supply the BIOS ROM and the flashing utility separately. Ideally, the utility's exact location of where it can be obtained should be correctly referenced in the "README.TXT" file.
  3. A tool to make what is known as a "boot disk".
  4. A very minimalistic, single tasking OS for the boot disk (e.g. MS-DOS or FreeDOS).
  5. A storage medium with enough space for the boot disk image and all the files needed to flash the BIOS.
The first step is to get MS-DOS or similar installed on something that can be booted from. I prefer a USB thumbdrive for a boot disk. USB thumbdrives can be booted from but working tools that make them bootable are difficult to find.

There are two popular-ish tools for making a bootable USB thumbdrive under Windows (if you run a different OS, you'll have to scour the Internet), but only one comes with MS-DOS and FreeDOS: Rufus (GitHub version)

Run Rufus with a USB thumbdrive plugged in that you don't mind the contents getting wiped. For me, the process was quick and painless to put MS-DOS on my thumbdrive using Rufus under Windows 7.

The next step is to put together the flashing utility and BIOS ROM. Usually this involves just copying files. I recommend creating a directory called 'FLASH' on the USB thumbdrive and putting the files there. Important note: DOS has a very restrictive file naming convention of 8 characters + a period/dot + 3 characters. "Characters" must be A-Z, 0-9, hypen, or underscore for the best reliability. Ideally, no lowercase letters and definitely no spaces.

Once the files are on the thumbdrive, it is ready to go. I generally build the flash drive on one computer that I can return to if something on the target machine goes horribly wrong. Don't do this without having a second, functional computer around.

Plug the USB thumbdrive into the machine to be flashed. Boot it up and watch the initial screens for something like "Press F10 for boot options". When I miss pressing the key, I just power off the computer and try again.

The boot menu should contain a USB thumbdrive boot option - assuming the hardware isn't ridiculously ancient - both the motherboard and the thumbdrive have to support the feature. Select the USB thumbdrive boot option and watch the computer boot to DOS. Then run the flash utility as one does under a DOS command-line. One would hope that the "README.TXT" file contains accurate directions. In the event that there aren't directions, running the EXE by itself may work or try to find a DOS "batch file" (a file that ends in '.BAT') that is associated with the flash utility - it might provide useful hints on how to use the flash utility's EXE file.

If all goes well, the BIOS firmware will be updated with the version of the BIOS being flashed. If something goes horribly wrong such as a power outage or surge at the wrong moment or a cat presses Ctrl-Alt-Del, the motherboard could be bricked. More expensive motherboards ship with dual BIOS chips just in case flashing fails and can revert back to the factory BIOS. Flashing is best done with power through a functional UPS backup, even if it is a laptop, and kicking animals and small children out of the room.

Each BIOS is completely different as far as updating firmware goes. The scenario described above is the ideal scenario. It would be something that simply works but the reality is that the people authoring BIOS code lack brain cells when it comes to deployment. Because there is no official standard for BIOS deployment, you'll most likely have to wrestle with the ideas a bad programmer came up with just to get the silly thing to work properly (Dell: I'm glaring at you).

The computer hardware industry needs to standardize on a few things yet. This seems to be one of them.

2 comments:

  1. hi, its easier to use Rufus and then please specify that most BIOS like DELL include the "-" between their numbers and letter/number versions like "0755-A22.exe" for Dell Optiplex 755. Must remove "-" from the file name first, then copy to USB Stick/Drive after making the USB FAT 32 file system ..under "create bootable disk using" = MS-DOS in Rufus. For the life of me, I could NOT update the BIOS only because that "-" is in the file's name 0755-A22.exe

    ReplyDelete
    Replies
    1. Been so long since I touched MS-DOS 8.3 filenames. Were hyphens not allowed back then? Sticking to letters and numbers and one dot is even better. The key is to keep filenames really short so that they don't become "long filenames".

      Delete