Skip to content

Conversation

@akerouanton
Copy link
Member

  • Automatically install gcc cross-compiler, and set ARCH and CROSS_COMPILE during kernel compilation, by comparing current arch with the supllied KERNEL_ARCH.
  • Use Buildkit TARGETARCH to determine which version of crun should be downloaded, and compile the init binary for the correct architecture.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
Copilot AI review requested due to automatic review settings January 9, 2026 12:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables cross-compilation of the kernel and initrd by automatically detecting architecture mismatches and configuring the appropriate toolchain. The changes ensure that the kernel, init binary, and crun runtime are compiled for the target architecture rather than the host architecture.

Key changes:

  • Added automatic installation of cross-compiler toolchains when host and target architectures differ
  • Configured kernel compilation with proper ARCH and CROSS_COMPILE environment variables for cross-compilation
  • Leveraged Buildkit's TARGETARCH variable to download the correct crun binary and compile the init binary for the target platform

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hsiangkao
Copy link
Member

sigh, hi @akerouanton I really hope #61 could be addressed.
I don't have enough bandwidth on this since my current work doesn't allow me, but I really hope there could be a local build way without Dockerfile since the network condition in China is very poor.

@dmcgowan
Copy link
Member

@hsiangkao can discuss in that issue, the cross compilation is not very easy right now. Some components cannot be compiled easily on Linux and some components cannot be easily compiled on Mac.

@akerouanton akerouanton merged commit fc08ecd into containerd:main Jan 13, 2026
3 checks passed
@akerouanton akerouanton deleted the fix-cross-compilation branch January 13, 2026 08:41
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