Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable vboot on Lenovo devices for measured boot #709

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PatrickRudolph
Copy link
Contributor

No description provided.

@tlaurion
Copy link
Collaborator

tlaurion commented Apr 26, 2020

A quick recap on the status of this PR.

From commit logs, general concerns in bold

This commit does only apply the basic requirement for vboot targets.
It does not adapt any board configurations and also disables the use of
the crosstoolchain for coreboot. Therfore it shouldn't be merged with
the master branch at the current state.

boards: add vboot Sandy Bridge targets

added targets:

  • vboot-x220 (Lenovo Thinkpad X220)
  • vboot-t420 (Lenovo Thinkpad T420)

Move linux-x230.config to linux-thinkpad.config, so can be used
as generic linux kernel for all Thinkpads.

boards: add vboot Ivy Bridge targets

added targets:

  • vboot-x230 (Lenovo Thinkpad X230)
  • vboot-x230-me
  • vboot-t430 (Lenovo Thinkpad T430)
  • vboot-t430-me
  • vboot-t530 (Lenovo Thinkpad T530)
  • vboot-t530-me
  • vboot-w530 (Lenovo Thinkpad W530)
  • vboot-w530-me

All targets with the -me suffix uses the full sized Intel ME
without shrinking it.

Warning:
the heads payload is currently 247 KiB too big for the targets
with the full sized ME.
(Tested on a X230 using the vboot-x230-me target)

bin: add lenovo_extract.sh script

Add a generic bash script to extract necessary blobs from
Lenovo Firmware Dumps.

bin/lenovo_extract.sh: Verify target board prefix

Verify if the target board prefix matches, instead of the full name.

modules/coreboot: adapt toolchain target file

@PatrickRudolph
Copy link
Contributor Author

Please comment inline what should be fixed. Marking sentences bold doesn't help anybody.

The first commit could be postponed until the next coreboot release, which will likely be released in two weeks.
That heads is to big for a non stripped ME is known and out of scope of this commit.
Extracting blobs is required as it contains the MAC of the GbE.

@tlaurion
Copy link
Collaborator

tlaurion commented May 3, 2020

Testing.

@tlaurion
Copy link
Collaborator

tlaurion commented May 3, 2020

@PatrickRudolph : Some notes.

user@x230-vboot:~/heads$ ./bin/lenovo_extract.sh -f /home/user/QubesIncoming/bottom.rom
user@x230-vboot:~/heads$ ls blobs/x230/
ifd.bin  me.bin
user@x230-vboot:~/heads$ make BOARD=vboot-x230
tail /home/user/heads/build/log/coreboot.log
-----
    HOSTCC     cbfstool/2sha256.o
    HOSTCC     cbfstool/2sha512.o
    HOSTCC     cbfstool/linux_trampoline.o
    HOSTCC     cbfstool/cbfs-payload-linux.o
    HOSTCC     cbfstool/compress.o
    HOSTCC     cbfstool/lz4.o
    HOSTCC     cbfstool/lz4hc.o
    HOSTCC     cbfstool/lz4frame.o
    HOSTCC     cbfstool/xxhash.o
    HOSTCC     cbfstool/lz4_wrapper.o
    HOSTCC     cbfstool/lzma.o
    HOSTCC     cbfstool/LzFind.o
    HOSTCC     cbfstool/LzmaDec.o
    HOSTCC     cbfstool/LzmaEnc.o
    HOSTCC     cbfstool/ifittool.o
    HOSTCC     cbfstool/fit.o
    Compile IFDTOOL
make[1]: *** No rule to make target '../../blobs/x230/ifd-minimal_me.bin', needed by 'add_intel_firmware'.  Stop.
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/user/heads/build/coreboot-4.11'
make: *** [Makefile:382: /home/user/heads/build/coreboot-4.11/vboot-x230/.build] Error 1

@tlaurion
Copy link
Collaborator

tlaurion commented May 3, 2020

@PatrickRudolph :
Note below error at final call of ifdtool and "Error while writing: Success"

Debian-10 output:

user@x230-vboot:~/heads$ ./bin/lenovo_extract.sh -f /home/user/QubesIncoming/PrivacyBeast-Certified-deploy/bottom.rom -t x230 
firmware rom: /home/user/QubesIncoming/PrivacyBeast-Certified-deploy/bottom.rom
me_cleaner: /home/user/heads/build/coreboot-4.11/util/me_cleaner/me_cleaner.py
ifdtool: /home/user/heads/build/coreboot-4.11/util/ifdtool/ifdtool
File /tmp/tmp.Z4cukaoa1n is 8388608 bytes
Setting the AltMeDisable to disable Intel ME...
Writing new image to /tmp/tmp.Z4cukaoa1n.new
File /tmp/tmp.Z4cukaoa1n is 8388608 bytes
  Flash Region 0 (Flash Descriptor): 00000000 - 00000fff 
  Flash Region 1 (BIOS): 00500000 - 00bfffff 
  Error while writing: Success
  Flash Region 2 (Intel ME): 00003000 - 004fffff 
  Flash Region 3 (GbE): 00001000 - 00002fff 
  Flash Region 4 (Platform Data): 00fff000 - 00000fff (unused)
/home/user/heads
ME/TXE image detected
Found FPT header at 0x10
Found 23 partition(s)
Found FTPR header: FTPR partition spans from 0x180000 to 0x24a000
ME/TXE firmware version 8.0.12.1498
Public key match: Intel ME, firmware versions 7.x.x.x, 8.x.x.x
Reading partitions list...
 ???? (0x000003c0 - 0x000000400, 0x00000040 total bytes): removed
 FOVD (0x00000400 - 0x000001000, 0x00000c00 total bytes): removed
 MDES (0x00001000 - 0x000002000, 0x00001000 total bytes): removed
 FCRS (0x00002000 - 0x000003000, 0x00001000 total bytes): removed
 EFFS (0x00003000 - 0x0000df000, 0x000dc000 total bytes): removed
 BIAL (NVRAM partition, no data, 0x0000add0 total bytes): nothing to remove
 BIEL (NVRAM partition, no data, 0x00003000 total bytes): nothing to remove
 BIIS (NVRAM partition, no data, 0x00036000 total bytes): nothing to remove
 NVCL (NVRAM partition, no data, 0x00010511 total bytes): nothing to remove
 NVCM (NVRAM partition, no data, 0x0000493e total bytes): nothing to remove
 NVCP (NVRAM partition, no data, 0x0000a553 total bytes): nothing to remove
 NVJC (NVRAM partition, no data, 0x00005000 total bytes): nothing to remove
 NVKR (NVRAM partition, no data, 0x0001151c total bytes): nothing to remove
 NVOS (NVRAM partition, no data, 0x0003429d total bytes): nothing to remove
 NVSH (NVRAM partition, no data, 0x00007609 total bytes): nothing to remove
 NVTD (NVRAM partition, no data, 0x00001eac total bytes): nothing to remove
 PLDM (NVRAM partition, no data, 0x0000a000 total bytes): nothing to remove
 GLUT (0x000df000 - 0x0000e3000, 0x00004000 total bytes): removed
 LOCL (0x000e3000 - 0x0000e7000, 0x00004000 total bytes): removed
 WCOD (0x000e7000 - 0x000140000, 0x00059000 total bytes): removed
 MDMV (0x00140000 - 0x000180000, 0x00040000 total bytes): removed
 FTPR (0x00180000 - 0x00024a000, 0x000ca000 total bytes): NOT removed
 NFTP (0x0024a000 - 0x0004a4000, 0x0025a000 total bytes): removed
Removing partition entries in FPT...
Removing EFFS presence flag...
Correcting checksum (0xfa)...
Reading FTPR modules list...
 UPDATE           (LZMA   , 0x1cb8ef - 0x1cbaad       ): removed
 ROMP             (Huffman, fragmented data, ~2 KiB   ): NOT removed, essential
 BUP              (Huffman, fragmented data, ~54 KiB  ): NOT removed, essential
 KERNEL           (Huffman, fragmented data, ~135 KiB ): removed
 POLICY           (Huffman, fragmented data, ~89 KiB  ): removed
 HOSTCOMM         (LZMA   , 0x1cbaad - 0x1d27c7       ): removed
 RSA              (LZMA   , 0x1d27c7 - 0x1d7a2e       ): removed
 CLS              (LZMA   , 0x1d7a2e - 0x1dd170       ): removed
 TDT              (LZMA   , 0x1dd170 - 0x1e3854       ): removed
 FTCS             (Huffman, fragmented data, ~18 KiB  ): removed
 ClsPriv          (LZMA   , 0x1e3854 - 0x1e3c34       ): removed
 SESSMGR          (LZMA   , 0x1e3c34 - 0x1f2584       ): removed
Relocating FTPR from 0x180000 - 0x24a000 to 0xcc0 - 0xcacc0...
 Adjusting FPT entry...
 Adjusting LUT start offset...
 Adjusting Huffman start offset...
 Adjusting chunks offsets...
 Moving data...
The ME minimum size should be 98304 bytes (0x18000 bytes)
Truncating file at 0x18000...
Checking the FTPR RSA signature... VALID
Done! Good luck!
File /tmp/tmp.Z4cukaoa1n is 8388608 bytes
DANGER: Region Intel ME is shrinking.
    The region will be truncated to fit.
    This may result in an unusable image.
Copy Descriptor 0 (Flash Descriptor) (4096 bytes)
   from 00000000+00000000:00000fff (      4096)
     to 00000000+00000000:00000fff (      4096)
Copy Descriptor 1 (BIOS) (7340032 bytes)
   from 00500000+00000000:00bfffff (   7340032)
     to 00020000+000e0000:007fffff (   8257536)
./bin/lenovo_extract.sh: line 120: 16587 Segmentation fault      $IFDTOOL -n "$TOP/fmaps/${SIZE}_minimal_me.layout" "$bioscopy"

@PatrickRudolph
Copy link
Contributor Author

Oh yes good point. That script requires patches on top coreboot 4.11 that are merged into the next release.

@tlaurion
Copy link
Collaborator

tlaurion commented May 4, 2020

@PatrickRudolph : What interests us from minimal_me (standard vboot-* platforms) may be the usage and adaptation of:

@PatrickRudolph
Copy link
Contributor Author

It might be possible to generate the GBE and fill it with a random MAC.
As me_cleaner is already able to handle most of the required functions adding a GBE extractor might be the easiest solution.

@tlaurion
Copy link
Collaborator

@PatrickRudolph : I've tested #721. Results there. Let me know if something newer needs to be tested or if same results would be expected from PCRs.

Copy link
Collaborator

@tlaurion tlaurion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes good point. That script requires patches on top coreboot 4.11 that are merged into the next release.

@PatrickRudolph 4.12 having been released and #721 being community work in parallel, I wait for your input to when you are ready for me to test this PR.

@@ -1,7 +1,7 @@
# Configuration for a T420 running Qubes and other OS, T420 is identical to X230 on the Linux Side of things.
export CONFIG_COREBOOT=y
CONFIG_COREBOOT_CONFIG=config/coreboot-t420.config
CONFIG_LINUX_CONFIG=config/linux-x230.config
CONFIG_LINUX_CONFIG=config/linux-thinkpad.config
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PatrickRudolph We might want to name this xx30 instead of thinkpad, since base linux configuration might be different for xx20 and xx30 boards

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PatrickRudolph I'm thinking of the RICOH and REALTEK SDCARD MMC reader for the only example I know for the x230, which i'm not even aware if used across xx30 boards. Your insights here would be welcome. Might or might not be a concern.

My point here is that the xx20 containing less space then xx30, it might not be advisable to share a linux config across boards, since xx20 might need even more tuning of config where the xx30 boards might not.

