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

cross-compile s390x on x86_64 hosts #262

Merged
merged 4 commits into from
Feb 14, 2024

Conversation

chantra
Copy link
Contributor

@chantra chantra commented Feb 13, 2024

This change enable us to compile s390x kernel/bpf samples/bpf selftests on x86_64 hosts, resulting in a 4x improvement in build time.

It piggy-backs on recent changes that passed the target arch to all actions.

matrix.py was modified to return a "build_run_on" field that indicate on what architecture to build. This returns the target arch except for s390x where it returns x86_64.

A small patch was added to force using the target version of bpftool when cross-compiling. This allows us to work around endianess quirks. We rely on the host having binfmt_misc support properly configured to run a binary for a foreign arch.

tar-artifact was also modified to find the location of the kernel image even when dealing with foreign arch.

I squeezed in upgrade to github actions v4 which were causing some deprecation messages, and also promise great improvments.

@chantra chantra marked this pull request as draft February 13, 2024 02:27
@chantra chantra force-pushed the build_runs_on branch 4 times, most recently from 2d01ca9 to 5935ac0 Compare February 13, 2024 03:10
When running on self-hosted, build s390x from x86_64 hosts.

Signed-off-by: Manu Bretelle <[email protected]>
@chantra chantra force-pushed the build_runs_on branch 2 times, most recently from 0694c38 to 709c148 Compare February 13, 2024 18:51
When running `make -s image_name` we need to pass `ARCH` variable.
There is no good way (that I know of) to infer linux's expected value
from `uname -m` value.
Here, I copied libbpf/ci's helpers to get the translation done.

Signed-off-by: Manu Bretelle <[email protected]>
v3 actions are using nodejs16 which is being deprecated. Bump to v4 to kill
the warning and also benefit from
https://github.blog/2024-02-12-get-started-with-v4-of-github-actions-artifacts/

Signed-off-by: Manu Bretelle <[email protected]>
@chantra
Copy link
Contributor Author

chantra commented Feb 13, 2024

depends on libbpf/ci#122

@chantra chantra marked this pull request as ready for review February 14, 2024 17:08
@chantra chantra changed the title WIP: cross-compilation cross-compile s390x on x86_64 hosts Feb 14, 2024
@chantra chantra merged commit 734d303 into kernel-patches:master Feb 14, 2024
48 checks passed
@chantra chantra deleted the build_runs_on branch February 14, 2024 18:10
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.

1 participant