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-compilation support #194

Closed
wants to merge 4 commits into from
Closed

Conversation

bjoto
Copy link

@bjoto bjoto commented Feb 13, 2023

This PR adds cross-compilation and riscv64 support.

The Linux kernel has good support for cross-compilation. Adding support for cross-compilation is somewhat straightforward:

  • Detect when the build should be cross-compiled (build arch != target arch)
  • Add/populate ARCH and CROSS_COMPILE with the target arch
  • Download a cross-compilation toolchain

RISC-V is added as the first cross-compiled target, which a corresponding rootfs.

Dependencies:

Expand the build/test matrix with build/test architecture, which allows to
specify build-/test-platform.

Further, explicitly pass the target architecture to some build steps.

Signed-off-by: Björn Töpel <[email protected]>
Cross-compile support to tar-artifacts make the logic a bit too messy
to be inline yaml. Move to libbpf/ci.

Signed-off-by: Björn Töpel <[email protected]>
Add riscv64 as a new, cross-compiled target.

Signed-off-by: Björn Töpel <[email protected]>
Add config.riscv64, similarly to config.$(uname -m) is a config
enabling building a kernel on riscv64 to be used in bpf's
selftests/kernel-patches CI.

Signed-off-by: Björn Töpel <[email protected]>
@chantra
Copy link
Contributor

chantra commented Feb 15, 2024

@bjoto FYI, we are now x-compiling s390x. I think it should work for riscv64 too.

This was done through a combination of #262, #263, #264, and #265 .

Currently, patches 0001 and 0002 from https://github.com/kernel-patches/vmtest/pull/265/files are only in bpf-next.
Patch 0099 is not even sent to the mailing list and probably will never. This makes us run bpftool from the target hosts and relies on binfmt to make it work. Preferably bpftool would handle that natively.

Other note.... this setup currently assumes that we run the tests in the native target host.

@chantra
Copy link
Contributor

chantra commented Feb 16, 2024

I will close this now that cross-compilation support has landed.

@chantra chantra closed this Feb 16, 2024
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.

3 participants