linuxboot / heads

A minimal Linux that runs as a coreboot or LinuxBoot ROM payload to provide a secure, flexible boot environment for laptops, workstations and servers.
https://osresearch.net/
GNU General Public License v2.0
1.4k stars 181 forks source link

Error compiling w530-dgpu-K1000m-maximized #1110

Closed zifxify closed 2 years ago

zifxify commented 2 years ago

EDIT (by tlaurion): Answer to this is reported below

I'm currently stuck at compiling an w530 image on Debian 11.2 Compiling an x230 image works...

7f89b099264ae15e72d423823f236f45f1cdf960237402ef3c6f8c4eafa33504 build/w530-dgpu-K1000m-maximized/initrd.cpio.xz 2022-02-12 13:27:43+01:00 MAKE coreboot tail /home/zifxify/Documenten/HEADS/heads/build/log/coreboot.log

CC            firmware/lib20/api_kernel.o
CC            firmware/lib20/kernel.o
CC            firmware/lib/vboot_api_kernel.o
CC            firmware/lib20/misc.o
CC            firmware/lib/vboot_audio.o
CC            firmware/lib/vboot_kernel.o
CC            firmware/lib20/packed_key.o
CC            firmware/lib/vboot_ui_legacy.o
CC            firmware/lib/vboot_ui_legacy_clamshell.o
RM            vboot_fw.a
AR            vboot_fw.a
CC            firmware/lib/vboot_ui_legacy_menu.o
CC            firmware/lib/vboot_ui_legacy_wilco.o
CC            firmware/lib20/api_kernel.o
CC            firmware/lib20/kernel.o
CC            firmware/lib20/misc.o
CC            firmware/lib20/packed_key.o
RM            vboot_fw.a
AR            vboot_fw.a

make[1]: Leaving directory '/home/zifxify/Documenten/HEADS/heads/build/coreboot-4.13' make: *** [Makefile:505: /home/zifxify/Documenten/HEADS/heads/build/coreboot-4.13/w530-dgpu-K1000m-maximized/.build] Fout 1

zifxify commented 2 years ago

make BOARD=w530-flash is working. I have flashed this and there's also coreboot.rom when building. Should I flash this from within heads ? (I have unlocked the descriptor and ME regions with ifdtool and cleaned ME with me_cleaner) What is the actual difference between w530-flash and w530-dgpu-K1000m-maximized and w530-dgpu-K1000m-hotp-maximized ? It's not exactly clear for me what I have to do next.

tlaurion commented 2 years ago

You should run blobs/xx30 scripts to generate vbios and download and extract me, and then make the maximized board corresponding to your GPU (dgpu or igpu).

@eganonoa ?

tlaurion commented 2 years ago

CircleCI is building on Debian 11 now.

Here the host dependencies https://github.com/osresearch/heads/blob/master/.circleci/config.yml#L16

Here the download and extract script for ME so that the blob is available when building xx30 boards: https://github.com/osresearch/heads/blob/master/.circleci/config.yml#L97

Here the w530 script that downloads and extracts the vbios files so they are available when building board: https://github.com/osresearch/heads/blob/master/.circleci/config.yml#L107

Your original post doesn't show the real error, so my guess is that the blobs scripts were not ran prior of building w530-dgpu1000m

@zifxify does that help?

It would be nice if the documentation for those board additions were added under heads-wiki @eganonoa ?

tlaurion commented 2 years ago

On difference between boards, xx30-flash boards are meant for legacy configuration and is explained under https://osresearch.net (which renders heads-wiki)

Maximized boards take the freed ME space and make it available for maximized boards. Maximized boards also include generic GBE blob, required for Ethernet bring up and fixates the MAC address. The outcome is a fully external and flashable ROM image, not only reflashing the BIOS region of the SPI flash. This permits to take full advantage of the 11.5mb space available inside of combined SPI chips, as opposed to the really limited 7mb BIOS region of legacy boards counterpart. Legacy boards requires a two steps flashing process, flashing xx30-flash on top SPI (4mb image) and then to flash the whole limited BIOS region (7mb) defined under xx30 board.

When building a maximized board, 3 images are created. A full ROM (12mb) then splitted into top and bottom. This doesn't just overwrite the BIOS region internally, but flash the whole image.

Maximized boards includes an unlocked IFD, which defines ME and BIOS region to maximized BIOS region.

Legacy boards will be limited in features in the future. If one opens hardware to flash externally, it is better to flash maximized boards then legacy.

Please help me document this properly under heads-wiki.

@zifxify @eganonoa @Thrilleratplay @Tonux599

We could also modify coreboot module to call the download and extract scripts to ease the process, while the reference is CircleCI creating those images and making them available to download from each successfully built boards, from gree n checkmarks of latest commits. Those can he downloaded and flashed directly.

tlaurion commented 2 years ago

make BOARD=w530-flash is working.

There is no such board configuration. Newer xx30 boards are only provided as Maximized boards configuration, since legacy boards are made to support users who didn't unlock IFD on initial flash, not having followed the guide to clean ME and unlock IFD at the same time.

There were debates in the past on that matter, some users preferring ME to stay intact and only deactivated as opposed to neutered.

If IFD was not unlocked, it is impossible to flash a maximized board ROM over a legacy ROM, since flashrom would not be able to rewrite the IFD, since locked, and the bigger BIOS region would overwrite part of ME, whichbwoukd result in bricking one device.

For those reasons, and for Heads to be the simplest possible to flash, Maximized boards need to be pushed forward and legacy boards, let down.

Sandy and Ivy bridges (xx20 and xx30) being free of Intel Firmware Software Package (FSP blobs), it is also possible to control platform locking (io386 PR). So it is totally feasible, now, to focus efforts on merging and testing platforms to have Heads lock access to SPI for the Operating System.

I hope that this will support the idea of ditching Legacy boards altogether, while a single issue is still there, being the GBE blob hardcoding MAC address to DE:AD:C0:FF:EE. That means everyone using Maximized boards should know that they need to randomize their MAC address prior of using Ethernet. That can he done through NetworkManager, is pushed by Q4.1 on WiFi interface while Tails does it for all network devices. @marmarek I'm still not sure not randomizing Ethernet MAC by default is serving privacy as of now. On Heads side, this is also why legacy boards are still needed by some, while complicating the flashing process.

zifxify commented 2 years ago

@tlaurion thanks for clarifying the difference between boards

There is no such board configuration.

I was also using @eganonoa fork because main branch didn't compile the maximized build for w530. I see now that there's is indeed no such board configuration in the main branch.

Running ./blobs/xx30/download_clean_me.sh -m $(readlink -f ./blobs/xx30/me_cleaner.py) works fine.

With following command ./blobs/xx30/vbios_w530.sh I get this error

/tmp/tmp.C1fmXlssw1/rom-parser-94a615302f89b94e70446270197e0f5138d678f3/VBiosFinder-c2d764975115de466fdb4963d7773b5bc8468a06/vendor/bundle/ruby/2.7.0/gems/terrapin-0.6.0/lib/terrapin/command_line.rb:82:inrun': Terrapin::CommandNotFoundError (Terrapin::CommandNotFoundError) Verifying expected hash of extracted roms ./blobs/xx30/vbios_w530.sh: regel 65: cd: output: Bestand of map bestaat niet sha256sum: vbios_10de_0ffb_1.rom: Bestand of map bestaat niet vbios_10de_0ffb_1.rom: openen of lezen is MISLUKT sha256sum: WAARSCHUWING: 1 getoond bestand kan niet gelezen worden K2000M rom failed sha256sum verification...`

tlaurion commented 2 years ago

As reported in separate issue for code of @eganonoa, there is a total lack of validation and script goes on without exiting on errors.

May I ask you if you are on latest commit? I changed his script to be compliant with Debian 11.

do git log under heads And make sure you do a git pull master To be on latest commit.

I fixed this error like a week ago.

