Skip to content

Commit

Permalink
nvidia: Refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Jung <[email protected]>
  • Loading branch information
ptr1337 committed Sep 27, 2024
1 parent 93d051f commit 3ff0ac1
Show file tree
Hide file tree
Showing 11 changed files with 223 additions and 165 deletions.
27 changes: 15 additions & 12 deletions linux-cachyos-bmq/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ fi
# NVIDIA pre-build module support
if [ -n "$_build_nvidia" ]; then
source+=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${_nv_ver}/${_nv_pkg}.run"
"${_patchsource}/misc/nvidia/make-modeset-fbdev-default.patch"
"${_patchsource}/misc/nvidia/6.11-fbdev.patch")
"${_patchsource}/misc/nvidia/0001-Make-modeset-and-fbdev-default-enabled.patch"
"${_patchsource}/misc/nvidia/0004-6.11-Add-fix-for-fbdev.patch")
fi

if [ -n "$_build_nvidia_open" ]; then
Expand Down Expand Up @@ -271,10 +271,11 @@ prepare() {
src="${src%%::*}"
src="${src##*/}"
src="${src%.zst}"
[[ $src = make-modeset-fbdev-default.patch ]] && continue
[[ $src = nvidia-open-gcc-ibt-sls.patch ]] && continue
[[ $src = fix-zen5.patch ]] && continue
[[ $src = 6.11-fbdev.patch ]] && continue
[[ $src = 0001-Make-modeset-and-fbdev-default-enabled.patch ]] && continue
[[ $src = 0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch ]] && continue
[[ $src = 0003-Add-IBT-Support.patch ]] && continue
[[ $src = 0004-6.11-Add-fix-for-fbdev.patch ]] && continue
[[ $src = 0005-6.12-drm_outpull_pill-changed-check.patch ]] && continue
[[ $src = *.patch ]] || continue
echo "Applying patch $src..."
patch -Np1 < "../$src"
Expand Down Expand Up @@ -518,19 +519,21 @@ prepare() {
sh "${_nv_pkg}.run" --extract-only

# Use fbdev and modeset as default
patch -Np1 -i "${srcdir}/make-modeset-fbdev-default.patch" -d "${srcdir}/${_nv_pkg}/kernel"
patch -Np1 -i "${srcdir}/0001-Make-modeset-and-fbdev-default-enabled.patch" -d "${srcdir}/${_nv_pkg}/kernel"
# Fix broken fbdev on 6.11
patch -Np2 -i "${srcdir}/6.11-fbdev.patch" -d "${srcdir}/${_nv_pkg}/kernel"
patch -Np2 -i "${srcdir}/0004-6.11-Add-fix-for-fbdev.patch" -d "${srcdir}/${_nv_pkg}/kernel"
fi

if [ -n "$_build_nvidia_open" ]; then
patch -Np1 -i "${srcdir}/make-modeset-fbdev-default.patch" -d "${srcdir}/${_nv_open_pkg}/kernel-open"
patch -Np1 -i "${srcdir}/0001-Make-modeset-and-fbdev-default-enabled.patch" -d "${srcdir}/${_nv_open_pkg}/kernel-open"
# Fix for https://bugs.archlinux.org/task/74886
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/nvidia-open-gcc-ibt-sls.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0003-Add-IBT-Support.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix for Zen5 error print in dmesg
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/fix-zen5.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix broken fbdev on 6.11
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/6.11-fbdev.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0004-6.11-Add-fix-for-fbdev.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix for 6.12 Module Compilation
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0005-6.12-drm_outpull_pill-changed-check.patch" -d "${srcdir}/${_nv_open_pkg}"
fi
}

Expand Down
36 changes: 20 additions & 16 deletions linux-cachyos-bore/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,17 @@ fi
# NVIDIA pre-build module support
if [ -n "$_build_nvidia" ]; then
source+=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${_nv_ver}/${_nv_pkg}.run"
"${_patchsource}/misc/nvidia/make-modeset-fbdev-default.patch"
"${_patchsource}/misc/nvidia/6.11-fbdev.patch")
"${_patchsource}/misc/nvidia/0001-Make-modeset-and-fbdev-default-enabled.patch"
"${_patchsource}/misc/nvidia/0004-6.11-Add-fix-for-fbdev.patch")
fi