modules/coreboot Outdated
Comment on lines 4 to 5
#coreboot_repo := https://review.coreboot.org/coreboot.git
coreboot_version := 4.11
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PatrickRudolph My concern here is that oher boards (kgpe-d16) will probably stay on 4.8.1 for a while. I think it would be advisable to probably duplicate coreboot module and have boards specify which coreboot version they are based on, even though this would require more tracking of versions in the future.

Changing coreboot for all boards at once might bring undesired results for untested boards, while changing them one by one after testing on a community based would seem more advisable.

@tlaurion
Copy link
Collaborator

tlaurion commented Jun 20, 2020

@MrChromebox @osresearch Heads and coreboot don't use the same PCRs.
I think Heads should match coreboot PCRs for newer releases, while of course keeping Heads' distinct measurements where there is no overlap.

Actual coreboot:

PCR-2 e8f2b57c9ec5ea06d1bbd3240a753974d4c3e7c8cd305c20a8ea26eed906dc89 SHA256 [FMAP: COREBOOT CBFS: bootblock]
PCR-2 309a5fcb231d3a39127de2521792f332f9a69e05675ec52535d2dcded756dc19 SHA256 [FMAP: COREBOOT CBFS: fallback/verstage]
PCR-2 0fbba07a833d4dcfc7024eaf313661a0ba8f80a05c6d29b8801c612e10e60dee SHA256 [FMAP: RO_VPD]
PCR-2 431681113ed44cbf6f68a12c6e5687e901052f1d728a4777b2ad36e559962047 SHA256 [FMAP: GBB]
PCR-2 f47a8ec3e9aff2318d896942282ad4fe37d6391c82914f54a5da8a37de1300c6 SHA256 [FMAP: SI_DESC]
PCR-3 237f6f567f8597dbdff0a00690d34d21616af0dbe434b9a2d432b136c012765f SHA256 [FMAP: SI_ME]
PCR-2 7d2c7ac4888bfd75cd5f56e8d61f69595121183afc81556c876732fd3782c62f SHA256 [FMAP: SI_GBE]
PCR-0 62571891215b4efc1ceab744ce59dd0b66ea6f73 SHA1 [GBB flags]
PCR-1 a66c8c2cda246d332d0c2025b6266e1e23c89410051002f46bfad1c9265f43d0 SHA256 [GBB HWID]
PCR-2 ceca357524caf8fc73f5fa130f05a75293031962af884e18990d281eb259f5ff SHA256 [FMAP: FW_MAIN_B CBFS: fallback/romstage]
PCR-2 548a097604e0a975de76f98b04c7f0b0ddec03883dd69179e47a784704a1c571 SHA256 [FMAP: FW_MAIN_B CBFS: fspm.bin]
PCR-2 1e86b27008818244c221df2436b0113bd20a86ec6ec9d8259defe87f45d2f604 SHA256 [FMAP: FW_MAIN_B CBFS: spd2.bin]
PCR-2 05d78005fcfc9edd4ca5625f11b1f49991d17bdb7cee33b72e722bc785db55ae SHA256 [FMAP: FW_MAIN_B CBFS: fallback/postcar]
PCR-2 c13e95829af12a584046f1a6f3e1f6e4af691209324cfeeec573633399384141 SHA256 [FMAP: FW_MAIN_B CBFS: fallback/ramstage]
PCR-2 a6ec2761b597abd252dba2a7237140ef4a5a8e0d47cad8afb65fa16314413401 SHA256 [FMAP: FW_MAIN_B CBFS: cpu_microcode_blob.bin]
PCR-2 c81ffa40df0b6cd6cfde4f476d452a1f6f2217bc96a3b98a4fa4a037ee7039cf SHA256 [FMAP: FW_MAIN_B CBFS: fsps.bin]
PCR-2 4e95f57bbf3c6627eb1c72be9c48df3aaa8e6da4f5f63d85e554cf6803505609 SHA256 [FMAP: FW_MAIN_B CBFS: vbt.bin]
PCR-3 b7663f611ecf8637a59d72f623ae92a456c30377d4175e96021c85362f0323c8 SHA256 [FMAP: RW_NVRAM]
PCR-2 178561f046e2adbc621b12b47d65be82756128e2a1fe5116b53ef3637da700e8 SHA256 [FMAP: FW_MAIN_B CBFS: fallback/dsdt.aml]
PCR-2 091706f5fce3eb123dd9b96c15a9dcc459a694f5e5a86e7bf6064b819a8575c7 SHA256 [FMAP: FW_MAIN_B CBFS: fallback/payload]

Actual Heads:

0: Boot block
1: ROM stage
2: RAM stage (and MRC? this should be separate)
3: Heads Linux kernel and initrd
4: Boot mode (0 during /init, then recovery or normal-boot)
5: Heads Linux kernel modules
6: Drive LUKS headers
7: Heads user-specific config files

@PatrickRudolph

@MrChromebox
Copy link
Contributor

@tlaurion I'm unclear what you're proposing. Also, coreboot's use of the PCRs will vary depending on if vboot is used or not.

@tlaurion
Copy link
Collaborator

tlaurion commented Jun 22, 2020

OK let me clarify this and Patrick should clarify additionally.

9elements work here is to bring VBOOT+measured boot to platforms missing it on coreboot mainline (xx30 and xx20).

Doing so, heads and coreboot are using different PCRs for measured boot implementation.

Two options here, we have coreboot patched so that measuring scheme of heads don't change.

Or we change heads measuring scheme to match coreboot's VBOOT+measured boot.

We have to take a decision.

@MrChromebox @PatrickRudolph

@tlaurion
Copy link
Collaborator

tlaurion commented Jul 11, 2020

@MrChromebox @PatrickRudolph we need to take a decision for things to move on and development to go ahead.

To minimize heads change, it seems that coreboot should be patched.

To facilitate maintainership, it seems that Heads should be modified.

Coreboot 4.12 includes measured boot without vboot. VBOOT requires space that is scarce and doesnt seem fit for Heads.

What do we do?

@MrChromebox
Copy link
Contributor

@tlaurion to clarify, coreboot 4.12 provides the option to use measured boot with or without vboot. so we can support both versions if desired and space available.

