heads icon indicating copy to clipboard operation
heads copied to clipboard

Bring dasharo+heads MSI boards from downstream Dasharo/heads to upstream

Open tlaurion opened this issue 1 year ago • 56 comments

  • files: boards + coreboot + linux, borrowed directly from https://github.com/Dasharo/heads/commit/cb430394e289fcfdaace8123aed4f76148041759 tip
  • cbfs-init modified as per downstream fork dasharo+heads used modifications (flashrom)
  • ash_functions modified as per downstream fork dasharo+heads used modifications (CBFS)
  • network-init-recovery modified as per downstream fork dasharo+heads used modifications (igc)
  • modules/linux modified as per downstream fork dasharo+heads used modifications (igc)
  • modules/coreboot modified as per downstream fork dasharo+heads used modifications (also impact nv41/ns50: coreboot version bump)
  • modules/flashrom modified to user flashrom 1.4 + https://review.coreboot.org/c/flashrom/+/83854
  • Circleci: added boards being dependent of nv41

NOTES:

  • This requires Nk3 firmware to be 1.7.1+
  • Requires external programmer in case of bricking, untested and not owning the platforms.
  • dGPU support known problematic
  • kgpe-d16 patch that was still under master was unapplied on master (permitting to flash openbmc from Heads)

DISCLAIMER: UNTESTED Sorry, not gonna cherry-pick commits from dahsharo/heads here, way too messy.


after merge, WILL superseed https://github.com/linuxboot/heads/pull/1489 abandonned effort.


TODO:

  • [x] kgpe-d16 misses a working patch for internal flashing? In this PR, unapplied patch deleted. issue #1753 created

OLD ~DO NOT FLASH YET IF NO EXTERNAL PROGRAMMER. THIS VERSION BUMP FLASHROM SO FLASHING MASTER FROM THIS IS NEEDED~ Edit: fixed with #1755 commit cherry-picked.

tlaurion avatar Aug 09 '24 13:08 tlaurion

@macpijan and others: not sure what this CONFIG_CBFS_VIA_FLASHROM in board configs is about as of now, most probably this PR totally invalid as of now, have not followed that white rabbit yet.

tlaurion avatar Aug 09 '24 13:08 tlaurion

@macpijan and others: not sure what this CONFIG_CBFS_VIA_FLASHROM in board configs is about as of now, most probably this PR totally invalid as of now, have not followed that white rabbit yet.

1- @macpijan : commit log should be clear enough: Please validate this matches all required changes downstream please. 2- Also, can you tell why/what version of flashrom this is based on? 1.3.0+ with all WP + needed chipsets/spi chips needed? Is this expected to create regression on other boards support?

tlaurion avatar Aug 09 '24 13:08 tlaurion

@macpijan I see this contains a coreboot version bump impacting nv41/ns50/MSI.

tlaurion avatar Aug 09 '24 14:08 tlaurion

I think I picked all files based changes from https://github.com/linuxboot/heads/compare/master...Dasharo:heads:master visual queues, without rebasing nor cherry-picking, simply applying changes directly in files

Not gentle reminder, but requirement: changes should be proposed upstream, not forced like that or for upstream to pick up, even less when security vuln lingering

tlaurion avatar Aug 09 '24 14:08 tlaurion

2- Also, can you tell why/what version of flashrom this is based on?

The flashrom fork is based from this version: https://github.com/flashrom/flashrom/commit/053d319141db5954ab1ad34cb9db61983d238134

with added:

  • support for ITE EC running closed source firmware (irrelevant)
  • miscellaneous improvements for APU2 (irrelevant)
  • fixes for yocto? @macpijan if you could confirm.
  • RaptorPoint PCH support (relevant for MSI Z790)

mkopec avatar Aug 09 '24 14:08 mkopec

@macpijan updated op with commit logs sourced info, need comment on those changes and insights on impacts for other boards, most specifically:

  • coreboot version bump: nv41/ns50 tested for regressions?
  • flashrom: regressionss expected for other Heads supported boards: version based? Do we finally have a --progress bar? What's in it?

tlaurion avatar Aug 09 '24 14:08 tlaurion

@JonathonHall-Purism would need your eyes on this too, including regression testing for your boards since flashrom version bump

tlaurion avatar Aug 09 '24 14:08 tlaurion

053d319

So flashrom 1.3.0-rc1 + patches, dating from upstream commit of ~2 years ago (cc @mkopec)

commit 053d319141db5954ab1ad34cb9db61983d238134 Author: Edward O'Callaghan [email protected] Date: Fri Aug 12 21:27:41 2022 +1000

@JonathonHall-Purism: is this a problem? Seems like we could hit regressions here... Heads master was more recent.

@mkopec patches were not merged upstream in 1.4.0 now released? @macpijan ?

tlaurion avatar Aug 09 '24 14:08 tlaurion

053d319

So flashrom 1.3.0-rc1 + patches, dating from upstream commit of ~2 years ago (cc @mkopec)

commit 053d319141db5954ab1ad34cb9db61983d238134 Author: Edward O'Callaghan [email protected] Date: Fri Aug 12 21:27:41 2022 +1000

@JonathonHall-Purism: is this a problem? Seems like we could hit regressions here... Heads master was more recent.

@mkopec patches were not merged upstream in 1.4.0 now released? @macpijan ?

1.4.0 was released 2 weeks ago https://github.com/flashrom/flashrom/releases/tag/v1.4.0

@mkopec @macpijan is everything you need under 1.4.0? See https://github.com/flashrom/flashrom/compare/053d319...eace095

tlaurion avatar Aug 09 '24 14:08 tlaurion

@mkopec @macpijan is everything you need under 1.4.0?

I think the https://github.com/Dasharo/flashrom/commit/24b8fcfccef31fbb95bc1dd308180f57d5cdb64c will be missing. I cannot see it being submitted into upstream, can you confirm @miczyg1 ?

macpijan avatar Aug 09 '24 14:08 macpijan

@mkopec @macpijan is everything you need under 1.4.0?

I think the Dasharo/flashrom@24b8fcf will be missing. I cannot see it being submitted into upstream, can you confirm @miczyg1 ?

