You can use flashrom to update the BIOS of a motherboard.
Example (Abit KN9 Ultra):
The board is AMD Athlon 64 board, AM2 Socket, Nvidia chipset, released from 2006. It has a 256 KB flash chip that is replaceable. The BIOS is labeled with 'Award', which seems to be trademark of Phoenix.
Flashrom supports that chipset and that flash chip.
The support can be tested with a command like:
# flashrom --programmer internal
Calibrating delay loop... OK.
Found chipset "NVIDIA MCP55".
Enabling flash write... OK.
Enabling full flash access for board "abit KN9 Ultra"... OK.
Found PMC flash chip "Pm49FL004" (512 kB, LPC, FWH) mapped at physical address 0x00000000fff80000.
It makes sense to backup the current contents of the flash chip, first:
# flashrom --programmer internal -c Pm49FL004 -r backup.bin
It then can be compared to a vanilla image file from the vendor (using e.g. xxd
and vimdiff
).
Some differences are expected - because some BIOS' also store additional information (e.g. DMI) and configuration (e.g. MAC addresses) in the flash. This is also the case with the Abit KN9 Ultra. The DMI data is stored in the first 1872 bytes - and is easily re-generated by the BIOS during boot. The MAC addresses are stored at offset 0x74E30.
The vendor firmware files are packaged in zip archive that contains awdflash.exe
and a BIN
file, e.g. M520A_23.BIN
. In this example, the bin file contains the BIOS image as-is, i.e. it can be directly written do the flash chip with a command like:
# flashrom --programmer internal -c Pm49FL004 -w M520A_23.BIN
Calibrating delay loop... OK.
Found chipset "NVIDIA MCP55".
Enabling flash write... OK.
Enabling full flash access for board "abit KN9 Ultra"... OK.
Found PMC flash chip "Pm49FL004" (512 kB, LPC, FWH) mapped at physical address 0x00000000fff80000.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.
Depending on the update, it might be necessary to clear the CMOS for the next reboot - otherwise the BIOS might not start up. On that board the CMOS can be cleared via a jumper setting. Clearing via software is also possible (e.g. via CmosPwd).
For keeping unique default MAC addresses, the new vendor image can be patched before flashing, e.g.:
dd if=backup.bin of=mac.bin bs=1 count=16 skip=$(echo 16 i 74E30 p | dc)
dd if=mac.bin of=M520A_23_with_mac.bin bs=1 seek=$(echo 16 i 74E30 p | dc) \
conv=notrunc
Pitfalls:
- The flash writing may fail due to a motherboard specific board enable (i.e. for disabling write protect) code that is not implemented by flashrom, yet.