From ae89edf92d63e84604f0b7005c1b3f7a3a957335 Mon Sep 17 00:00:00 2001 From: yugozhang Date: Wed, 29 Apr 2026 15:57:46 +0800 Subject: [PATCH 1/3] update --- 10-nvidia.conf | 9 + 60-nvidia.rules | 15 + 70-nvidia-driver-cuda.preset | 10 + 70-nvidia-driver.preset | 12 + 99-nvidia.conf | 3 + README.en.md | 2 +- README.md | 40 +- alternate-install-present | 2 + com.nvidia.driver.metainfo.xml | 46 +++ com.nvidia.driver.png | Bin 0 -> 6881 bytes dkms-nvidia.conf | 20 + nvidia-595.spec | 730 +++++++++++++++++++++++++++++++++ nvidia-boot-update | 163 ++++++++ nvidia-modeset.conf | 4 + nvidia-persistenced.service | 14 + nvidia-profiling.conf | 1 + nvidia.conf | 24 ++ parse-supported-gpus.py | 43 ++ sources | 3 + 19 files changed, 1101 insertions(+), 40 deletions(-) create mode 100644 10-nvidia.conf create mode 100644 60-nvidia.rules create mode 100644 70-nvidia-driver-cuda.preset create mode 100644 70-nvidia-driver.preset create mode 100644 99-nvidia.conf create mode 100644 alternate-install-present create mode 100644 com.nvidia.driver.metainfo.xml create mode 100644 com.nvidia.driver.png create mode 100644 dkms-nvidia.conf create mode 100644 nvidia-595.spec create mode 100644 nvidia-boot-update create mode 100644 nvidia-modeset.conf create mode 100644 nvidia-persistenced.service create mode 100644 nvidia-profiling.conf create mode 100644 nvidia.conf create mode 100644 parse-supported-gpus.py create mode 100644 sources diff --git a/10-nvidia.conf b/10-nvidia.conf new file mode 100644 index 0000000..98fc7f1 --- /dev/null +++ b/10-nvidia.conf @@ -0,0 +1,9 @@ +Section "OutputClass" + Identifier "nvidia" + MatchDriver "nvidia-drm" + Driver "nvidia" + Option "AllowEmptyInitialConfiguration" + Option "PrimaryGPU" "yes" + Option "SLI" "Auto" + Option "BaseMosaic" "on" +EndSection diff --git a/60-nvidia.rules b/60-nvidia.rules new file mode 100644 index 0000000..7a0f524 --- /dev/null +++ b/60-nvidia.rules @@ -0,0 +1,15 @@ +# Device nodes are created by nvidia-modprobe, which is called by the nvidia +# DDX or other components. +# In case the DDX is not started, the device nodes are never created, so call +# nvidia-modprobe in the udev rules to cover various cases like Wayland, compute +# node without a started display or Optimus laptop. +ACTION=="add|bind", KERNEL=="nvidia", RUN+="/usr/bin/nvidia-modprobe" +ACTION=="add|bind", KERNEL=="nvidia_uvm", RUN+="/usr/bin/nvidia-modprobe -c0 -u" + +# Enable runtime PM for NVIDIA VGA/3D controller devices on driver bind +ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="auto" + +# Disable runtime PM for NVIDIA VGA/3D controller devices on driver unbind +ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="on" +ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="on" diff --git a/70-nvidia-driver-cuda.preset b/70-nvidia-driver-cuda.preset new file mode 100644 index 0000000..04aec51 --- /dev/null +++ b/70-nvidia-driver-cuda.preset @@ -0,0 +1,10 @@ +# Enable persistence state. From: +# file:///usr/share/doc/nvidia-driver/html/nvidia-persistenced.html + +enable nvidia-persistenced.service + +# Enable Fabric Manager: +enable nvidia-fabricmanager.service + +# Enable IMEX: +enable nvidia-imex.service diff --git a/70-nvidia-driver.preset b/70-nvidia-driver.preset new file mode 100644 index 0000000..f897d23 --- /dev/null +++ b/70-nvidia-driver.preset @@ -0,0 +1,12 @@ +# Enable complete power management. From: +# file:///usr/share/doc/nvidia-driver/html/powermanagement.html + +enable nvidia-hibernate.service +enable nvidia-resume.service +enable nvidia-suspend.service +enable nvidia-suspend-then-hibernate.service + +# Enable Dynamic Boost. From: +# file:///usr/share/doc/nvidia-driver/html/dynamicboost.html + +enable nvidia-powerd.service diff --git a/99-nvidia.conf b/99-nvidia.conf new file mode 100644 index 0000000..a4af5e3 --- /dev/null +++ b/99-nvidia.conf @@ -0,0 +1,3 @@ +# Omit the nvidia driver from the ramdisk, to avoid needing to regenerate +# the ramdisk on updates. +omit_drivers+=" nvidia nvidia-drm nvidia-modeset nvidia-uvm nvidia-peermem " diff --git a/README.en.md b/README.en.md index 48918b1..57687c5 100644 --- a/README.en.md +++ b/README.en.md @@ -1,4 +1,4 @@ -# nvidia-595 +# nvidia #### Description {**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} diff --git a/README.md b/README.md index 2ced9b8..1aa5592 100644 --- a/README.md +++ b/README.md @@ -1,39 +1 @@ -# nvidia-595 - -#### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +nvidia-driver-server is the driver for Nvidia DataCenter GPU. \ No newline at end of file diff --git a/alternate-install-present b/alternate-install-present new file mode 100644 index 0000000..594dc21 --- /dev/null +++ b/alternate-install-present @@ -0,0 +1,2 @@ +The NVIDIA proprietary driver is already installed in this system. +It was installed through packages and not with the self extracting executable. diff --git a/com.nvidia.driver.metainfo.xml b/com.nvidia.driver.metainfo.xml new file mode 100644 index 0000000..fd652e7 --- /dev/null +++ b/com.nvidia.driver.metainfo.xml @@ -0,0 +1,46 @@ + + + com.nvidia.driver + + nvidia-settings.desktop + + NVIDIA Graphics Driver + /usr/share/pixmaps/com.nvidia.driver.png + NVIDIA Accelerated Graphics Driver + + NVIDIA Corporation + + +

The NVIDIA Accelerated Linux Graphics Driver brings accelerated 2D functionality and high-performance OpenGL support to Linux with the use of NVIDIA graphics processing units.

+

These drivers provide optimized hardware acceleration for OpenGL and X applications and support nearly all recent NVIDIA GPU products. The NVIDIA graphics driver uses a Unified Driver Architecture: the single graphics driver supports all modern NVIDIA GPUs.

+
+ + CUDA + GeForce + NVIDIA + OpenGL + Quadro + Tesla + Video + Vulkan + av1 + avc + driver + h264 + h265 + hevc + jpeg + mpeg2 + vaapi + vc-1 + vp8 + vp9 + + CC0-1.0 + LicenseRef-proprietary:NVIDIA + https://www.nvidia.com/ + cudatools@nvidia.com + + True + +
diff --git a/com.nvidia.driver.png b/com.nvidia.driver.png new file mode 100644 index 0000000000000000000000000000000000000000..ff023b8b1b8ee56018b5e0d3232ac7337262ab4e GIT binary patch literal 6881 zcmbt(c{J2t`2Twr%#3X?*+X_EYt}4d-!%xMEHm~sgR&*wma&Uc_GOTzs7Q-7(8Is`uos%;4>n(FK7O#-pqX8-EUeol)V1$iy8hwsG93;|C|)lT`=H@gdgeo`eJRs| zP2By#p%s=-$xc4inm!N0S~Vvggtcq3*Kamy#tBvdB=A94o2FxZSgmGo{ia9mSHA6y z7ui|Cb*(m~CLjJTsWX5K52CCyFYH|Z@V71TE8i0lH8*eDQsxhZ4$D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QOUp-ZB&X^~a~K+7^f0Xa!GZ0FLL1R$k~1|sjfYmzG7l{$ua^b%5F zq{ug|6MnitoV?bM?$0^&ten=`k{p~6WdLb;`lZEZ>u-OQ_EmKt#a=sQI2H)U#2%)o zE99SedH9*PXbqxXQvnD%hRg)LoQ+wP(V8_o$xclul7d}kqbicsazC$9|8;!PJ_u=J zqQ6asD&Ruee_hYT>|~~&aPtY*0!*GA3S&2wdAj@}{kIOk3xRJ~834J*>f7l$F5qR# z0tD|AcAk_0DIiCnZgw%l`bzA7!B@Y)DRRJ>(>HH4JuY%-I--)GxM#-Q54d3)6SM_4 z$_y>thahJTn8R>g{zJ+)b~$f=pOE0$6U(ks?tswg5|vApgNY|B?z2k*5|FyCuwX%E z%d1}VidPbEG7%a@UoNP(R0FcF${t8`6qS3g&a)%2Ep)# z7t$?)fH44@nUBKHU)2JN&&dD2l?NrEqU{Ko;y^W|ZqE3?5j3%wh**yV4#~gzm}9&w zAT7b^aQZct|HXOEI7WHNy@52;Zg8F-6#k+)zRvl2fE(Ia=X>eVza~it{o>cPy2?le=&?I{(0$DX{W_0ut%=Jh7#`t7D=>~k9Gu{nVst|Xv%iVvH&jsQjbknEMew- zE$#Z#9Uzzp%dhl`Kql9De6_u0hKJ*T&C@lBNA*$lr*)_2pmcOhs!PE$M}U4hCg}}6 zL+H^Df8cPeH)B5zNlj8rmkJS6r6VMY*r|mlbT{O1k7EBN?MXS#>u-^?50l0qn~lgH zO#;FTro3{3Qr{l0J9Z?KDYJqsJAMNn+1in1F$os!WZvslb z*XI$hz1n>iJQUg>Cs=QJE-C2SykbLl6aJ= 3.9 +%else +BuildRequires: python3 +%endif +BuildRequires: systemd-rpm-macros +BuildRequires: libappstream-glib +# for building sign-file +%if %{with kernel_sign} +BuildRequires: kernel-devel +BuildRequires: glibc-devel, glibc-static, libstdc++-static +BuildRequires: gcc +BuildRequires: openssl-devel +%endif + +AutoReqProv: no +# for runtime dependencies +## from orignal nvidia-driver +Conflicts: nvidia-x11-drv +Conflicts: nvidia-x11-drv-470xx +Conflicts: xorg-x11-drv-nvidia +Conflicts: xorg-x11-drv-nvidia-470xx +# from orignal nvidia-driver-libs +Requires: libvdpau >= 0.5 +Requires: libglvnd >= 1.0 +Requires: libglvnd-egl >= 1.0 +Requires: libglvnd-gles >= 1.0 +Requires: libglvnd-glx >= 1.0 +Requires: libglvnd-opengl >= 1.0 +Requires: vulkan-loader +Obsoletes: nvidia-driver-libs < %{epoch}:%{version}-%{release} +Conflicts: nvidia-x11-drv-libs +Conflicts: nvidia-x11-drv-470xx-libs +Conflicts: xorg-x11-drv-nvidia-libs +Conflicts: xorg-x11-drv-nvidia-470xx-libs +# from orignal libnvidia-fbc +Obsoletes: libnvidia-fbc < %{epoch}:%{version}-%{release} +# from orignal libnvidia-ml +Obsoletes: libnvidia-ml < %{epoch}:%{version}-%{release} +Obsoletes: nvidia-driver-NVML < %{epoch}:%{version}-%{release} +# from orignal libnvidia-cfg +Obsoletes: libnvidia-cfg < %{epoch}:%{version}-%{release} +# from orignal cuda +Requires: opencl-filesystem +Requires: ocl-icd +Obsoletes: nvidia-driver-cuda < %{epoch}:%{version}-%{release} +Conflicts: xorg-x11-drv-nvidia-cuda +Conflicts: xorg-x11-drv-nvidia-470xx-cuda +# from orignal nvidia-driver-cuda-libs +Obsoletes: nvidia-driver-cuda-libs < %{epoch}:%{version}-%{release} +Conflicts: xorg-x11-drv-nvidia-cuda-libs +Conflicts: xorg-x11-drv-nvidia-470xx-cuda-libs +# from orignal xorg-x11-nvidia +Requires: xorg-x11-server-Xorg +Obsoletes: xorg-x11-nvidia < %{epoch}:%{version}-%{release} +# nvidia-modprobe +Obsoletes: nvidia-modprobe < %{epoch}:%{version}-%{release} + +%description +This package provides the most recent NVIDIA display driver which allows for +hardware accelerated rendering with recent NVIDIA chipsets. + +For the full product support list, please consult the release notes for driver +version %{version}. + + +%package -n nvidia +Summary: NVIDIA's display driver for NVIDIA graphic cards +Requires: %{name} = %{epoch}:%{version}-%{release} +AutoReqProv: no + +%description -n nvidia +This package provides the most recent NVIDIA display driver which allows for +hardware accelerated rendering with recent NVIDIA chipsets. + +For the full product support list, please consult the release notes for driver +version %{version}. + + +%package -n nvidia-driver +Summary: NVIDIA's proprietary display driver for NVIDIA graphic cards +Requires: %{pkg_name} = %{epoch}:%{version}-%{release} +AutoReqProv: no + +%description -n nvidia-driver +This package provides the NVIDIA display driver which allows for +hardware accelerated rendering with recent NVIDIA chipsets. + +For the full product support list, please consult the release notes for driver +version %{version}. + + +%package -n nvidia-driver-open +Summary: NVIDIA's opensource display driver for NVIDIA graphic cards +Requires: %{pkg_open_name} = %{epoch}:%{version}-%{release} +AutoReqProv: no + +%description -n nvidia-driver-open +This package provides the most recent NVIDIA display driver which allows for +hardware accelerated rendering with recent NVIDIA chipsets. + +For the full product support list, please consult the release notes for driver +version %{version}. + + +%package -n kmod-nvidia-latest-dkms +Summary: DKMS packaging source for NVIDIA proprietary kernel modules +Requires: %{kmod_pkg_name} = %{epoch}:%{version}-%{release} +AutoReqProv: no + +%description -n kmod-nvidia-latest-dkms +DKMS packaging source for NVIDIA kernel modules + + +%package -n kmod-nvidia-latest-dkms-open +Summary: DKMS packaging source for NVIDIA opensource kernel modules +Requires: %{kmod_open_pkg_name} = %{epoch}:%{version}-%{release} +AutoReqProv: no + +%description -n kmod-nvidia-latest-dkms-open +DKMS packaging source for NVIDIA opensource kernel modules + + +%package -n %{pkg_name} +Summary: NVIDIA's proprietary display driver for NVIDIA graphic cards +Requires: %{name} = %{epoch}:%{version}-%{release} +Requires: %{kmod_pkg_name} = %{epoch}:%{version}-%{release} +Conflicts: %{pkg_open_name} +AutoReqProv: no + +%description -n %{pkg_name} +This package provides the NVIDIA display driver which allows for +hardware accelerated rendering with recent NVIDIA chipsets. + +For the full product support list, please consult the release notes for driver +version %{version}. + +# some new device can only be supported by opensource driver +%package -n %{pkg_open_name} +Summary: NVIDIA's opensource display driver for NVIDIA graphic cards +Requires: %{name} = %{epoch}:%{version}-%{release} +Requires: %{kmod_open_pkg_name} = %{epoch}:%{version}-%{release} +Conflicts: %{pkg_name} +AutoReqProv: no + +%description -n %{pkg_open_name} +This package provides the most recent NVIDIA display driver which allows for +hardware accelerated rendering with recent NVIDIA chipsets. + +For the full product support list, please consult the release notes for driver +version %{version}. + +%package -n %{kmod_pkg_name} +# merged nvidia-kmod-headers +Summary: DKMS packaging source for NVIDIA proprietary kernel modules +AutoReqProv: no +Requires: dkms +Requires: gcc +%if %{with kernel_sign} +# for sign kmod +Recommends: kernel-signing-keys +Recommends: openssl +%endif +Conflicts: kmod-nvidia-latest-dkms-open +Conflicts: %{kmod_open_pkg_name} + +%description -n %{kmod_pkg_name} +DKMS packaging source for NVIDIA kernel modules + +%package -n %{kmod_open_pkg_name} +# merged nvidia-kmod-source +Summary: DKMS packaging source for NVIDIA opensource kernel modules +AutoReqProv: no +Requires: dkms +Requires: gcc +%if %{with kernel_sign} +# for sign kmod +Recommends: kernel-signing-keys +Recommends: openssl +%endif +Conflicts: kmod-nvidia-latest-dkms +Conflicts: %{kmod_pkg_name} + +%description -n %{kmod_open_pkg_name} +DKMS packaging source for NVIDIA opensource kernel modules + + + +%prep +%setup -q -T -b 3 -n open-gpu-kernel-modules-%{version} +rm -rf kernel-open + +%setup -q -T -c %{name}-%{version} +# nvidia-driver +# .run will forcely create a subdirectory +rm -rf nvidia-tmp +%ifarch x86_64 +chmod +x %{SOURCE0} +bash %{SOURCE0} --extract-only --target nvidia-tmp +mv -v nvidia-tmp/{.,}* . || true +rmdir nvidia-tmp + +%if 0%{?tencentos} == 3 || 0%{?opencloudos} == 8 +rm -f libnvidia-pkcs11-openssl3.so.* +%else +rm -f rm -f libnvidia-pkcs11.so.* +%endif + +%endif + +%ifarch aarch64 +chmod +x %{SOURCE1} +bash %{SOURCE1} --extract-only --target nvidia-tmp +mv -v nvidia-tmp/{.,}* . || true +rmdir nvidia-tmp +%endif + +# Create symlinks for shared objects +ldconfig -vn . + +# Required for building gstreamer 1.0 NVENC plugins +ln -sf libnvidia-encode.so.%{version} libnvidia-encode.so + +# Required for building ffmpeg 3.1 Nvidia CUVID +ln -sf libnvcuvid.so.%{version} libnvcuvid.so + +# Required for building against CUDA +ln -sf libcuda.so.%{version} libcuda.so + +# kmod +rm -f kernel/dkms.conf kernel-open/dkms.conf +cp -a %{SOURCE301} kernel/dkms.conf +chmod +x kernel/dkms.conf +cp -a %{SOURCE301} kernel-open/dkms.conf +chmod +x kernel-open/dkms.conf +sed -i -e 's/__VERSION_STRING/%{version}/g' kernel/dkms.conf +sed -i -e 's/__VERSION_STRING/%{version}/g' kernel-open/dkms.conf +# open module +mv ../open-gpu-kernel-modules-%{version} kernel-source + + + +%build +%if %{with kernel_sign} +# because /usr/src/kernels//scripts/sign-file is an error elf, +# so we need compile it temply +if ! [ -d "/usr/src/kernels/$(uname -r)/scripts" ]; +then + echo "can not find /usr/src/kernels/$(uname -r)/ for kernel version $(uname -r)" + exit 1 +fi + +gcc -Wall -O2 -lcrypto -o sign-file-%{name} /usr/src/kernels/$(uname -r)/scripts/sign-file.c +%endif + + +%install +# EGL loader +install -p -m 0644 -D 10_nvidia.json %{buildroot}%{_datadir}/glvnd/egl_vendor.d/10_nvidia.json + +# Vulkan loader +%if %{pkg_main_ver} >= 560 +install -p -m 0644 -D nvidia_icd.json %{buildroot}%{_datadir}/vulkan/icd.d/nvidia_icd.%{_target_cpu}.json +sed -i -e 's|libGLX_nvidia|%{_libdir}/libGLX_nvidia|g' %{buildroot}%{_datadir}/vulkan/icd.d/nvidia_icd.%{_target_cpu}.json +%endif + +%if %{pkg_main_ver} >= 560 +%ifarch x86_64 +# Vulkan SC loader and compiler +install -p -m 0644 -D nvidia_icd_vksc.json %{buildroot}%{_datadir}/vulkansc/icd.d/nvidia_icd.%{_target_cpu}.json +sed -i -e 's|libnvidia-vksc-core|%{_libdir}/libnvidia-vksc-core|g' %{buildroot}%{_datadir}/vulkansc/icd.d/nvidia_icd.%{_target_cpu}.json +install -p -m 0755 -D nvidia-pcc %{buildroot}%{_bindir}/nvidia-pcc +%endif +%endif + +# Unique libraries +mkdir -p %{buildroot}%{_libdir}/vdpau/ +cp -a lib*GL*_nvidia.so* libcuda*.so* libnv*.so* %{buildroot}%{_libdir}/ +cp -a libvdpau_nvidia.so* %{buildroot}%{_libdir}/vdpau/ + +# GBM loader +mkdir -p %{buildroot}%{_libdir}/gbm/ +ln -sf ../libnvidia-allocator.so.%{version} %{buildroot}%{_libdir}/gbm/nvidia-drm_gbm.so + +%ifarch x86_64 +# NGX Proton/Wine library +mkdir -p %{buildroot}%{_libdir}/nvidia/wine/ +cp -a *.dll %{buildroot}%{_libdir}/nvidia/wine/ +%if %{pkg_main_ver} >= 570 +# nvsandboxutils configuration +install -p -m 0644 -D sandboxutils-filelist.json %{buildroot}%{_datadir}/nvidia/files.d/sandboxutils-filelist.json +%endif +%endif + +# alternate-install-present file triggers runfile warning +install -m 0755 -d %{buildroot}/usr/lib/nvidia/ +install -p -m 0644 %{SOURCE5} %{buildroot}/usr/lib/nvidia/ + +# Empty? +mkdir -p %{buildroot}%{_sysconfdir}/nvidia/ + +# OpenCL config +install -p -m 0755 -D nvidia.icd %{buildroot}%{_sysconfdir}/OpenCL/vendors/nvidia.icd + +# Binaries +mkdir -p %{buildroot}%{_bindir} +for file in nvidia-{debugdump,smi,cuda-mps-control,cuda-mps-server,bug-report.sh,ngx-updater,powerd,xconfig,modprobe,pcc,persistenced,settings}; do + if [[ -f "$file" ]]; then + cp -pv "$file" "%{buildroot}%{_bindir}/" && + chmod 0755 "%{buildroot}%{_bindir}/$file" + else + echo "Warnning:file $file is not existing, skip it" >&2 + fi +done + +# Man pages +mkdir -p %{buildroot}%{_mandir}/man1/ +install -p -m 0644 nvidia-*.gz %{buildroot}%{_mandir}/man1/ + +# X stuff +install -p -m 0644 -D %{SOURCE4} %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/10-nvidia.conf +install -p -m 0755 -D nvidia_drv.so %{buildroot}%{_libdir}/xorg/modules/drivers/nvidia_drv.so +install -p -m 0755 -D libglxserver_nvidia.so.%{version} %{buildroot}%{_libdir}/xorg/modules/extensions/libglxserver_nvidia.so + +# NVIDIA specific configuration files +mkdir -p %{buildroot}%{_datadir}/nvidia/ +install -p -m 0644 nvidia-application-profiles-%{version}-key-documentation \ + %{buildroot}%{_datadir}/nvidia/ +install -p -m 0644 nvidia-application-profiles-%{version}-rc \ + %{buildroot}%{_datadir}/nvidia/ + +# OptiX +%if %{pkg_main_ver} >= 535 +install -p -m 0644 nvoptix.bin %{buildroot}%{_datadir}/nvidia/ +%endif + +# Systemd units and script for suspending/resuming +mkdir -p %{buildroot}%{_systemd_util_dir}/system-preset/ +install -p -m 0644 %{SOURCE9} %{SOURCE10} %{buildroot}%{_systemd_util_dir}/system-preset/ +mkdir -p %{buildroot}%{_unitdir}/ +install -p -m 0644 systemd/system/*.service %{buildroot}%{_unitdir}/ +install -p -m 0755 systemd/nvidia-sleep.sh %{buildroot}%{_bindir}/ +install -p -m 0755 -D systemd/system-sleep/nvidia %{buildroot}%{_systemd_util_dir}/system-sleep/nvidia +%if (%{pkg_main_ver} >= 550) || (%{pkg_main_ver} < 550 && "%{_arch}" == "x86_64") +install -p -m 0644 -D nvidia-dbus.conf %{buildroot}%{_datadir}/dbus-1/system.d/nvidia-dbus.conf +%endif + +# Ignore powerd binary exiting if hardware is not present +# We should check for information in the DMI table +sed -i -e 's/ExecStart=/ExecStart=-/g' %{buildroot}%{_unitdir}/nvidia-powerd.service + +# Vulkan layer +install -p -m 0644 -D nvidia_layers.json %{buildroot}%{_datadir}/vulkan/implicit_layer.d/nvidia_layers.json + +# Install AppData and add modalias provides, do not use appstream-util add-provide as it mangles the xml +install -p -m 0644 -D %{SOURCE6} %{buildroot}%{_metainfodir}/com.nvidia.driver.metainfo.xml +mkdir -p %{buildroot}%{_datadir}/pixmaps/ +cp %{SOURCE8} %{buildroot}%{_datadir}/pixmaps/ + +# non root user can access GPU +install -p -m 0644 -D %{SOURCE11} %{buildroot}%{_sysconfdir}/modprobe.d/nvidia-profiling.conf + +#### +# kmod +#### +# close module +mkdir -p %{buildroot}%{_usrsrc}/nvidia-%{version}/ +cp -fr kernel/* %{buildroot}%{_usrsrc}/nvidia-%{version}/ + +# open module +# Create empty tree +mkdir -p %{buildroot}%{_usrsrc}/nvidia-open-%{version}/src +cp -fr kernel-open/* %{buildroot}%{_usrsrc}/nvidia-open-%{version}/ +cp -fr kernel-source/* %{buildroot}%{_usrsrc}/nvidia-open-%{version}/src/ +# Add symlink +cd %{buildroot}%{_usrsrc}/nvidia-open-%{version}/src/ && +ln -sf ../../nvidia-open-%{version}/ kernel-open && +cd - >/dev/null + +#### +# kmod-common +#### +# Script for post/preun tasks +install -p -m 0755 -D %{SOURCE101} %{buildroot}%{_sbindir}/nvidia-boot-update + +# Nvidia modesetting support: +install -p -m 0644 -D %{SOURCE119} %{buildroot}%{_sysconfdir}/modprobe.d/nvidia-modeset.conf + +# Load nvidia-uvm, enable complete power management: +install -p -m 0644 -D %{SOURCE120} %{buildroot}%{_modprobedir}/nvidia.conf + +# Avoid Nvidia modules getting in the initrd: +install -p -m 0644 -D %{SOURCE124} %{buildroot}%{_prefix}/lib/dracut/dracut.conf.d/99-nvidia.conf + +# UDev rules: +# https://github.com/NVIDIA/nvidia-modprobe/blob/master/modprobe-utils/nvidia-modprobe-utils.h#L33-L46 +# https://github.com/negativo17/nvidia-kmod-common/issues/11 +# https://github.com/negativo17/nvidia-driver/issues/27 +install -p -m 644 -D %{SOURCE121} %{buildroot}%{_udevrulesdir}/60-nvidia.rules + +# Firmware files: +mkdir -p %{buildroot}%{_prefix}/lib/firmware/nvidia/%{version}/ +install -p -m 644 firmware/* %{buildroot}%{_prefix}/lib/firmware/nvidia/%{version} + +#### +# nvidia-persistenced +#### +install -p -m 644 -D %{SOURCE201} %{buildroot}%{_unitdir}/nvidia-persistenced.service + +%if %{with kernel_sign} +#### +# kmod sign-file +#### +install -p -m 755 -D sign-file-%{name} %{buildroot}%{_bindir}/sign-file-%{name} +%endif + + + + +%check +# Using appstreamcli: appstreamcli validate --strict +# Icon type local is not supported by appstreamcli for drivers +appstream-util validate --nonet %{buildroot}%{_metainfodir}/com.nvidia.driver.metainfo.xml + + + +%post -n %{pkg_name} +%systemd_post nvidia-hibernate.service +%if (%{pkg_main_ver} >= 560) || (%{pkg_main_ver} < 560 && "%{_arch}" == "x86_64") +%systemd_post nvidia-powerd.service +%endif +%systemd_post nvidia-resume.service +%systemd_post nvidia-suspend.service +%systemd_post nvidia-suspend-then-hibernate.service +%systemd_post nvidia-persistenced.service + +%preun -n %{pkg_name} +%systemd_preun nvidia-hibernate.service +%if (%{pkg_main_ver} >= 560) || (%{pkg_main_ver} < 560 && "%{_arch}" == "x86_64") +%systemd_preun nvidia-powerd.service +%endif +%systemd_preun nvidia-resume.service +%systemd_preun nvidia-suspend.service +%systemd_preun nvidia-suspend-then-hibernate.service +%systemd_preun nvidia-persistenced.service + +%postun -n %{pkg_name} +%systemd_postun nvidia-hibernate.service +%if (%{pkg_main_ver} >= 560) || (%{pkg_main_ver} < 560 && "%{_arch}" == "x86_64") +%systemd_postun nvidia-powerd.service +%endif +%systemd_postun nvidia-resume.service +%systemd_postun nvidia-suspend.service +%systemd_postun nvidia-suspend-then-hibernate.service +%systemd_postun nvidia-persistenced.service + +%post -n %{pkg_open_name} +%systemd_post nvidia-hibernate.service +%if (%{pkg_main_ver} >= 560) || (%{pkg_main_ver} < 560 && "%{_arch}" == "x86_64") +%systemd_post nvidia-powerd.service +%endif +%systemd_post nvidia-resume.service +%systemd_post nvidia-suspend.service +%systemd_post nvidia-suspend-then-hibernate.service +%systemd_post nvidia-persistenced.service + +%preun -n %{pkg_open_name} +%systemd_preun nvidia-hibernate.service +%if (%{pkg_main_ver} >= 560) || (%{pkg_main_ver} < 560 && "%{_arch}" == "x86_64") +%systemd_preun nvidia-powerd.service +%endif +%systemd_preun nvidia-resume.service +%systemd_preun nvidia-suspend.service +%systemd_preun nvidia-suspend-then-hibernate.service +%systemd_preun nvidia-persistenced.service + +%postun -n %{pkg_open_name} +%systemd_postun nvidia-hibernate.service +%if (%{pkg_main_ver} >= 560) || (%{pkg_main_ver} < 560 && "%{_arch}" == "x86_64") +%systemd_postun nvidia-powerd.service +%endif +%systemd_postun nvidia-resume.service +%systemd_postun nvidia-suspend.service +%systemd_postun nvidia-suspend-then-hibernate.service +%systemd_postun nvidia-persistenced.service + +%post -n %{kmod_pkg_name} +%if %{with kernel_sign} +if grep -q "module.sig_enforce=1" /proc/cmdline || grep "CONFIG_MODULE_SIG_FORCE" /boot/config-$(uname -r); then + echo "✅ module.sig_enforce is enabled" + if ! [ -d "/usr/share/doc/kernel-keys/$(uname -r)" ]; + then + echo "missing kernel-signing-keys, failing sign kmod." + exit 1 + fi + if ! [ -f "/usr/share/doc/kernel-keys/$(uname -r)/signing_key.x509" ]; + then + openssl x509 -in /usr/share/doc/kernel-keys/$(uname -r)/kernel-signing-ca.pem -out /usr/share/doc/kernel-keys/$(uname -r)/signing_key.x509 + fi + export mok_signing_key=/usr/share/doc/kernel-keys/$(uname -r)/kernel-signing-ca.pem + export mok_certificate=/usr/share/doc/kernel-keys/$(uname -r)/signing_key.x509 + export sign_file=/usr/bin/sign-file-nvidia-driver +else + echo "❌ module.sig_enforce is disabled" + dkms will not sign kernel module +fi +%endif +dkms remove -m nvidia-open -q --all || : +dkms add -m nvidia -v %{version} +# Rebuild and make available for the currently running kernel +dkms build -m nvidia -v %{version} +dkms install -m nvidia -v %{version} --force +# kmod-common +%{_sbindir}/nvidia-boot-update post + +%preun -n %{kmod_pkg_name} +# Remove all versions from DKMS registry +dkms remove -m nvidia -v %{version} -q --all || : +# cannot remove nvidia_uvm.ko by default +modprobe -r nvidia_uvm || true +find /lib/modules/$(uname -r) -name "nvidia_uvm.ko*" -delete || true +depmod -a +# kmod-common +if [ "$1" -eq "0" ]; then + %{_sbindir}/nvidia-boot-update preun +fi ||: + +%post -n %{kmod_open_pkg_name} +%if %{with kernel_sign} +if grep -q "module.sig_enforce=1" /proc/cmdline || grep "CONFIG_MODULE_SIG_FORCE" /boot/config-$(uname -r); then + echo "✅ module.sig_enforce is enabled" + if ! [ -d "/usr/share/doc/kernel-keys/$(uname -r)" ]; + then + echo "missing kernel-signing-keys, failing sign kmod." + exit 1 + fi + if ! [ -f "/usr/share/doc/kernel-keys/$(uname -r)/signing_key.x509" ]; + then + openssl x509 -in /usr/share/doc/kernel-keys/$(uname -r)/kernel-signing-ca.pem -out /usr/share/doc/kernel-keys/$(uname -r)/signing_key.x509 + fi + export mok_signing_key=/usr/share/doc/kernel-keys/$(uname -r)/kernel-signing-ca.pem + export mok_certificate=/usr/share/doc/kernel-keys/$(uname -r)/signing_key.x509 + export sign_file=/usr/bin/sign-file-nvidia-driver +else + echo "❌ module.sig_enforce is disabled" + dkms will not sign kernel module +fi +%endif +dkms remove -m nvidia -q --all +dkms add -m nvidia-open -v %{version} +# Rebuild and make available for the currently running kernel +dkms build -m nvidia-open -v %{version} +dkms install -m nvidia-open -v %{version} --force +# kmod-common +%{_sbindir}/nvidia-boot-update post + +%preun -n %{kmod_open_pkg_name} +# Remove all versions from DKMS registry +dkms remove -m nvidia-open -v %{version} -q --all +# cannot remove nvidia_uvm.ko by default +modprobe -r nvidia_uvm || true +find /lib/modules/$(uname -r) -name "nvidia_uvm.ko*" -delete || true +depmod -a +# kmod-common +if [ "$1" -eq "0" ]; then + %{_sbindir}/nvidia-boot-update preun +fi ||: + + + +%files +%license LICENSE +%doc NVIDIA_Changelog README.txt html supported-gpus/supported-gpus.json +%dir %{_sysconfdir}/nvidia +%{_bindir}/* +%{_libdir}/*.so* +%dir %{_libdir}/gbm +%{_libdir}/gbm/nvidia-drm_gbm.so +%ifarch x86_64 +%dir %{_libdir}/nvidia +%dir %{_libdir}/nvidia/wine +%{_libdir}/nvidia/wine/*.dll +%endif +%{_libdir}/xorg/modules/extensions/libglxserver_nvidia.so +%{_libdir}/xorg/modules/drivers/nvidia_drv.so +%{_libdir}/vdpau/*.so.* +%if (%{pkg_main_ver} >= 550) || (%{pkg_main_ver} < 550 && "%{_arch}" == "x86_64") +%{_datadir}/dbus-1/system.d/nvidia-dbus.conf +%endif +%{_datadir}/nvidia/ +%{_datadir}/pixmaps/com.nvidia.driver.png +%{_datadir}/glvnd/egl_vendor.d/10_nvidia.json +%if %{pkg_main_ver} >= 560 +%{_datadir}/vulkan/icd.d/nvidia_icd.%{_target_cpu}.json +%endif +%{_datadir}/vulkan/implicit_layer.d/nvidia_layers.json +%ifarch x86_64 +%if %{pkg_main_ver} >= 560 +%{_datadir}/vulkansc/icd.d/nvidia_icd.%{_target_cpu}.json +%endif +%endif +%{_prefix}/lib/nvidia/alternate-install-present +%{_systemd_util_dir}/system-preset/70-nvidia-driver.preset +%{_systemd_util_dir}/system-preset/70-nvidia-driver-cuda.preset +%{_systemd_util_dir}/system-sleep/nvidia +%{_unitdir}/nvidia-*.service +%{_metainfodir}/com.nvidia.driver.metainfo.xml +%config(noreplace) %{_sysconfdir}/X11/xorg.conf.d/10-nvidia.conf +%{_sysconfdir}/OpenCL/vendors/* +%{_mandir}/man1/ +%{_sysconfdir}/modprobe.d/nvidia-profiling.conf + +%files -n %{pkg_name} +%license LICENSE +%doc NVIDIA_Changelog README.txt html supported-gpus/supported-gpus.json + +%files -n %{pkg_open_name} +%license LICENSE +%doc NVIDIA_Changelog README.txt html supported-gpus/supported-gpus.json + +%files -n %{kmod_pkg_name} +%{_usrsrc}/nvidia-%{version}/ +# kmod-common +%{_prefix}/lib/dracut/dracut.conf.d/99-nvidia.conf +%{_modprobedir}/nvidia.conf +%{_prefix}/lib/firmware/nvidia/%{version} +%{_sbindir}/nvidia-boot-update +%config %{_sysconfdir}/modprobe.d/nvidia-modeset.conf +%{_udevrulesdir}/60-nvidia.rules + +%files -n %{kmod_open_pkg_name} +%{_usrsrc}/nvidia-open-%{version}/ +# kmod-common +%{_prefix}/lib/dracut/dracut.conf.d/99-nvidia.conf +%{_modprobedir}/nvidia.conf +%{_prefix}/lib/firmware/nvidia/%{version} +%{_sbindir}/nvidia-boot-update +%config %{_sysconfdir}/modprobe.d/nvidia-modeset.conf +%{_udevrulesdir}/60-nvidia.rules + +%files -n nvidia + +%files -n nvidia-driver + +%files -n nvidia-driver-open + +%files -n kmod-nvidia-latest-dkms + +%files -n kmod-nvidia-latest-dkms-open + + + +%changelog +* Tue Apr 28 2026 shouhuanxiaoji <345865759@163.com> - 595.58.03-1 +- Update driver version to 595.58.03. \ No newline at end of file diff --git a/nvidia-boot-update b/nvidia-boot-update new file mode 100644 index 0000000..327fb5d --- /dev/null +++ b/nvidia-boot-update @@ -0,0 +1,163 @@ +#!/usr/bin/sh + + +# Complete use case coverage, regardless of boot loaders: +# +# - update options in /etc/default/grub +# - regenerate grub.cfg/grubenv +# - update options in /boot/{efi/}loader/entries/*.conf entries +# - update options in /etc/kernel/cmdline +# - cover both UEFI and BIOS case + +CMDLINE_ARGS_NVIDIA="rd.driver.blacklist=nouveau" +CMDLINE_ARGS_ALWAYS_REMOVE="nomodeset gfxpayload=vga=normal nouveau.modeset=0 nvidia-drm.modeset=1 nvidia-drm.fbdev=1 modprobe.blacklist=nouveau initcall_blacklist=simpledrm_platform_driver_init" + +print_usage() { +cat <> /etc/default/grub + else + for param in $CMDLINE_ARGS_NVIDIA; do + echo ${GRUB_CMDLINE_LINUX} | grep -q $param + [ $? -eq 1 ] && GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} ${param}" + done + for param in $CMDLINE_ARGS_ALWAYS_REMOVE; do + echo ${GRUB_CMDLINE_LINUX} | grep -q $param + [ $? -eq 0 ] && GRUB_CMDLINE_LINUX="$(echo ${GRUB_CMDLINE_LINUX} | sed -e "s/ $param//g")" + done + sed -i -e "s|^GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX=\"${GRUB_CMDLINE_LINUX}\"|g" /etc/default/grub + fi + + grub2-mkconfig -o $GRUB_CFG &>/dev/null + + fi + + # Edit BootLoaderSpec entries + if [ -v BLS_ENTRIES ]; then + + for config_file in $BLS_ENTRIES/*.conf; do + for param in $CMDLINE_ARGS_NVIDIA; do + grep -q $param $config_file + [ $? -eq 1 ] && sed -i -e "s|^options.*|& $param|" $config_file + done + for param in $CMDLINE_ARGS_ALWAYS_REMOVE; do + grep -q $param $config_file + [ $? -eq 0 ] && sed -i -e "s| $param||" $config_file + done + done + + fi + + # Edit /etc/kernel/cmdline + for param in $CMDLINE_ARGS_NVIDIA; do + grep -q $param /etc/kernel/cmdline + [ $? -eq 1 ] && sed -i -e "s|^.*|& $param|" /etc/kernel/cmdline + done + for param in $CMDLINE_ARGS_ALWAYS_REMOVE; do + grep -q $param /etc/kernel/cmdline + [ $? -eq 0 ] && sed -i -e "s| $param||" /etc/kernel/cmdline + done + +} + +preun() { + + # Edit GRUB configuration file + if [ -v GRUB_CFG ]; then + + for param in $CMDLINE_ARGS_NVIDIA; do + echo ${GRUB_CMDLINE_LINUX} | grep -q $param + [ $? -eq 0 ] && GRUB_CMDLINE_LINUX="$(echo ${GRUB_CMDLINE_LINUX} | sed -e "s/ $param//g")" + done + sed -i -e "s|^GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX=\"${GRUB_CMDLINE_LINUX}\"|g" /etc/default/grub + + grub2-mkconfig -o $GRUB_CFG &>/dev/null + + fi + + # Edit BootLoaderSpec entries + if [ -v BLS_ENTRIES ]; then + + for config_file in $BLS_ENTRIES/*.conf; do + for param in $CMDLINE_ARGS_NVIDIA; do + grep -q $param $config_file + [ $? -eq 0 ] && sed -i -e "s| $param||" $config_file + done + done + + fi + + # Edit /etc/kernel/cmdline + for param in $CMDLINE_ARGS_NVIDIA; do + grep -q $param /etc/kernel/cmdline + [ $? -eq 0 ] && sed -i -e "s| $param||" /etc/kernel/cmdline + done + +} + +case "$1" in + post) + check + post + exit 0 + ;; + preun) + check + preun + exit 0 + ;; + *) + print_usage + exit 0 + ;; +esac diff --git a/nvidia-modeset.conf b/nvidia-modeset.conf new file mode 100644 index 0000000..8645dab --- /dev/null +++ b/nvidia-modeset.conf @@ -0,0 +1,4 @@ +# Nvidia modesetting support. Set to 0 or comment to disable kernel modesetting +# and framebuffer console support. This must be disabled in case of Mosaic or SLI. + +options nvidia-drm modeset=1 diff --git a/nvidia-persistenced.service b/nvidia-persistenced.service new file mode 100644 index 0000000..8a461ed --- /dev/null +++ b/nvidia-persistenced.service @@ -0,0 +1,14 @@ +[Unit] +Description=NVIDIA Persistence Daemon +After=syslog.target + +[Service] +Type=forking +PIDFile=/var/run/nvidia-persistenced/nvidia-persistenced.pid +Restart=always +ExecStart=/usr/bin/nvidia-persistenced --verbose +ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced/* +TimeoutSec=300 + +[Install] +WantedBy=multi-user.target diff --git a/nvidia-profiling.conf b/nvidia-profiling.conf new file mode 100644 index 0000000..acf5fa4 --- /dev/null +++ b/nvidia-profiling.conf @@ -0,0 +1 @@ +options nvidia NVreg_RestrictProfilingToAdminUsers=0 diff --git a/nvidia.conf b/nvidia.conf new file mode 100644 index 0000000..788e698 --- /dev/null +++ b/nvidia.conf @@ -0,0 +1,24 @@ +# Nouveau must be blacklisted here as well beside from the initrd to avoid a +# delayed loading (for example on Optimus laptops where the Nvidia card is not +# driving the main display). + +blacklist nouveau + +# Add soft dependencies for extra modules as adding the module loading to +# /usr/lib/modules-load.d/*.conf for systemd consumption, makes the +# configuration file to be added to the initrd but not the module, throwing an +# error on plymouth about not being able to find the module. +# Ref: /usr/lib/dracut/modules.d/00systemd/module-setup.sh + +# Even adding the modules is not the correct thing, as we don't want it to be +# included in the initrd, so use this configuration file to specify the +# dependency. + +softdep nvidia post: nvidia-uvm nvidia-drm + +# Enable complete power management. From: +# file:///usr/share/doc/nvidia-driver/html/powermanagement.html + +options nvidia NVreg_TemporaryFilePath=/var/tmp +options nvidia NVreg_EnableS0ixPowerManagement=1 +options nvidia NVreg_PreserveVideoMemoryAllocations=1 diff --git a/parse-supported-gpus.py b/parse-supported-gpus.py new file mode 100644 index 0000000..cb2feef --- /dev/null +++ b/parse-supported-gpus.py @@ -0,0 +1,43 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021-2024 Simone Caronni +# Licensed under the GNU General Public License Version or later + +import json +import sys +import xml.etree.ElementTree as ElementTree + +def main(): + if len(sys.argv) != 3: + print("usage: %s supported-gpus.json com.nvidia.driver.metainfo.xml" % sys.argv[0]) + return 1 + + json_input = open(sys.argv[1]) + gpus_raw = json.load(json_input) + legacy = 'legacybranch' + devids = [] + + for product in gpus_raw["chips"]: + + if legacy not in product.keys(): + + devid = int(product["devid"], 16) + if not devid in devids: + devids.append(devid) + + appstream_xml = ElementTree.parse(sys.argv[2]) + root = appstream_xml.getroot() + provides = ElementTree.Element('provides') + root.append(provides) + + for devid in devids: + modalias = ElementTree.SubElement(provides, "modalias") + modalias.text = "pci:v000010DEd%08Xsv*sd*bc*sc*i*" % (devid) + + ElementTree.indent(root, space=" ", level=0) + # appstream-util validate requires the xml header + appstream_xml.write(sys.argv[2], encoding="utf-8", xml_declaration=True) + +if __name__ == "__main__": + main() diff --git a/sources b/sources new file mode 100644 index 0000000..3516a83 --- /dev/null +++ b/sources @@ -0,0 +1,3 @@ +SHA512 (NVIDIA-Linux-aarch64-595.58.03.run) = 4dd1544019df01bbb6e7640aeab32b32801e45f36604eee4143992c3b1710960927d55f05ee831058c4a8af861f698c450f7d2f93077fcb652b48f53743acd2b +SHA512 (NVIDIA-Linux-x86_64-595.58.03.run) = d38e184805230ab1dc7065c49814d92c7033cf0e078e2cec919baef05d8ea297d061fb45a8fec608e7b2823f756568df3cbe1b08d75e8581c55a380413018499 +SHA512 (595.58.03.tar.gz) = a422b6935209d590f57fa6766f59bb207d9130f8a6777af9245c4ff8cd0f4c4ccef4602a0b26d543e1e8efba24241180992fdb749ea4e5d2aa5218a584b85101 -- Gitee From d215660c40714896173a2b99f1cc469f7ccdcdfc Mon Sep 17 00:00:00 2001 From: yugozhang Date: Wed, 29 Apr 2026 20:32:11 +0800 Subject: [PATCH 2/3] type and desc --- nvidia-595.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nvidia-595.spec b/nvidia-595.spec index 8ab94b7..04c16de 100644 --- a/nvidia-595.spec +++ b/nvidia-595.spec @@ -726,5 +726,6 @@ fi ||: %changelog -* Tue Apr 28 2026 shouhuanxiaoji <345865759@163.com> - 595.58.03-1 -- Update driver version to 595.58.03. \ No newline at end of file +* Tue Apr 28 2026 shouhuanxiaoji <345865759@163.com> - 3:595.58.03-1 +- [Type] sync +- [DESC] Update driver version to 595.58.03. \ No newline at end of file -- Gitee From 68b1320f20f458ef92f6d0b86b5db4cbef2b55e9 Mon Sep 17 00:00:00 2001 From: yugozhang Date: Thu, 30 Apr 2026 23:10:57 +0800 Subject: [PATCH 3/3] fix some errors --- nvidia-595.spec | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/nvidia-595.spec b/nvidia-595.spec index 04c16de..6074669 100644 --- a/nvidia-595.spec +++ b/nvidia-595.spec @@ -278,7 +278,7 @@ rmdir nvidia-tmp %if 0%{?tencentos} == 3 || 0%{?opencloudos} == 8 rm -f libnvidia-pkcs11-openssl3.so.* %else -rm -f rm -f libnvidia-pkcs11.so.* +rm -f libnvidia-pkcs11.so.* %endif %endif @@ -384,7 +384,7 @@ for file in nvidia-{debugdump,smi,cuda-mps-control,cuda-mps-server,bug-report.sh cp -pv "$file" "%{buildroot}%{_bindir}/" && chmod 0755 "%{buildroot}%{_bindir}/$file" else - echo "Warnning:file $file is not existing, skip it" >&2 + echo "Warning: file $file is not existing, skip it" >&2 fi done @@ -576,8 +576,7 @@ if grep -q "module.sig_enforce=1" /proc/cmdline || grep "CONFIG_MODULE_SIG_FORCE export mok_certificate=/usr/share/doc/kernel-keys/$(uname -r)/signing_key.x509 export sign_file=/usr/bin/sign-file-nvidia-driver else - echo "❌ module.sig_enforce is disabled" - dkms will not sign kernel module + echo "❌ module.sig_enforce is disabled, dkms will not sign kernel module" fi %endif dkms remove -m nvidia-open -q --all || : @@ -617,11 +616,10 @@ if grep -q "module.sig_enforce=1" /proc/cmdline || grep "CONFIG_MODULE_SIG_FORCE export mok_certificate=/usr/share/doc/kernel-keys/$(uname -r)/signing_key.x509 export sign_file=/usr/bin/sign-file-nvidia-driver else - echo "❌ module.sig_enforce is disabled" - dkms will not sign kernel module + echo "❌ module.sig_enforce is disabled, dkms will not sign kernel module" fi %endif -dkms remove -m nvidia -q --all +dkms remove -m nvidia -q --all || : dkms add -m nvidia-open -v %{version} # Rebuild and make available for the currently running kernel dkms build -m nvidia-open -v %{version} @@ -631,7 +629,7 @@ dkms install -m nvidia-open -v %{version} --force %preun -n %{kmod_open_pkg_name} # Remove all versions from DKMS registry -dkms remove -m nvidia-open -v %{version} -q --all +dkms remove -m nvidia-open -v %{version} -q --all || : # cannot remove nvidia_uvm.ko by default modprobe -r nvidia_uvm || true find /lib/modules/$(uname -r) -name "nvidia_uvm.ko*" -delete || true -- Gitee