Skip to content

Conversation

@tlaurion
Copy link
Collaborator

@tlaurion tlaurion commented Feb 4, 2022

This is WIP.

In an attempt to investigate why car.data is not build under coreboot 4.11 builds under debian-11, I've decided to check what is going on in Heads' build system, which at the end of the day is supposed to do the right thing until we have something better to use.

To have reproducible builds, we are supposed to have fixed versions of some tools, prior of building anything in the hope of producing reproducible output:

  • known make version being same as defined in module definition
  • known gawk version being same as defined in module definition
  • musl-cross-make toolchain as defined per musl-cross module definition to build all modules but coreboot
  • coreboot version specific build toolchain so coreboot parts are reproducible.
  • At that point, we should have reproducible coreboot, reproducible kernel, reproducible initrd containing all Heads related built modules (tools.cpio, heads.cpio being bundled) which should be hopefully all being reproducible again.
  • Have a reproducible ROM for a specific commit ID, if and only the precedent are all true.

If initrd is not reproducible, then check individual modules output under hashes.txt. Check logs for configure output of faulty module. Diffscope. Patch. Redo.

I first noticed that local gawk was only built if make was also in wrong local version, and then noticed that most of the make calls to build all modules were actually not using the locally built make version but the host deployed version, from both configure logs and build logs under build/logs/*.

This is an attempt to correct the situation.

My make fu not being optimal, please review and comment, and/or propose another PR with proper fixes. Also.... Please educate me if i'm doing stupid things when compared to original Makefile (which was obviously also doing stupid things.... as you can see by my attempt of improving it).

The DATE fixation Makefile statement was embedded under make version checking under Makefile as well. This is also fixed per current PR.

Still TODO: We lost rom hash output under hashes.txt. Not sure since when and why, yet. Things got broken when gawk local build was added, or around that time.

@tlaurion tlaurion marked this pull request as draft February 4, 2022 15:57
@tlaurion
Copy link
Collaborator Author

tlaurion commented Feb 4, 2022

It was coincidental that it worked for debian-10, since locally deployed make was the good one per OS deployed versions (make 4.2.1) so the Makefile test was successful:

root@89a0503e542f:~# make --version
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Also to be noted that under debian-10, gawk was not installed by default, the Makefile test depending on something else then gawk if not found...

root@89a0503e542f:~# gawk --version
-bash: gawk: command not found

On debian-10, we consequently see that gawk is reported to be in a "bad version" per global Makefile, but was still not compiled: https://circleci.com/api/v1.1/project/github/tlaurion/heads/3735/output/103/0?file=true&allocation-id=61fbece2b47315079ce0ff17-0-build%2F30054AE1 prior of musl-cross-make target.

Also to be noted that the locally built make and gawk were not properly being propagated for make calls for all other modules. awk was available on the system.

Basically, Heads was still using host deployed versions.

@tlaurion tlaurion force-pushed the CircleCI_retry_coreboot-411_under_debian-11 branch from 7232f53 to d5e68a1 Compare February 4, 2022 16:54
@tlaurion
Copy link
Collaborator Author

tlaurion commented Feb 4, 2022

Rebased on master to only include changes related to support debian-11

@tlaurion
Copy link
Collaborator Author

tlaurion commented Feb 4, 2022

Now, build fails at https://app.circleci.com/pipelines/github/tlaurion/heads/961/workflows/51bc0444-e29d-42f8-804e-ee3dabd0ea8c/jobs/3902/parallel-runs/0/steps/0-103 :

/root/project/build/make-4.2.1/make -C "/root/project/build/coreboot-4.11/kgpe-d16_workstation" -C /root/project/build/coreboot-4.11 obj=/root/project/build/coreboot-4.11/kgpe-d16_workstation CROSS=/root/project/crossgcc/bin/i386-linux-musl- IASL=/root/project/build/coreboot-4.11/util/crossgcc/xgcc/bin/iasl DOTCONFIG=/root/project/build/coreboot-4.11/kgpe-d16_workstation/.config BUILD_TIMELESS=1 CFLAGS_x86_32=-fdebug-prefix-map=/root/project=heads -gno-record-gcc-switches -Wno-error=packed-not-aligned CFLAGS_x86_64=-fdebug-prefix-map=/root/project=heads -gno-record-gcc-switches -Wno-error=packed-not-aligned -j36 --max-load 16
make[1]: Entering directory '/root/project/build/coreboot-4.11'
/root/project/build/make-4.2.1/make oldconfig
KCONFIG_STRICT= kgpe-d16_workstation/util/kconfig/conf --oldconfig src/Kconfig
#
# configuration written to /root/project/build/coreboot-4.11/kgpe-d16_workstation/.config
#
kgpe-d16_workstation/util/kconfig/conf --silentoldconfig src/Kconfig
    HOSTCC     util/romcc/romcc (this may take a while)
gcc -g  -Wall -o kgpe-d16_workstation/util/romcc/romcc /root/project/build/coreboot-4.11/util/romcc/romcc.c
    GEN        build.h
mv kgpe-d16_workstation/build.ht kgpe-d16_workstation/build.h
    CC         bootblock/arch/x86/walkcbfs.o
/root/project/build/coreboot-4.11/util/crossgcc/xgcc/bin/i386-elf-gcc -MMD -Isrc -Isrc/include -Isrc/commonlib/include -Ikgpe-d16_workstation -I3rdparty/vboot/firmware/include -include src/include/kconfig.h -include src/include/rules.h -include src/commonlib/include/commonlib/compiler.h -I3rdparty -D__BUILD_DIR__=\"kgpe-d16_workstation\" -Isrc/superio/aspeed -Isrc/arch/x86/include -D__ARCH_x86_32__ -pipe -g -nostdinc -std=gnu11 -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wno-trigraphs -Wimplicit-fallthrough -Wstrict-aliasing -Wshadow -Wdate-time -Wtype-limits -Wvla -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-pie -fno-delete-null-pointer-checks -Wno-packed-not-aligned -fconserve-stack -Wnull-dereference -Wreturn-type -Wno-unused-but-set-variable -Werror -Os -I3rdparty/vboot/firmware/2lib/include -I3rdparty/vboot/firmware/lib21/include -fdebug-prefix-map=/root/project=heads -gno-record-gcc-switches -Wno-error=packed-not-aligned -MT kgpe-d16_workstation/bootblock/arch/x86/walkcbfs.o -D__PRE_RAM__ -D__BOOTBLOCK__ -c -o kgpe-d16_workstation/bootblock/arch/x86/walkcbfs.o src/arch/x86/walkcbfs.S
    GEN        generated/assembly.inc
printf '#include "src/cpu/amd/car/cache_as_ram.inc"\n' > kgpe-d16_workstation/generated/assembly.inc
/bin/sh: 1: cannot create kgpe-d16_workstation/generated/assembly.inc: Directory nonexistent
make[1]: *** [src/arch/x86/Makefile.inc:61: kgpe-d16_workstation/generated/assembly.inc] Error 2
make[1]: Leaving directory '/root/project/build/coreboot-4.11'
make: *** [Makefile:503: /root/project/build/coreboot-4.11/kgpe-d16_workstation/.build] Error 1

CircleCI received exit code 0

I am redoing build on top of debian-10 with the modified Makefile to see if it breaks here: https://app.circleci.com/pipelines/github/tlaurion/heads/962/workflows/8ed9bcc0-4539-4bed-88e2-6296ee203692

@tlaurion
Copy link
Collaborator Author

tlaurion commented Feb 4, 2022

Builds successfully on top of debian-10 with same modified Makefile worked here: https://app.circleci.com/pipelines/github/tlaurion/heads/962/workflows/7af97058-b209-4e3d-8a4f-2250cb1fd25c and commit

So now i'm even more puzzled now. We are now sure here vs debian-10 that:

  • We use the same make and gawk versions between debian-10 and debian-11 dockers (first lines of on screen logs, then search in logs and realize that local gawk and local make are used everywhere else)
  • We build musl-cross-make to build modules outside of coreboot
  • We build coreboot with its own coreboot-version based toolchain.....

Then why:

On screen log trace on debian-10:

  HOSTCC     util/romcc/romcc (this may take a while)
    GEN        build.h
mv kgpe-d16_workstation/build.ht kgpe-d16_workstation/build.h
    GEN        generated/assembly.inc
gcc -g  -Wall -o kgpe-d16_workstation/util/romcc/romcc /root/project/build/coreboot-4.11/util/romcc/romcc.c
printf '#include "src/cpu/amd/car/cache_as_ram.inc"\n' > kgpe-d16_workstation/generated/assembly.inc
printf "    HOSTCC     cbfstool/rmodtool.o\n"
printf "    HOSTCC     cbfstool/rmodule.o\n"
printf "    HOSTCC     cbfstool/common.o\n"
    HOSTCC     cbfstool/rmodtool.o
gcc -D_DEFAULT_SOURCE  -D_XOPEN_SOURCE=700  -I/root/project/build/coreboot-4.11/util/cbfstool/flashmap -I/root/project/build/coreboot-4.11/util/cbfstool -Ikgpe-d16_workstation/util/cbfstool -I/root/project/build/coreboot-4.11/src/commonlib/include -include /root/project/build/coreboot-4.11/src/commonlib/include/commonlib/compiler.h -I3rdparty/vboot/firmware/include -I3rdparty/vboot/firmware/2lib/include -I/root/project/build/coreboot-4.11/src -I/root/project/build/coreboot-4.11/src/vendorcode/intel/edk2/uefi_2.4/MdePkg/Include -Werror -Wall -Wextra -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -O2 -std=c99 -g -fms-extensions -c -o kgpe-d16_workstation/util/cbfstool/rmodtool.o /root/project/build/coreboot-4.11/util/cbfstool/rmodtool.c
    HOSTCC     cbfstool/rmodule.o
    HOSTCC     cbfstool/common.o

On screen log trace on debian-11:

    HOSTCC     util/romcc/romcc (this may take a while)
gcc -g  -Wall -o kgpe-d16_workstation/util/romcc/romcc /root/project/build/coreboot-4.11/util/romcc/romcc.c
    GEN        build.h
mv kgpe-d16_workstation/build.ht kgpe-d16_workstation/build.h
    CC         bootblock/arch/x86/walkcbfs.o
/root/project/build/coreboot-4.11/util/crossgcc/xgcc/bin/i386-elf-gcc -MMD -Isrc -Isrc/include -Isrc/commonlib/include -Ikgpe-d16_workstation -I3rdparty/vboot/firmware/include -include src/include/kconfig.h -include src/include/rules.h -include src/commonlib/include/commonlib/compiler.h -I3rdparty -D__BUILD_DIR__=\"kgpe-d16_workstation\" -Isrc/superio/aspeed -Isrc/arch/x86/include -D__ARCH_x86_32__ -pipe -g -nostdinc -std=gnu11 -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wno-trigraphs -Wimplicit-fallthrough -Wstrict-aliasing -Wshadow -Wdate-time -Wtype-limits -Wvla -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-pie -fno-delete-null-pointer-checks -Wno-packed-not-aligned -fconserve-stack -Wnull-dereference -Wreturn-type -Wno-unused-but-set-variable -Werror -Os -I3rdparty/vboot/firmware/2lib/include -I3rdparty/vboot/firmware/lib21/include -fdebug-prefix-map=/root/project=heads -gno-record-gcc-switches -Wno-error=packed-not-aligned -MT kgpe-d16_workstation/bootblock/arch/x86/walkcbfs.o -D__PRE_RAM__ -D__BOOTBLOCK__ -c -o kgpe-d16_workstation/bootblock/arch/x86/walkcbfs.o src/arch/x86/walkcbfs.S
    GEN        generated/assembly.inc
printf '#include "src/cpu/amd/car/cache_as_ram.inc"\n' > kgpe-d16_workstation/generated/assembly.inc
/bin/sh: 1: cannot create kgpe-d16_workstation/generated/assembly.inc: Directory nonexistent
make[1]: *** [src/arch/x86/Makefile.inc:61: kgpe-d16_workstation/generated/assembly.inc] Error 2
make[1]: Leaving directory '/root/project/build/coreboot-4.11'
make: *** [Makefile:503: /root/project/build/coreboot-4.11/kgpe-d16_workstation/.build] Error 1

Someone?!
CircleCI is building with 36 cores and 8GB ram.

Concurrence is the problem. But why!?!

@tlaurion
Copy link
Collaborator Author

tlaurion commented Feb 5, 2022

The next run fixes it magically. My eyes do not see what needs to be fixed under coreboot Makefile, Makefile.inc to fix that race condition...

@MrChromebox? Same applies in current master for build.h

So the parts generating build.h and assembly.inc are fragile in coreboot 4.11. What fixed it in later coreboot versions?

@tlaurion
Copy link
Collaborator Author

tlaurion commented Feb 5, 2022

Seems like https://review.coreboot.org/c/coreboot/+/42883 might fix assembly.inc race condition

Edit: yesssssss

@tlaurion
Copy link
Collaborator Author

tlaurion commented Feb 5, 2022

And that for build.h race condition https://review.coreboot.org/c/coreboot/+/11904

Will test both...

Edit: unfortunately, this specific upstream patch cannot be applied directly.

Edit2: not needed.

@tlaurion
Copy link
Collaborator Author

tlaurion commented Feb 5, 2022

Todo: debian-10 reports bad gawk version even if good. Fix this. done

Also report more clearly local versions used prior of starting builds done.

- Add kgpe-d16 patch to remove HID for PCI devices (successful build on top of linuxboot#1101 and linuxboot#1012 per https://app.circleci.com/pipelines/github/tlaurion/heads/937/workflows/de49bea0-3f58-4a91-8891-87622f5a0eed)
- CircleCI modified to build for coreboot 4.11 kgpe-d16_workstation on top of 4.15 passed workspace
- CircleCI modified so that we still archive all the logs in artifacts for the current build even if failing. We now exit 1 after having archived all the log files under build/
- Add xx30 vbios extract scripts to test. Expecting musl-cross target to fail since make and gawk aren't built
- CircleCI: gawk was not installed in apt statements under Debian. Installing
- Makefile: seperate and fix local make and gawk building pror of using. Otherwise, impossible to build musl-cross target seperatly.
  - Also give some debugging info at start of Heads builds to tell which local gawk and make are used, also telling which make call will be propagated in the rest of the builds
  - Fix gawk version checking, reporting bad version even if 4.2.1 as expected on debian-10 (debian-10 OS deploys gawk and make in version 4.2.1)
- CircleCI: Changing musl-cross taget to bootstrap (gawk+make) and musl-cross-make (bootstrap_musl-cross-make) for clarity
…ng present and causing race condition in parallelized builds with high number of cores
@tlaurion tlaurion force-pushed the CircleCI_retry_coreboot-411_under_debian-11 branch from a60fb21 to 510ce2b Compare February 5, 2022 19:22
@tlaurion
Copy link
Collaborator Author

tlaurion commented Feb 5, 2022

Good news. Builds are now stable on debian-11 for coreboot 4.11 boards since bd0d080 and do not need reruns when there is concurrency problems (at least for 36 cores as under CircleCI) since local gawk and make are now actually properly propagated down the Heads buildsystem.

Notice at beginning of builds on debian-11+ :

2022-02-05 14:26:43-05:00 Wrong OS deployed make detected: 4.3. Building and using 4.2.1...
2022-02-05 14:26:43-05:00 Wrong OS deployed gawk detected: 5.1.0. Building and using 4.2.1...
2022-02-05 14:26:43-05:00 Local built HEADS_GAWK only if different then provided by OS: /root/project/build/gawk-4.2.1/gawk
2022-02-05 14:26:43-05:00 Local built HEADS_MAKE only if different then provided by OS: /root/project/build/make-4.2.1/make
2022-02-05 14:26:43-05:00 Heads build system will call make from now on as: MAKE: /root/project/build/make-4.2.1/make.

Also notice that on debian-10, there is no gawk versioning mismatch anymore when 4.2.1 is expected (and found per OS deployment). On debian-10, both make and gawk OS deployed were in version 4.2.1.

@MrChromebox a clean build, just to make sure, is happening under latest commit of this PR.

Should be ready to merge, while your eyes on Makefile changes would still be nice.
If you could flash librem_l1um rom from CircleCI, as usual, that would be amazing.

@tlaurion tlaurion marked this pull request as ready for review February 5, 2022 19:32
@tlaurion tlaurion changed the title WIP: make coreboot 4.11 platforms buildable under recent OS (CircleCI on debian-11 here) make coreboot 4.11 platforms buildable under recent OSea (CircleCI builds on debian-11 here) Feb 5, 2022
@tlaurion
Copy link
Collaborator Author

tlaurion commented Feb 5, 2022

@MrChromebox
Copy link
Contributor

@tlaurion tlaurion merged commit 0670bcd into linuxboot:master Feb 8, 2022
@tlaurion
Copy link
Collaborator Author

CircleCI still hits a race condition for coreboot 4.11, which breaks CircleCI builds, even more consistently with #1178....

I cannot wrap my head around it.... end of consistently failing build log, enven when trying to trace issue from connecting to CircleCI through SSH and rebuilding now. With #1178, we are removing local make 4.2.1 locally being built and having all builds depend on that make 4.2.1 for everything being built.... That would be desirable for reasons explained under #1178.

gcc -D_DEFAULT_SOURCE  -D_XOPEN_SOURCE=700  -I/root/project/build/coreboot-4.11/util/cbfstool/flashmap -I/root/project/build/coreboot-4.11/util/cbfstool -Ikgpe-d16_workstation/util/cbfstool -I/root/project/build/coreboot-4.11/src/commonlib/include -include /root/project/build/coreboot-4.11/src/commonlib/include/commonlib/compiler.h -I3rdparty/vboot/firmware/include -I3rdparty/vboot/firmware/2lib/include -I/root/project/build/coreboot-4.11/src -I/root/project/build/coreboot-4.11/src/vendorcode/intel/edk2/uefi_2.4/MdePkg/Include -Werror -Wall -Wextra -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -O2 -std=c99 -g -fms-extensions -c -o kgpe-d16_workstation/util/cbfstool/valstr.o /root/project/build/coreboot-4.11/util/cbfstool/flashmap/valstr.c
    GEN        generated/assembly.inc
make[1]: *** No rule to make target '".car.data"', needed by 'kgpe-d16_workstation/coreboot.pre'.  Stop.
make[1]: *** Waiting for unfinished jobs....
printf '#include "src/cpu/amd/car/cache_as_ram.inc"\n' > kgpe-d16_workstation/generated/assembly.inc
KCONFIG_STRICT= kgpe-d16_workstation/util/kconfig/conf --oldconfig src/Kconfig
#
# configuration written to /root/project/build/coreboot-4.11/kgpe-d16_workstation/.config
#
kgpe-d16_workstation/util/kconfig/conf --silentoldconfig src/Kconfig
kgpe-d16_workstation/auto.conf:1260:notice: override: reassigning to symbol PICASSO_UART_CLOCK_SOURCE
rm kgpe-d16_workstation/util/cbfstool/fmd_parser.c kgpe-d16_workstation/util/cbfstool/fmd_scanner.c
make[1]: Leaving directory '/root/project/build/coreboot-4.11'
make: *** [Makefile:390: /root/project/build/coreboot-4.11/kgpe-d16_workstation/.build] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants