Hey folks,
during review of commits that port per-region file arguments [1] from CrOS flashrom over here, we ran into a discussion about the command line interface changes. The basic question that arose is
Do we want to maintain full CLI compatibility to CrOS flashrom?
This would have the upside, that it would ease remerging of the two flashrom versions (in some unknown future). And anybody currently using CrOS flashrom could transition more smoothly. OTOH, depending on how the compatibility is achieved, it might increase the costs for review and development heavily (for a project with 0 spare resources).
To not have to discuss this each and every time when some non-trivial feature is ported over from CrOS, I'd like to have some opinions, how valuable CLI compatibility is to you all and how we want to achieve it. I have currently some alternative ideas in mind that I'll sketch below. Feel free to add other ideas or just to comment them.
1) Integrate CLI changes from CrOS into flashrom proper's CLI.
This turned out to be much harder than one might initially think: For the mentioned patches, it means that a lot of additional deve- lopment has to happen: * Restore internal behaviour in flashrom that became incompatible. * Add appropriate sanity checks for the arguments passed (yes, flashrom proper does such). * Discuss and review the additional code, too. It also restricts us to the design choices already made for CrOS flashrom and makes our review process kind of mindless.
It does, however, get the job done, and everybody could just run `make` and wouldn't have to care if he's using one version of flashrom or the other.
2) Design our own interface for flashrom proper, but keep internal compatibility for an alternate CLI.
It would allow us to make our own design choices at the interface level. A steady implementation might be much easier to accomplish if we keep things simple.
Somebody would have to maintain an additional, CrOS compatible CLI.
We could be more lax regarding to sanity checks in the alternate CLI, to speed up development.
But, everybody already familiar with the CrOS flashrom CLI might get confused until he finds the alternative CLI.
3) Design our own implementation; provide compatibility with a wrapper script.
The basic function of flashrom should be clear: read, write or verify the contents of a flash chip. Everything else (like com- bining multiple files in complex ways) shouldn't add unnecessary complexity to flashrom, and can likely be done in cleaner ways with other tools. In other words, we could try to keep flashrom more like a UNIX tool.
IMHO, this would allow us to get new features in faster. If some- body sees a better way to implement a feature, we can just do it.
Writing a wrapper script seems much easier too me than main- taining compatibility and safety in an unnecessary complex C program.
Same as 2), people used to the other interface would have to learn a new one (or use the wrapper).
So please let me know what you think, folks ;)
Nico
[1] 23021, 23022 and related 23353 in https://review.coreboot.org/
On Wed, Jan 24, 2018 at 10:36 AM, Nico Huber nico.h@gmx.de wrote:
Hey folks,
during review of commits that port per-region file arguments [1] from CrOS flashrom over here, we ran into a discussion about the command line interface changes. The basic question that arose is
Do we want to maintain full CLI compatibility to CrOS flashrom?
This would have the upside, that it would ease remerging of the two flashrom versions (in some unknown future). And anybody currently using CrOS flashrom could transition more smoothly. OTOH, depending on how the compatibility is achieved, it might increase the costs for review and development heavily (for a project with 0 spare resources).
To not have to discuss this each and every time when some non-trivial feature is ported over from CrOS, I'd like to have some opinions, how valuable CLI compatibility is to you all and how we want to achieve it. I have currently some alternative ideas in mind that I'll sketch below. Feel free to add other ideas or just to comment them.
Option #2 seems pretty good IMHO. I suspect that CrOS will need to maintain their legacy behavior for a while longer, but that does not need to hold back upstream. We should of course improve our testing to avoid breaking one or the other, at least without sufficient reason and time to adjust.
Some background on this: CrOS currently maintains a separate CLI in their tree, cli_mfg.c, specifically because the upstream CLI was not well-suited for their manufacturing needs. Things like syntax changes, additional options, verbosity, error handling, etc. were simply different from what typical users expect. The partial read/write/verify syntax was developed to meet specific needs of the manufacturing flow, and the write-protection syntax was added specifically to address the way write-protection works on Chromebooks. Stuff like "combining multiple files" was done to avoid wasting valuable time on the assembly line and at runtime during normal OS maintenance (yes, seconds really do matter).
I'd still like to see CrOS converge with upstream so we share development and testing efforts. It would also be great to have more device manufacturers working with upstream. Having an alternate CLI coexist alongside the "classic" CLI seems like a decent compromise IMO. Both sides will benefit from a converged codebase, let's not make the CLI a blocking issue.