From patchwork Thu Oct 9 20:31:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 38530 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1961F202DB for ; Thu, 9 Oct 2014 20:32:07 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id q1sf1351198lam.0 for ; Thu, 09 Oct 2014 13:32:06 -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=Nj20/EqHEzZuJ36tSR6WyUWSHv4x7MgRtI432U3GWII=; b=QE/rvnt4xu1jV5qA8O9a3q3ZP2xBzyjW2oIyaHVbcOhlAs5QFC8HpOik4ZTjFiugzK f+vnod9Ho2u+VQUzIZUsMXLWblgIgqlrYCYEuJRLzVzdqI8MXf21qIR+1fdQwlnMxYRj U1qNfWcekiyC7PIgz/dKolZwDOFEQ6KCJBlcw2Q5l+hFHrD7crIsci8BUARY6g0W+BwD VNGUw2lkRdrMsg8iOTcQB45i1+7bRSabrpffgfU3ivv9fJNStt8+O9k/M08czhluUwe1 pSc7kIj4mJD7jYKQqfl3svT+vWk7P7nb53yI+U97Ho1rdUIcxnrP/z8x1Qmqp6ypYLqH GDAQ== X-Gm-Message-State: ALoCoQlukiGCnBXW8JR47V72YK0GR2Murw3urQT5sDc/L0Y/fehC032a4oayT5Rqlk/7v5w8qqHb X-Received: by 10.152.29.130 with SMTP id k2mr32340lah.3.1412886726633; Thu, 09 Oct 2014 13:32:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.226 with SMTP id q2ls209663lae.15.gmail; Thu, 09 Oct 2014 13:32:06 -0700 (PDT) X-Received: by 10.112.72.38 with SMTP id a6mr7089362lbv.65.1412886726443; Thu, 09 Oct 2014 13:32:06 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by mx.google.com with ESMTPS id l7si6140008lae.29.2014.10.09.13.32.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Oct 2014 13:32:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so1857953lbv.24 for ; Thu, 09 Oct 2014 13:32:06 -0700 (PDT) X-Received: by 10.112.134.229 with SMTP id pn5mr20049659lbb.22.1412886726063; Thu, 09 Oct 2014 13:32:06 -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 c5csp313733lbz; Thu, 9 Oct 2014 13:32:05 -0700 (PDT) X-Received: by 10.68.78.65 with SMTP id z1mr438046pbw.140.1412886724588; Thu, 09 Oct 2014 13:32:04 -0700 (PDT) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by mx.google.com with ESMTPS id n9si1602232pdr.167.2014.10.09.13.32.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Oct 2014 13:32:04 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.53 as permitted sender) client-ip=209.85.220.53; Received: by mail-pa0-f53.google.com with SMTP id kq14so378309pab.40 for ; Thu, 09 Oct 2014 13:32:03 -0700 (PDT) X-Received: by 10.66.136.69 with SMTP id py5mr358429pab.71.1412886723823; Thu, 09 Oct 2014 13:32:03 -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 sa6sm1011742pbb.29.2014.10.09.13.32.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Oct 2014 13:32:03 -0700 (PDT) From: John Stultz To: projectara-software-dev@linaro.org Cc: John Stultz Subject: [RFC][PATCH] greybus: Changes required for integrating into the Android build Date: Thu, 9 Oct 2014 13:31:53 -0700 Message-Id: <1412886713-1980-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.217.179 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: , Just wanted to get some early feedback here. 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. The ARCHLINE detail is really hackish, but I couldn't seem to find a way to get the ARCH specified properly when crossbuilding without being explicit. Any ideas? Signed-off-by: John Stultz --- Android.mk | 21 +++++++++++++++++++++ Makefile | 11 ++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 Android.mk diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..c2029d7 --- /dev/null +++ b/Android.mk @@ -0,0 +1,21 @@ +.PHONY: build-greybus + +$(PRODUCT_OUT)/ramdisk.img: greybus.ko + +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) + +build-greybus: android_kernel + cd $(GREYBUS_SRC_PATH) &&\ + $(MAKE) -j$(MAKE_JOBS) CROSS_COMPILE=$(KERNEL_TOOLS_PREFIX) +ifeq (,$(wildcard $(PRODUCT_OUT)/root/lib/modules)) + mkdir -p $(PRODUCT_OUT)/root/lib/modules +endif + cp $(GREYBUS_SRC_PATH)/greybus.ko $(PRODUCT_OUT)/root/lib/modules diff --git a/Makefile b/Makefile index 42a3944..372e94b 100644 --- a/Makefile +++ b/Makefile @@ -18,17 +18,22 @@ obj-m += greybus.o obj-m += es1-ap-usb.o obj-m += test_sink.o +ifneq (${ANDROID_PRODUCT_OUT}, ) +KERNELDIR := ${ANDROID_PRODUCT_OUT}/obj/kernel +ARCHLINE := "ARCH=arm64" +else 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) CROSS_COMPILE=$(CROSS_COMPILE) $(ARCHLINE) check: - $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__" + $(MAKE) -C $(KERNELDIR) M=$(PWD) C=2 CF="-D__CHECK_ENDIAN__" CROSS_COMPILE=$(CROSS_COMPILE) $(ARCHLINE) clean: rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c @@ -36,5 +41,5 @@ clean: rm -rf .tmp_versions Modules.symvers coccicheck: - $(MAKE) -C $(KERNELDIR) M=$(PWD) coccicheck + $(MAKE) -C $(KERNELDIR) M=$(PWD) CROSS_COMPILE=$(CROSS_COMPILE) $(ARCHLINE) coccicheck