2024-10-22 17:05:20 +02:00
|
|
|
#! /usr/bin/make -f
|
|
|
|
|
|
|
|
## See debhelper(7) (uncomment to enable).
|
|
|
|
## Output every command that modifies files on the build system.
|
|
|
|
export DH_VERBOSE = 1
|
|
|
|
export PIKA_BUILD_ARCH = $(shell cat ../pika-build-arch)
|
|
|
|
|
|
|
|
override_dh_prep:
|
|
|
|
# amd64 build prep
|
|
|
|
ifeq (amd64,$(DEB_HOST_ARCH))
|
|
|
|
# Extract nvidia files from run archive
|
|
|
|
./nvidia-installer.run --extract-only
|
|
|
|
mkdir -p debian/tmp
|
|
|
|
# Copy installer contents into debian temp dir
|
|
|
|
cp -rf ./NVIDIA-Linux-*/* debian/tmp
|
|
|
|
# Delete 32 libs on amd64 builds
|
|
|
|
rm -rf debian/tmp/32
|
|
|
|
# Extract all manpages
|
|
|
|
gunzip debian/tmp/*.1.gz -k
|
2025-01-20 13:45:45 +00:00
|
|
|
|
|
|
|
# Enable modeset and fbdev as default
|
2025-01-20 13:47:49 +00:00
|
|
|
# This avoids various issue, when Simplefb is used
|
|
|
|
# https://gitlab.archlinux.org/archlinux/packaging/packages/nvidia-utils/-/issues/14
|
|
|
|
# https://github.com/rpmfusion/nvidia-kmod/blob/master/make_modeset_default.patch
|
2025-01-20 15:02:24 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0001-Make-modeset-and-fbdev-default-enabled.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0001-Make-modeset-and-fbdev-default-enabled.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Dont error, when Zen5 CPU is in the system
|
2025-01-20 15:02:24 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Fix for https://bugs.archlinux.org/task/74886
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0003-Add-IBT-support.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0003-Add-IBT-support.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Patch by Nvidia to silence error messages until a real fix drops in 570.xx
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/716#issuecomment-2391898884
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0004-silence-event-assert-until-570.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0004-silence-event-assert-until-570.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Patch by Nvidia to fix HDMI names which are otherwise broken in the /proc/asound/NVidia/* ELD files
|
|
|
|
# Should hopefully ship with 570.xx
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/pull/715
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0005-nvkms-Sanitize-trim-ELD-product-name-strings.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0005-nvkms-Sanitize-trim-ELD-product-name-strings.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Fix build errors on 6.13+
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/746
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0006-crypto-Add-fix-for-6.13-Module-compilation.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0006-crypto-Add-fix-for-6.13-Module-compilation.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/751
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0007-nvidia-nv-Convert-symbol-namespace-to-string-literal.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0007-nvidia-nv-Convert-symbol-namespace-to-string-literal.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/747
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0008-Kbuild-Use-absolute-paths-for-symbolic-links.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0008-Kbuild-Use-absolute-paths-for-symbolic-links.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Fixes fbdev on 6.13+
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/749
|
|
|
|
# https://gist.github.com/xtexChooser/da92d9df902788b75f746f348552ae80
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0009-FROM-AOSC-Use-linux-aperture.c-for-removing-conflict.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0009-FROM-AOSC-Use-linux-aperture.c-for-removing-conflict.patch -d $(CURDIR)/debian/tmp/kernel-open
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0010-FROM-AOSC-TTM-fbdev-emulation-for-Linux-6.13.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0010-FROM-AOSC-TTM-fbdev-emulation-for-Linux-6.13.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:45:45 +00:00
|
|
|
|
2024-10-22 19:43:38 +03:00
|
|
|
# NVENC/NvFBC
|
2024-12-05 21:01:37 +03:00
|
|
|
sed -i 's/\xe8\x35\x3e\xfe\xff\x85\xc0\x41\x89\xc4/\xe8\x35\x3e\xfe\xff\x29\xc0\x41\x89\xc4/g' "debian/tmp/libnvidia-encode.so.565.77"
|
|
|
|
sed -i 's/\x85\xc0\x0f\x84\x9b\x00\x00\x00\x48/\x85\xc0\x90\x90\x90\x90\x90\x90\x48/g' "debian/tmp/libnvidia-fbc.so.565.77"
|
2024-10-22 17:05:20 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
# i386 (x86) build
|
|
|
|
ifeq (i386,$(DEB_HOST_ARCH))
|
|
|
|
# Extract nvidia files from run archive
|
|
|
|
./nvidia-installer.run --extract-only
|
|
|
|
mkdir -p debian/tmp
|
|
|
|
# Copy installer contents into debian temp dir
|
|
|
|
cp -rf ./NVIDIA-Linux-*/* debian/tmp
|
2025-01-20 13:45:45 +00:00
|
|
|
|
|
|
|
# Enable modeset and fbdev as default
|
2025-01-20 13:47:49 +00:00
|
|
|
# This avoids various issue, when Simplefb is used
|
|
|
|
# https://gitlab.archlinux.org/archlinux/packaging/packages/nvidia-utils/-/issues/14
|
|
|
|
# https://github.com/rpmfusion/nvidia-kmod/blob/master/make_modeset_default.patch
|
2025-01-20 15:02:24 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0001-Make-modeset-and-fbdev-default-enabled.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0001-Make-modeset-and-fbdev-default-enabled.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Dont error, when Zen5 CPU is in the system
|
2025-01-20 15:02:24 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Fix for https://bugs.archlinux.org/task/74886
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0003-Add-IBT-support.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0003-Add-IBT-support.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Patch by Nvidia to silence error messages until a real fix drops in 570.xx
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/716#issuecomment-2391898884
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0004-silence-event-assert-until-570.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0004-silence-event-assert-until-570.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Patch by Nvidia to fix HDMI names which are otherwise broken in the /proc/asound/NVidia/* ELD files
|
|
|
|
# Should hopefully ship with 570.xx
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/pull/715
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0005-nvkms-Sanitize-trim-ELD-product-name-strings.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0005-nvkms-Sanitize-trim-ELD-product-name-strings.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Fix build errors on 6.13+
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/746
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0006-crypto-Add-fix-for-6.13-Module-compilation.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0006-crypto-Add-fix-for-6.13-Module-compilation.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/751
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0007-nvidia-nv-Convert-symbol-namespace-to-string-literal.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0007-nvidia-nv-Convert-symbol-namespace-to-string-literal.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/747
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0008-Kbuild-Use-absolute-paths-for-symbolic-links.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0008-Kbuild-Use-absolute-paths-for-symbolic-links.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:47:49 +00:00
|
|
|
|
|
|
|
# Fixes fbdev on 6.13+
|
|
|
|
# https://github.com/NVIDIA/open-gpu-kernel-modules/issues/749
|
|
|
|
# https://gist.github.com/xtexChooser/da92d9df902788b75f746f348552ae80
|
2025-01-20 14:58:41 +00:00
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0009-FROM-AOSC-Use-linux-aperture.c-for-removing-conflict.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0009-FROM-AOSC-Use-linux-aperture.c-for-removing-conflict.patch -d $(CURDIR)/debian/tmp/kernel-open
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0010-FROM-AOSC-TTM-fbdev-emulation-for-Linux-6.13.patch -d $(CURDIR)/debian/tmp/kernel
|
|
|
|
patch -Np2 -i $(CURDIR)/debian/patches/0010-FROM-AOSC-TTM-fbdev-emulation-for-Linux-6.13.patch -d $(CURDIR)/debian/tmp/kernel-open
|
2025-01-20 13:45:45 +00:00
|
|
|
|
2024-10-22 17:05:20 +02:00
|
|
|
# Replace libs with 32 bit
|
|
|
|
rm -rf debian/tmp/*.so*
|
|
|
|
cp -rf ./NVIDIA-Linux-*/32/* debian/tmp
|
|
|
|
rm -rf debian/tmp/32
|
|
|
|
endif
|
|
|
|
|
|
|
|
override_dh_shlibdeps:
|
|
|
|
dh_shlibdeps -l/usr/lib/$(DEB_HOST_MULTIARCH)/nvidia/current/:/usr/lib/nvidia/current/
|
|
|
|
|
|
|
|
%:
|
|
|
|
dh $@
|