I think it is not in upstream flashrom (I believe we didn't even send a patch)

miczyg1 avatar Aug 09 '24 14:08 miczyg1

@mkopec @macpijan is everything you need under 1.4.0?

I think the Dasharo/flashrom@24b8fcf will be missing. I cannot see it being submitted into upstream, can you confirm @miczyg1 ?

I think it is not in upstream flashrom (I believe we didn't even send a patch)

@miczyg1 thats problematic. Bumped to 1.4.0 at 445d70f will try to put your unupstreamed patch into a Head patch. There is no way Head can regress to 2 years ago flashrom version since other stakeholders need flashrom too.

tlaurion avatar Aug 09 '24 14:08 tlaurion

@tlaurion Updated patch: https://github.com/Dasharo/flashrom/commit/7db77d39ae951cfd36765a91f6537377be34dad2

https://review.coreboot.org/c/flashrom/+/83854

macpijan avatar Aug 09 '24 14:08 macpijan

@tlaurion Updated patch: Dasharo/flashrom@7db77d3

https://review.coreboot.org/c/flashrom/+/83854

EDITED: @macpijan fails to build see https://github.com/linuxboot/heads/pull/1753/commits/e8aaaabf43acd9aaba42bed317c82e86d647ddca

EDITED2: @miczyg1 patch won't build see above

tlaurion avatar Aug 09 '24 15:08 tlaurion

Another rev (the same link: https://review.coreboot.org/c/flashrom/+/83854) builds, tested to probe the chip on MSI.

macpijan avatar Aug 09 '24 15:08 macpijan

@macpijan please review ab74127

tlaurion avatar Aug 09 '24 16:08 tlaurion

@macpijan please review ab74127

Reviewed, could not spot any obvious problems in the configs ordering.

DDR5 board names have changed. @macpijan that's ok?

tlaurion avatar Aug 09 '24 16:08 tlaurion

Regression testing with ab74127 built roms at https://app.circleci.com/pipelines/github/tlaurion/heads/2740/workflows/d9fabdea-65e1-4fa4-81a0-94a56a8a6aee for:

  • [ ] x230-hotp-maximized internal flashing to older version from this PR version
  • [ ] nv41 internal flashing to older version from this PR version
  • [ ] librems

Needs testers to add to #692 otherwise these boards won't stay long as tested and will move to untested and unmaintained see https://github.com/linuxboot/heads/tree/master/unmaintained_boards:

  • [ ] msi_z690a_ddr4
  • [ ] msi_z690a_ddr5
  • [ ] msi_z790p_ddr4
  • [ ] msi_z790p_ddr5

Board testers need to be added under https://github.com/linuxboot/heads/blob/master/BOARD_TESTERS.md PRIOR OF MERGE OF THIS PR

tlaurion avatar Aug 09 '24 16:08 tlaurion

Seems like https://github.com/Dasharo/flashrom/commit/6b2061bc0699202f81aeb782f301f1bba9f8a826 is missing from flashrom master, breaking Heads progress output hack since --progress still missing from flashrom....

Flashrom progress stuck at 0% when flashing internally to another rom from this PR, behavior exactly as under https://github.com/Dasharo/flashrom/pull/11#issuecomment-1409142374

Putting PR as draft again...

tlaurion avatar Aug 11 '24 04:08 tlaurion

This is not enough: internal flashing to another ROM from this PR + current added patches still spins fast at 0% without percentage change when flashing overnight....

Seems like flashrom changed something again in their debug output (Heads takes verbose debug output and parses it to produce missing upstream progress bar output) Heads needs to patch again deeper???

https://github.com/user-attachments/assets/8aaf3e3a-afb9-4166-8a3d-54816e098815

WhatsUp flashrom.... It's expected to flash 32mb flash without progress output in 2024?!?!

tlaurion avatar Aug 11 '24 13:08 tlaurion

Ok, so following rabbit hole where upstream --progress still unfixed for years https://ticket.coreboot.org/issues/390

To be edited with logs and maybe a fix....

Ha, maybe bad patch on my side, output diff (same HSFC: redundant and unneeded lines flooding output?) output_diff.txt

This is output of flashrom -p internal -w rom.rom -V > debug.log output from 1.3.0 on master vs 1.4.0 with patch supposed to fix exactly this from https://github.com/linuxboot/heads/pull/1753/commits/664df3b69189e6e60e4508a381d632624c731b5f

tlaurion avatar Aug 11 '24 13:08 tlaurion

Don't get it, wiping build caches, building clean on CircleCI at https://app.circleci.com/pipelines/github/tlaurion/heads?branch=bring_downstream_Dasharo-Heads_msi_to_upstream with https://app.circleci.com/pipelines/github/tlaurion/heads?branch=bring_downstream_Dasharo-Heads_msi_to_upstream which fails because of mirror issues as well. Rebuilding builds from failed step until successfull.... Not a good day for testing.

Note that this issue not resolved nor patches added upstream, there is absolutely no reason to have more then 33k lines in debug repeating themselves, flashrom upstream!

(same HSFC: redundant and unneeded lines flooding output?) output_diff.txt

https://github.com/Dasharo/flashrom/pull/11#issuecomment-2282779936

Asked why upstream --progress still unfixed https://matrix.to/#/!EhaGFZyYcbyhdSgStq:matrix.org/$VmOqrKd4o-T2fHu2DAlP0WG67CyPO_H-o_A0PDvRWs4?via=matrix.org&via=sibnsk.net&via=nope.chat

tlaurion avatar Aug 11 '24 14:08 tlaurion

Nope. Rebuilding clean (no cache whatsoever) from CI did a reproducible rom image for 230-maximized.

I will need help with this regression, will not have time to invest into this in foreseeable future @macpijan @JonathonHall-Purism and all other stakeholders benefiting from this with newer platforms needing flashrom version bumps while changes not upstreamed upstream requiring free maintenance downstream. Hacks not sustainable.

TLDR: flashrom 1.4 + patches in this PR breaks flashrom internal Heads progress output because flashrom still don't have --progress output which we would love to see landing since it makes no sense to flash in total blindness for more then 2 years now. Not a Heads problem, but an ecosystem problem, and I just stop personally trying to fix for free everyone's problem where collaboration upstream from people having a voice there would fix it once and for all and get rid of what was supposed to be a short time mitigation while things fixed upstream


Work can be picked up from https://github.com/Dasharo/flashrom/pull/11#issuecomment-2282779936 Past discussion with you @macpijan https://github.com/Dasharo/flashrom/pull/11#issuecomment-1409142374 Behavior observable from video at https://github.com/linuxboot/heads/pull/1753#issuecomment-2282761292 Workaround code to generate progress absent of flashrom from flashrom verbose output parsing under https://github.com/linuxboot/heads/blob/d9e5087caa06ab2ba3464b09c905ad7ef89b710b/initrd/bin/flash.sh#L151-L154

tlaurion avatar Aug 11 '24 19:08 tlaurion

Coreboot channel attempted discussion waiting for answer https://matrix.to/#/!EhaGFZyYcbyhdSgStq:matrix.org/$9003TsHZPIZZIoTt7Z2cs6rJrciRFng0kALZThTEuJk?via=matrix.org&via=sibnsk.net&via=paranoia.wf

tlaurion avatar Aug 12 '24 16:08 tlaurion

Dasharo general discussion downstram since we need a workaround if upstream don't fix it https://matrix.to/#/!rsKWMJGPMsyPTTjXuh:matrix.org/$N8PJecLPGi_tWckTmgBaeP0y5FFxdKNcPInqayUHmoo?via=matrix.org&via=nitro.chat&via=fedora.im

CC @macpijan

tlaurion avatar Aug 12 '24 17:08 tlaurion

Cherry-picking #1755 commit

tlaurion avatar Aug 23 '24 12:08 tlaurion

With #1755 cherry-picked: all is good and problem deflected upstream where it should be resolved: https://ticket.coreboot.org/issues/390

Decided: not Heads downstream problem to workaround infinitely, where solution for all flashrom users is to have flashrom --progress working, and default, for erase/write functions (missing, where no --progress is under 1.40 release still)

tlaurion avatar Aug 23 '24 12:08 tlaurion

There is an important regression from this flashrom version bump and loss of in-house progress output.

Flashrom UX is regressing :/

So on master with flashrom 1.3 without in-house progress output of flashrom:

  • tested (DEBUG ON) https://output.circle-artifacts.com/output/job/78a45204-7736-4f87-bf5d-922b48469782/artifacts/0/build/x86/x230-hotp-maximized/heads-x230-hotp-maximized-v0.2.0-2282-g1e03e8c.zip
  • Scary, but ok: signal-2024-08-23-102929

Under this PR flashrom 1.4 without in-house progress output of flashrom:

  • tested (DEBUG ON) https://output.circle-artifacts.com/output/job/31dce9e2-7216-4d90-9528-efd3d0ff6668/artifacts/0/build/x86/x230-hotp-maximized/heads-x230-hotp-maximized-v0.2.0-2290-g35b43b0.zip
  • Scary but not so ok: signal-2024-08-23-102615

tlaurion avatar Aug 23 '24 14:08 tlaurion

Question asked under coreboot matrix channel https://matrix.to/#/!EhaGFZyYcbyhdSgStq:matrix.org/$9K9t1rkGi2wPL6iHc3Hde2EhLkVbEN3N07Y1dFU3lek?via=matrix.org&via=sibnsk.net&via=nope.chat

tlaurion avatar Aug 23 '24 14:08 tlaurion

Question asked under Dasharo General matrix room: https://matrix.to/#/!rsKWMJGPMsyPTTjXuh:matrix.org/$1l2yMDyYBoGeU-1KNAI2e-QLMpfGgav4e_pBqg8J_qQ?via=matrix.org&via=nitro.chat&via=fedora.im

tlaurion avatar Aug 23 '24 16:08 tlaurion