From b5c100b9517ae793720215d4f9a68138f8c2cf67 Mon Sep 17 00:00:00 2001 From: John Rigby Date: Tue, 10 Jan 2012 12:01:41 -0700 Subject: 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 --- scripts/Kbuild.include | 6 +++++- scripts/Makefile.build | 6 +++++- scripts/kconfig/Makefile | 30 ++++++++++++++++++------------ scripts/mod/Makefile | 10 ++++++++-- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 547e15daf03d..09aa90ce6e48 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 + # Execute the command and also postprocess generated .d dependencies file. if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ @set -e; \ $(echo-cmd) $(cmd_$(1)); \ - scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ + $(KBUILD_SCRIPTROOT)/scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ rm -f $(depfile); \ mv -f $(dot-target).tmp $(dot-target).cmd) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index d5d859c80729..de351927a7c0 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -291,13 +291,17 @@ cmd_record_mcount = \ fi; endif +ifeq ($(KBUILD_SCRIPTROOT),) +KBUILD_SCRIPTROOT=. +endif + define rule_cc_o_c $(call echo-cmd,checksrc) $(cmd_checksrc) \ $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ $(cmd_modversions) \ $(call echo-cmd,record_mcount) \ $(cmd_record_mcount) \ - scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ + $(KBUILD_SCRIPTROOT)/scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ $(dot-target).tmp; \ rm -f $(depfile); \ mv -f $(dot-target).tmp $(dot-target).cmd diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 844bc9da08da..c58f91260cce 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -14,6 +14,12 @@ endif # We need this, in case the user has it in its environment unexport CONFIG_ +ifdef KBUILD_SCRIPTROOT +CONF = $(KBUILD_SCRIPTROOT)/scripts/kconfig/conf +else +CONF = $(obj)/conf +endif + xconfig: $(obj)/qconf $< $(Kconfig) @@ -23,31 +29,31 @@ gconfig: $(obj)/gconf menuconfig: $(obj)/mconf $< $(Kconfig) -config: $(obj)/conf +config: $(CONF) $< --oldaskconfig $(Kconfig) nconfig: $(obj)/nconf $< $(Kconfig) -oldconfig: $(obj)/conf +oldconfig: $(CONF) $< --$@ $(Kconfig) -silentoldconfig: $(obj)/conf +silentoldconfig: $(CONF) $(Q)mkdir -p include/generated $< --$@ $(Kconfig) -localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf +localyesconfig localmodconfig: $(obj)/streamline_config.pl $(CONF) $(Q)mkdir -p include/generated $(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config $(Q)if [ -f .config ]; then \ cmp -s .tmp.config .config || \ (mv -f .config .config.old.1; \ mv -f .tmp.config .config; \ - $(obj)/conf --silentoldconfig $(Kconfig); \ + $(CONF) --silentoldconfig $(Kconfig); \ mv -f .config.old.1 .config.old) \ else \ mv -f .tmp.config .config; \ - $(obj)/conf --silentoldconfig $(Kconfig); \ + $(CONF) --silentoldconfig $(Kconfig); \ fi $(Q)rm -f .tmp.config @@ -76,24 +82,24 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig -allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf +allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(CONF) $< --$@ $(Kconfig) PHONY += listnewconfig olddefconfig oldnoconfig savedefconfig defconfig -listnewconfig olddefconfig: $(obj)/conf +listnewconfig olddefconfig: $(CONF) $< --$@ $(Kconfig) # oldnoconfig is an alias of olddefconfig, because people already are dependent # on its behavior(sets new symbols to their default value but not 'n') with the # counter-intuitive name. -oldnoconfig: $(obj)/conf +oldnoconfig: $(CONF) $< --olddefconfig $(Kconfig) -savedefconfig: $(obj)/conf +savedefconfig: $(CONF) $< --$@=defconfig $(Kconfig) -defconfig: $(obj)/conf +defconfig: $(CONF) ifeq ($(KBUILD_DEFCONFIG),) $< --defconfig $(Kconfig) else @@ -101,7 +107,7 @@ else $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) endif -%_defconfig: $(obj)/conf +%_defconfig: $(CONF) $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) # Help text used by make help diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index 75d59fcd48b8..4603ac6d4802 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile @@ -1,6 +1,12 @@ hostprogs-y := modpost mk_elfconfig always := $(hostprogs-y) empty.o +ifdef KBUILD_SCRIPTROOT +MKELFCONFIG = $(KBUILD_SCRIPTROOT)/scripts/mod/mk_elfconfig +else +MKELFCONFIG = $(obj)/mk_elfconfig +endif + modpost-objs := modpost.o file2alias.o sumversion.o devicetable-offsets-file := devicetable-offsets.h @@ -45,9 +51,9 @@ $(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h $(obj)/file2alias.o: $(obj)/$(devicetable-offsets-file) quiet_cmd_elfconfig = MKELF $@ - cmd_elfconfig = $(obj)/mk_elfconfig < $< > $@ + cmd_elfconfig = $(MKELFCONFIG) < $< > $@ -$(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE +$(obj)/elfconfig.h: $(obj)/empty.o $(MKELFCONFIG) FORCE $(call if_changed,elfconfig) targets += elfconfig.h -- cgit v1.2.3 From ad0bd36b1474802b6f2c93e7f9e5f80892d4237b Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Wed, 15 May 2013 05:27:00 -0400 Subject: ARM: crypto: sha1-armv4-large.S: fix SP handling Make the SHA1 asm code ABI conformant by making sure all stack accesses occur above the stack pointer. Origin: http://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=1a9d60d2 Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/sha1-armv4-large.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/crypto/sha1-armv4-large.S b/arch/arm/crypto/sha1-armv4-large.S index 92c6eed7aac9..99207c45ec10 100644 --- a/arch/arm/crypto/sha1-armv4-large.S +++ b/arch/arm/crypto/sha1-armv4-large.S @@ -195,6 +195,7 @@ ENTRY(sha1_block_data_order) add r3,r3,r10 @ E+=F_00_19(B,C,D) cmp r14,sp bne .L_00_15 @ [((11+4)*5+2)*3] + sub sp,sp,#25*4 #if __ARM_ARCH__<7 ldrb r10,[r1,#2] ldrb r9,[r1,#3] @@ -290,7 +291,6 @@ ENTRY(sha1_block_data_order) add r3,r3,r10 @ E+=F_00_19(B,C,D) ldr r8,.LK_20_39 @ [+15+16*4] - sub sp,sp,#25*4 cmn sp,#0 @ [+3], clear carry to denote 20_39 .L_20_39_or_60_79: ldr r9,[r14,#15*4] -- cgit v1.2.3 From c98155bfe199f6532e7f9d6d589d7ee0aa8b44f2 Mon Sep 17 00:00:00 2001 From: Fathi Boudra Date: Thu, 21 Mar 2013 18:35:32 +0400 Subject: perf tools: make perf to build in 3.9 kernel tree again Put the behaviour back to the same as in 3.8 kernel tree, but preserve compatibility with make version 3.80 Signed-off-by: Andrey Konovalov --- tools/perf/config/utilities.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/config/utilities.mak b/tools/perf/config/utilities.mak index 8ef3bd30a549..3e897198d1f7 100644 --- a/tools/perf/config/utilities.mak +++ b/tools/perf/config/utilities.mak @@ -173,7 +173,7 @@ _ge-abspath = $(if $(is-executable),$(1)) # Usage: absolute-executable-path-or-empty = $(call get-executable-or-default,variable,default) # define get-executable-or-default -$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2),$(1))) +$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2))) endef _ge_attempt = $(if $(get-executable),$(get-executable),$(_gea_warn)$(call _gea_err,$(2))) _gea_warn = $(warning The path '$(1)' is not executable.) -- cgit v1.2.3 From 0763c9e7a9898b5d23b508c472057497e65e3118 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Tue, 28 May 2013 18:57:43 +0400 Subject: Add cross-build support to tools/lib/lk library Signed-off-by: Wookey --- tools/lib/lk/Makefile | 2 ++ tools/perf/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/lib/lk/Makefile b/tools/lib/lk/Makefile index 926cbf3efc7f..bcfb7bcc7890 100644 --- a/tools/lib/lk/Makefile +++ b/tools/lib/lk/Makefile @@ -15,6 +15,8 @@ EXTLIBS = -lpthread -lrt -lelf -lm ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ALL_LDFLAGS = $(LDFLAGS) +CC = $(CROSS_COMPILE)gcc +AR = $(CROSS_COMPILE)ar RM = rm -f $(LIBFILE): $(LIB_OBJS) diff --git a/tools/perf/Makefile b/tools/perf/Makefile index b0f164b133d9..d160c6f52367 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile @@ -1074,12 +1074,12 @@ $(LIBTRACEEVENT)-clean: # already $(LIBLK): ifeq ($(subdir),) - $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a + $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) CROSS_COMPILE=$(CROSS_COMPILE) O=$(OUTPUT) liblk.a endif $(LIBLK)-clean: ifeq ($(subdir),) - $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean + $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) CROSS_COMPILE=$(CROSS_COMPILE) O=$(OUTPUT) clean endif help: -- cgit v1.2.3