This article describes how to apply a BIOS update on a Gentoo system.
Hardware manufactures often provide updates for BIOS and other types of firmware. To apply (often referred to as "flash") the updates is sometimes not straight forward on GNU/Linux systems. This occasionally requires some extra work.
If the hardware is operational there is often no need to upgrade the BIOS. If something goes wrong permanent damage may be caused to the BIOS or system firmware that may expire the hardware warranty. Proceed with caution!
- 1 Gather firmware information
- 2 BIOS option
- 3 Boot-CD
- 4 FreeDOS environment
- 5 Flashrom
- 6 See also
Gather firmware information
First find the motherboard's manufacturer and the model. Check the user manual that came with the system. Most of the needed information can be found in the user manual.
The sys-apps/dmidecode package can be used to retrieve additional information on system hardware. dmidecode looks at the motherboard's DMI table in order to provide richer details about the firmware and hardware components.
dmidecode -t bios -t baseboard
Lastly, if physical access to the motherboard is possible, the required information may be found directly on the motherboard itself.
Accessing the motherboard of a computer may cause loss of warranty!
After searching for the manufacturer's firmware update, proceed to download the package necessary to update the hardware. It is normal for a manufacturer to store firmware update packages in .zip, .exe, or .iso format.
Archive: 7235v1A.zip creating: 7235v1A/ inflating: 7235v1A/7235v1x.txt inflating: 7235v1A/AWFL865.EXE inflating: 7235v1A/How to flash the BIOS.DOC inflating: 7235v1A/W7235IMS.1A0
Many BIOSes have an option to read the new binary image from an external storage medium or from an internal disk. Enter the BIOS setup and look for the option. If the BIOS does not support this, continue with the next section.
Often the manufacturer offers a CD-ROM image to download as a boot medium. The file should have an .iso file extension which should be properly burned to an empty CD-R(W). One of the tools that supports this is cdrecord:
cdrecord is provided by two packages. Choose one of the following: app-cdr/cdrtools and app-cdr/cdrkit.
Choose from the BIOS boot menu to boot from CD and follow the instructions on the manufacturers website or in the user manual.
There is a convenient FreeDOS boot on the SystemRescueCD that works well for this and will save much effort, allowing readers to skip this section. See the note at the end of the Using SystemRescueCD to boot FreeDOS section for details.
FreeDOS can be used to run DOS-based BIOS update utilities. A "custom" FreeDOS image which includes the necessary BIOS tools must be created. After the custom image has been generated, boot the image via one of the methods shown below.
Download FreeDOS and tools:
- FreeDOS - Download the fdboot.img file.
- FreeDOS bootsector - Download the sys-freedos-linux.zip file.
- The DOS-Flash program and new BIOS from the manufacturers website.
Create a custom FreeDOS image
First download the required software and enable the loopback device in the kernel:
Device Drivers ---> [*] Block devices ---> <M> Loopback device support
If the module has not been loaded use modprobe to load it:
Install the required software:
emerge --ask dev-lang/nasm app-arch/unzip sys-fs/dosfstools
Create an image file of ~20MB using the dd command. The name needs to be freedos.img when replacing the one on the SystemRescueCD:
dd if=/dev/null of=freedos.img bs=1024 seek=20480
Write a file system to the image:
Write the boot sector to the image file:
unzip sys-freedos-linux.zip && ./sys-freedos.pl --disk=freedos.img
Now copy the FreeDOS files to the new image.
Create the mount points:
mkdir -p /mnt/freedos /mnt/freedos_new
Mount the original image:
mount -o loop fdboot.img /mnt/freedos
Mount the new image:
mount -o loop freedos.img /mnt/freedos_new
Copy the FreeDOS system files to the new image:
cp -ar /mnt/freedos/* /mnt/freedos_new/
Now copy the flash program and the new BIOS to the image file:
cp -ar FLASH-PROGRAM BIOS-UPDATE /mnt/freedos_new
Unmount both images:
umount /mnt/freedos_new /mnt/freedos
DOS can only display names up to a length of 8 characters. It is a good idea to rename some of the files if their filenames are longer than this limit.
Using SystemRescueCD to boot FreeDOS
The SystemRescueCD comes with a version of FreeDOS. This version can replace the original image and create a bootable memory stick which contains the needed programs to flash the firmware.
Download SystemRescueCD and prepare LiveUSB
- SystemRescueCD - Download the normal ISO image.
Create a bootable memory stick
Use the default method to create the SystemRescueCD boot medium, the script usb_inst.sh will provide guidance through the installation.
This will delete any data on the memory stick! Be sure all data has been properly backed up before using the memory stick for this task!
Create the folder in /mnt:
Mount the CD image:
mount -o loop systemrescuecd-x86-VERSION.iso /mnt/SysRescueCD
Start the installation script:
Unmount the CD image:
If you simply wish to update your BIOS, there is no need to tinker with the FreeDOS image on SystemRescueCD. After creating the bootable SystemRescueCD stick as described above mount the USB stick to a directory. Copy the BIOS update there. You are done! Boot on the USB stick and choose DOS tools ---> FREEDOS from the SystemRescueCD startup menu. You will find the DOS truncated name of your BIOS update file in the A: directory. If you don't see it try C:. I don't believe this harms the SystemRescueCD instance on the USB stick, but if it does it's easy enough to recreate when you are done.
Replace the FreeDOS image
It is time to replace the original FreeDOS image on the SystemRescueCD memory stick.
Mount the SystemRescueCD memory stick (/dev/sdX1 needs to be replaced by the device name of the memory stick):
mount /dev/sdX1 /mnt/SysRescueCD
Replace the freedos.img file:
cp freedos.img /mnt/SysRescueCD/bootdisk/
Unmount the SystemRescueCD memory stick:
Booting the FreeDOS image from GRUB directly
To boot FreeDOS without any external media use the memdisk tool from syslinux to allow grub (or another bootloader) to boot the FreeDOS image directly.
emerge --ask sys-boot/syslinux
Mount the /boot partition (if needed):
Copy the memdisk binary and the newly built FreeDOS image to /boot:
cp /usr/share/syslinux/memdisk /boot
cp freedos.img /boot
Edit /boot/grub/grub.conf and add an entry for FreeDOS:
title FreeDOS (BIOS update) kernel /boot/memdisk floppy initrd /boot/freedos.img
Restart and choose to boot from the USB memory stick or the new grub entry. When using SystemRescueCD, in the GRUB command line type:
This should boot into the new FreeDOS image. The DOS prompt should appear:
Now start the BIOS update by following the manufacturers instructions. Some useful commands in DOS:
- cd <dir>
- Change to the directory.
- List the files in the current directory.
- type [drive][path]filename
- Display the contents of a file.
Some motherboards can support flashing (via the sys-apps/flashrom package) directly from the system. In this case the only needed component is the BIOS image. Before continuing this path, first check the list of supported hardware.
If the hardware is supported, verify the new BIOS image:
flashrom -v W7235IMS.1A0
If everything checks out, then flash it:
flashrom -vw W7235IMS.1A0