greybus: build: android: replace Linaro build specific logic with AOSP equivalents
authorMichael Scott <michael.scott@linaro.org>
Fri, 2 Oct 2015 19:05:33 +0000 (12:05 -0700)
committerGreg Kroah-Hartman <gregkh@google.com>
Sat, 3 Oct 2015 10:54:12 +0000 (12:54 +0200)
When using greybus build in a different Android setup, it was noted that
several portions of this makefile rely on Linaro specific build items.
Replace these with more generic build steps.

- ANDROID_64 is only defined by Linaro build tasks, use TARGET_ARCH to
  establish ARCH= parameter for greybus build
- KERNEL_TOOLS_PREFIX is only defined by Linaro build tasks.  AOSP has
  a near equivalent variable: TARGET_TOOLS_PREFIX
- build-greybus was dependant on subtask: android_kernel a task defined
  only by Linaro build tasks.  Replace with a generic dependancy to
  the kernel binary located in $OUT (INSTALLED_KERNEL_TARGET).
  End result is the same: kernel must be built before greybus modules

Signed-off-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/Android.mk

index 3357499ae0fd4313ba0252edc7c67eaec8451aac..47af2d34ce674b52d4d7427069bb838e4d0ba6d9 100644 (file)
@@ -5,6 +5,7 @@ $(PRODUCT_OUT)/ramdisk.img: build-greybus
 endif
 
 GREYBUS_MODULE_OUT_PATH := $(PRODUCT_OUT)/root/lib/modules
+GREYBUS_CC_PREFIX := $(shell cd `dirname $(TARGET_TOOLS_PREFIX)` && pwd)/$(shell basename $(TARGET_TOOLS_PREFIX))
 
 include $(CLEAR_VARS)
 GREYBUS_SRC_PATH := $(ANDROID_BUILD_TOP)/external/greybus/
@@ -17,19 +18,14 @@ $(LOCAL_PATH)/$(LOCAL_SRC_FILES): build-greybus
 include $(BUILD_PREBUILT)
 
 KDIRARG := KERNELDIR="${ANDROID_PRODUCT_OUT}/obj/kernel"
-ifneq ($(ANDROID_64),)
-  ARCHARG := ARCH=arm64
-  FLAGARG := EXTRA_CFLAGS+=-fno-pic
-else
-  ARCHARG := ARCH=arm
-  FLAGARG := EXTRA_CFLAGS+=-fno-pic
-endif
+ARCHARG := ARCH=$(TARGET_ARCH)
+FLAGARG := EXTRA_CFLAGS+=-fno-pic
 ARGS := $(KDIRARG) $(ARCHARG) $(FLAGARG)
 
-build-greybus: android_kernel
+build-greybus: $(INSTALLED_KERNEL_TARGET)
        make clean -C $(GREYBUS_SRC_PATH)
        cd $(GREYBUS_SRC_PATH) &&\
-       $(MAKE) -j$(MAKE_JOBS) CROSS_COMPILE=$(KERNEL_TOOLS_PREFIX) $(ARGS)
+       $(MAKE) -j$(MAKE_JOBS) CROSS_COMPILE=$(GREYBUS_CC_PREFIX) $(ARGS)
        mkdir -p $(GREYBUS_MODULE_OUT_PATH)
        ko=`find $(GREYBUS_SRC_PATH) -type f -name "*.ko"`;\
        for i in $$ko; do $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $$i;\