Thread (34 messages) 34 messages, 4 authors, 2026-03-17

Re: [PATCH 14/14] klp-build: Support cross-compilation

From: Song Liu <song@kernel.org>
Date: 2026-03-17 18:21:55
Also in: linux-arm-kernel, lkml

On Tue, Mar 17, 2026 at 10:52 AM Josh Poimboeuf [off-list ref] wrote:
[...]
quoted
Yeah, I think that would be a good idea.  Will do that for v2.
So, in general ARCH is complicated.  For example:

 - ARCH=arm64 would never match "uname -m" (aarch64)
 - ARCH=i386 would use the same gcc binary (no cross-compiler needed)
 - I'm sure there are many other edge cases...
Agreed. I haven't worked with i386 for a long time, but I did notice
the arm64 vs. aarch64 difference.
Instead of a manual error, it may be simpler to just let the build fail
naturally if the user doesn't set the right ARCH.

Though, I think the check can be improved slightly, as ARCH is a
reasonably good indicator that cross-compiling is happening.  So I can
at least add an ARCH check at the beginning like so?

cross_compile_init() {
        if [[ ! -v ARCH ]]; then
                OBJCOPY=objcopy
                return 0
        fi

        if [[ -v LLVM ]]; then
                OBJCOPY=llvm-objcopy
        else
                OBJCOPY="${CROSS_COMPILE:-}objcopy"
        fi
}
Do we need ARCH when CROSS_COMPILE is set? I was
under the impression that CROSS_COMPILE doesn't require
ARCH.

Thanks,
Song
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help