public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: Mark Brown <broonie@kernel.org>
Cc: linaro-kernel@lists.linaro.org, linux-kbuild@vger.kernel.org,
	John Rigby <john.rigby@linaro.org>,
	Mark Brown <broonie@linaro.org>
Subject: Re: [PATCH] kbuild: Allow scripts/* to be cross compiled
Date: Fri, 09 Aug 2013 14:36:27 +0200	[thread overview]
Message-ID: <5204E24B.3090608@suse.cz> (raw)
In-Reply-To: <1376046432-12588-1-git-send-email-broonie@kernel.org>

On 9.8.2013 13:07, Mark Brown wrote:
> From: John Rigby <john.rigby@linaro.org>
> 
> Cross compiling the binaries in scripts/* is not possible
> because various makefiles assume that $(obj)/whatever is
> executable on the build host.

What is the use case for cross-compiling them? If you have a powerful
enough target machine to build the kernel on it, you can as well compile
the host scripts natively, can't you? But maybe I'm missing something, I
do not cross-compile the kernel on a daily basis. Are there other
projects that have such feature in their build system?


> This patch introduces a new variable called KBUILD_SCRIPTROOT
> that points to script/binaries to use while cross compiling.
> 
> Usage:
> 
> Build scripts for the build host:
> 	make O=path/to/buildhost/buildscripts \
> 		silentoldconfig prepare scripts
> Then cross build script for target:
> 	make O=path/to/target/buildscripts \
> 		HOSTCC=$CROSS_COMPILE \
> 		KBUILD_SCRIPTROOT=path/to/buildhost/buildscripts
> 		silentoldconfig prepare scripts

Note that a build that uses KBUILD_SCRIPTROOT cannot detect if the
scripts are up to date and cannot rebuild them. This must be documented.


> This patch does not use KBUILD_SCRIPTROOT for all script invocations
> it only redefines the following if KBUILD_SCRIPTROOT is defined.
> 
> scripts/Makefile.build
> 	scripts/basic/fixdep --> $(KBUILD_SCRIPTROOT)/scripts/basic/fixdep
> 
> scripts/kconfig/Makefile
> 	$(obj)/conf --> $(KBUILD_SCRIPTROOT)/scripts/kconfig/conf
> 
> scripts/mod/Makefile
> 	$(obj)mk_elfconfig --> $(KBUILD_SCRIPTROOT)/scripts/mod/mk_elfconfig

OK, but you might need to add a couple of more of them, like
lib/gen_crc32table.


> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index 547e15d..09aa90c 100644
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -222,11 +222,15 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)),                       \
>  	$(echo-cmd) $(cmd_$(1));                                             \
>  	echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
>  
> +ifeq ($(KBUILD_SCRIPTROOT),)
> +KBUILD_SCRIPTROOT=.
> +endif
> +

This should be set in the top level Makefile once.

Thanks,
Michal

      parent reply	other threads:[~2013-08-09 12:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09 11:07 [PATCH] kbuild: Allow scripts/* to be cross compiled Mark Brown
2013-08-09 12:32 ` Sam Ravnborg
2013-08-09 15:00   ` Mark Brown
2013-08-09 15:13     ` Sam Ravnborg
2013-08-09 15:27       ` Mark Brown
2013-08-09 15:35         ` Michal Marek
2013-08-09 16:08           ` Mark Brown
2013-08-09 12:36 ` Michal Marek [this message]

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=5204E24B.3090608@suse.cz \
    --to=mmarek@suse.cz \
    --cc=broonie@kernel.org \
    --cc=broonie@linaro.org \
    --cc=john.rigby@linaro.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kbuild@vger.kernel.org \
    /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