public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Bolle <pebolle@tiscali.nl>
To: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Michal Marek <mmarek@suse.cz>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH v2 4/4] kconfig: link CONFIG_CROSS_COMPILE with environment variable
Date: Wed, 03 Sep 2014 23:11:35 +0200	[thread overview]
Message-ID: <1409778695.5546.55.camel@x220> (raw)
In-Reply-To: <20140901071639.28909.88888.stgit@zurg>

Hi Konstantin,

On Mon, 2014-09-01 at 11:16 +0400, Konstantin Khlebnikov wrote:
> Cross-compiler tool prefix can be set in command line, in the environment
> variable CROSS_COMPILE or in config file, in option CONFIG_COROSS_COMPILE.
> Also some arch/*/Makefile provides default value.
> 
> This patch links config option CONFIG_CROSS_COMPILE and variable CROSS_COMPILE
> in both directions: environment/command line has higher priority and updates
> value saved in the config file, config option acts as default value for it.
> 
> This is especially useful together with option O=dir which allows to create
> separate directory for each target architecture and kernel flavor:
> 
> # make O=build/arm ARCH=arm CROSS_COMPILE=arm-none-eabi- defconfig
> # make -C build/arm
> 
> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>

I have only had a quick glance at this series. Just a quick question to
help me understand where it is going.

Would this patch mean that, if a (def)config file has both ARCH and
CROSS_COMPILE set, one could use that (def)config file and invoke "make
$whatever_target" and expect it to do the right thing (provided a
suitable cross compiler is installed)?

This implies cross compiler prefixes are standardized across
distributions, I guess. Maybe they're not.

> ---
>  Makefile     |    6 +++++-
>  init/Kconfig |    1 +
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index f648405..1044f40 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -263,7 +263,11 @@ endif
>  # "make" in the configured kernel build directory always uses that.
>  # Default value for CROSS_COMPILE is not to prefix executables
>  # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
> -CROSS_COMPILE	?= $(CONFIG_CROSS_COMPILE:"%"=%)
> +ifndef CROSS_COMPILE
> +	CROSS_COMPILE := $(shell $(srctree)/scripts/config \
> +				--file $(KBUILD_OUTPUT)$(KCONFIG_CONFIG) \
> +				--if-undef "" --state "CROSS_COMPILE")
> +endif
>  
>  # Architecture as present in compile.h
>  UTS_MACHINE 	:= $(ARCH)
> diff --git a/init/Kconfig b/init/Kconfig
> index e84c642..1c2f621 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -47,6 +47,7 @@ config INIT_ENV_ARG_LIMIT
>  
>  config CROSS_COMPILE
>  	string "Cross-compiler tool prefix"
> +	option env="CROSS_COMPILE"
>  	help
>  	  Same as running 'make CROSS_COMPILE=prefix-' but stored for
>  	  default make runs in this kernel build directory.  You don't
> 


Paul Bolle


  reply	other threads:[~2014-09-03 21:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-01  7:16 [PATCH v2 0/4] kconfig: store default ARCH in .config Konstantin Khlebnikov
2014-09-01  7:16 ` [PATCH v2 1/4] kconfig: save values imported from environment into config file Konstantin Khlebnikov
2014-09-01  7:16 ` [PATCH v2 2/4] scripts/config: add option for changing output for undefined options Konstantin Khlebnikov
2014-09-01  7:16 ` [PATCH v2 3/4] kconfig: get target architecture from config file Konstantin Khlebnikov
2014-09-01  7:16 ` [PATCH v2 4/4] kconfig: link CONFIG_CROSS_COMPILE with environment variable Konstantin Khlebnikov
2014-09-03 21:11   ` Paul Bolle [this message]
2014-09-04  5:23     ` Konstantin Khlebnikov
2014-09-01  7:24 ` [PATCH v2 0/4] kconfig: store default ARCH in .config Geert Uytterhoeven
2014-09-01  7:35   ` Konstantin Khlebnikov
2014-10-27 17:20 ` Konstantin Khlebnikov
2014-12-10 20:24   ` Paul Bolle

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=1409778695.5546.55.camel@x220 \
    --to=pebolle@tiscali.nl \
    --cc=geert@linux-m68k.org \
    --cc=koct9i@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /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