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

feat(docker): compile toolchains separately #368

Merged
merged 5 commits into from
Oct 31, 2024

Conversation

AtomicFS
Copy link
Collaborator

@AtomicFS AtomicFS commented Oct 14, 2024

At the moment this is not used yet, but will be.

Basically I am moving the compilation of the tool-chains out of the Dockerfile, as I believe this to be the only reasonable way to achieve multi-arch docker containers.

There is a lot to comprehend, so here are some notes as to why:

  • u-root and linux are OK to build the "normal way", however with edk2 and coreboot I get errors when trying to compile to tool-chains - I suspect the problem to be native emulation not supporting all of the instructions required
    • building x86 on x86 machine and arm64 on arm64 works fine, but building arm64 on x86 machine is broken
  • this means that I cannot build edk2 or coreboot multi-arch container on single x86 machine as I can u-root or linux
  • I looked into cross-compilation - aka cross-compile the cross-compilation tool-chains ... well that did not go well
  • one way would be to build each arch-container separately (x86 part on x86 machine and arm64 part on arm64 machine), publish them separately and then publish hand-crafted manifest connecting them together ... (see The hard way with docker manifest in Multi-arch build and images, the simple way
  • but we can avoid all of that with simply compiling the tool-chains separately on their respective machines and then just copy files into single multi-arch container (which can be done without any problems with simple native emulation)
  • so this is one step towards that
  • one advantage is that this way we can cache the compiled tool-chains for coreboot and speed up the build by one order of magnitude (normally they take around 1 hour to compile)

UPDATE:

  • unfortunately pre-compiling edk2 BaseTools is not that simple, there are 2 big problems:
    • the oldest edk2 that we have is udk2017 which is using Ubuntu Bionic (18.04) which is simply too old to run GitHub action inside it due to obsolete NodeJS (see GLIBC_2.28 not found)
    • GitHub is not going to fix this, nor they are likely to remove the idiotic design-flaw of having actions being written in JavaScript
  • so I will make it such that the edk2 BaseTools gets compile on the first use by the user, and since it does not take long, it should be fine I guess

@AtomicFS AtomicFS requested a review from MDr164 as a code owner October 14, 2024 16:52
@github-actions github-actions bot added feature New feature or request testing Testing related github_actions Pull requests that update GitHub Actions code labels Oct 14, 2024
@AtomicFS AtomicFS force-pushed the feat/compile-toolchains-separatly branch 24 times, most recently from 22d585d to 808affb Compare October 15, 2024 13:40
@AtomicFS AtomicFS force-pushed the feat/compile-toolchains-separatly branch 10 times, most recently from af65761 to f2f9442 Compare October 17, 2024 13:03
@AtomicFS AtomicFS changed the title feat: compile toolchains separately feat(docker): compile toolchains separately Oct 17, 2024
@AtomicFS
Copy link
Collaborator Author

AtomicFS commented Oct 17, 2024

@MDr164 I think that this is ready for preview.

Next PR will replace the in Dockerfile toolchain compilation with these pre-compiled toolchains.

@AtomicFS AtomicFS force-pushed the feat/compile-toolchains-separatly branch 2 times, most recently from e16041d to 0cb3751 Compare October 21, 2024 14:09
- ubuntu uses different yq parser which does act a bit oddly, this
  should make it act in more predictable way
- add check to validate the JSON

Signed-off-by: AtomicFS <[email protected]>
@AtomicFS AtomicFS force-pushed the feat/compile-toolchains-separatly branch 3 times, most recently from 3a78766 to 4a0f830 Compare October 26, 2024 18:58
- I did try to pre-compile edk2 BaseTools, just like we do with
  coreobot, but there were simply too many problems
- udk2017 uses Ubuntu Bionic (18.04) which is simply too old for GitHub
  actions, which require modern NodeJS
- uploading almost 1GB of artifacts per edk2 variant is just too much
  for the CI and takes forever
- since the BaseTools do not take that long to compile (under 1 minute),
  it will be better to run the compilation on the first use by the user

Signed-off-by: AtomicFS <[email protected]>
@AtomicFS AtomicFS force-pushed the feat/compile-toolchains-separatly branch from 4a0f830 to 727199c Compare October 26, 2024 23:32
Copy link
Collaborator

@MDr164 MDr164 left a comment

Choose a reason for hiding this comment

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

Looks alright, gonna run some local tests once those updates are in

.github/workflows/docker-build-and-test.yml Show resolved Hide resolved
@AtomicFS AtomicFS requested a review from MDr164 October 31, 2024 09:52
@AtomicFS AtomicFS added this pull request to the merge queue Oct 31, 2024
Merged via the queue into main with commit bbdcfa1 Oct 31, 2024
213 of 220 checks passed
@AtomicFS AtomicFS deleted the feat/compile-toolchains-separatly branch October 31, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker docker related feature New feature or request github_actions Pull requests that update GitHub Actions code testing Testing related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants