Dumping a Video BIOS

A video BIOS may contain x86 binary code, binary scripts and several data tables, which describe the hardware. Portable drivers need to parse the scripts and tables to drive the hardware correctly. Therefore driver developers sometimes would like to look into BIOSes from different cards.

There are several options on how to dump the BIOS:

  • vbtracetool: http://cgit.freedesktop.org/~stuart/vbtracetool/
    • Vbtracetool can do more than just dump the BIOS, and is the recommended method. You can get it with git: git clone git://people.freedesktop.org/~stuart/vbtracetool and then follow the QUICKSTART.
  • using /sys: echo 1 > /sys/bus/pci/devices/<pciid>/rom; cat /sys/bus/pci/devices/<pciid>/rom > vbios.rom; echo 0 > /sys/bus/pci/devices/<pciid>/rom
  • using a dd incantation: dd if=/dev/mem of=vbios.rom bs=1k skip=768 count=64
    • This can result in a damaged BIOS dump unfortunately, due to possible mangling when the system BIOS copies the video BIOS in shadow RAM.
  • nvclock: http://www.linuxhardware.org/nvclock/
  • nvagetbios: https://github.com/envytools/envytools/blob/master/nva/nvagetbios.c
  • using any nouveau module after 2.6.34 (commit):
    • cat /sys/kernel/debug/dri/0/vbios.rom > vbios.rom Note: assuming that you have debugfs mounted on "/sys/kernel/debug"

On powerpc machines, the video BIOS can be retrieved from Open Firmware:

  • find the file with: grep -r "IBM VGA Compatible" /proc/device-tree/
  • copy it to a convenient location, using the path obtained above. For example on a 12" powerbook this is most likely: cp "/proc/device-tree/pci@f0000000/NVDA,Parent@10/NVDA,BMP" ~/vbios.rom

Make sure you have a file of roughly 65kB in size (it may be smaller on older cards). If it's only a few bytes (or even worse, empty) the dump probably failed.