zifxify commented 2 years ago

I'm on last commit and still getting these errors with vbios_w530.sh. Strange that it is working on CircleCI.

zifxify commented 2 years ago

Seems to have the same issue: https://webcache.googleusercontent.com/search?q=cache:roU1lJZ6JQMJ:https://githubmemory.com/repo/thoughtbot/terrapin/issues/14+&cd=7&hl=nl&ct=clnk&gl=be&client=firefox-b-e

Still don't know what to do. Do I need to change my $PATH or is there an issue with the dependencies

zifxify commented 2 years ago

Script isn't working but I have the blobs downloaded from https://github.com/eric-pierce/Coreboot-W530. Now I have successfully build an image for the w530.

So @tlaurion you were right that the blobs scripts were not ran prior of building w530-dgpu1000m

tlaurion commented 2 years ago

CircleCI builds as root. Will look into that this week...

tlaurion commented 2 years ago

@zifxify #1111 fixes https://github.com/osresearch/heads/issues/1110#issuecomment-1037955019

@eganonoa : you have a local branch for documentation ready to push upstream?

tlaurion commented 2 years ago

For completeness of this issue, which should be part of wiki docs. Ideal would be to resolve this in code instead.... But time is missing. PR welcome, as usual.

The following errors will show when blobs are not dumped in place prior of building a blob-requiring board config:

vbios not being download/extracted per blobs/xx30/vbios_w530.sh prior of doing building a board requiring vbioses. build/logs/coreboot.log will show:

ASL Input:     dsdt.asl -   51150 bytes   1460 keywords   3031 source lines
AML Output:    dsdt.aml -   14615 bytes    902 opcodes     558 named objects

Compilation successful. 0 Errors, 0 Warnings, 15 Remarks, 463 Optimizations, 11 Constants Folded
    IASL       3150 2158 warning types were ignored!
    CC            firmware/2lib/2secdata_fwmp.o
    IASL       w530-dgpu-K1000m-hotp-maximized/dsdt.aml disassembled correctly.
make[1]: *** No rule to make target '../../blobs/xx30/8086,0106.rom', needed by 'w530-dgpu-K1000m-hotp-maximized/coreboot.pre'.  Stop.
make[1]: *** Waiting for unfinished jobs....

ME not having been download/extracted per blobs/xx30/download_clean_me.sh prior of building a xx30 board: build/logs/coreboot.log will show:

gcc -D_DEFAULT_SOURCE  -D_BSD_SOURCE -D_SVID_SOURCE  -D_XOPEN_SOURCE=700  -I/home/user/heads/build/coreboot-4.13/util/cbfstool/flashmap -I/home/user/h
eads/build/coreboot-4.13/util/cbfstool -Iw530-dgpu-K1000m-hotp-maximized/util/cbfstool -I/home/user/heads/build/coreboot-4.13/src/commonlib/include -I
/home/user/heads/build/coreboot-4.13/src/commonlib/bsd/include -include /home/user/heads/build/coreboot-4.13/src/commonlib/bsd/include/commonlib/bsd/c
ompiler.h -I3rdparty/vboot/firmware/include -I3rdparty/vboot/firmware/2lib/include -I/home/user/heads/build/coreboot-4.13/src -I/home/user/heads/build
/coreboot-4.13/src/vendorcode/intel/edk2/uefi_2.4/MdePkg/Include -include /home/user/heads/build/coreboot-4.13/src/commonlib/bsd/include/commonlib/bsd
/compiler.h -Werror -Wall -Wextra -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -O2 -std=c11 -g -fms
-extensions -c -o w530-dgpu-K1000m-hotp-maximized/util/cbfstool/fit.o /home/user/heads/build/coreboot-4.13/util/cbfstool/fit.c
make[1]: *** No rule to make target '../../blobs/xx30/me.bin', needed by 'add_intel_firmware'.  Stop.
make[1]: *** Waiting for unfinished jobs....
tlaurion commented 2 years ago

@zifxify can this issue be closed?