From patchwork Fri Oct 10 17:53:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 38628 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A036B205D8 for ; Fri, 10 Oct 2014 17:53:30 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id b15sf2492429eek.8 for ; Fri, 10 Oct 2014 10:53:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Y9np5/xOToXBuvgxK2IIbLNuY8RSe8ABTAwJx0jLDNM=; b=ZrOFkA7tdWcHLku4yjJJaa1s+3FkAKa5YMbhpVvaPABYyXNlhPXPFJXwy3efhcP075 az/eMQi+5SKwXO5GJlsYk0ukiOLoEsyVPF8OvYuqNylPsXF6cOxEqRZXFMtvvlUpHGq8 uGwuAxar+AYjID8kpXiB9wICTubRxjWz77aSxPoQuPlApmC8Fg3++tKP9VrSrCbreneN fb7l8Hkz4+Mkd34j1XCsnLXDuyONHFToNjGAkdGl3mAR0FN1gry2MRjSe36N8EQf77vb yBqGKr/TLwtfJTzu5yj9jxM8nmKXkBY6RUrS4bOXB+bL8nQ4OlyfJIQ2wtiz9GxYI/uF poiA== X-Gm-Message-State: ALoCoQnvhoKuVdUmqvdVFqI+mHwRPsehRmDFwPNaWdwx8N8TvaZoiXrABTRzy8oRn9ntT7xnWgCY X-Received: by 10.180.82.74 with SMTP id g10mr2453792wiy.0.1412963609649; Fri, 10 Oct 2014 10:53:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.169 with SMTP id k9ls318658laa.91.gmail; Fri, 10 Oct 2014 10:53:29 -0700 (PDT) X-Received: by 10.152.3.167 with SMTP id d7mr6540395lad.17.1412963609486; Fri, 10 Oct 2014 10:53:29 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx.google.com with ESMTPS id oh2si10338336lbb.107.2014.10.10.10.53.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Oct 2014 10:53:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id gm9so3620901lab.41 for ; Fri, 10 Oct 2014 10:53:29 -0700 (PDT) X-Received: by 10.112.156.227 with SMTP id wh3mr6334788lbb.23.1412963609151; Fri, 10 Oct 2014 10:53:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.84.229 with SMTP id c5csp472298lbz; Fri, 10 Oct 2014 10:53:28 -0700 (PDT) X-Received: by 10.68.96.4 with SMTP id do4mr7041143pbb.44.1412963607315; Fri, 10 Oct 2014 10:53:27 -0700 (PDT) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by mx.google.com with ESMTPS id fk1si4416463pab.127.2014.10.10.10.53.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Oct 2014 10:53:27 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.175 as permitted sender) client-ip=209.85.192.175; Received: by mail-pd0-f175.google.com with SMTP id v10so2024355pde.6 for ; Fri, 10 Oct 2014 10:53:26 -0700 (PDT) X-Received: by 10.67.23.136 with SMTP id ia8mr6701272pad.125.1412963606408; Fri, 10 Oct 2014 10:53:26 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id ah2sm4182534pad.10.2014.10.10.10.53.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Oct 2014 10:53:25 -0700 (PDT) From: John Stultz To: projectara-software-dev@linaro.org Cc: John Stultz Subject: [PATCH v3] greybus: Changes required for integrating into the Android build Date: Fri, 10 Oct 2014 10:53:23 -0700 Message-Id: <1412963603-7334-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In order to easily integrate into the Android build, include an Android.mk and some extra conditionals in the Makefile to get the proper kerneldir. Signed-off-by: John Stultz --- v3: Sorted out the reallocation issue w/ -fno-pic. This should be ok to merge, if no one objects. Android.mk | 28 ++++++++++++++++++++++++++++ Makefile | 10 +++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 Android.mk diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..189ca0c --- /dev/null +++ b/Android.mk @@ -0,0 +1,28 @@ +.PHONY: build-greybus + +$(PRODUCT_OUT)/ramdisk.img: build-greybus + +include $(CLEAR_VARS) +GREYBUS_SRC_PATH := $(ANDROID_BUILD_TOP)/external/greybus/ +LOCAL_PATH := $(GREYBUS_SRC_PATH) +LOCAL_SRC_FILES := greybus.ko +LOCAL_MODULE := $(LOCAL_SRC_FILES) +LOCAL_MODULE_CLASS := EXECUTABLES +LOCAL_MODULE_PATH := $(PRODUCT_OUT)/root/lib/modules +$(LOCAL_PATH)/$(LOCAL_SRC_FILES): build-greybus +include $(BUILD_PREBUILT) + +KDIRARG := KERNELDIR="${ANDROID_PRODUCT_OUT}/obj/kernel" +ifneq ($(ANDROID_64),) + ARCHARG := ARCHLINE="ARCH=arm64" +else + ARCHARG := ARCHLINE="ARCH=arm" +endif +ARGS := $(KDIRARG) $(ARCHARG) + +build-greybus: android_kernel + make clean -C $(GREYBUS_SRC_PATH) + cd $(GREYBUS_SRC_PATH) &&\ + $(MAKE) -j$(MAKE_JOBS) CROSS_COMPILE=$(KERNEL_TOOLS_PREFIX) $(ARGS) + mkdir -p $(PRODUCT_OUT)/root/lib/modules + cp $(GREYBUS_SRC_PATH)/greybus.ko $(PRODUCT_OUT)/root/lib/modules diff --git a/Makefile b/Makefile index 42a3944..375a4c5 100644 --- a/Makefile +++ b/Makefile @@ -18,17 +18,21 @@ obj-m += greybus.o obj-m += es1-ap-usb.o obj-m += test_sink.o +ifeq ($(KERNELDIR), ) KERNELVER ?= $(shell uname -r) KERNELDIR ?= /lib/modules/$(KERNELVER)/build +endif PWD := $(shell pwd) +EXTRA_CFLAGS += -fno-pic + all: module module: - $(MAKE) -C $(KERNELDIR) M=$(PWD) + $(MAKE) -C $(KERNELDIR) M=$(PWD) $(ARCHLINE) check: - $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__" + $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__" $(ARCHLINE) clean: rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c @@ -36,5 +40,5 @@ clean: rm -rf .tmp_versions Modules.symvers coccicheck: - $(MAKE) -C $(KERNELDIR) M=$(PWD) coccicheck + $(MAKE) -C $(KERNELDIR) M=$(PWD) $(ARCHLINE) coccicheck