diff options
| author | John Rigby <john.rigby@linaro.org> | 2011-03-02 20:57:21 -0500 |
|---|---|---|
| committer | Luis Henriques <luis.henriques@canonical.com> | 2012-03-26 05:27:07 -0400 |
| commit | a6b3d7a1815c4a11efacd4ef8141a02eb9805a79 (patch) | |
| tree | 30a5bea756cba9c71ca0d4bc6017d52668e07f86 /scripts/mod | |
| parent | d4920420d54c6d433fd7f185341daed4787a2fdd (diff) | |
KBuild: Allow scripts/* to be cross compiled
BugLink: http://bugs.launchpad.net/bugs/963823
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>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Diffstat (limited to 'scripts/mod')
| -rw-r--r-- | scripts/mod/Makefile | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index ff954f8168c..258d4ba32d5 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile | |||
| @@ -1,6 +1,12 @@ | |||
| 1 | hostprogs-y := modpost mk_elfconfig | 1 | hostprogs-y := modpost mk_elfconfig |
| 2 | always := $(hostprogs-y) empty.o | 2 | always := $(hostprogs-y) empty.o |
| 3 | 3 | ||
| 4 | ifdef KBUILD_SCRIPTROOT | ||
| 5 | MKELFCONFIG = $(KBUILD_SCRIPTROOT)/scripts/mod/mk_elfconfig | ||
| 6 | else | ||
| 7 | MKELFCONFIG = $(obj)/mk_elfconfig | ||
| 8 | endif | ||
| 9 | |||
| 4 | modpost-objs := modpost.o file2alias.o sumversion.o | 10 | modpost-objs := modpost.o file2alias.o sumversion.o |
| 5 | 11 | ||
| 6 | # dependencies on generated files need to be listed explicitly | 12 | # dependencies on generated files need to be listed explicitly |
| @@ -8,9 +14,9 @@ modpost-objs := modpost.o file2alias.o sumversion.o | |||
| 8 | $(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h | 14 | $(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h |
| 9 | 15 | ||
| 10 | quiet_cmd_elfconfig = MKELF $@ | 16 | quiet_cmd_elfconfig = MKELF $@ |
| 11 | cmd_elfconfig = $(obj)/mk_elfconfig < $< > $@ | 17 | cmd_elfconfig = $(MKELFCONFIG) < $< > $@ |
| 12 | 18 | ||
| 13 | $(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE | 19 | $(obj)/elfconfig.h: $(obj)/empty.o $(MKELFCONFIG) FORCE |
| 14 | $(call if_changed,elfconfig) | 20 | $(call if_changed,elfconfig) |
| 15 | 21 | ||
| 16 | targets += elfconfig.h | 22 | targets += elfconfig.h |