if [ -n "$_build_nvidia_open" ]; then
source+=("nvidia-open-${_nv_ver}.tar.gz::https://github.com/NVIDIA/open-gpu-kernel-modules/archive/refs/tags/${_nv_ver}.tar.gz"
"${_patchsource}/misc/nvidia/make-modeset-fbdev-default.patch"
"${_patchsource}/misc/nvidia/nvidia-open-gcc-ibt-sls.patch"
"${_patchsource}/misc/nvidia/fix-zen5.patch"
"${_patchsource}/misc/nvidia/6.11-fbdev.patch")
"${_patchsource}/misc/nvidia/0001-Make-modeset-and-fbdev-default-enabled.patch"
"${_patchsource}/misc/nvidia/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch"
"${_patchsource}/misc/nvidia/0003-Add-IBT-Support.patch"
"${_patchsource}/misc/nvidia/0004-6.11-Add-fix-for-fbdev.patch"
"${_patchsource}/misc/nvidia/0005-6.12-drm_outpull_pill-changed-check.patch")
fi

## List of CachyOS schedulers
Expand Down Expand Up @@ -271,10 +272,11 @@ prepare() {
src="${src%%::*}"
src="${src##*/}"
src="${src%.zst}"
[[ $src = make-modeset-fbdev-default.patch ]] && continue
[[ $src = nvidia-open-gcc-ibt-sls.patch ]] && continue
[[ $src = fix-zen5.patch ]] && continue
[[ $src = 6.11-fbdev.patch ]] && continue
[[ $src = 0001-Make-modeset-and-fbdev-default-enabled.patch ]] && continue
[[ $src = 0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch ]] && continue
[[ $src = 0003-Add-IBT-Support.patch ]] && continue
[[ $src = 0004-6.11-Add-fix-for-fbdev.patch ]] && continue
[[ $src = 0005-6.12-drm_outpull_pill-changed-check.patch ]] && continue
[[ $src = *.patch ]] || continue
echo "Applying patch $src..."
patch -Np1 < "../$src"
Expand Down Expand Up @@ -518,19 +520,21 @@ prepare() {
sh "${_nv_pkg}.run" --extract-only

# Use fbdev and modeset as default
patch -Np1 -i "${srcdir}/make-modeset-fbdev-default.patch" -d "${srcdir}/${_nv_pkg}/kernel"
patch -Np1 -i "${srcdir}/0001-Make-modeset-and-fbdev-default-enabled.patch" -d "${srcdir}/${_nv_pkg}/kernel"
# Fix broken fbdev on 6.11
patch -Np2 -i "${srcdir}/6.11-fbdev.patch" -d "${srcdir}/${_nv_pkg}/kernel"
patch -Np2 -i "${srcdir}/0004-6.11-Add-fix-for-fbdev.patch" -d "${srcdir}/${_nv_pkg}/kernel"
fi

if [ -n "$_build_nvidia_open" ]; then
patch -Np1 -i "${srcdir}/make-modeset-fbdev-default.patch" -d "${srcdir}/${_nv_open_pkg}/kernel-open"
patch -Np1 -i "${srcdir}/0001-Make-modeset-and-fbdev-default-enabled.patch" -d "${srcdir}/${_nv_open_pkg}/kernel-open"
# Fix for https://bugs.archlinux.org/task/74886
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/nvidia-open-gcc-ibt-sls.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0003-Add-IBT-Support.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix for Zen5 error print in dmesg
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/fix-zen5.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix broken fbdev on 6.11
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/6.11-fbdev.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0004-6.11-Add-fix-for-fbdev.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix for 6.12 Module Compilation
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0005-6.12-drm_outpull_pill-changed-check.patch" -d "${srcdir}/${_nv_open_pkg}"
fi
}

Expand Down
43 changes: 24 additions & 19 deletions linux-cachyos-deckify/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ _cachy_config=${_cachy_config-y}
### Selecting the CPU scheduler
# ATTENTION - only one of the following values can be selected:
# 'bore' - select 'Burst-Oriented Response Enhancer'
# 'bmq' - select 'BMQ Scheduler'
# 'hardened' - select 'BORE Scheduler hardened' ## kernel with hardened config and hardening patches with the bore scheduler
# 'cachyos' - select 'Sched-Ext Scheduler Framework Variant Scheduler with BORE Scheduler'
# 'eevdf' - select 'EEVDF Scheduler'
Expand Down Expand Up @@ -219,16 +220,17 @@ fi
# NVIDIA pre-build module support
if [ -n "$_build_nvidia" ]; then
source+=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${_nv_ver}/${_nv_pkg}.run"
"${_patchsource}/misc/nvidia/make-modeset-fbdev-default.patch"
"${_patchsource}/misc/nvidia/6.11-fbdev.patch")
"${_patchsource}/misc/nvidia/0001-Make-modeset-and-fbdev-default-enabled.patch"
"${_patchsource}/misc/nvidia/0004-6.11-Add-fix-for-fbdev.patch")
fi

