summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>2011-12-06 14:25:51 +0059
committerBernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>2011-12-06 14:25:51 +0059
commit24e68c9e9484fde462cb56591e308eabea677bda (patch)
treec26981206cff65475da4c7f6f7b7da6e043aaa46
parent58cc590dc38f8e796c12b89a48110186a2f2eb9c (diff)
common/tasks: Build kernel and u-boot with the right toolchain
This makes sure u-boot and the kernel are built with the Linaro toolchain if it's being used to compile everything, and the system wide toolchain if the prebuilt toolchain is used. Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
-rw-r--r--tasks/kernel.mk19
-rw-r--r--tasks/uboot.mk18
2 files changed, 25 insertions, 12 deletions
diff --git a/tasks/kernel.mk b/tasks/kernel.mk
index 9babc67..c30d4df 100644
--- a/tasks/kernel.mk
+++ b/tasks/kernel.mk
@@ -2,20 +2,31 @@ ifneq ($(strip $(SHOW_COMMANDS)),)
KERNEL_VERBOSE="V=1"
endif
+ifneq ($(findstring prebuilt,$(TARGET_TOOLS_PREFIX)),)
+# The prebuilt toolchain is way too old to compile
+# current kernels - so we use a system wide toolchain
+# installation if available.
+KERNEL_TOOLCHAIN := arm-linux-gnueabi-
+else
+KERNEL_TOOLCHAIN := $(shell sh -c "cd $(TOP); cd `dirname $(TARGET_TOOLS_PREFIX)`; pwd")/$(shell basename $(TARGET_TOOLS_PREFIX))
+endif
+
android_kernel: $(PRODUCT_OUT)/u-boot.bin
cd $(TOP)/kernel &&\
if [ -e $(TARGET_TOOLS_PREFIX)ld.bfd ]; then LD=$(TARGET_TOOLS_PREFIX)ld.bfd; else LD=$(TARGET_TOOLS_PREFIX)ld; fi && \
export PATH=../$(BUILD_OUT_EXECUTABLES):$(PATH) && \
- $(MAKE) -j1 $(KERNEL_VERBOSE) ARCH=arm CROSS_COMPILE=$(shell sh -c "cd $(TOP); cd `dirname $(TARGET_TOOLS_PREFIX)`; pwd")/$(shell basename $(TARGET_TOOLS_PREFIX)) LD=$$LD defconfig $(KERNEL_CONFIG) &&\
+ $(MAKE) -j1 $(KERNEL_VERBOSE) ARCH=arm CROSS_COMPILE=$(KERNEL_TOOLCHAIN) LD=$$LD defconfig $(KERNEL_CONFIG) &&\
$(MAKE) $(KERNEL_VERBOSE) ARCH=arm CROSS_COMPILE=$(shell sh -c "cd $(TOP); cd `dirname $(TARGET_TOOLS_PREFIX)`; pwd")/$(shell basename $(TARGET_TOOLS_PREFIX)) LD=$$LD uImage
android_kernel_modules: $(INSTALLED_KERNEL_TARGET) $(ACP)
cd $(TOP)/kernel &&\
+ if [ -e $(TARGET_TOOLS_PREFIX)ld.bfd ]; then LD=$(TARGET_TOOLS_PREFIX)ld.bfd; else LD=$(TARGET_TOOLS_PREFIX)ld; fi && \
export PATH=../$(BUILD_OUT_EXECUTABLES):$(PATH) && \
- $(MAKE) ARCH=arm CROSS_COMPILE=$(shell sh -c "cd $(TOP); cd `dirname $(TARGET_TOOLS_PREFIX)`; pwd")/$(shell basename $(TARGET_TOOLS_PREFIX)) modules
+ $(MAKE) ARCH=arm CROSS_COMPILE=$(KERNEL_TOOLCHAIN) LD=$$LD modules
mkdir -p $(TOP)/kernel/modules_for_android
cd $(TOP)/kernel &&\
- $(MAKE) ARCH=arm CROSS_COMPILE=$(shell sh -c "cd $(TOP); cd `dirname $(TARGET_TOOLS_PREFIX)`; pwd")/$(shell basename $(TARGET_TOOLS_PREFIX)) modules_install INSTALL_MOD_PATH=modules_for_android
+ if [ -e $(TARGET_TOOLS_PREFIX)ld.bfd ]; then LD=$(TARGET_TOOLS_PREFIX)ld.bfd; else LD=$(TARGET_TOOLS_PREFIX)ld; fi && \
+ $(MAKE) ARCH=arm CROSS_COMPILE=$(KERNEL_TOOLCHAIN) LD=$$LD modules_install INSTALL_MOD_PATH=modules_for_android
mkdir -p $(TARGET_OUT)/modules
find kernel/modules_for_android -name "*.ko" -exec $(ACP) -fpt {} $(TARGET_OUT)/modules/ \;
@@ -24,7 +35,7 @@ ifeq ($(TARGET_USE_GATOR),true)
KERNEL_PATH:=$(shell pwd)/kernel
gator_driver: android_kernel_modules $(INSTALLED_KERNEL_TARGET) $(ACP)
cd $(TOP)/external/gator/driver &&\
- $(MAKE) ARCH=arm CROSS_COMPILE=$(shell sh -c "cd $(TOP); cd `dirname $(TARGET_TOOLS_PREFIX)`; pwd")/$(shell basename $(TARGET_TOOLS_PREFIX)) -C $(KERNEL_PATH) M=`pwd` modules
+ $(MAKE) ARCH=arm CROSS_COMPILE=$(KERNEL_TOOLCHAIN) -C $(KERNEL_PATH) M=`pwd` modules
mkdir -p $(TARGET_OUT)/modules
find $(TOP)/external/gator/driver/. -name "*.ko" -exec $(ACP) -fpt {} $(TARGET_OUT)/modules/ \;
else
diff --git a/tasks/uboot.mk b/tasks/uboot.mk
index 8fa5549..38061c9 100644
--- a/tasks/uboot.mk
+++ b/tasks/uboot.mk
@@ -1,15 +1,17 @@
+ifneq ($(findstring prebuilt,$(TARGET_TOOLS_PREFIX)),)
+# The AOSP prebuilt toolchain is too old to compile
+# current u-boot, so we fall back to a system compiler
+UBOOT_TCDIR = $(shell basename `which arm-linux-gnueabi-gcc`)
+UBOOT_TCPREFIX = arm-linux-gnueabi-
+else
UBOOT_TCDIR = $(shell dirname $(TARGET_TOOLS_PREFIX))
-UBOOT_TCPREFIX = $(shell basename $(TARGET_TOOLS_PREFIX))
-
-# u-boot tends to trigger compiler and linker bugs frequently.
-# If you're running into a problem not fixed easily, use an
-# older compiler by commenting out the 2 lines above and
-# uncommenting the one below.
-#UBOOT_TCPREFIX = arm-linux-gnueabi-
+# u-boot is not an Android application and should be
+# built with the bare metal toolchain if it is available
+UBOOT_TCPREFIX = $(shell if [ -e $(UBOOT_TCDIR)/arm-eabi-gcc ]; then echo arm-eabi-; else basename $(TARGET_TOOLS_PREFIX); fi)
+endif
# u-boot can't be built with gold - so we force BFD LD into the
# PATH ahead of everything else
-
android_uboot: $(ACP)
mkdir -p $(PRODUCT_OUT)/obj/u-boot
cd $(TOP)/u-boot &&\