linuxboot / heads

A minimal Linux that runs as a coreboot or LinuxBoot ROM payload to provide a secure, flexible boot environment for laptops, workstations and servers.
https://osresearch.net/
GNU General Public License v2.0
1.4k stars 180 forks source link

nv41/ns50 : How to update EC firmware #1639

Open tlaurion opened 2 months ago

tlaurion commented 2 months ago

Edit: how to update EC to be in sync with firmware version?

~flashrom needs to support ite_ec programmer to be able to flash ec firmware internally on nv41~ edit: flashrom only supports proprietary protocol to talk to EC prior of switching to open source version. This strategy wouldn't work. Clarified in next comments. Firmware will contain EC and coreboot will sync EC to its contained version.

To be followed : https://github.com/linuxboot/heads/issues/1639#issuecomment-2059884079

SRC: https://docs.dasharo.com/unified/novacustom/initial-deployment/#installing-dasharo

tlaurion commented 2 months ago

If ideal goal forward is to be able to also flash EC firmware through fwupd, then

First step is to have flashrom under heads able to talk to ec spi: this is ite_ec programmer support, not present under currently used flashrom versions.

@marmarek @pietrushnic am I missing something on the strategy level?

macpijan commented 2 months ago

flashrom needs to support ite_ec programmer to be able to flash ec firmware internally on nv41 SRC: https://docs.dasharo.com/unified/novacustom/initial-deployment/#installing-dasharo

Unfortunately it is more convoluted. The flasrom ite_ec programer works with proprietary EC firmware only. So it allows us to transition from proprietary to open-source EC firmware. But from this point on, flashrom ite_ec plugin is pretty much useless unfortunately, as the system76ec we base on uses different update protocol than the proprietary one.

In order to update the open-sorce EC version, you need the system76_ectool which is in Rust and will probably occupy too much space when integrated into heads: https://github.com/Dasharo/ec/tree/master/tool/src

macpijan commented 2 months ago

We have a bit different proposal from @mkopec here: https://github.com/Dasharo/coreboot/pull/481

The EC firmware to be updated shall be stored in the coreboot binary. Then, the coreboot itself will sync (update) the firmware from main flash into EC flash. So no need for ite_ec or any other external tools, as the EC update protocol is implemented in coreboot, so that the coreboot and EC can be always in sync. This should work the same, regardless of the payload (heads or edk2).

tlaurion commented 2 months ago

Renamed issue on goal, not on its strategy

tlaurion commented 2 months ago

@macpijan needed under https://github.com/linuxboot/heads/issues/1647

fhvyhjriur commented 2 months ago

The topic here looks general about EC update. Is this also about thinkpad EC? There its known for people to realize at some point, that new OEM batteries are not really available and they need to patch the EC for the replacement battery they got. Also there are issues if you have not updated the lenovo bios ever before and the outdated EC from the first lenovo bios releases is known to make problems with coreboot. The most common way to make a thinkpad ready for flashing coreboot is this project here: https://github.com/hamishcoleman/thinkpad-ec If you missed this step before flashing coreboot, in general you are stuck at reflashing the lenovo OEM bios file and then lock your SPI again. And then you have again to open up your device once again and redo everything or you have to learn how to remove the write protection in the OEM Lenovo image before writing it to the SPI and this is really terrible documented.

To be able to flash inside heads the EC of the Thinkpad would be some great improvement. If you for example decide ever later to use a x20 keyboard in a x30 Thinkpad you can just change the EC with heads.

tlaurion commented 2 months ago

The topic here looks general about EC update. Is this also about thinkpad EC? There its known for people to realize at some point, that new OEM batteries are not really available and they need to patch the EC for the replacement battery they got.

Right. Unfortunately, this doesn't apply to Lenovo. I changed the title.

Also there are issues if you have not updated the lenovo bios ever before and the outdated EC from the first lenovo bios releases is known to make problems with coreboot. The most common way to make a thinkpad ready for flashing coreboot is this project here: https://github.com/hamishcoleman/thinkpad-ec

1vyprep is another way to do this AFAIK. Should be in wiki.

If you missed this step before flashing coreboot, in general you are stuck at reflashing the lenovo OEM bios file and then lock your SPI again. And then you have again to open up your device once again and redo everything or you have to learn how to remove the write protection in the OEM Lenovo image before writing it to the SPI and this is really terrible documented.

To be able to flash inside heads the EC of the Thinkpad would be some great improvement. If you for example decide ever later to use a x20 keyboard in a x30 Thinkpad you can just change the EC with heads.