nvidia-driver-565/nvidia-graphics-drivers-565/debian/patches/0008-Kbuild-Use-absolute-paths-for-symbolic-links.patch

79 lines
2.9 KiB
Diff
Raw Normal View History

2025-01-20 13:45:45 +00:00
From d0f1f20fb51a82499a9bd6f28d1cfd5b5b504436 Mon Sep 17 00:00:00 2001
From: Eric Naim <dnaim@cachyos.org>
Date: Fri, 20 Dec 2024 20:32:49 +0800
Subject: [PATCH 08/10] Kbuild: Use absolute paths for symbolic links
Command to create a symbolic link, explicitly resolving the symlink target
to an absolute path to abstract away the difference between Linux < 6.13,
where the CWD is the Linux kernel source tree for Kbuild extmod builds, and
Linux >= 6.13, where the CWD is the external module source tree.
This is used to create the nv*-kernel.o -> nv*-kernel.o_binary symlinks for
kernel modules which use precompiled binary object files
Signed-off-by: Eric Naim <dnaim@cachyos.org>
---
kernel-open/Kbuild | 14 ++++++++++++++
kernel-open/nvidia-modeset/nvidia-modeset.Kbuild | 5 +----
kernel-open/nvidia/nvidia.Kbuild | 5 +----
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/kernel-open/Kbuild b/kernel-open/Kbuild
index bda602aa..53e34bd1 100644
--- a/kernel-open/Kbuild
+++ b/kernel-open/Kbuild
@@ -57,6 +57,20 @@ ifeq ($(NV_UNDEF_BEHAVIOR_SANITIZER),1)
UBSAN_SANITIZE := y
endif
+#
+# Command to create a symbolic link, explicitly resolving the symlink target
+# to an absolute path to abstract away the difference between Linux < 6.13,
+# where the CWD is the Linux kernel source tree for Kbuild extmod builds, and
+# Linux >= 6.13, where the CWD is the external module source tree.
+#
+# This is used to create the nv*-kernel.o -> nv*-kernel.o_binary symlinks for
+# kernel modules which use precompiled binary object files.
+#
+
+quiet_cmd_symlink = SYMLINK $@
+ cmd_symlink = ln -sf $(abspath $<) $@
+
+
$(foreach _module, $(NV_KERNEL_MODULES), \
$(eval include $(src)/$(_module)/$(_module).Kbuild))
diff --git a/kernel-open/nvidia-modeset/nvidia-modeset.Kbuild b/kernel-open/nvidia-modeset/nvidia-modeset.Kbuild
index 9698b59e..d5ca07ca 100644
--- a/kernel-open/nvidia-modeset/nvidia-modeset.Kbuild
+++ b/kernel-open/nvidia-modeset/nvidia-modeset.Kbuild
@@ -40,9 +40,6 @@ NV_KERNEL_MODULE_TARGETS += $(NVIDIA_MODESET_KO)
NVIDIA_MODESET_BINARY_OBJECT := $(src)/nvidia-modeset/nv-modeset-kernel.o_binary
NVIDIA_MODESET_BINARY_OBJECT_O := nvidia-modeset/nv-modeset-kernel.o
-quiet_cmd_symlink = SYMLINK $@
-cmd_symlink = ln -sf $< $@
-
targets += $(NVIDIA_MODESET_BINARY_OBJECT_O)
$(obj)/$(NVIDIA_MODESET_BINARY_OBJECT_O): $(NVIDIA_MODESET_BINARY_OBJECT) FORCE
diff --git a/kernel-open/nvidia/nvidia.Kbuild b/kernel-open/nvidia/nvidia.Kbuild
index ea4ef5ba..0a4e68d4 100644
--- a/kernel-open/nvidia/nvidia.Kbuild
+++ b/kernel-open/nvidia/nvidia.Kbuild
@@ -40,9 +40,6 @@ NVIDIA_KO = nvidia/nvidia.ko
NVIDIA_BINARY_OBJECT := $(src)/nvidia/nv-kernel.o_binary
NVIDIA_BINARY_OBJECT_O := nvidia/nv-kernel.o
-quiet_cmd_symlink = SYMLINK $@
- cmd_symlink = ln -sf $< $@
-
targets += $(NVIDIA_BINARY_OBJECT_O)
$(obj)/$(NVIDIA_BINARY_OBJECT_O): $(NVIDIA_BINARY_OBJECT) FORCE
--
2.47.1