Skip to content

Conversation

@liu-song-6
Copy link
Contributor

llvm/clang supports cross compiling of the kernel. To build livepatch in the same cross compile environment, enable specifying TARGET_ARCH for kpatch-build. For example, in a x86_64 host, we can build livepatch for aarch64 kernel with:

TARGET=aarch64 kpatch-build ...

@liu-song-6
Copy link
Contributor Author

I am creating this PR for comments. We probably want to wait until #1439 is landed.

@joe-lawrence
Copy link
Contributor

This is interesting and something I hoped we'd eventually implement :) Have you run cross-compiled kpatch modules against native-built kernels?

@liu-song-6
Copy link
Contributor Author

Have you run cross-compiled kpatch modules against native-built kernels?

I haven't tried this, but I think this should work. The compiler should create the same binary in native compile and cross compile.

In practice, I assume we will use identical environment to build the kernel and the kpatch modules.

@liu-song-6
Copy link
Contributor Author

With the aarch64 support landed, can we merge this PR and cut a new release?

Thanks!

@joe-lawrence
Copy link
Contributor

Hi @liu-song-6 : we should probably document usage and any caveats for this. For example, is this clang/llvm only or what happens if used with gcc? Can it be used to kpatch native-built binaries as well? (I'm not sure if this belongs as a FAQ or short blurb on the README.md or developer's guide, etc?)

@liu-song-6
Copy link
Contributor Author

Hi @liu-song-6 : we should probably document usage and any caveats for this. For example, is this clang/llvm only or what happens if used with gcc? Can it be used to kpatch native-built binaries as well? (I'm not sure if this belongs as a FAQ or short blurb on the README.md or developer's guide, etc?)

@liu-song-6 liu-song-6 closed this Oct 13, 2025
@liu-song-6 liu-song-6 reopened this Oct 13, 2025
@liu-song-6 liu-song-6 force-pushed the target-arch branch 2 times, most recently from 1f2f485 to bb7b6a9 Compare October 13, 2025 17:10
llvm/clang supports cross compiling of the kernel. To build livepatch in
the same cross compile environment, enable specifying TARGET_ARCH for
kpatch-build. For example, in a x86_64 host, we can build livepatch for
aarch64 kernel with:

   TARGET=aarch64 kpatch-build ...

Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> [removed whitespace changes]
@joe-lawrence joe-lawrence merged commit df983a3 into dynup:master Oct 16, 2025
3 checks passed
@joe-lawrence
Copy link
Contributor

Thanks @liu-song-6 , I dropped out some of the extraneous whitespace edits (probably an editor setting).

I'll work out a release next week (need to run all the internal tests and then push out a tag).

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.

2 participants