From 4f006f58ad2406a9d0ae429f6ada394ce386eae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfonso=20S=C3=A1nchez-Beato?= Date: Wed, 9 Oct 2024 11:49:03 -0400 Subject: [PATCH] static: create device nodes if nvidia driver is loaded Import the 71-nvidia.rules file shipped by nvidia-kernel-common-* and the ancillary ub-device-create executable that creates some device nodes when the nvidia kernel module is loaded. --- hooks/001-extra-packages.chroot | 10 ++++++++++ static/usr/lib/udev/rules.d/71-nvidia.rules | 17 ----------------- 2 files changed, 10 insertions(+), 17 deletions(-) delete mode 100644 static/usr/lib/udev/rules.d/71-nvidia.rules diff --git a/hooks/001-extra-packages.chroot b/hooks/001-extra-packages.chroot index 739d7485..6566c8ff 100755 --- a/hooks/001-extra-packages.chroot +++ b/hooks/001-extra-packages.chroot @@ -171,6 +171,8 @@ PACKAGES=( wpasupplicant locales cracklib-runtime + # This is a ub-device-create dependency + libpciaccess0 ) case "$(dpkg --print-architecture)" in @@ -196,3 +198,11 @@ apt-get download snapd dpkg --fsys-tarfile snapd_*.deb | tar xf - ./usr/lib/systemd/system-generators/snapd-generator rm snapd_*.deb + +# Copy nvidia udev rules and dependencies (sources for this come from +# Canonical, not from Nvidia, see +# https://github.com/canonical/nvidia-graphics-drivers). +nvidia_common_pkg=nvidia-kernel-common-550 +apt-get download "$nvidia_common_pkg" +dpkg --fsys-tarfile "$nvidia_common_pkg"_*.deb | + tar xf - ./sbin/ub-device-create ./lib/udev/rules.d/71-nvidia.rules diff --git a/static/usr/lib/udev/rules.d/71-nvidia.rules b/static/usr/lib/udev/rules.d/71-nvidia.rules deleted file mode 100644 index 095713ef..00000000 --- a/static/usr/lib/udev/rules.d/71-nvidia.rules +++ /dev/null @@ -1,17 +0,0 @@ -# 0x10de is NVIDIA vendor id -# -# Tag the device as master-of-seat so that logind is happy -# (see LP: #1365336) -SUBSYSTEM=="pci", ATTRS{vendor}=="0x10de", TAG+="seat", TAG+="master-of-seat" - -# Enable runtime PM for NVIDIA VGA/3D controller devices -ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", TEST=="power/control", ATTR{power/control}="auto" - -# Enable runtime PM for NVIDIA Audio devices -ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", TEST=="power/control", ATTR{power/control}="auto" - -# Enable runtime PM for NVIDIA USB xHCI Host Controller devices -ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", TEST=="power/control", ATTR{power/control}="auto" - -# Enable runtime PM fo NVIDIA USB Type-C UCSI devices -ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", TEST=="power/control", ATTR{power/control}="auto"