Updating BIOS with Linux

If you don’t have Windows installed and you need to upgrade your BIOS, Linux does have the tools to be able to create a BIOS flash CD. Not many companies make Linux flash utilities and alot of these utilites are DOS utilities so a bootable DOS disk is needed. This is a simple, easy way to create a BIOS flash CD.

First, get a BIOS image. You’ll need to download a BIOS image for your board. For information on what Flash utility to use, a good place to look is your computer manufacturers homepage. Award BIOS and American Megatrends BIOS are the most popular BIOS’s used on motherboards.

Editing FreeDOS Minimal Boot Image

Note: This didn’t work for me but plenty of people have had success with it, fdboot.img is a bit old and may not work on newer hardware. Look at flashrom below for another alternative.

FreeDOS provides a bootable DOS image. Download the DOS image to the Desktop:

wget http://www.ibiblio.org/pub/micro/pc-stuff/FreeDOS/files/distributions/1.0/fdboot.img

and mount it:

sudo mount -t vfat -o loop /home/user/Desktop/fdboot.img /media/ISO

The BIOS flash utility and BIOS image will need to be added to the FreeDOS image. I prefer to use /media/ISO but any empty directory will do. The bootable image has a fixed size (1,440 Kb, the size of a floppy disk) and hence /media/ISO will also have that limited memory. The size needs to remain fixed in order to create a bootable floppy of it. You can see the space used in the image by:

du -b /media/ISO

Add the flash utility DOS executable and the BIOS image (there should be just enough room for it). I prefer to put these in a new directory but it’s up to you.

cd /media/ISO
mkdir bios
cp /home/user/Desktop/flashprog.exe /home/user/Desktop/bios-image /media/ISO/bios

The data added to the FreeDOS image will be saved when the ISO is unmounted:

sudo umount /media/ISO

Now return to the Desktop and convert the appended FreeDOS image to a bootable ISO:

mkisofs -r -b fdboot.img -c boot.cat -o fdboot-bios.iso fdboot.img

The -b option defines the floppy image used for booting; the -c option will create a boot.cat file that directs to fdboot.img and is necessary for booting; the -o option defines the output file, in this case a bootable iso; and finally the image file needs to be added.

Now burn the iso to the CD/DVD however you like. For example, from the command line:

cdrecord fdboot-bios.iso

Flash BIOS in Linux with Flashrom

Flashrom is a utility to directly flash the bios directly in Linux. It’s design to be a comprehensive utility and supports a good number of hardware devices. Above that, flashrom is easy to use. Check their page for compatibility, or install flashrom and see if it recognizes your chipset. I’d tell more but the flashrom website does a good job of telling about the utility.

Questions

Because BIOS sizes are getting larger, we may need to learn how to create larger bootable images. mkisofs mentions that is can create an El Torito (bootable) iso with either 1200 Kb, 1440 Kb, or 2880 Kb images. I know how to create an empty vfat image can be created with:

mkfs.msdos -C newimage.img 2880

And, of course, it can be mounted and the FreeDOS files can be copied there, but how could we make it bootable?

Resources

2 thoughts on “Updating BIOS with Linux

Leave a comment