My fun with SuperIO continues, and may be at the logical end. I’ve now added the required code to the
superio plugin to flash IT89xx embedded controllers. Most of the work was working out how to talk to the hardware on ports 0x62 and 0x66, although the flash “commands” are helpfully JEDEC compliant. The actual flashing process is the typical:
- Enter into a bootloader mode (which disables your keyboard, fans and battery reporting)
- Mark the internal EEPROM as writable
- Erase blocks of data
- Write blocks of data to the device
- Read back the blocks of data to verify the write
- Mark the internal EEPROM as read-only
- Return to runtime mode
There were a few slight hickups, in that when you read the data back from the device just one byte is predictably wrong, but nothing that can’t be worked around in software. Working around the wrong byte means we can verify the attestation checksum correctly.
Now, don’t try flashing your EC with random binaries. The binaries look unsigned, don’t appear to have any kind of checksum, and flashing the wrong binary to the wrong hardware has the failure mode of “no I/O devices appear at boot” so unless you have a hardware programmer handy it’s probably best to wait for an update from your OEM.
We also do the EC update from a special offline-update mode where nothing else than
fwupd is running, much like we do the system updates in Fedora. All this work was supported by the people at Star Labs, and now basically everything in the LapTop Mk3 is updatable in Linux. EC updates for Star Labs hardware should appear on the LVFS soon.