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 <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2807613
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2022-11-11 11:43:39 +00:00
committed by mobile promotions
parent d875303e72
commit e4f3b51112
2 changed files with 19 additions and 4 deletions

View File

@@ -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))