Flashing a BIOS with FreeDOS and Grml via USB
Most BIOS update utilities for PCs expect to run in a DOS like environment. This page describes how to flash a BIOS, using Debian, FreeDOS, Grml Live Linux, and a USB stick, no matter what Operating System is installed, without using a Windows Operating System.
A USB stick allows the use of >1.2MB files in the FreeDOS image, where the traditional floppy based methods would not work. Many BIOS files and tools are bigger than can fit on a floppy image.
If the hardware works, there is often no need to flash the BIOS. If something goes wrong, this might cause permanent damage to your BIOS and you might lose your warranty. Flashing motherboard BIOS is a dangerous activity that can render your motherboard inoperable!
Identifying the motherboard
You should know your motherboard and have any necessary BIOS files available. If you have not identified your motherboard, you should do so now for reference and any potential troubleshooting later. Check any manuals that came with the computer.
You can also use the dmidecode package to retrieve some info:
# dmidecode -t bios -t baseboard
If you have physical access to the motherboard, you may find the required information directly on the motherboard itself.
Make a directory to work in and change into it:
# mkdir -p /tmp/bios/ # cd /tmp/bios/
Move or copy your BIOS update files into your working dir.
You need USB flash drive that can be completely overwritten. grml2usb should take care of any necessary formatting. Insert the stick, and it will be recognized in the /dev/ system, probably as /dev/sdb with primary partition /dev/sdb1 but this can vary based on your system config.
Note, we will assume that the USB stick is recognized as /dev/sdX with primary partition /dev/sdX1.
grml2usb for copying the downloaded Grml .iso to USB
qemu-kvm (optional) for testing the Grml/FreeDOS image
Install Grml to USB stick
# grml2usb grml96-full_2013.02.iso /dev/sdX1
Try man grml2usb or see http://grml.org/grml2usb/ for more information.
Insert BIOS update into the Grml FreeDOS image
After Grml is installed on a usb stick, mount it, e.g.
# mkdir -p /media/grml_usb # mount /dev/sdX1 /media/grml_usb
Next we need to unzip and mount the embedded FreeDOS image:
# gunzip </media/grml_usb/boot/addons/balder10.imz >balder10.img # mkdir balder10 # mount -o loop balder10.img balder10
Now, just copy any necessary BIOS update files into the mounted image:
# cp -a FLASH-PROGRAM BIOS-UPDATE balder10/
Unmount FreeDOS, re-zip it, and put it back on the USB stick:
# umount balder10 # cp /media/grml_usb/boot/addons/balder10.imz balder10.imz.bak # gzip <balder10.img >/media/grml_usb/boot/addons/balder10.imz
Test the FreeDOS image
Unmount the USB stick and test it with Qemu / KVM:
# umount /dev/sdX1 # kvm -hdb /dev/sdX
After booting Grml, select FreeDOS from the menu:
Addons => Run FreeDOS
If you see a message about 'cannot find command.com' then try:
# qemu-system-x86_64 -hda /dev/sdX
Boot into DOS / command.com and check that your BIOS files are present.
Perform the update
We can't flash the BIOS from within Qemu obviously. Now you can reboot from the Grml USB stick and flash your BIOS from FreeDOS running on the metal. You may need to press a key on boot to access the BIOS menu or a boot menu. When the motherboard powers on you ought to see a message about which buttons to press, or check your motherboard manual. Then you can boot into FreeDOS from the USB stick and run the BIOS update program.
Some useful commands in DOS:
change to the directory
list the files in the current directory
display the contents of a file
e.g. switch to the A drive
For Example, flashing a Foxconn H67S motherboard:
C:\> dir C:\> A: A:\> dir A:\> cd mebios\bios\ A:\> dir A:\> fpt -f C33F1P02.BIN -y