From b02040f87ccd08292c4883f5a4d2014aa710558b Mon Sep 17 00:00:00 2001 From: Tk-Glitch Date: Thu, 16 Apr 2020 16:02:38 +0200 Subject: [PATCH] Add initial hacky kernel 5.7 patch thanks to Isaak I. Aleksandrov - https://gitlab.com/snippets/1965550 --- PKGBUILD | 29 +++++++++++++++++++++++++++-- patches/kernel-5.7.patch | 22 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 patches/kernel-5.7.patch diff --git a/PKGBUILD b/PKGBUILD index cf19040..e4b7c6d 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -143,7 +143,7 @@ fi pkgname=("${_pkgname_array[@]}") pkgver=$_driver_version -pkgrel=104 +pkgrel=105 arch=('x86_64') url="http://www.nvidia.com/" license=('custom:NVIDIA') @@ -187,6 +187,7 @@ source=($_source_name 'kernel-5.6.patch' # 5.6 workaround '5.6-legacy-includes.diff' # 5.6 includes needed for <440.59(stable) and <440.58.01(vk dev) '5.6-ioremap.diff' # 5.6 additional ioremap workaround (<440.64) + 'kernel-5.7.patch' # 5.7 workaround ) msg2 "Selected driver integrity check behavior (md5sum or SKIP): $_md5sum" # If the driver is "known", return md5sum. If it isn't, return SKIP @@ -211,7 +212,8 @@ md5sums=("$_md5sum" '1c1966d6ee6f3cd381ebcc92f1488c68' 'c44e43638e1ab708fbdd6d7aa76afcf2' '84dc2d2eff2846b2f961388b153e2a89' - '1f11f5c765e42c471b202e630e3cd407') + '1f11f5c765e42c471b202e630e3cd407' + '8b0b4fd32275a4745d55ea391f23a43e') if [ $_autoaddpatch == "true" ]; then # Auto-add *.patch files from $startdir to source=() @@ -425,6 +427,12 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf fi fi + # 5.7 + if (( $(vercmp "$_kernel" "5.7") >= 0 )); then + _kernel57="1" + _whitelist57=( 396* 410* 415* 418* 430* 435* 440* ) + fi + # Loop patches (linux-4.15.patch, lol.patch, ...) for _p in $(printf -- '%s\n' ${source[@]} | grep .patch); do # https://stackoverflow.com/a/21058239/1821548 # Patch version (4.15, "", ...) @@ -460,6 +468,9 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf if [ "$_patch" == "5.6" ]; then _whitelist=(${_whitelist56[@]}) fi + if [ "$_patch" == "5.7" ]; then + _whitelist=(${_whitelist57[@]}) + fi patchy=0 if (( $(vercmp "$_kernel" "$_patch") >= 0 )); then @@ -637,6 +648,20 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf fi fi + # 5.7 + if [ "$_kernel57" == "1" ]; then + patchy=0 + for yup in "${_whitelist57[@]}"; do + [[ $pkgver = $yup ]] && patchy=1 + done + if [ "$patchy" == "1" ]; then + msg2 "Applying kernel-5.7.patch for dkms..." + patch -Np1 -i "$srcdir"/kernel-5.7.patch + else + msg2 "Skipping kernel-5.7.patch as it doesn't apply to this driver version..." + fi + fi + # Legacy quirks if [ "$_oldstuff" == "1" ]; then msg2 "Applying 01-ipmi-vm.diff for dkms..." diff --git a/patches/kernel-5.7.patch b/patches/kernel-5.7.patch new file mode 100644 index 0000000..a6821b5 --- /dev/null +++ b/patches/kernel-5.7.patch @@ -0,0 +1,22 @@ +diff --git a/kernel/conftest.sh b/kernel/conftest.sh +index 8f807a1..af29636 100755 +--- a/kernel/conftest.sh ++++ b/kernel/conftest.sh +@@ -143,6 +143,7 @@ test_headers() { + FILES="$FILES video/nv_internal.h" + FILES="$FILES asm/book3s/64/hash-64k.h" + FILES="$FILES asm/set_memory.h" ++ FILES="$FILES asm/pgtable.h" + FILES="$FILES asm/prom.h" + FILES="$FILES asm/powernv.h" + FILES="$FILES asm/tlbflush.h" +@@ -466,6 +467,9 @@ compile_test() { + # It does not exist on all architectures. + # + CODE=" ++ #if defined(NV_ASM_PGTABLE_H_PRESENT) ++ #include ++ #endif + #if defined(NV_ASM_SET_MEMORY_H_PRESENT) + #include + #else