Files
system76-embedded-controller/docs/flashing.md
Tim Crawford 70c8678a5f tool: Add error for write locked
Add a new error for the case of trying to flash when security is enabled
and it is still locked and update the related docs.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2024-07-15 11:49:32 -06:00

77 lines
2.1 KiB
Markdown

# Flashing firmware
## UEFI application
The `flash.sh` script from the top-level firmware-open project will use
firmware-update, the UEFI application which is used for normal system updates.
This will flash both the SBIOS and the EC after building the firmware. To
flash just the EC, delete the built `firmware.rom` before running `flash.sh`.
## Internal programmer
Use this method for flashing a system already running System76 EC.
This method will only work if the running firmware is not locked. Firmware is
write locked if it was built with `CONFIG_SECURITY=y`. The firmware can be
unlocked using ectool for a single boot:
```
./scripts/ectool.sh security unlock
```
This method will trigger a watchdog reset causing the system to **immediately
power off**. OS data may be lost or corrupted as a result. Save and close all
applications before flashing.
```
make BOARD=<vendor>/<model> flash_internal
```
## External programmer
Use this method for:
- flashing from proprietary firmware to System76 EC firmware
- flashing without risking loss of OS data
- flashing a bricked controller
This requires:
- [A configured Mega 2560](./mega2560.md): For programming the EC itself
- A USB cable: For creating a common ground and providing power
- USB-C is recommended, but USB-A will work as well
- A second computer: For building and flashing the firmware
**The system must not have any power!**
1. Turn off the laptop
2. Unplug the AC adapter
3. Remove the bottom panel
4. Disconnect the battery
5. Disconnect the keyboard from its port
6. Replace the bottom panel and flip the laptop back over
7. Connect the USB cable from the laptop to the host machine
8. Connect the Mega 2560 to the host machine
9. Attach the programmer to the keyboard port
10. Flash the firmware
```
make BOARD=<vendor>/<model> flash_external
```
One of the first things it does is read the EC ID and version. If working, the
ID will be the EC model the machine uses.
```
ID: 5570 VER: 2
ID: 8587 VER: 6
```
Any other values means that the Mega 2560 is misconfigured or the FPC is not
seated correctly. E.g., this is wrong:
```
ID: FF7F VER: 127
```