if [ -n "$_build_nvidia_open" ]; then
source+=("nvidia-open-${_nv_ver}.tar.gz::https://github.com/NVIDIA/open-gpu-kernel-modules/archive/refs/tags/${_nv_ver}.tar.gz"
"${_patchsource}/misc/nvidia/make-modeset-fbdev-default.patch"
"${_patchsource}/misc/nvidia/nvidia-open-gcc-ibt-sls.patch"
"${_patchsource}/misc/nvidia/fix-zen5.patch"
"${_patchsource}/misc/nvidia/6.11-fbdev.patch")
"${_patchsource}/misc/nvidia/0001-Make-modeset-and-fbdev-default-enabled.patch"
"${_patchsource}/misc/nvidia/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch"
"${_patchsource}/misc/nvidia/0003-Add-IBT-Support.patch"
"${_patchsource}/misc/nvidia/0004-6.11-Add-fix-for-fbdev.patch"
"${_patchsource}/misc/nvidia/0005-6.12-drm_outpull_pill-changed-check.patch")
fi

## List of CachyOS schedulers
Expand All @@ -238,8 +240,8 @@ case "$_cpusched" in
"${_patchsource}/sched/0001-bore-cachy-ext.patch");;
bore) ## BORE Scheduler
source+=("${_patchsource}/sched/0001-bore-cachy.patch");;
echo) ## ECHO Scheduler
source+=("${_patchsource}/sched/0001-echo-cachy.patch");;
bmq) ## Project C Scheduler
source+=("${_patchsource}/sched/0001-prjc-cachy.patch");;
eevdf) ## 6.12 EEVDF patches
source+=("${_patchsource}/sched/0001-eevdf-next.patch");;
rt) ## EEVDF with RT patches
Expand Down Expand Up @@ -274,10 +276,11 @@ prepare() {
src="${src%%::*}"
src="${src##*/}"
src="${src%.zst}"
[[ $src = make-modeset-fbdev-default.patch ]] && continue
[[ $src = nvidia-open-gcc-ibt-sls.patch ]] && continue
[[ $src = fix-zen5.patch ]] && continue
[[ $src = 6.11-fbdev.patch ]] && continue
[[ $src = 0001-Make-modeset-and-fbdev-default-enabled.patch ]] && continue
[[ $src = 0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch ]] && continue
[[ $src = 0003-Add-IBT-Support.patch ]] && continue
[[ $src = 0004-6.11-Add-fix-for-fbdev.patch ]] && continue
[[ $src = 0005-6.12-drm_outpull_pill-changed-check.patch ]] && continue
[[ $src = *.patch ]] || continue
echo "Applying patch $src..."
patch -Np1 < "../$src"
Expand Down Expand Up @@ -318,7 +321,7 @@ prepare() {
case "$_cpusched" in
cachyos) scripts/config -e SCHED_CLASS_EXT -e SCHED_BORE --set-val MIN_BASE_SLICE_NS 1000000;;
bore|hardened) scripts/config -e SCHED_BORE --set-val MIN_BASE_SLICE_NS 1000000;;
echo) scripts/config -e ECHO_SCHED;;
bmq) scripts/config -e SCHED_ALT -e SCHED_BMQ;;
eevdf) ;;
rt) scripts/config -e PREEMPT_COUNT -e PREEMPTION -d PREEMPT_VOLUNTARY -d PREEMPT -d PREEMPT_NONE -d PREEMPT_RT -d PREEMPT_DYNAMIC -e PREEMPT_BUILD -e PREEMPT_BUILD_AUTO -e PREEMPT_AUTO;;
rt-bore) scripts/config -e SCHED_BORE --set-val MIN_BASE_SLICE_NS 1000000 -e PREEMPT_COUNT -e PREEMPTION -d PREEMPT_VOLUNTARY -d PREEMPT -d PREEMPT_NONE -d PREEMPT_RT -d PREEMPT_DYNAMIC -e PREEMPT_BUILD -e PREEMPT_BUILD_AUTO -e PREEMPT_AUTO;;
Expand Down Expand Up @@ -521,19 +524,21 @@ prepare() {
sh "${_nv_pkg}.run" --extract-only

# Use fbdev and modeset as default
patch -Np1 -i "${srcdir}/make-modeset-fbdev-default.patch" -d "${srcdir}/${_nv_pkg}/kernel"
patch -Np1 -i "${srcdir}/0001-Make-modeset-and-fbdev-default-enabled.patch" -d "${srcdir}/${_nv_pkg}/kernel"
# Fix broken fbdev on 6.11
patch -Np2 -i "${srcdir}/6.11-fbdev.patch" -d "${srcdir}/${_nv_pkg}/kernel"
patch -Np2 -i "${srcdir}/0004-6.11-Add-fix-for-fbdev.patch" -d "${srcdir}/${_nv_pkg}/kernel"
fi

if [ -n "$_build_nvidia_open" ]; then
patch -Np1 -i "${srcdir}/make-modeset-fbdev-default.patch" -d "${srcdir}/${_nv_open_pkg}/kernel-open"
patch -Np1 -i "${srcdir}/0001-Make-modeset-and-fbdev-default-enabled.patch" -d "${srcdir}/${_nv_open_pkg}/kernel-open"
# Fix for https://bugs.archlinux.org/task/74886
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/nvidia-open-gcc-ibt-sls.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0003-Add-IBT-Support.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix for Zen5 error print in dmesg
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/fix-zen5.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix broken fbdev on 6.11
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/6.11-fbdev.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0004-6.11-Add-fix-for-fbdev.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix for 6.12 Module Compilation
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0005-6.12-drm_outpull_pill-changed-check.patch" -d "${srcdir}/${_nv_open_pkg}"
fi
}

