|
52 | 52 | endif
|
53 | 53 | endif
|
54 | 54 |
|
| 55 | + # If CC hasn't been set explicitly, check the value of CONFIG_CC_VERSION_TEXT. |
| 56 | + # Look for the compiler specified there, and use it by default, if found. |
| 57 | + ifeq ($(origin CC),default) |
| 58 | + cc_version_text=$(firstword $(shell . $(KERNEL_OUTPUT)/.config; \ |
| 59 | + echo "$$CONFIG_CC_VERSION_TEXT")) |
| 60 | + |
| 61 | + ifneq ($(cc_version_text),) |
| 62 | + ifeq ($(shell command -v $(cc_version_text)),) |
| 63 | + $(warning WARNING: Unable to locate the compiler $(cc_version_text) \ |
| 64 | + from CONFIG_CC_VERSION_TEXT in the kernel configuration.) |
| 65 | + else |
| 66 | + CC=$(cc_version_text) |
| 67 | + endif |
| 68 | + endif |
| 69 | + endif |
| 70 | + |
55 | 71 | CC ?= cc
|
56 | 72 | LD ?= ld
|
57 | 73 | OBJDUMP ?= objdump
|
|
64 | 80 | )
|
65 | 81 | endif
|
66 | 82 |
|
| 83 | + KERNEL_ARCH = $(ARCH) |
| 84 | + |
| 85 | + ifneq ($(filter $(ARCH),i386 x86_64),) |
| 86 | + KERNEL_ARCH = x86 |
| 87 | + else |
| 88 | + ifeq ($(filter $(ARCH),arm64 powerpc),) |
| 89 | + $(error Unsupported architecture $(ARCH)) |
| 90 | + endif |
| 91 | + endif |
| 92 | + |
67 | 93 | NV_KERNEL_MODULES ?= $(wildcard nvidia nvidia-uvm nvidia-vgpu-vfio nvidia-modeset nvidia-drm nvidia-peermem)
|
68 | 94 | NV_KERNEL_MODULES := $(filter-out $(NV_EXCLUDE_KERNEL_MODULES), \
|
69 | 95 | $(NV_KERNEL_MODULES))
|
|
103 | 129 | # module symbols on which the Linux kernel's module resolution is dependent
|
104 | 130 | # and hence must be used whenever present.
|
105 | 131 |
|
106 |
| - LD_SCRIPT ?= $(KERNEL_SOURCES)/scripts/module-common.lds \ |
107 |
| - $(KERNEL_SOURCES)/arch/$(ARCH)/kernel/module.lds \ |
| 132 | + LD_SCRIPT ?= $(KERNEL_SOURCES)/scripts/module-common.lds \ |
| 133 | + $(KERNEL_SOURCES)/arch/$(KERNEL_ARCH)/kernel/module.lds \ |
| 134 | + $(KERNEL_OUTPUT)/arch/$(KERNEL_ARCH)/module.lds \ |
108 | 135 | $(KERNEL_OUTPUT)/scripts/module.lds
|
109 | 136 | NV_MODULE_COMMON_SCRIPTS := $(foreach s, $(wildcard $(LD_SCRIPT)), -T $(s))
|
110 | 137 |
|
|
0 commit comments