From patchwork Fri Oct 10 03:27:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 38541 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9CB65202DB for ; Fri, 10 Oct 2014 03:27:23 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf1577687lbg.9 for ; Thu, 09 Oct 2014 20:27:22 -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=OIDh041WAhvPdfqtumT5SkLPfrJ2rcQ+RXS6T1gTWCo=; b=SmN9kMvWGZQTyS7NY+sFshlj/BUEhW3LvWDqfCq+uX0nXc2XGFfx+K68P63Pk1ZX0/ JinyoHK16K+esw6jswBLjK1jbByV0fqv+JKPUZS/Nh195nKbbmGfadj5ws5pJDYXhFlw Phc3jHpviTddOc3X5qJ1zRFFFyqW1NfEDJ5RBuny1Aj9q8FOh0DidjKvAewY2vtIujun J/KmEhlhQeAtsOtRKpKwuNq9ZCIVXtdBMKi7b3rzvtck/0of9vSxByBSAQ+iw8uo5CY6 X0v/CzWthS/RAeAqkmjuLW30Rlu7vU97qbWolTzVNfSG3+rZ9Hxr411oUTsTCzgz1tJE 4ITA== X-Gm-Message-State: ALoCoQnvrdigePv+AG62PORvo2CCsqs9G+OcUl6kq54WAcsPUdd0EKJntSnl3aKsUxh0mFmLm6NY X-Received: by 10.112.158.73 with SMTP id ws9mr7942lbb.22.1412911642460; Thu, 09 Oct 2014 20:27:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.67 with SMTP id z3ls236741lag.74.gmail; Thu, 09 Oct 2014 20:27:22 -0700 (PDT) X-Received: by 10.152.18.130 with SMTP id w2mr1665696lad.64.1412911642197; Thu, 09 Oct 2014 20:27:22 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by mx.google.com with ESMTPS id m2si6922894lbp.105.2014.10.09.20.27.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Oct 2014 20:27:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id hs14so2425998lab.17 for ; Thu, 09 Oct 2014 20:27:22 -0700 (PDT) X-Received: by 10.152.27.40 with SMTP id q8mr147694lag.92.1412911641981; Thu, 09 Oct 2014 20:27:21 -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 c5csp353649lbz; Thu, 9 Oct 2014 20:27:21 -0700 (PDT) X-Received: by 10.68.216.35 with SMTP id on3mr2281882pbc.34.1412911640503; Thu, 09 Oct 2014 20:27:20 -0700 (PDT) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by mx.google.com with ESMTPS id fc5si2436143pdb.29.2014.10.09.20.27.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Oct 2014 20:27:20 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.174 as permitted sender) client-ip=209.85.192.174; Received: by mail-pd0-f174.google.com with SMTP id y13so831438pdi.5 for ; Thu, 09 Oct 2014 20:27:19 -0700 (PDT) X-Received: by 10.70.36.237 with SMTP id t13mr2251699pdj.134.1412911639346; Thu, 09 Oct 2014 20:27:19 -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 gu10sm1853467pbc.72.2014.10.09.20.27.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Oct 2014 20:27:18 -0700 (PDT) From: John Stultz To: projectara-software-dev@linaro.org Cc: John Stultz Subject: [RFC][PATCH v2] greybus: Changes required for integrating into the Android build Date: Thu, 9 Oct 2014 20:27:15 -0700 Message-Id: <1412911635-6014-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.44 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 --- v2: Some cleanups suggested by Rob and Greg. Unfortunately the resulting module here still doesn't load, due to a reallocation issue, but I'll continue looking at that tomorrow and hopefully have something to officially submit then. Android.mk | 28 ++++++++++++++++++++++++++++ Makefile | 8 +++++--- 2 files changed, 33 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..5edd297 100644 --- a/Makefile +++ b/Makefile @@ -18,17 +18,19 @@ 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) 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 +38,5 @@ clean: rm -rf .tmp_versions Modules.symvers coccicheck: - $(MAKE) -C $(KERNELDIR) M=$(PWD) coccicheck + $(MAKE) -C $(KERNELDIR) M=$(PWD) $(ARCHLINE) coccicheck