Expand Down
36 changes: 20 additions & 16 deletions linux-cachyos-eevdf/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,17 @@ fi
# NVIDIA pre-build module support
if [ -n "$_build_nvidia" ]; then
source+=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${_nv_ver}/${_nv_pkg}.run"
"${_patchsource}/misc/nvidia/make-modeset-fbdev-default.patch"
"${_patchsource}/misc/nvidia/6.11-fbdev.patch")
"${_patchsource}/misc/nvidia/0001-Make-modeset-and-fbdev-default-enabled.patch"
"${_patchsource}/misc/nvidia/0004-6.11-Add-fix-for-fbdev.patch")
fi

if [ -n "$_build_nvidia_open" ]; then
source+=("nvidia-open-${_nv_ver}.tar.gz::https://github.com/NVIDIA/open-gpu-kernel-modules/archive/refs/tags/${_nv_ver}.tar.gz"
"${_patchsource}/misc/nvidia/make-modeset-fbdev-default.patch"
"${_patchsource}/misc/nvidia/nvidia-open-gcc-ibt-sls.patch"
"${_patchsource}/misc/nvidia/fix-zen5.patch"
"${_patchsource}/misc/nvidia/6.11-fbdev.patch")
"${_patchsource}/misc/nvidia/0001-Make-modeset-and-fbdev-default-enabled.patch"
"${_patchsource}/misc/nvidia/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch"
"${_patchsource}/misc/nvidia/0003-Add-IBT-Support.patch"
"${_patchsource}/misc/nvidia/0004-6.11-Add-fix-for-fbdev.patch"
"${_patchsource}/misc/nvidia/0005-6.12-drm_outpull_pill-changed-check.patch")
fi