Question is, is the PCR measurement performed by coreboot 4.12 less secure/optimal than that done by Heads currently? Or just different?

@tlaurion
Copy link
Collaborator

tlaurion commented Jul 11, 2020

@MrChromebox this is answered here and exposed there.

Question is, is the PCR measurement performed by coreboot 4.12 less secure/optimal than that done by Heads currently? Or just different?

Short answer is: different.

Condensate of #721 (comment) (please read):
Mainly everything that intetrests us and measured by Heads under PCRs 0-3 are measured by coreboot all under PCR 2.

@MrChromebox : I have not played with MeasuredBoot without VBOOT, nor can find proper documentation from coreboot website, which was the goal of funding the work at the first place #540 which led to #605 which resulted in this PR for the moment, which doesn't fill the bill and now stalls, see next note.
@pietrushnic? @miczyg1? : What is the best measurement approach here? Heads or coreboot for measured boot? commit 4868694 notes specifies:

Warning:
the heads payload is currently 247 KiB too big for the targets
with the full sized ME.
(Tested on a X230 using the vboot-x230-me target)

Which links to #307 and still unresolved problems for distribution.

@PatrickRudolph? What are the next steps? What do you think of Heads measuring scheme as opposed to coreboot without VBOOT?

@tlaurion
Copy link
Collaborator

tlaurion commented Jul 12, 2020

@PatrickRudolph @MrChromebox : @osresearch says that we should change Heads to match coreboot measuring scheme:

Adapting the official vboot/coreboot PCR usage makes some sense to me, since maintaining coreboot patches is quite a bit of work and adding the TPM drivers to the various stages is a somewhat invasive change.

Using one PCR for all of the stages also seems fine, especially if there is an event log that validates what went into the measurements. Having separate ones in the Heads design was mostly out of laziness on my part for ease of precomputation.

@PatrickRudolph @pietrushnic this one is for yous:

If Bootguard is enabled (in modes 2, 3, or 5), my understanding that PCR0 will be extended with the CRTM (the ACM and the IBB). Does this conflict with vboot's use of PCR0?

@MrChromebox : I understand that most of the boards you support will go the VBOOT+measureboot, while xx30 and xx20 boards will go the measured boot path without VBOOT for lack of space. @PatrickRudolph : where can we see the measured boot without Vboot measuring scheme? Is it different then VBOOT+measured boot?

@miczyg1
Copy link

miczyg1 commented Jul 13, 2020

@tlaurion
Measured Boot is now separately available under Security -> Trusted Platform Module. Enable Measured Boot option will appear when one of TPM families is enabled

For Boot Guard, besides the IBB, the PCR0 is extended with Boot Guard configuration, ACM SVN and signature, manifests signatures. And yes, that is a conflict with vboot's PCR0. AFAIK boot extends boot mode in PCR0 only.

@tlaurion
Copy link
Collaborator

tlaurion commented Jul 19, 2020

@MrChromebox @PatrickRudolph : so how do we deal with PCR0 and adapt heads to coreboot measuring scheme following precedent comment?

@tlaurion
Copy link
Collaborator

tlaurion commented Aug 1, 2020

@MrChromebox @PatrickRudolph discussions on implementation continues here #721 (comment)

Should we close this PR?

tlaurion added a commit to linuxboot/heads-wiki that referenced this pull request Aug 11, 2020
Documentation changes linked to PCR usage in coreboot 4.8.1 and newer versions, to be applied at the same time as linuxboot/heads#793 is merged.
Linked to VBOOT+Measured boot/Measured boot changes applied directly in coreboot so that we have a common base prior of going linuxboot/heads#709 and linuxboot/heads#721 

@PatrickRudolph comments welcome
tlaurion added a commit to linuxboot/heads-wiki that referenced this pull request Aug 11, 2020
…#42)

* Update Keys.md

Documentation changes linked to PCR usage in coreboot 4.8.1 and newer versions, to be applied at the same time as linuxboot/heads#793 is merged.
Linked to VBOOT+Measured boot/Measured boot changes applied directly in coreboot so that we have a common base prior of going linuxboot/heads#709 and linuxboot/heads#721 

@PatrickRudolph comments welcome

* Update Keys.md

Removed comment about MRC needing to be measured into different PCR since coreboot is merging them all under PCR2 in newer VBOOT+measured boot/measuredboot
Ref:https://doc.coreboot.org/security/vboot/measured_boot.html
@tlaurion
Copy link
Collaborator

28d3b7c being merged #721 #709 are next.
@MrChromebox @PatrickRudolph

@MrChromebox
Copy link
Contributor

@tlaurion #721 is ready to go, but #709 definitely isn't. Either needs to be rebased on 4.12, or rebased to add support for coreboot 4.11 rather than replacing. I'd strongly advocate for the former, since I'm not sure there's any value to adding support for 4.11 at this time (we may want to for other boards than can't be updated to 4.12, eg KGPE-D16)

@tlaurion tlaurion self-assigned this Aug 11, 2020
@tlaurion
Copy link
Collaborator

@PatrickRudolph this can be resumed since #721 was merged.

@tlaurion
Copy link
Collaborator

tlaurion commented Sep 4, 2020

@PatrickRudolph Any news?

* Add vboot support to supported Lenovo boards
* Didn't add config that wouldn't build (non ME stripped versions)

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
@PatrickRudolph
Copy link
Contributor Author

Any comments on the new commits?

@tlaurion
Copy link
Collaborator

