Sometimes it can be useful to dump PCI expansion ROMs for debugging and troubleshooting purposes. This page shows how to extract PCI expansion ROM contents.
Sysfs provides access to all PCI devices on a system (sysfs-pci.txt documentation). It is possible to map in expansion ROMs in order to dump their contents.
First select the PCI device you want to dump the ROM from:
# lspci -nn # this lists PCI devices and their bus IDs 00:00.0 Host bridge : Intel Corporation Mobile 915GM/PM/GMS/910GML Express Processor to DRAM Controller [8086:2590] (rev 04) 00:02.0 VGA compatible controller : Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller [8086:2592] (rev 04) [...]
Enable the expansion ROM for the device:
# cd /sys/bus/pci/devices/0000\:00\:02.0 # the VGA controller from above # echo 1 >rom
Dump the ROM contents:
# cp rom /tmp/rom_dump
An Alternate way to dump the ROM contents (the first way may truncate the ROM):
# dd if=rom of=/tmp/rom_dump
Disable the expansion ROM for the device:
# echo 0 >rom