Re: [PATCH 14/14] klp-build: Support cross-compilation
From: Josh Poimboeuf
Date: Mon Mar 16 2026 - 15:15:39 EST
On Wed, Mar 11, 2026 at 04:18:40PM -0700, Song Liu wrote:
> On Wed, Mar 4, 2026 at 7:32 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> >
> > Add support for cross-compilation. The user must export ARCH, and
> > either CROSS_COMPILE or LLVM.
> >
> > Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> > ---
> > scripts/livepatch/klp-build | 11 ++++++++++-
> > 1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
> > index 809e198a561d..b6c057e2120f 100755
> > --- a/scripts/livepatch/klp-build
> > +++ b/scripts/livepatch/klp-build
> > @@ -404,6 +404,14 @@ validate_patches() {
> > revert_patches
> > }
> >
> > +cross_compile_init() {
> > + if [[ -v LLVM ]]; then
> > + OBJCOPY=llvm-objcopy
> > + else
> > + OBJCOPY="${CROSS_COMPILE:-}objcopy"
> > + fi
> > +}
>
> Shall we show a specific warning if
> - ARCH is set; and
> - ARCH is not the same as (uname -m); and
> - neither LLVM nor CROSS_COMPILE is set.
Yeah, I think that would be a good idea. Will do that for v2.
--
Josh