| 1 |
===================== |
| 2 |
Misc notes and advice |
| 3 |
===================== |
| 4 |
|
| 5 |
This document contains miscellaneous and unstructured (and mostly, legacy) notes and advice about using flashrom. |
| 6 |
|
| 7 |
Command set tricks for parallel and LPC chips |
| 8 |
============================================= |
| 9 |
|
| 10 |
This is only mentioned in very few datasheets, but it applies to some parallel (and some LPC) chips. |
| 11 |
|
| 12 |
Upper address bits of commands are ignored if they are not mentioned explicitly. If a datasheet specifies the following sequence:: |
| 13 |
|
| 14 |
chip_writeb(0xAA, bios + 0x555); |
| 15 |
chip_writeb(0x55, bios + 0x2AA); |
| 16 |
chip_writeb(0x90, bios + 0x555); |
| 17 |
|
| 18 |
then it is quite likely the following sequence will work as well:: |
| 19 |
|
| 20 |
chip_writeb(0xAA, bios + 0x5555); |
| 21 |
chip_writeb(0x55, bios + 0x2AAA); |
| 22 |
chip_writeb(0x90, bios + 0x5555); |
| 23 |
|
| 24 |
However, if the chip datasheet specifies addresses like ``0x5555``, you can't shorten them to ``0x555``. |
| 25 |
|
| 26 |
To summarize, replacing short addresses with long addresses usually works, but the other way round usually fails. |
| 27 |
|
| 28 |
flashrom doesn't work on my board, what can I do? |
| 29 |
================================================= |
| 30 |
|
| 31 |
* First of all, check if your chipset, ROM chip, and mainboard are supported |
| 32 |
(see :doc:`/supported_hw/index`). |
| 33 |
* If your board has a jumper for BIOS flash protection (check the manual), disable it. |
| 34 |
* Should your BIOS menu have a BIOS flash protection option, disable it. |
| 35 |
* If you run flashrom on Linux and see messages about ``/dev/mem``, see next section. |
| 36 |
* If you run flashrom on OpenBSD, you might need to obtain raw access permission by setting |
| 37 |
``securelevel = -1`` in ``/etc/rc.securelevel`` and rebooting, or rebooting into single user mode. |
| 38 |
|
| 39 |
What can I do about /dev/mem errors? |
| 40 |
==================================== |
| 41 |
|
| 42 |
* If flashrom tells you ``/dev/mem mmap failed: Operation not permitted``: |
| 43 |
|
| 44 |
* Most common at the time of writing is a Linux kernel option, ``CONFIG_IO_STRICT_DEVMEM``, |
| 45 |
that prevents even the root user from accessing hardware from user-space if the resource is unknown |
| 46 |
to the kernel or a conflicting kernel driver reserved it. On Intel systems, this is most often ``lpc_ich``, |
| 47 |
so ``modprobe -r lpc_ich`` can help. A more invasive solution is to try again after rebooting |
| 48 |
with ``iomem=relaxed`` in the kernel command line. |
| 49 |
|
| 50 |
* Some systems with incorrect memory reservations (e.g. E820 map) may have the same problem |
| 51 |
even with ``CONFIG_STRICT_DEVMEM``. In that case ``iomem=relaxed`` in the kernel command line may help too. |
| 52 |
|
| 53 |
* If it tells you ``/dev/mem mmap failed: Resource temporarily unavailable``: |
| 54 |
|
| 55 |
* This may be an issue with PAT (e.g. if the memory flashrom tries to map is already mapped |
| 56 |
in an incompatible mode). Try again after rebooting with nopat in the kernel command line. |
| 57 |
|
| 58 |
* If you see this message ``Can't mmap memory using /dev/mem: Invalid argument``: |
| 59 |
|
| 60 |
* Your flashrom is very old, better update it. If the issue persists, try the kernel options mentioned above. |
| 61 |
|
| 62 |
* Generally, if your version of flashrom is very old, an update might help. |
| 63 |
Flashrom has less strict requirements now and works on more systems without having to change the kernel. |
| 64 |
|
| 65 |
Connections |
| 66 |
=========== |
| 67 |
|
| 68 |
Using In-System programming requires some means to connect the external programmer to the flash chip. |
| 69 |
|
| 70 |
Note that some external flashers (like the Openmoko debug board) lack a connector, |
| 71 |
so they do requires some soldering to be used. Some other don't. For instance the buspirate has a pin connector on it. |
| 72 |
|
| 73 |
Programmer <-> Removable chip connection |
| 74 |
---------------------------------------- |
| 75 |
|
| 76 |
A breadboard can be used to connect Dual in-line 8 pins chips to the programmer, as they they fit well into it. |
| 77 |
|
| 78 |
Programmer <-> Clip connection |
| 79 |
------------------------------ |
| 80 |
|
| 81 |
If your programmer has a pin connector, and that you want to avoid soldering, you can use |
| 82 |
**Short** `Jump Wires <https://en.wikipedia.org/wiki/Jump_wire>`_ to connect it to a clip. |
| 83 |
They usually can be found on some electronic shops. |
| 84 |
|
| 85 |
Other issues |
| 86 |
------------- |
| 87 |
|
| 88 |
* Wires length and connection quality: Long wires, and bad connection can create some issues, so avoid them. |
| 89 |
|
| 90 |
* The maximum wires length is very dependent on your setup, so try to have the shortest wires possible. |
| 91 |
* If you can't avoid long wires and if you're flash chip is SPI, then lowering the SPI clock could make |
| 92 |
it work in some cases. Many programmers do support such option (Called spispeed with most of them, or divisor with ft2232_spi). |
| 93 |
|
| 94 |
* When soldering wires, the wire tend to break near the soldering point. To avoid such issue, |
| 95 |
you have to prevent the wires from bending near the soldering point. |
| 96 |
To do that `Heat-shrink_tubing <https://en.wikipedia.org/wiki/Heat-shrink_tubing>`_ or similar methods can be used. |
| 97 |
|
| 98 |
Common problems |
| 99 |
=============== |
| 100 |
|
| 101 |
The following describes problems commonly found when trying to access flash chips in systems |
| 102 |
that are not designed properly for this job, e.g. ad-hoc setups to flash in-system |
| 103 |
(TODO add a doc for in-system-specific problems). |
| 104 |
|
| 105 |
Symptoms indicating you may have at least one of these are for example inconsistent reads or probing results. |
| 106 |
This happens basically because the analog electrical waveforms representing the digital information |
| 107 |
get too distorted to by interpreted correctly all the time. Depending on the cause different steps can be tried. |
| 108 |
|
| 109 |
* Not all input pins are connected to the correct voltage level/output pin of the programmer. |
| 110 |
Always connect all input pins of ICs! |
| 111 |
|
| 112 |
* The easiest thing to try is lowering the (SPI) clock frequency if your programmer supports it. |
| 113 |
That way the waveforms have more time to settle before being sampled by the receiver which might be enough. |
| 114 |
Depending on the design of the driver and receiver as well as the actual communication path |
| 115 |
this might not change anything as well. |
| 116 |
|
| 117 |
* Wires are too long. Shortening them to a few cm (i.e. < 20, the lesser the better) might help. |
| 118 |
|
| 119 |
* The impedances of the wires/traces do not match the impedances of the input pins |
| 120 |
(of either the circuit/chip on the mainboard or the external programmer). |
| 121 |
Try using shorter wires, adding small (<100 Ohm) series resistors or parallel capacitors (<20pF) |
| 122 |
as near as possible to the input pins (this includes also the MISO line which ends near the programmer)\ |
| 123 |
and/or ask someone who has experience with high frequency electronics. |
| 124 |
|
| 125 |
* The supply voltage of the flash chip is not stable enough. Try adding a 0.1 µF - 1 µF (ceramic) capacitor |
| 126 |
between the flash chip's VCC and GND pins as near as possible to the chip. |
| 127 |
|
| 128 |
Live CD |
| 129 |
========= |
| 130 |
|
| 131 |
A Live CD containing flashrom provides a user with a stable work environment to read, write and verify a flash device on any supported hardware. |
| 132 |
|
| 133 |
It can help avoid Linux installation issues, which can be a hassle for some users. |
| 134 |
|
| 135 |
flashrom is already shipped in some of the Live CDs, see below. *Please note, some of these ship very old versions of flashrom*. |
| 136 |
|
| 137 |
* `SystemRescueCd <http://www.sysresccd.org/>`_ has been including flashrom since about version 2.5.1. |
| 138 |
|
| 139 |
* `grml <http://grml.org/>`_ |
| 140 |
|
| 141 |
* Note: You need the full grml ISO, "small" (and "medium") ISOs do not contain flashrom. |
| 142 |
* Note: Some releases (e.g. 2011.12) did not contain flashrom. |
| 143 |
|
| 144 |
* `Parted Magic <http://partedmagic.com/>`_ |
| 145 |
|
| 146 |
* `Hiren's BootCD <http://www.hirensbootcd.org/>`_ |
| 147 |
|
| 148 |
* When you select "Linux based rescue environment (Parted Magic 6.7)" and then "Live with default settings", |
| 149 |
you have access to a system which has flashrom. |