-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
135 lines (117 loc) · 4.69 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
MAKEFILE_DIR := $(abspath $(shell dirname $(lastword $(MAKEFILE_LIST))))
NVIDIA_CONFTEST ?= $(MAKEFILE_DIR)/out/nvidia-conftest
all: nvidia-nvgpu-modules nvidia-oot-modules vc-mipi-driver-modules
install: nvidia-modules-install vc-mipi-driver-modules-install
# Build a tarball for installation on Nano
# Some serious tar black magic for transforming the absolute INSTALL_MOD_PATH
# to the relative path install/
# Need -P option to _not_ strip the leading slash,
# so the regex (which includes the leading slash) works
package: install
install -m 755 install.sh $(INSTALL_MOD_PATH)
tar --transform "flags=r;s|$(INSTALL_MOD_PATH)|install|" -Pcjf install.tar.bz2 $(INSTALL_MOD_PATH)
vc-mipi-driver-modules: nvidia-oot-modules check-env
$(MAKE) -j $(NPROC) \
KBUILD_EXTRA_SYMBOLS=$(MAKEFILE_DIR)/nvidia-oot/Module.symvers \
CONFIG_TEGRA_OOT_MODULE=y \
srctree.nvidia-oot=$(MAKEFILE_DIR)/nvidia-oot \
srctree.vc-mipi-driver=$(MAKEFILE_DIR)/vc-mipi-driver \
srctree.nvconftest=$(NVIDIA_CONFTEST) \
M=$(MAKEFILE_DIR)/vc-mipi-driver \
-C $(KERNEL_SRC)
vc-mipi-driver-modules-install: vc-mipi-driver-modules check-env
$(MAKE) \
KBUILD_EXTRA_SYMBOLS=$(MAKEFILE_DIR)/nvidia-oot/Module.symvers \
CONFIG_TEGRA_OOT_MODULE=y \
srctree.nvidia-oot=$(MAKEFILE_DIR)/nvidia-oot \
KERNEL_SRC=$(KERNEL_SRC) \
-C $(MAKEFILE_DIR)/vc-mipi-driver install
nvidia-oot-conftest: check-env
mkdir -p $(NVIDIA_CONFTEST)/nvidia;
cp -av $(MAKEFILE_DIR)/nvidia-oot/scripts/conftest/* $(NVIDIA_CONFTEST)/nvidia
$(MAKE) -j $(NPROC) ARCH=arm64 \
src=$(NVIDIA_CONFTEST)/nvidia obj=$(NVIDIA_CONFTEST)/nvidia \
CC=$(CROSS_COMPILE)gcc LD=$(CROSS_COMPILE)ld \
NV_KERNEL_SOURCES=$(KERNEL_SRC) \
NV_KERNEL_OUTPUT=$(KERNEL_SRC) \
-f $(NVIDIA_CONFTEST)/nvidia/Makefile
nvidia-hwpm-modules: nvidia-oot-conftest check-env
$(MAKE) -j $(NPROC) \
CONFIG_TEGRA_OOT_MODULE=m \
srctree.hwpm=$(MAKEFILE_DIR)/nvidia-hwpm \
srctree.nvconftest=$(NVIDIA_CONFTEST) \
M=$(MAKEFILE_DIR)/nvidia-hwpm/drivers/tegra/hwpm \
-C $(KERNEL_SRC) \
modules
nvidia-hwpm-modules-install: nvidia-hwpm-modules check-env
$(MAKE) \
CONFIG_TEGRA_OOT_MODULE=m \
srctree.hwpm=$(MAKEFILE_DIR)/nvidia-hwpm \
srctree.nvconftest=$(NVIDIA_CONFTEST) \
M=$(MAKEFILE_DIR)/nvidia-hwpm/drivers/tegra/hwpm \
-C $(KERNEL_SRC) \
modules_install
nvidia-oot-modules: nvidia-oot-conftest nvidia-hwpm-modules check-env
cp -av $(MAKEFILE_DIR)/nvidia-nvethernetrm $(MAKEFILE_DIR)/nvidia-oot/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm
$(MAKE) -j $(NPROC) \
CONFIG_TEGRA_OOT_MODULE=m \
srctree.nvidia-oot=$(MAKEFILE_DIR)/nvidia-oot \
srctree.nvconftest=$(NVIDIA_CONFTEST) \
srctree.hwpm=$(MAKEFILE_DIR)/nvidia-hwpm \
KBUILD_EXTRA_SYMBOLS=$(MAKEFILE_DIR)/nvidia-hwpm/drivers/tegra/hwpm/Module.symvers \
M=$(MAKEFILE_DIR)/nvidia-oot \
-C $(KERNEL_SRC) \
modules
nvidia-oot-modules-install: nvidia-oot-modules check-env
$(MAKE) \
CONFIG_TEGRA_OOT_MODULE=m \
srctree.nvidia-oot=$(MAKEFILE_DIR)/nvidia-oot \
srctree.nvconftest=$(NVIDIA_CONFTEST) \
srctree.hwpm=$(MAKEFILE_DIR)/nvidia-hwpm \
KBUILD_EXTRA_SYMBOLS=$(MAKEFILE_DIR)/nvidia-hwpm/drivers/tegra/hwpm/Module.symvers \
M=$(MAKEFILE_DIR)/nvidia-oot \
-C $(KERNEL_SRC) \
modules_install
nvidia-nvgpu-modules: nvidia-oot-modules nvidia-oot-conftest check-env
$(MAKE) -j $(NPROC) \
CONFIG_TEGRA_OOT_MODULE=m \
KBUILD_EXTRA_SYMBOLS=$(MAKEFILE_DIR)/nvidia-oot/Module.symvers \
srctree.nvidia-oot=$(MAKEFILE_DIR)/nvidia-oot \
srctree.nvidia=$(MAKEFILE_DIR)/nvidia-oot \
srctree.nvconftest=$(NVIDIA_CONFTEST) \
M=$(MAKEFILE_DIR)/nvidia-nvgpu/drivers/gpu/nvgpu \
-C $(KERNEL_SRC) \
modules
nvidia-nvgpu-modules-install: nvidia-nvgpu-modules check-env
$(MAKE) \
CONFIG_TEGRA_OOT_MODULE=m \
KBUILD_EXTRA_SYMBOLS=$(MAKEFILE_DIR)/nvidia-oot/Module.symvers \
srctree.nvidia-oot=$(MAKEFILE_DIR)/nvidia-oot \
srctree.nvidia=$(MAKEFILE_DIR)/nvidia-oot \
srctree.nvconftest=$(NVIDIA_CONFTEST) \
M=$(MAKEFILE_DIR)/nvidia-nvgpu/drivers/gpu/nvgpu \
-C $(KERNEL_SRC) \
modules_install
nvidia-modules-install: nvidia-nvgpu-modules-install nvidia-oot-modules-install nvidia-hwpm-modules-install
check-env:
ifndef ARCH
$(error Environment variable ARCH must be defined)
endif
ifndef CROSS_COMPILE
$(error Environment variable CROSS_COMPILE must be defined)
endif
ifndef KERNEL_SRC
$(error Environment variable KERNEL_SRC must be defined)
endif
clean:
rm -rf out/
$(MAKE) \
srctree.nvidia-oot=$(MAKEFILE_DIR)/nvidia-oot \
srctree.nvconftest=$(NVIDIA_CONFTEST) \
M=$(MAKEFILE_DIR)/nvidia-oot \
-C $(KERNEL_SRC) clean
$(MAKE) \
srctree.nvidia-oot=$(MAKEFILE_DIR)/nvidia-oot \
KERNEL_SRC=$(KERNEL_SRC) \
-C $(MAKEFILE_DIR)/vc-mipi-driver clean
.PHONY: clean package install all check-env