KBuild: Allow scripts/* to be cross compiled
authorJohn Rigby <john.rigby@linaro.org>
Thu, 3 Mar 2011 01:57:21 +0000 (18:57 -0700)
committerJohn Rigby <john.rigby@linaro.org>
Thu, 14 Apr 2011 18:08:58 +0000 (12:08 -0600)
commit1c0a3b28f83c08661b6d30bc250d5ac6a7faf27d
treef04c16101ac74cbcd5f04bd24ef2294396d0c317
parentf2a9bbbd2083fc66fa87922c5dc4be2bff94a7d6
KBuild: Allow scripts/* to be cross compiled

Cross compiling the binaries in scripts/* is not possible
because various makefiles assume that $(obj)/whatever is
executable on the build host.

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

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

Signed-off-by: John Rigby <john.rigby@linaro.org>
scripts/Kbuild.include
scripts/Makefile.build
scripts/kconfig/Makefile
scripts/mod/Makefile