From e4f3b511120eb1c0e0f2b1ad23d03647e2046d95 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Fri, 11 Nov 2022 11:43:39 +0000 Subject: [PATCH] device-tree: Use TEGRA_TOP for hardware DT source Use the TEGRA_TOP environment variable for getting the path of hardware DT source. If it is not available then use the TOP. If TEGRA_TOP and TOP is not exported then report compilation error. Bug 3860258 Change-Id: I5c31f8861f795cec3b3bddb01621e3413d044454 Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2807613 Reviewed-by: Bitan Biswas Reviewed-by: svcacv Tested-by: Bitan Biswas GVS: Gerrit_Virtual_Submit --- device-tree/platform/generic-dts/Makefile | 12 ++++++++++-- device-tree/platform/legacy-dts/Makefile | 11 +++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/device-tree/platform/generic-dts/Makefile b/device-tree/platform/generic-dts/Makefile index 17329f46..8eb957ef 100644 --- a/device-tree/platform/generic-dts/Makefile +++ b/device-tree/platform/generic-dts/Makefile @@ -15,13 +15,21 @@ DTC_CPP_FLAGS += $(EXTRA_CPP_FLAGS) DTC_CPP_FLAGS += -DLINUX_VERSION=515 -DTEGRA_HOST1X_DT_VERSION=1 -tegra-dtstree := $(TOP)/hardware/nvidia +ifneq ($(TEGRA_TOP),) +SOURCE_TOP := $(TEGRA_TOP) +else ifneq ($(TOP),) +SOURCE_TOP := $(TOP) +else +$(error TEGRA_TOP or TOP is not defined) +endif + +tegra-dtstree := $(SOURCE_TOP)/hardware/nvidia # Get relative path for tegra-dtstree from this makefile null := space :=$(null) $(null) obj-path := $(obj) -obj-path-from-top := $(subst $(TOP),,$(obj-path)) +obj-path-from-top := $(subst $(SOURCE_TOP),,$(obj-path)) rel-top-path := $(subst /, $(space)/,$(obj-path-from-top)) rel-top-path := $(patsubst /%,../,$(rel-top-path)) rel-top-path := $(subst $(space),,$(rel-top-path)) diff --git a/device-tree/platform/legacy-dts/Makefile b/device-tree/platform/legacy-dts/Makefile index 2521335a..26b949af 100644 --- a/device-tree/platform/legacy-dts/Makefile +++ b/device-tree/platform/legacy-dts/Makefile @@ -15,13 +15,20 @@ DTC_CPP_FLAGS += $(EXTRA_CPP_FLAGS) DTC_CPP_FLAGS += -DLINUX_VERSION=515 -DTEGRA_HOST1X_DT_VERSION=1 -tegra-dtstree := $(TOP)/hardware/nvidia +ifneq ($(TEGRA_TOP),) +SOURCE_TOP := $(TEGRA_TOP) +else ifneq ($(TOP),) +SOURCE_TOP := $(TOP) +else +$(error TEGRA_TOP or TOP is not defined) +endif +tegra-dtstree := $(SOURCE_TOP)/hardware/nvidia # Get relative path for tegra-dtstree from this makefile null := space :=$(null) $(null) obj-path := $(obj) -obj-path-from-top := $(subst $(TOP),,$(obj-path)) +obj-path-from-top := $(subst $(SOURCE_TOP),,$(obj-path)) rel-top-path := $(subst /, $(space)/,$(obj-path-from-top)) rel-top-path := $(patsubst /%,../,$(rel-top-path)) rel-top-path := $(subst $(space),,$(rel-top-path))