From 87478111b7c383683f565aa3f706c66b90d29e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Fri, 10 Apr 2015 10:38:10 +0200 Subject: [PATCH 1/3] mali/ump: fix out of tree build --- drivers/gpu/arm/mali/Kbuild | 34 ++++++++++++++++++++-------------- drivers/gpu/arm/ump/Kbuild | 32 +++++++++++++++++++------------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/arm/mali/Kbuild b/drivers/gpu/arm/mali/Kbuild index 005329dea0b185..f8b40a7621c398 100755 --- a/drivers/gpu/arm/mali/Kbuild +++ b/drivers/gpu/arm/mali/Kbuild @@ -23,11 +23,17 @@ MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS ?= 0 MALI_UPPER_HALF_SCHEDULING ?= 1 MALI_ENABLE_CPU_CYCLES ?= 0 +ifneq ($(KBUILD_SRC),) + ifneq ($(wildcard $(KBUILD_SRC)/$(src)),) + TOP_KBUILD_SRC := $(KBUILD_SRC)/ + endif +endif + # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases: # The ARM proprietary product will only include the license/proprietary directory # The GPL product will only include the license/gpl directory -ifeq ($(wildcard $(src)/linux/license/gpl/*),) - ccflags-y += -I$(src)/linux/license/proprietary +ifeq ($(wildcard $(TOP_KBUILD_SRC)$(src)/linux/license/gpl/*),) + ccflags-y += -I$(TOP_KBUILD_SRC)$(src)/linux/license/proprietary ifeq ($(CONFIG_MALI400_PROFILING),y) $(error Profiling is incompatible with non-GPL license) endif @@ -39,7 +45,7 @@ ifeq ($(wildcard $(src)/linux/license/gpl/*),) endif $(error Linux Device integration is incompatible with non-GPL license) else - ccflags-y += -I$(src)/linux/license/gpl + ccflags-y += -I$(TOP_KBUILD_SRC)$(src)/linux/license/gpl endif ifeq ($(USING_GPU_UTILIZATION), 1) @@ -123,7 +129,7 @@ mali-y += \ platform/meson_m450/platform_m8b.o ccflags-$(CONFIG_SYNC) += -Idrivers/staging/android -ccflags-y += -I$(src)/../../../../include/ump +ccflags-y += -I$(TOP_KBUILD_SRC)$(src)/../../../../include/ump ifneq ($(MALI_PLATFORM_FILES),) mali-y += $(MALI_PLATFORM_FILES:.c=.o) @@ -133,7 +139,7 @@ mali-$(CONFIG_MALI400_PROFILING) += linux/mali_ukk_profiling.o mali-$(CONFIG_MALI400_PROFILING) += linux/mali_osk_profiling.o mali-$(CONFIG_MALI400_INTERNAL_PROFILING) += linux/mali_profiling_internal.o timestamp-$(TIMESTAMP)/mali_timestamp.o -ccflags-$(CONFIG_MALI400_INTERNAL_PROFILING) += -I$(src)/timestamp-$(TIMESTAMP) +ccflags-$(CONFIG_MALI400_INTERNAL_PROFILING) += -I$(TOP_KBUILD_SRC)$(src)/timestamp-$(TIMESTAMP) mali-$(CONFIG_DMA_SHARED_BUFFER) += linux/mali_memory_dma_buf.o mali-$(CONFIG_SYNC) += linux/mali_sync.o @@ -161,16 +167,16 @@ ifeq ($(MALI_UPPER_HALF_SCHEDULING),1) ccflags-y += -DMALI_UPPER_HALF_SCHEDULING endif -ccflags-$(CONFIG_MALI400_UMP) += -I$(src)/../../ump/include/ump +ccflags-$(CONFIG_MALI400_UMP) += -I$(TOP_KBUILD_SRC)$(src)/../../ump/include/ump ccflags-$(CONFIG_MALI400_DEBUG) += -DDEBUG # Use our defines when compiling -ccflags-y += -I$(src) -I$(src)/include -I$(src)/common -I$(src)/linux -I$(src)/platform +ccflags-y += -I$(TOP_KBUILD_SRC)$(src) -I$(TOP_KBUILD_SRC)$(src)/include -I$(TOP_KBUILD_SRC)$(src)/common -I$(TOP_KBUILD_SRC)$(src)/linux -I$(TOP_KBUILD_SRC)$(src)/platform # Get subversion revision number, fall back to only ${MALI_RELEASE_NAME} if no svn info is available -MALI_RELEASE_NAME=$(shell cat $(src)/.version 2> /dev/null) +MALI_RELEASE_NAME=$(shell cat $(TOP_KBUILD_SRC)$(src)/.version 2> /dev/null) -SVN_INFO = (cd $(src); svn info 2>/dev/null) +SVN_INFO = (cd $$(TOP_KBUILD_SRC)(src); svn info 2>/dev/null) ifneq ($(shell $(SVN_INFO) 2>/dev/null),) # SVN detected @@ -181,13 +187,13 @@ CHANGED_REVISION := $(shell $(SVN_INFO) | grep '^Last Changed Rev: ' | cut -d: - REPO_URL := $(shell $(SVN_INFO) | grep '^URL: ' | cut -d: -f2- | cut -b2-) else # SVN -GIT_REV := $(shell cd $(src); git describe --always 2>/dev/null) +GIT_REV := $(shell cd $(TOP_KBUILD_SRC)$(src); git describe --always 2>/dev/null) ifneq ($(GIT_REV),) # Git detected DRIVER_REV := $(MALI_RELEASE_NAME)-$(GIT_REV) -CHANGE_DATE := $(shell cd $(src); git log -1 --format="%ci") +CHANGE_DATE := $(shell cd $(TOP_KBUILD_SRC)$(src); git log -1 --format="%ci") CHANGED_REVISION := $(GIT_REV) -REPO_URL := $(shell cd $(src); git describe --all --always 2>/dev/null) +REPO_URL := $(shell cd $(TOP_KBUILD_SRC)$(src); git describe --all --always 2>/dev/null) else # Git # No Git or SVN detected @@ -200,7 +206,7 @@ endif ccflags-y += -DSVN_REV_STRING=\"$(DRIVER_REV)\" VERSION_STRINGS := -VERSION_STRINGS += API_VERSION=$(shell cd $(src); grep "\#define _MALI_API_VERSION" $(FILES_PREFIX)include/linux/mali/mali_utgard_uk_types.h | cut -d' ' -f 3 ) +VERSION_STRINGS += API_VERSION=$(shell cd $(TOP_KBUILD_SRC)$(src); grep "\#define _MALI_API_VERSION" $(FILES_PREFIX)include/linux/mali/mali_utgard_uk_types.h | cut -d' ' -f 3 ) VERSION_STRINGS += REPO_URL=$(REPO_URL) VERSION_STRINGS += REVISION=$(DRIVER_REV) VERSION_STRINGS += CHANGED_REVISION=$(CHANGED_REVISION) @@ -224,5 +230,5 @@ VERSION_STRINGS += USING_DVFS=$(CONFIG_MALI_DVFS) VERSION_STRINGS += MALI_UPPER_HALF_SCHEDULING=$(MALI_UPPER_HALF_SCHEDULING) # Create file with Mali driver configuration -$(src)/__malidrv_build_info.c: +$(TOP_KBUILD_SRC)$(src)/__malidrv_build_info.c: @echo 'const char *__malidrv_build_info(void) { return "malidrv: $(VERSION_STRINGS)";}' > $(src)/__malidrv_build_info.c diff --git a/drivers/gpu/arm/ump/Kbuild b/drivers/gpu/arm/ump/Kbuild index e0d81a7a411eb1..5a17f10d71d884 100755 --- a/drivers/gpu/arm/ump/Kbuild +++ b/drivers/gpu/arm/ump/Kbuild @@ -12,21 +12,27 @@ # Change this to use a different config.h CONFIG ?= default +ifneq ($(KBUILD_SRC),) + ifneq ($(wildcard $(KBUILD_SRC)/$(src)),) + TOP_KBUILD_SRC := $(KBUILD_SRC)/ + endif +endif + # Validate selected config -ifneq ($(shell [ -d $(src)/arch-$(CONFIG) ] && [ -f $(src)/arch-$(CONFIG)/config.h ] && echo "OK"), OK) -$(warning Current directory is $(src)) +ifneq ($(shell [ -d $(TOP_KBUILD_SRC)$(src)/arch-$(CONFIG) ] && [ -f $(TOP_KBUILD_SRC)$(src)/arch-$(CONFIG)/config.h ] && echo "OK"), OK) +$(warning Current directory is $(TOP_KBUILD_SRC)$(src)) $(error No configuration found for config $(CONFIG). Check that arch-$(CONFIG)/config.h exists) else # Link arch to the selected arch-config directory -$(shell [ -L $(src)/arch ] && rm $(src)/arch) -$(shell ln -sf arch-$(CONFIG) $(src)/arch) -$(shell touch $(src)/arch/config.h) +$(shell [ -L $(TOP_KBUILD_SRC)$(src)/arch ] && rm $(TOP_KBUILD_SRC)$(src)/arch) +$(shell ln -sf arch-$(CONFIG) $(TOP_KBUILD_SRC)$(src)/arch) +$(shell touch $(TOP_KBUILD_SRC)$(src)/arch/config.h) endif UDD_FILE_PREFIX = ../mali/ # Get subversion revision number, fall back to 0000 if no svn info is available -SVN_INFO = (cd $(src); svn info 2>/dev/null) +SVN_INFO = (cd $(TOP_KBUILD_SRC)$(src); svn info 2>/dev/null) ifneq ($(shell $(SVN_INFO) 2>/dev/null),) # SVN detected @@ -37,13 +43,13 @@ CHANGED_REVISION := $(shell $(SVN_INFO) | grep '^Last Changed Rev: ' | cut -d: - REPO_URL := $(shell $(SVN_INFO) | grep '^URL: ' | cut -d: -f2- | cut -b2-) else # SVN -GIT_REV := $(shell cd $(src); git describe --always 2>/dev/null) +GIT_REV := $(shell cd $(TOP_KBUILD_SRC)$(src); git describe --always 2>/dev/null) ifneq ($(GIT_REV),) # Git detected DRIVER_REV := $(MALI_RELEASE_NAME)-$(GIT_REV) -CHANGE_DATE := $(shell cd $(src); git log -1 --format="%ci") +CHANGE_DATE := $(shell cd $(TOP_KBUILD_SRC)$(src); git log -1 --format="%ci") CHANGED_REVISION := $(GIT_REV) -REPO_URL := $(shell cd $(src); git describe --all --always 2>/dev/null) +REPO_URL := $(shell cd $(TOP_KBUILD_SRC)$(src); git describe --all --always 2>/dev/null) else # Git # No Git or SVN detected @@ -56,7 +62,7 @@ endif ccflags-y += -DSVN_REV=$(SVN_REV) ccflags-y += -DSVN_REV_STRING=\"$(DRIVER_REV)\" -ccflags-y += -I$(src) -I$(src)/common -I$(src)/linux -I$(src)/../mali/common -I$(src)/../mali/linux -I$(src)/../../ump/include/ump -I$(src)/../../../../include/ump +ccflags-y += -I$(TOP_KBUILD_SRC)$(src) -I$(TOP_KBUILD_SRC)$(src)/common -I$(TOP_KBUILD_SRC)$(src)/linux -I$(TOP_KBUILD_SRC)$(src)/../mali/common -I$(TOP_KBUILD_SRC)$(src)/../mali/linux -I$(TOP_KBUILD_SRC)$(src)/../../ump/include/ump -I$(TOP_KBUILD_SRC)$(src)/../../../../include/ump ccflags-y += -DMALI_STATE_TRACKING=0 ccflags-y += -DMALI_ENABLE_CPU_CYCLES=0 ccflags-$(CONFIG_UMP_DEBUG) += -DDEBUG @@ -65,10 +71,10 @@ ccflags-$(CONFIG_UMP_DEBUG) += -DDEBUG # The ARM proprietary product will only include the license/proprietary directory # The GPL product will only include the license/gpl directory -ifeq ($(wildcard $(src)/linux/license/gpl/*),) -ccflags-y += -I$(src)/linux/license/proprietary -I$(src)/../mali/linux/license/proprietary +ifeq ($(wildcard $(TOP_KBUILD_SRC)$(src)/linux/license/gpl/*),) +ccflags-y += -I$(TOP_KBUILD_SRC)$(src)/linux/license/proprietary -I$(TOP_KBUILD_SRC)$(src)/../mali/linux/license/proprietary else -ccflags-y += -I$(src)/linux/license/gpl -I$(src)/../mali/linux/license/gpl +ccflags-y += -I$(TOP_KBUILD_SRC)$(src)/linux/license/gpl -I$(TOP_KBUILD_SRC)$(src)/../mali/linux/license/gpl endif ump-y = common/ump_kernel_common.o \ From 97b4e81952e929ddefb2db06109f18f5e68c726b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Fri, 10 Apr 2015 10:50:16 +0200 Subject: [PATCH 2/3] Fix BACKPORT_DIR --- arch/arm/configs/odroidc_defconfig | 2 +- backports/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/configs/odroidc_defconfig b/arch/arm/configs/odroidc_defconfig index 92809819f291fe..bcee9b1ef14675 100644 --- a/arch/arm/configs/odroidc_defconfig +++ b/arch/arm/configs/odroidc_defconfig @@ -4366,7 +4366,7 @@ CONFIG_AVERAGE=y CONFIG_OID_REGISTRY=m # CONFIG_VIRTUALIZATION is not set CONFIG_BACKPORT_INTEGRATE=y -CONFIG_BACKPORT_DIR="backports/" +CONFIG_BACKPORT_DIR="backports" CONFIG_BACKPORT_VERSION="backports-20150129-0-gdd4a670" CONFIG_BACKPORT_KERNEL_VERSION="next-20150129-0-g828f79f" CONFIG_BACKPORT_KERNEL_NAME="Linux" diff --git a/backports/Makefile b/backports/Makefile index 5636a2278c3a96..851ba1449133c5 100644 --- a/backports/Makefile +++ b/backports/Makefile @@ -19,7 +19,7 @@ NOSTDINC_FLAGS := \ export backport_srctree = $(M) else -export BACKPORT_DIR = backports/ +export BACKPORT_DIR = backports export backport_srctree = $(BACKPORT_DIR) NOSTDINC_FLAGS := \ -I$(BACKPORT_DIR)/backport-include/ \ From d65f23854574d231a91eec32aace54586961c3ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Fri, 10 Apr 2015 11:00:56 +0200 Subject: [PATCH 3/3] Backport: fix out of tree build --- backports/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backports/Makefile b/backports/Makefile index 851ba1449133c5..b7aed5091b9b77 100644 --- a/backports/Makefile +++ b/backports/Makefile @@ -19,7 +19,12 @@ NOSTDINC_FLAGS := \ export backport_srctree = $(M) else -export BACKPORT_DIR = backports +ifneq ($(KBUILD_SRC),) + ifneq ($(wildcard $(KBUILD_SRC)/$(src)),) + TOP_KBUILD_SRC := $(KBUILD_SRC)/ + endif +endif +export BACKPORT_DIR = $(TOP_KBUILD_SRC)backports export backport_srctree = $(BACKPORT_DIR) NOSTDINC_FLAGS := \ -I$(BACKPORT_DIR)/backport-include/ \