On Sun, Dec 17, 2023 at 7:37 PM James Feeney <james@nurealm.net> wrote:
> Since my MrChromebox firmware does not use vboot, I have ported the EC-RW firmware update code from vboot to coreboot, and check if an EC-RW update is needed on each boot as part of EC init in ramstage. This code is in my tree on github for inspection.

Well, there are over 100 files named "ramstage.c" in the github repository.

it's not in a file named ramstage; I was simply mentioning where it occurred in the boot process, which is different than in Google-built images

https://github.com/MrChromebox/coreboot/commit/9f780d35a7bb029a27d96e44f7fe0797eecf5143
 

Do I understand correctly that the MrChromebox firmware generated will have a custom ramstage, different from the stock coreboot ramstage, just to check if an EC-RW update is needed? Coreboot would not typically try to do that?

completely. My tree has over 100 commits in addition to the upstream tag on which it is based. The addition of the EC firmware update is just one of many.

coreboot does not update the EC firmware, because it's a function of vboot and Google's payload (depthcharge).
 

> It's not necessary to build your own EC-RW firmware or even update it unless there's a specific issue you're trying to resolve.

But still, to play-around with different payloads, using mostly stock coreboot, the EC firmware could just be completely left out of the coreboot ROM image?

absolutely. If you're building from upstream coreboot, the RO EC firmware will be used. if building from my tree, then the RW firmware will be used (regardless if it is updated or not)
 

And, if I still needed to update the EC firmware, I could use the Google flashrom fork, as in the Google example, just: flashrom -p internal:bus=lpc -w ec.bin ?

not necessarily. You'd need a version of flashrom which supports EC firmware updates (it's actually being removed / may have been removed), kernel permissions which allow it, an EC that's actually on the LPC bus (vs eSPI). And you wouldn't want to write the entire EC firmware as in the command above, you'd only want to update the RW portion. And you'd want to have a mechanism to not boot the RW firmware automatically in case your update failed, or in case it succeeded and the firmware was bad.