@PatrickRudolph Will look into it tomorrow. Thanks! (Didn't see since not tagged, sorry for the delay)

@tlaurion
Copy link
Collaborator

tlaurion commented Sep 18, 2020

@PatrickRudolph build successfull (x230-vboot and t430-vboot): https://app.circleci.com/pipelines/github/tlaurion/heads/393/workflows/1c587111-101b-418b-9918-413c5addc255/jobs/422 (cannot build from CI t420 and x220 since blobs)

Requires the following change (would be nice that it is merged into this PR so its self-contained):

Artifacts:

I will test x230-vboot rom in a bit, cannot test any other platforms.

tlaurion added a commit to tlaurion/heads that referenced this pull request Sep 19, 2020
@tlaurion
Copy link
Collaborator

tlaurion commented Sep 19, 2020

@PatrickRudolph

flashed x230-vboot.rom over #703 externally flashed x230 with flashrom --force --noverify-all -p internal --ifd --image bios -w x230-boot.rom resulting into a brick.

Would have thought that would work, since IFD is maximized for BIOS region while ME is minimized there, but I guess VBOOT should be flashed some other way. Is something special expected from x230-flash.rom, or should x230-flash-vboot exists?

Is IFD supposed to be modified in some way prior of flashing?

@Tonux599
Copy link
Contributor

Tonux599 commented Oct 12, 2020

@tlaurion

flashed x230-vboot.rom over #703 externally flashed x230 with flashrom --force --noverify-all -p internal --ifd --image bios -w x230-boot.rom resulting into a brick.

That brick may be related to this response here in which vboot is not functional when using a read-only flashmap. I have replied to the thread to see if the behaviour that is described by Julius applies to coreboot 4.12 as well as 4.11 and will update here when I know.

EDIT: Note the reply here in particularly:

The behavior I described has been pretty
much unchanged since 2018, I think (so long before 4.12 or 4.11).

As such, it appears that read-only flashmaps (which is what this PR uses) won't work with vboot and support has yet to be implemented. A workaround may be to use a large RW section and a small RO section in the .fmd 's and to exclude the payload from being written to the RO section. I'll be working on that theory in regards to the KGPE-D16 and coreboot 4.11.

Julius also notes:

Note that measured boot is independent from verified boot. The main point of verified boot is to allow keeping a part of the flash writable so it can be updated but is still cryptographically verified. If you don't care about that, you can just write-protect your whole flash and only enable CONFIG_TPM_MEASURED_BOOT.

If this is sufficient to the goals of Heads this would appear to work also.

tlaurion added a commit to tlaurion/heads that referenced this pull request Oct 16, 2020
tlaurion added a commit to tlaurion/heads that referenced this pull request Oct 23, 2020
@tlaurion
Copy link
Collaborator

tlaurion commented Oct 28, 2020

@PatrickRudolph so this is not functional as of now without further instructions.
I have tried to use coreboot 4.12 as is with CONFIG_TPM_MEASURED_BOOT without VBOOT, where the result is the following:
https://circleci.com/api/v1.1/project/github/tlaurion/heads/612/output/139/0?file=true&allocation-id=5f99ebbb75749718eee3ed1e-0-build%2F677C4D3D

LINK       cbfs/fallback/bootblock.debug
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd -b elf32-i386 -melf_i386 --gc-sections -nostdlib -nostartfiles -static --emit-relocs  -o x230-external-flash/cbfs/fallback/bootblock.debug -Lx230-external-flash --wrap __divdi3 --wrap __udivdi3 --wrap __moddi3 --wrap __umoddi3 --whole-archive --start-group x230-external-flash/bootblock/arch/x86/boot.o x230-external-flash/bootblock/arch/x86/bootblock_crt0.o x230-external-flash/bootblock/arch/x86/cf9_reset.o x230-external-flash/bootblock/arch/x86/cpu_common.o x230-external-flash/bootblock/arch/x86/id.o x230-external-flash/bootblock/arch/x86/memcpy.o x230-external-flash/bootblock/arch/x86/memset.o x230-external-flash/bootblock/arch/x86/mmap_boot.o x230-external-flash/bootblock/arch/x86/post.o x230-external-flash/bootblock/arch/x86/timestamp.o x230-external-flash/bootblock/arch/x86/walkcbfs.o x230-external-flash/bootblock/commonlib/bsd/lz4_wrapper.o x230-external-flash/bootblock/commonlib/cbfs.o x230-external-flash/bootblock/commonlib/iobuf.o x230-external-flash/bootblock/commonlib/mem_pool.o x230-external-flash/bootblock/commonlib/region.o x230-external-flash/bootblock/console/console.o x230-external-flash/bootblock/console/die.o x230-external-flash/bootblock/console/init.o x230-external-flash/bootblock/console/post.o x230-external-flash/bootblock/console/printk.o x230-external-flash/bootblock/console/vsprintf.o x230-external-flash/bootblock/console/vtxprintf.o x230-external-flash/bootblock/cpu/intel/car/bootblock.o x230-external-flash/bootblock/cpu/intel/car/non-evict/cache_as_ram.o x230-external-flash/bootblock/cpu/intel/common/fsb.o x230-external-flash/bootblock/cpu/intel/microcode/microcode.o x230-external-flash/bootblock/cpu/intel/microcode/microcode_asm.o x230-external-flash/bootblock/cpu/intel/model_206ax/bootblock.o x230-external-flash/bootblock/cpu/x86/early_reset.o x230-external-flash/bootblock/cpu/x86/lapic/boot_cpu.o x230-external-flash/bootblock/cpu/x86/mtrr/debug.o x230-external-flash/bootblock/cpu/x86/mtrr/earlymtrr.o x230-external-flash/bootblock/cpu/x86/name/name.o x230-external-flash/bootblock/cpu/x86/pae/pgtbl.o x230-external-flash/bootblock/cpu/x86/tsc/delay_tsc.o x230-external-flash/bootblock/device/device_const.o x230-external-flash/bootblock/device/i2c.o x230-external-flash/bootblock/device/mmio.o x230-external-flash/bootblock/device/pci_early.o x230-external-flash/bootblock/device/pci_ops.o x230-external-flash/bootblock/drivers/pc80/pc/i8254.o x230-external-flash/bootblock/drivers/pc80/rtc/mc146818rtc.o x230-external-flash/bootblock/drivers/pc80/rtc/mc146818rtc_boot.o x230-external-flash/bootblock/drivers/spi/adesto.o x230-external-flash/bootblock/drivers/spi/amic.o x230-external-flash/bootblock/drivers/spi/atmel.o x230-external-flash/bootblock/drivers/spi/bitbang.o x230-external-flash/bootblock/drivers/spi/eon.o x230-external-flash/bootblock/drivers/spi/gigadevice.o x230-external-flash/bootblock/drivers/spi/macronix.o x230-external-flash/bootblock/drivers/spi/spansion.o x230-external-flash/bootblock/drivers/spi/spi-generic.o x230-external-flash/bootblock/drivers/spi/spi_flash.o x230-external-flash/bootblock/drivers/spi/sst.o x230-external-flash/bootblock/drivers/spi/stmicro.o x230-external-flash/bootblock/drivers/spi/winbond.o x230-external-flash/bootblock/ec/acpi/ec.o x230-external-flash/bootblock/ec/lenovo/h8/sense.o x230-external-flash/bootblock/ec/lenovo/pmh7/pmh7.o x230-external-flash/bootblock/lib/boot_device.o x230-external-flash/bootblock/lib/bootblock.o x230-external-flash/bootblock/lib/bootmode.o x230-external-flash/bootblock/lib/cbfs.o x230-external-flash/bootblock/lib/cbmem_console.o x230-external-flash/bootblock/lib/crc_byte.o x230-external-flash/bootblock/lib/delay.o x230-external-flash/bootblock/lib/fmap.o x230-external-flash/bootblock/lib/gcc.o x230-external-flash/bootblock/lib/halt.o x230-external-flash/bootblock/lib/hexdump.o x230-external-flash/bootblock/lib/libgcc.o x230-external-flash/bootblock/lib/memchr.o x230-external-flash/bootblock/lib/memcmp.o x230-external-flash/bootblock/lib/prog_loaders.o x230-external-flash/bootblock/lib/prog_ops.o x230-external-flash/bootblock/lib/reset.o x230-external-flash/bootblock/lib/string.o x230-external-flash/bootblock/lib/timestamp.o x230-external-flash/bootblock/lib/version.o x230-external-flash/bootblock/mainboard/lenovo/x230/early_init.o x230-external-flash/bootblock/mainboard/lenovo/x230/gpio.o x230-external-flash/bootblock/northbridge/intel/sandybridge/bootblock.o x230-external-flash/bootblock/security/tpm/tspi/crtm.o x230-external-flash/bootblock/security/tpm/tspi/log.o x230-external-flash/bootblock/security/tpm/tspi/tspi.o x230-external-flash/bootblock/security/tpm/tss/tcg-1.2/tss.o x230-external-flash/bootblock/security/vboot/vboot_lib.o x230-external-flash/bootblock/southbridge/intel/bd82x6x/bootblock.o x230-external-flash/bootblock/southbridge/intel/bd82x6x/early_pch.o x230-external-flash/bootblock/southbridge/intel/common/gpio.o x230-external-flash/bootblock/southbridge/intel/common/pmbase.o x230-external-flash/bootblock/southbridge/intel/common/reset.o x230-external-flash/bootblock/southbridge/intel/common/rtc.o x230-external-flash/bootblock/southbridge/intel/common/spi.o x230-external-flash/bootblock/southbridge/intel/common/usb_debug.o x230-external-flash/bootblock/external/vboot_reference-bootblock/vboot_fw.a x230-external-flash/bootblock/mainboard/lenovo/x230/static.o  --no-whole-archive /root/project/crossgcc/bin/../lib/gcc/i386-linux-musl/8.3.0/libgcc.a --end-group -T x230-external-flash/bootblock/arch/x86/memlayout.ld --oformat elf32-i386
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (2455608440)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (339811400)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (1719035846)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (1144631712)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3226207387)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (4163111854)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (142943288)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (695610209)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (116715353)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3168694238)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3802965275)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3591861875)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (1499309958)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (2625584344)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (1098579263)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (1513456395)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (181585153)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3733711292)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3960406313)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (2248388292)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (1192076455)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (108608800)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (2677191463)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (654877294)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (242247255)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3783673451)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (2280787454)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (2387121193)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (1313604850)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (4095527887)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (709691520)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3453198923)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (2085198407)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (213556834)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (1249297073)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3750993132)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3408208093)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3475904618)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (227556745)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3458473692)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3143195044)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (723259437)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (308124738)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3102817813)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (2875709993)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (689023225)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (4285292482)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (2331049310)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (4006939825)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (1650385820)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3742869416)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3700709259)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (494651364)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3377761520)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (7630441)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o)(.debug_info+0x20f): reloc against `.debug_str': error 4
make[1]: *** [src/arch/x86/Makefile.inc:120: x230-external-flash/cbfs/fallback/bootblock.debug] Error 1
rm x230-external-flash/util/cbfstool/fmd_scanner.c x230-external-flash/util/cbfstool/fmd_parser.c
make[1]: Leaving directory '/root/project/build/coreboot-4.12'
tail /root/project/build/log/coreboot.log
-----
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3458473692)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3143195044)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (723259437)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (308124738)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3102817813)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (2875709993)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (689023225)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (4285292482)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (2331049310)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (4006939825)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (1650385820)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3742869416)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3700709259)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (494651364)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (3377761520)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o): access beyond end of merged section (7630441)
/root/project/crossgcc/bin/i386-linux-musl-ld.bfd: x230-external-flash/bootblock/external/vboot_reference-bootblock/../../../external/vboot_reference-bootblock/vboot_fw.a(2crypto.o)(.debug_info+0x20f): reloc against `.debug_str': error 4
make[1]: *** [src/arch/x86/Makefile.inc:120: x230-external-flash/cbfs/fallback/bootblock.debug] Error 1
rm x230-external-flash/util/cbfstool/fmd_scanner.c x230-external-flash/util/cbfstool/fmd_parser.c
make[1]: Leaving directory '/root/project/build/coreboot-4.12'
make: *** [Makefile:442: /root/project/build/coreboot-4.12/x230-external-flash/.build] Error 1

