Testing Flashrom
From FGARWiki
Contents |
Testing Flashrom
All of these directions are meant for being followed in a terminal.
on Ubuntu, open Applications->Accessories->Terminal
Installing Flashrom
If you are loading this from Ubuntu the first time, use the following code.
- sudo apt-get install flashrom
If this is the second time loading flashrom and you are seeking to fix any problems with the newest version, download the newest version from the flashrom official page [1] sand extract to the home directory.
Open up a command line terminal. Input
- cd flashrom\
- ls
- cd <latest version number>
Next type
- apt-get install flashrom
If there are problems, try inputting
- sudo apt-get install dpkg-dev
- sudo apt-get source flashrom
- cd <most recently run flashronm>
- debuild
- sudo apt-get install devscripts
- debuild
- ":sudo apt-get install cdbs
- sudo apt-get install debhelper (>= 5)
- sudo apt-get instal libpci-dev
- sudo apt-get install libftdi-dev
- cd ..
- cd <newest version>
- make install
- sudo make install
Then open the directory where the new version built in and check the version to double check.
Checking for Flashrom Support
run flashrom, with no arguments to get a report of the support level the chipset in this machine has.
- sudo flashrom
you're looking for:
- a line that begins with "Found Chipset". This identifies the motherboard chipset that flashrom sees.
- a line that begins with "Found Chip". this identifies the flash chip that flashrom has detected in the machine.
Oddities
different parts have various levels of support in flashrom. if the chip you're using has operations that have been untested, you will see a large warning, in between some "triple equals" lines.
If ERASE is not yet verified
Run through the below operations, then performs the steps for reporting results back to flashrom.
If WRITE is not yet verified
Run through the below operations, then performs the steps for reporting results back to flash
Reading the ROM Contents
- sudo flashrom -r romfile.out
Verifying the read operation worked
First, lets make sure read created a file, and that it has a non-zero length.
- du -sk romfile.out
this should show a non-zero size in the first column (size of the rom in kilobytes), and the nakme of the rom file in the second column, like such:
256 romfile.bin
Next lets read through the romfile.out to see if theres any strings we recognize as being 'obviously part of a bios'.
- strings romfile.out
Just look through this for obvious bios strings, such as support for floppies, or boot sector stuff.
Erasing a ROM
WARNING: this clears the rom's contents, and if a board reboots after this, it will come up blank, if you do not write a new rom to it. THIS CAN DESTROY BOARDS!
- sudo flashrom -EV
Verifying an Erase
First, we need to read the now empty rom contents to a file, and verify that it is indeed empty.
To read the empty rom contents to a file:
- sudo flashrom -r emptyromfile.out
To verify the read generated a file:
- du -sk emptyromfile.out
To search for strings in this empty rom:
- strings emptyromfile.out
This last step should generate no output. If it does, something has gone horribly wrong.
Writing the Contents back to the Flash
- sudo flashrom -wV romfile.out
This should produce a lot of output, ending in 'SUCCESS' 'verifying flash... VERIFIED', and 'COMPLETE'. if you don't see those three phrases, again, something has gone horribly wrong.
Preparing Results for Flashrom
Flashrom needs the output of three commands run as root, and saved. they are:
- flashrom -V
- lspci -nnvvvxxx
- superiotool -deV
Collecting flashrom -V output
to collect the output of most unix commands, we merely have to redirect the output to a file, with the greater than symbol, so run:
- sudo flashrom -V > flashrom-V.out
This should create a file in your local directory called flashrom-V.out. to verify it is not empty:
- du -sk flashrom-V.out
Collecting lspci output
lspci is the utility that lists the PCI devices in your lachine (or AGP, or pci-x-133, or PCI-E, or...)
to collect its output, run the following command:
- sudo lspci -nnvvvxxx > lspci.out
Again, to verify the command generated a non-empty file, we'll use du.
- du -sk lspci.out
Collecting superiotool output
superiotool is not installed by default. to install it:
- sudo apt-get install superiotool
after installation, run superiotool, again saving the output using file redirection.
- sudo superiotool -deV > superiotool-deV.out
Collecting Oddities
If you were told to by the warning presented by flashrom's output, you may need to collect the output of a flashrom command.
Erase
If the erase command needs to be logged, re-verify you have a valid romfile.out, then run the erase in verbose mode, verify the erase, and re-install the rom contents.
To log the Erase Command:
- sudo flashrom -EV > flashrom-EV.out
To Restore the flashrom's contents:
- sudo flashrom -w romfile.out
Write
If the write command needs to be logged, re-verify you have a valid romfile.out, then run the write in verbose mode, verify the written data.
To log the Write Command:
- sudo flashrom -Vw romfile.out > flashrom-Vw.out
submitting results to flashrom
we need to submit any of the data collected to paste.flashrom.org, then submit the returned addresses to flashrom@flashrom.org.
First, open up all the above collected data files in gedit. from there, we're going to cut and paste the contents into the page at paste.flashrom.org
To open up in gedit:
- For if neither Write nor Erase needed to be logged:
gedit superiotool-deV.out lspci.out flashrom-V.out
- For if Erase needed to be logged:
gedit superiotool-deV.out lspci.out flashrom-EV.out flashrom-V.out
- For if Write needed to be logged:
gedit superiotool-deV.out lspci.out flashrom-Vw.out flashrom-V.out
- For if both Write and Erase needed to be logged:
gedit superiotool-deV.out lspci.out flashrom-Vw.out flashrom-V.out flashrom-EV.out
Then cut and paste each of these files with a brief description before it into the 'Program Output' pane. then hit the 'browse' button next to 'File Name', and select the 'romfile.out' rom image.
send these IDs to flashrom@flashrom.org