## List of CachyOS schedulers
Expand Down Expand Up @@ -271,10 +272,11 @@ prepare() {
src="${src%%::*}"
src="${src##*/}"
src="${src%.zst}"
[[ $src = make-modeset-fbdev-default.patch ]] && continue
[[ $src = nvidia-open-gcc-ibt-sls.patch ]] && continue
[[ $src = fix-zen5.patch ]] && continue
[[ $src = 6.11-fbdev.patch ]] && continue
[[ $src = 0001-Make-modeset-and-fbdev-default-enabled.patch ]] && continue
[[ $src = 0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch ]] && continue
[[ $src = 0003-Add-IBT-Support.patch ]] && continue
[[ $src = 0004-6.11-Add-fix-for-fbdev.patch ]] && continue
[[ $src = 0005-6.12-drm_outpull_pill-changed-check.patch ]] && continue
[[ $src = *.patch ]] || continue
echo "Applying patch $src..."
patch -Np1 < "../$src"
Expand Down Expand Up @@ -518,19 +520,21 @@ prepare() {
sh "${_nv_pkg}.run" --extract-only

# Use fbdev and modeset as default
patch -Np1 -i "${srcdir}/make-modeset-fbdev-default.patch" -d "${srcdir}/${_nv_pkg}/kernel"
patch -Np1 -i "${srcdir}/0001-Make-modeset-and-fbdev-default-enabled.patch" -d "${srcdir}/${_nv_pkg}/kernel"
# Fix broken fbdev on 6.11
patch -Np2 -i "${srcdir}/6.11-fbdev.patch" -d "${srcdir}/${_nv_pkg}/kernel"
patch -Np2 -i "${srcdir}/0004-6.11-Add-fix-for-fbdev.patch" -d "${srcdir}/${_nv_pkg}/kernel"
fi

if [ -n "$_build_nvidia_open" ]; then
patch -Np1 -i "${srcdir}/make-modeset-fbdev-default.patch" -d "${srcdir}/${_nv_open_pkg}/kernel-open"
patch -Np1 -i "${srcdir}/0001-Make-modeset-and-fbdev-default-enabled.patch" -d "${srcdir}/${_nv_open_pkg}/kernel-open"
# Fix for https://bugs.archlinux.org/task/74886
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/nvidia-open-gcc-ibt-sls.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0003-Add-IBT-Support.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix for Zen5 error print in dmesg
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/fix-zen5.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix broken fbdev on 6.11
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/6.11-fbdev.patch" -d "${srcdir}/${_nv_open_pkg}"
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0004-6.11-Add-fix-for-fbdev.patch" -d "${srcdir}/${_nv_open_pkg}"
# Fix for 6.12 Module Compilation
patch -Np1 --no-backup-if-mismatch -i "${srcdir}/0005-6.12-drm_outpull_pill-changed-check.patch" -d "${srcdir}/${_nv_open_pkg}"
fi
}

Expand Down
Loading

0 comments on commit 3ff0ac1

Please sign in to comment.