So still no coreboot 4.12 for xx20 nor xx30 with Heads payload.

@Tonux599
Copy link
Contributor

@tlaurion worth noting that that error is the same as the one we were getting when trying to make KGPE-D16 + coreboot 4.11 + vboot.

@tlaurion
Copy link
Collaborator

@Tonux599 : that was fixed in https://circleci.com/api/v1.1/project/github/tlaurion/heads/620/output/139/0?file=true&allocation-id=5f9c17bd45255007fb8bb449-0-build%2F2737844C

with tlaurion@7afdc23

Unfortunately, it comes with another error, saying that musl-cross-make is not providing /root/project/crossgcc/bin/i386-linux-musl-gnatbind

@tlaurion tlaurion mentioned this pull request Nov 10, 2020
@alexmaloteaux
Copy link
Contributor

alexmaloteaux commented Nov 10, 2020

Unfortunately, it comes with another error, saying that musl-cross-make is not providing /root/project/crossgcc/bin/i386-linux-musl-gnatbind

Here is how i compiled heads with coreboot 4.12 for t430.

  • changed board config to use 4.12 and then got musl-gnatbind not found issue
  • compiled muslc latest (actual one in heads will fail on ada compiler) on ubuntu 20.04(18.04 wont work due to old gnat version) with those commands
