public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Saurabh Sengar <ssengar@linux.microsoft.com>
Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org, ssengar@microsoft.com,
	avladu@cloudbasesolutions.com
Subject: Re: [PATCH] tools: hv: Fix cross-compilation
Date: Thu, 12 Dec 2024 23:06:16 +0000	[thread overview]
Message-ID: <Z1tsaJJhUsSilZqq@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <1733992114-7305-1-git-send-email-ssengar@linux.microsoft.com>

On Thu, Dec 12, 2024 at 12:28:34AM -0800, Saurabh Sengar wrote:
> Use the native ARCH only incase it is not set, this will allow
> the cross complilation where ARCH is explicitly set. Add few
> info prints as well to know what arch and toolchain is getting
> used to build it.
> 
> Additionally, simplify the check for ARCH so that fcopy daemon
> is build only for x86_64.
> 
> Fixes: 82b0945ce2c2 ("tools: hv: Add new fcopy application based on uio driver")
> Reported-by: Adrian Vladu <avladu@cloudbasesolutions.com>
> Closes: https://lore.kernel.org/linux-hyperv/Z1Y9ZkAt9GPjQsGi@liuwe-devbox-debian-v2/
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> ---
>  tools/hv/Makefile | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/hv/Makefile b/tools/hv/Makefile
> index 34ffcec264ab..d29e6be6309b 100644
> --- a/tools/hv/Makefile
> +++ b/tools/hv/Makefile
> @@ -2,7 +2,7 @@
>  # Makefile for Hyper-V tools
>  include ../scripts/Makefile.include
>  
> -ARCH := $(shell uname -m 2>/dev/null)
> +ARCH ?= $(shell uname -m 2>/dev/null)
>  sbindir ?= /usr/sbin
>  libexecdir ?= /usr/libexec
>  sharedstatedir ?= /var/lib
> @@ -20,18 +20,26 @@ 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)
> +ifeq ($(ARCH), x86_64)

Technically speaking, you can also build this for x86 (32bit). Whether
anybody uses it is another question.

>  ALL_TARGETS += hv_fcopy_uio_daemon
>  endif
>  ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
>  
>  ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh
>  
> -all: $(ALL_PROGRAMS)
> +all: info $(ALL_PROGRAMS)
>  
>  export srctree OUTPUT CC LD CFLAGS
>  include $(srctree)/tools/build/Makefile.include
>  
> +info:
> +	@echo "---------------------"
> +	@echo "Building for:"
> +	@echo "CC $(CC)"
> +	@echo "LD $(LD)"
> +	@echo "ARCH $(ARCH)"
> +	@echo "---------------------"

I don't think this is needed. Anyone who's building the kernel source
should know what tool chain they are using and architecture they're
building for.

Thanks,
Wei.

> +
>  HV_KVP_DAEMON_IN := $(OUTPUT)hv_kvp_daemon-in.o
>  $(HV_KVP_DAEMON_IN): FORCE
>  	$(Q)$(MAKE) $(build)=hv_kvp_daemon
> -- 
> 2.43.0
> 

  reply	other threads:[~2024-12-12 23:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12  8:28 [PATCH] tools: hv: Fix cross-compilation Saurabh Sengar
2024-12-12 23:06 ` Wei Liu [this message]
2024-12-13  4:01   ` Saurabh Singh Sengar
2024-12-17 18:49     ` Wei Liu
2024-12-13 18:11 ` Roman Kisel
2024-12-14 12:06   ` Adrian Vladu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z1tsaJJhUsSilZqq@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=avladu@cloudbasesolutions.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ssengar@linux.microsoft.com \
    --cc=ssengar@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox