On Wed, Oct 23, 2024 at 02:01:12PM +0000, Adrian Vladu wrote: > Hello, > > While trying to build the LIS daemons for Flatcar Container Linux for > ARM64 (https://www.flatcar.org/), as we are doing Gentoo based > cross-building from X64 boxes, there was an error while building those > daemons, because the cross-compile scenario was not working, as ` ARCH > := $(shell uname -m 2>/dev/null)` always returns `x86_64`. > > I have a working patch for the Linux kernel here that was already > applied in the Flatcar context and it works: > https://github.com/flatcar/scripts/blob/94b1df1b19449eb5aa967fd48ba4c1f4a6d5f415/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/6.10/z0008-tools-hv-fix-cross-compilation-for-ARM64.patch > > Raw patch link here: > https://raw.githubusercontent.com/flatcar/scripts/94b1df1b19449eb5aa967fd48ba4c1f4a6d5f415/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/6.10/z0008-tools-hv-fix-cross-compilation-for-ARM64.patch > > Sorry for the delivery method via github link, but I cannot send > proper patches from my work email address currently, as the email > server does not support it. > > Please let me know if I need to send the patch via the recommended way > or if the patch can be used directly. > > Also, maybe there is a better way to address the cross-compilation > issue, I just wanted to report the bug and also provide a possible > fix.
Saurabh added the ARCH variable. He's CCed. BTW I think your patch can be simplified by using ARCH ?= $(shell uname -m 2>/dev/null) instead of the ifeq test in your patch. I don't think that's correct. ARCH will be set to the correct value by Kbuild. Saurabh and Adrian, can you test the following patch? Thanks, Wei. >From e6a1827887617c08172e2d0ee0d60549f5ccad65 Mon Sep 17 00:00:00 2001 From: Wei Liu <wei....@kernel.org> Date: Mon, 9 Dec 2024 00:32:50 +0000 Subject: [PATCH] tools/hv: fix cross-compilation issue in hv tools The Kbuild system sets ARCH to the correct value. Signed-off-by: Wei Liu <wei....@kernel.org> --- tools/hv/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/hv/Makefile b/tools/hv/Makefile index 34ffcec264ab..9008223279df 100644 --- a/tools/hv/Makefile +++ b/tools/hv/Makefile @@ -2,7 +2,6 @@ # Makefile for Hyper-V tools include ../scripts/Makefile.include -ARCH := $(shell uname -m 2>/dev/null) sbindir ?= /usr/sbin libexecdir ?= /usr/libexec sharedstatedir ?= /var/lib @@ -20,7 +19,7 @@ override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include override CFLAGS += -Wno-address-of-packed-member ALL_TARGETS := hv_kvp_daemon hv_vss_daemon -ifneq ($(ARCH), aarch64) +ifneq ($(ARCH), arm64) ALL_TARGETS += hv_fcopy_uio_daemon endif ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) -- 2.45.2