make TARGET=x86_64-linux-musl GCC_CONFIG="--enable-languages=ada,c,c++" FULL_GCC_CONFIG="--enable-languages=ada,c,c++"  -j $(($(nproc --all) + 1))  install
make TARGET=i386-linux-musl GCC_CONFIG="--enable-languages=ada,c,c++" FULL_GCC_CONFIG="--enable-languages=ada,c,c++"  -j $(($(nproc --all) + 1))  install
  • Create inside heads this folder crossgcc/x86_64-linux-musl and copy the file from output in musl-cross-make there.

  • launch heads compilation with
    make TOOLCHAIN=$(pwd) BOARD=t420 V=s

  • Coreboot compilation failed , and i had to add this line to build/coreboot-4.12/Makefile.inc
    CFLAGS_common += Wno-address-of-packed-member

  • relaunched compilation and it failed again with relocation type 10 on ramstage.debug, for this we need to disable RELOCATABLE_RAMSTAGE, alternatively i removed the step in src/arch/x86/Makefile.inc

from there at least it compiled , but i faced permament black screen while the board stays powered on as opposed to #897

I think that heads should not rely on muslc to compile coreboot but use the built in coreboot toolchain, however i m just a noobs in this area :)

@tlaurion
Copy link
Collaborator

tlaurion commented Nov 24, 2020

@zaolin @PatrickRudolph that was supposed to be paid by NlNet when functional and mergeable.

Tonux599 pushed a commit to Tonux599/heads that referenced this pull request Nov 28, 2020
Changing CONFIG_USB_BOOT_DEV to sdc1, adding back CONFIG_BOOT_STATIC_IP to 192.168.2.3, adding dual console to OpenBMC and tty0 in attempt to have QubesOS graphic installer which complains with no networking when attempting to start VNC

Adding dual console to OpenBmc and tty0

putting kgpe-d16-coreboot.conf in defconfig format

NO_HZ wasn't included in kernel config. Adding it.

Wasn't able to have both console firing up QubesOS gui installer, complaining about hvc1 console errors. Splitting up Workstation and server config. This one works for Worstation

Removing serial configuration and static IP stuff since we have a workstation here.

Seperate Workstation and Server board configurations until dual console truely works through QubesOS gui installation. kgpe-d16 board config removed until then.

Placing files in good directories

Corrrect flashrom options for kgpe-d16 server and workstation boards

kgpe-d16 linux: NO_HZ_IDLE instead of NO_HZ

kgpe-d16: seperate board for workstation to be AST and gui-init based, while kgpe-d16-> kgpe-d16_server

kgpe-d16_server: boots, shows ASpeed text on VGA, controllable through BMC via SSH.

kgpe-d16_workstation on ASpeed console. WIP. (Includes CIs configs to build server and workstation)

kgpe-d16_workstation in defconfig format

kgpe-d16 boards: pass from GPG to GPG2 board definitions

kgpe-d16_workstation : Adding Cairo and FbWhpitail in board config for gui-init to work in FB mode

kgpe-d16: removing plymouth.ignore-serial-consoles to fix server terminal output

kgpe-d16: bring par with staging branch https://gitlab.com/tlaurion/heads/commits/kgpe-d16_staging

kgpe-d16 : expressively export CONFIG_TPM=n

kgpe-d16_wokstation gui-init variables were missing

kgpe-d16 boards: add CONFIG_LINUX_USB_COMPANION_CONTROLLER so that usb is recognized

linux-kgpe-d16*: add support for Pike

kgpe-d16_workstation-usb_keyboard board support addition

kgpe-d16_server-whiptail: Add board and dependencies to have gui-init in whiptail (console mode, not FbWhiptail based

GitlabCI: kgpe-d16 fixes and upstream merge of change

kgpe-d16* board: add statement to fixate coreboot version to 4.8.1 for the moment

kgpe-d16: add missing config/linux-kgpe-d16_server-whiptail.config file

KGPE-D16: community work migration to coreboot 4.11 to fix issue linuxboot#740

KGPE-D16 boards: Adding VBOOT+measured boot, musl-cross patch and 4.11 patch brought up per linuxboot#709

kgpe-d16* boards: add VBOOT Kconfig patch per @miczyg1 recommendation under linuxboot#795 (comment)

KGPE-D16* coreboot configs: Add S3NV as a Runtime data whitelist (so that it is not measured at term) per @miczyg1 recommendation under linuxboot#795 (comment)

kgpe-d16 coreboot 4.11: add https://review.coreboot.org/c/coreboot/+/36908 patch

kgpe-d16 boards: add Linux kernel version where missing.

CircleCI: Add debug output on fail for kgpe-d16 board builds to bring par with upstream after rebasing on master

coreboot module: typo correction (tabs vs spaces)

CircleCI: trying to address "g++: fatal error: Killed signal terminated program cc1plus." happening under coreboot 4.11 and coreboot 4.12 builds

CircleCI: remove past addition to test recommendation from CircleCI: "resource_class: large"

CircleCi: Ok.... lets output dmesg content prior of other logs.... I'm out of ideas. Next step, ask CircleCI for support

At this stage:
- job's "make --load" is supposed to guarantee that the number of thread doesn't exhaust pass of a load of 2 (medium, free class, CircleCI has 32 cores so possibility of a load of 32)
- "--max_old_space_size=4096" in CircleCI environement is supposed to limit memory consumption to 4096Mb of memory, the max of a medium class free tier CircleCI node

CircleCI: remove verbose build (no more V=1), in case of failed build, find all logs modified in last minute and output each of them on console.

coreboot module: implement load average respect inside of problematic CI build for coreboot 4.11+ being killed in the action (32 cores with 4Gb ram get gcc OOM)

coreboot module: replace nproc by number of Gb actually available as number of CPUs, since each thread is expected to have 1Gb of ram.

CircleCI & coreboot config: fix merge conflict rebasing on master

coreboot 4.11 kgpe-d16 vboot patches addendum, credits goes to @Tonux599

Fix merge conflicts and make sure all boards are inside of CircleCI builds. PoC build for linuxboot#867
Tonux599 pushed a commit to Tonux599/heads that referenced this pull request Dec 2, 2020
Changing CONFIG_USB_BOOT_DEV to sdc1, adding back CONFIG_BOOT_STATIC_IP to 192.168.2.3, adding dual console to OpenBMC and tty0 in attempt to have QubesOS graphic installer which complains with no networking when attempting to start VNC

Adding dual console to OpenBmc and tty0

putting kgpe-d16-coreboot.conf in defconfig format

NO_HZ wasn't included in kernel config. Adding it.

Wasn't able to have both console firing up QubesOS gui installer, complaining about hvc1 console errors. Splitting up Workstation and server config. This one works for Worstation

Removing serial configuration and static IP stuff since we have a workstation here.

Seperate Workstation and Server board configurations until dual console truely works through QubesOS gui installation. kgpe-d16 board config removed until then.

Placing files in good directories

Corrrect flashrom options for kgpe-d16 server and workstation boards

kgpe-d16 linux: NO_HZ_IDLE instead of NO_HZ

kgpe-d16: seperate board for workstation to be AST and gui-init based, while kgpe-d16-> kgpe-d16_server

kgpe-d16_server: boots, shows ASpeed text on VGA, controllable through BMC via SSH.

kgpe-d16_workstation on ASpeed console. WIP. (Includes CIs configs to build server and workstation)

kgpe-d16_workstation in defconfig format

kgpe-d16 boards: pass from GPG to GPG2 board definitions

kgpe-d16_workstation : Adding Cairo and FbWhpitail in board config for gui-init to work in FB mode

kgpe-d16: removing plymouth.ignore-serial-consoles to fix server terminal output

kgpe-d16: bring par with staging branch https://gitlab.com/tlaurion/heads/commits/kgpe-d16_staging

kgpe-d16 : expressively export CONFIG_TPM=n

kgpe-d16_wokstation gui-init variables were missing

kgpe-d16 boards: add CONFIG_LINUX_USB_COMPANION_CONTROLLER so that usb is recognized

linux-kgpe-d16*: add support for Pike

kgpe-d16_workstation-usb_keyboard board support addition

kgpe-d16_server-whiptail: Add board and dependencies to have gui-init in whiptail (console mode, not FbWhiptail based

GitlabCI: kgpe-d16 fixes and upstream merge of change

kgpe-d16* board: add statement to fixate coreboot version to 4.8.1 for the moment

kgpe-d16: add missing config/linux-kgpe-d16_server-whiptail.config file

KGPE-D16: community work migration to coreboot 4.11 to fix issue linuxboot#740

KGPE-D16 boards: Adding VBOOT+measured boot, musl-cross patch and 4.11 patch brought up per linuxboot#709

kgpe-d16* boards: add VBOOT Kconfig patch per @miczyg1 recommendation under linuxboot#795 (comment)

KGPE-D16* coreboot configs: Add S3NV as a Runtime data whitelist (so that it is not measured at term) per @miczyg1 recommendation under linuxboot#795 (comment)

kgpe-d16 coreboot 4.11: add https://review.coreboot.org/c/coreboot/+/36908 patch

kgpe-d16 boards: add Linux kernel version where missing.

CircleCI: Add debug output on fail for kgpe-d16 board builds to bring par with upstream after rebasing on master

coreboot module: typo correction (tabs vs spaces)

CircleCI: trying to address "g++: fatal error: Killed signal terminated program cc1plus." happening under coreboot 4.11 and coreboot 4.12 builds

CircleCI: remove past addition to test recommendation from CircleCI: "resource_class: large"

CircleCi: Ok.... lets output dmesg content prior of other logs.... I'm out of ideas. Next step, ask CircleCI for support

At this stage:
- job's "make --load" is supposed to guarantee that the number of thread doesn't exhaust pass of a load of 2 (medium, free class, CircleCI has 32 cores so possibility of a load of 32)
- "--max_old_space_size=4096" in CircleCI environement is supposed to limit memory consumption to 4096Mb of memory, the max of a medium class free tier CircleCI node

CircleCI: remove verbose build (no more V=1), in case of failed build, find all logs modified in last minute and output each of them on console.

coreboot module: implement load average respect inside of problematic CI build for coreboot 4.11+ being killed in the action (32 cores with 4Gb ram get gcc OOM)

coreboot module: replace nproc by number of Gb actually available as number of CPUs, since each thread is expected to have 1Gb of ram.

CircleCI & coreboot config: fix merge conflict rebasing on master

coreboot 4.11 kgpe-d16 vboot patches addendum, credits goes to @Tonux599

Fix merge conflicts and make sure all boards are inside of CircleCI builds. PoC build for linuxboot#867
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants