Flashing a BIOS with FreeDOS and Grml
This allows the use of >1.2MB files in the FreeDOS image, where other methods would not work with files >1.2MB. Most 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
First you should find the motherboard's manufacturer and the model. Check the user's Manual that comes with your computer, usually there you'll find all needed information.
You can also use the dmidecode package to retrieve some info:
# dmidecode -t bios -t baseboard
Lastly, 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/
You can use FreeDOS to run the DOS-based BIOS utility from your manufacturer. You must first create a custom FreeDOS image which includes the necessary BIOS tools, and then boot this image via Grml.
Download FreeDOS and tools
FreeDOS - download the fdboot.img file
FreeDOS bootsector - download the file sys-freedos-linux.zip
- The DOS-Flash program and new BIOS from your motherboard's manufacturers website
Create a custom FreeDOS image
# aptitude install dosfstools nasm unzip
Create an image file of ~20MB using dd:
# dd if=/dev/null of=freedos.img bs=1024 seek=20480
Write a file system to the image:
# mkfs.msdos freedos.img
Write the bootsector to the image file:
# unzip sys-freedos-linux.zip && ./sys-freedos.pl --disk=freedos.img
Now we need to copy the FreeDOS files to our new image. Create the mount-points:
# mkdir freedos freedos-new
Mount the original image:
# mount -o loop fdboot.img freedos/
Mount the new image:
# mount -o loop freedos.img freedos-new/
Copy the FreeDOS system files to our new image:
# cp -a freedos/* freedos-new/
Now you should also copy your flash program and the new BIOS to the image file:
# cp -a FLASH-PROGRAM BIOS-UPDATE freedos-new/
List freedos-new to make sure the files are there:
# ls -la freedos-new/
Unmount both images:
# umount /tmp/bios/freedos/ /tmp/bios/freedos-new/
Using Grml on a usb stick to boot FreeDOS
Download a Grml iso.
Although it is possible to copy the Grml ISO directly:
# dd if=grml96-full_2013.02.iso of=/dev/sdX
..this is not suitable for our purposes, since the iso9660 filesystem which is created can only be mounted read-only, and we require read-write access to copy in extra files. NOTE: also ANY existing data on your USB device will be destroyed when using the dd approach.
Instead, use the grml2usb package to install Grml to a usb stick:
# grml2usb grml96-full_2013.02.iso /dev/sdX1
- Where /dev/sdX1 is a partition on your USB device.
For more information on grml2usb, usage and FAQ:
$ man grml2usb
Also available at the grml2usb page.
After Grml is installed on a usb stick and mounted, copy the freedos.img to Grml:
# cp freedos.img /media/usb0/boot/addons/
Now backup the Grml FreeDOS version:
# cd /media/usb0/boot/addons/ # mv balder10.imz balder10.imz.org
Use gzip to create a balder10.imz file using the freedos.img we created earlier:
# gzip <freedos.img >balder10.imz
Optionally now test with kvm:
$ kvm -hdb /dev/sdX
After booting Grml, select FreeDOS from the menu:
Addons => Run FreeDOS
2. FreeDOS Safe Mode (don't load any drivers)
If you see a message about 'cannot find command.com' then try instead:
$ qemu-system-x86_64 -hda /dev/sdX
Check that the BIOS files are present. Now you can reboot and flash your BIOS by using the Grml usb stick. You will 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:
cd <dir> change to the directory dir list the files in the current directory type display the contents of a file
For Example, flashing a Foxconn H67S motherboard:
A:\dir A:\cd mebios\bios\ A:\dir A:\fpt -f C33F1P02.BIN -y
When done flashing the BIOS. Mount the Grml usb stick, remove freedos.img and balder10.imz. Move balder10.imz.org back to balder10.imz:
# cd /media/usb0/boot/addons/
# rm freedos.img balder10.imz
# mv balder10.imz.org balder10.imz
- Flashing a BIOS with FreeDOS and Grml, was adapted from: