soc/intel/ptl: Update ME specification version to 21
[coreboot.git] / Documentation / tutorial / flashing_firmware / index.md
blob3063e4c3dd3edc4075efbcb617965063c33fbd6a
1 # Flashing firmware tutorial
3 Updating the firmware is possible using the **internal method**, where the updates
4 happen from a running system, or using the **external method**, where the system
5 is in a shut down state and an external programmer is attached to write into the
6 flash IC.
8 ## Contents
10 ```{toctree}
11 :maxdepth: 1
13 Flashing internally <int_flashrom.md>
14 Flashing firmware standalone <ext_standalone.md>
15 Flashing firmware externally supplying direct power <ext_power.md>
16 Flashing firmware externally without supplying direct power <no_ext_power.md>
17 ```
19 ## General advice
21 * It's recommended to only flash the BIOS region.
22 * Always verify the firmware image.
23 * If you flash externally and have transmission errors:
24   * Use short wires
25   * Reduce clock frequency
26   * Check power supply
27   * Make sure that there are no other bus masters (EC, ME, SoC, ...)
29 ## Internal method
31 This method using [flashrom] is available on many platforms, as long as they
32 aren't locked down.
34 There are various protection schemes that make it impossible to modify or
35 replace a firmware from a running system. coreboot allows to disable these
36 mechanisms, making it possible to overwrite (or update) the firmware from a
37 running system.
39 Usually you must use the **external method** once to install a retrofitted
40 coreboot and then you can use the **internal method** for future updates.
42 There are multiple ways to update the firmware:
43 * Using flashrom's *internal* programmer to directly write into the firmware
44   flash IC, running on the target machine itself
45 * A proprietary software to update the firmware, running on the target machine
46   itself
47 * A UEFI firmware update capsule
49 More details on flashrom's
50 ```{toctree}
51 :maxdepth: 1
53 internal programmer <int_flashrom.md>
54 ```
56 ## External method
58 External flashing is possible on many platforms, but requires disassembling
59 the target hardware. You need to buy a flash programmer, that
60 exposes the same interface as your flash IC (likely SPI).
62 Please also have a look at the mainboard-specific documentation for details.
64 After exposing the firmware flash IC, read the schematics and use one of the
65 possible methods:
67 ```{toctree}
68 :maxdepth: 1
70 Flashing firmware standalone <ext_standalone.md>
71 Flashing firmware externally supplying direct power <ext_power.md>
72 Flashing firmware externally without supplying direct power <no_ext_power.md>
73 ```
75 **WARNING:** Using the wrong method or accidentally using the wrong pinout might
76   permanently damage your hardware!
78 **WARNING:** Do not rely on dots *painted* on flash ICs to orient the pins!
79 Any dots painted on flash ICs may only indicate if they've been tested.  Dots
80 that appear in datasheets to indicate pin 1 correspond to some kind of physical
81 marker, such as a drilled hole, or one side being more flat than the other.
83 ## Using a layout file
84 On platforms where the flash IC is shared with other components you might want
85 to write only a part of the flash IC. On Intel for example there are IFD, ME and
86 GBE which don't need to be updated to install coreboot.
87 To make [flashrom] only write the *bios* region, leaving Intel ME and Intel IFD
88 untouched, you can use a layout file, which can be created with ifdtool and a backup
89 of the original firmware.
91 ```bash
92 ifdtool -f rom.layout backup.rom
93 ```
95 and looks similar to:
97 ```
98 00000000:00000fff fd
99 00500000:00bfffff bios
100 00003000:004fffff me
101 00001000:00002fff gbe
104 By specifying *-l* and *-i* [flashrom] writes a single region:
105 ```bash
106 flashrom -l rom.layout -i bios -w coreboot.rom -p <programmer>
109 ## Using an IFD to determine the layout
110 flashrom version 1.0 supports reading the layout from the IFD (first 4KiB of
111 the ROM). You don't need to manually specify a layout it, but it only works
112 under the following conditions:
114 * Only available on Intel ICH7+
115 * There's only one flash IC when flashing externally
117 ```bash
118 flashrom --ifd -i bios -w coreboot.rom -p <programmer>
121 **TODO** explain FMAP regions, normal/fallback mechanism, flash lock mechanisms
123 [flashrom]: https://www.flashrom.org/Flashrom