Difficulty: ★★★★☆
In one of the threads talking about kernel 5.9 and nvidia support I was was asked if I could provide a tutorial how to patch the kernel to make nvidia opencl work again.
So here we go. The patching process is pretty simple.
First of all you need the latest linux59
build files for Manjaro:
git clone https://gitlab.manjaro.org/packages/core/linux59.git
Second you need the patch file. I have created my own patch file and it is working just fine.
999_inherit.patch
--- linux-5.9/kernel/module.c.old 2020-10-14 06:51:57.598066293 +0200
+++ linux-5.9/kernel/module.c 2020-10-14 07:58:16.504570606 +0200
@@ -1431,6 +1431,7 @@
return 0;
}
+#if 0
static bool inherit_taint(struct module *mod, struct module *owner)
{
if (!owner || !test_bit(TAINT_PROPRIETARY_MODULE, &owner->taints))
@@ -1449,6 +1450,7 @@
}
return true;
}
+#endif
/* Resolve a symbol for this module. I.e. if we find one, record usage. */
static const struct kernel_symbol *resolve_symbol(struct module *mod,
@@ -1474,6 +1476,7 @@
if (!sym)
goto unlock;
+#if 0
if (license == GPL_ONLY)
mod->using_gplonly_symbols = true;
@@ -1481,6 +1484,7 @@
sym = NULL;
goto getname;
}
+#endif
if (!check_version(info, name, mod, crc)) {
sym = ERR_PTR(-EINVAL);
I called it 999_inherit.patch
. But you can call it however you want. Place this file into the linux59
directory next to the PKGBUILD
file
Now you need to edit the PKGBUILD file to include your patch.
For that you just need to add the filename into the sources=(…). I put it as last enry to the soruces
sources = (" https://www.kernel.org/pub/linux/kernel/v5.x/linux-${_basekernel}.tar.xz"
...
'0512-bootsplash.patch'
'0513-bootsplash.gitpatch'
'999_inherit.patch')
Next you need to update the checksum.
Make sure that you are in the linux59 directory and excecute
updpkgsums
At this point you are ready to create the packages.
Just excecute
makepkg -sf
This will compile the kernel and create two packages:
linux59-5.9.0-2-x86_64.pkg.tar.xz
linux59-headers-5.9.0-2-x86_64.pkg.tar.xz
I have not changed the names of the packages. That is not best practice for customized packages but this ensures that these new packages are drop-in replacements for the official Manjaro packages. Therefore all other extramodules coming from Manjaro will work fine with this customized kernel (e.g. zfs, virtualbox, etc.)
Now you are ready to install the new kernel packages:
sudo pacman -U linux59-5.9.0-2-x86_64.pkg.tar.xz linux59-headers-5.9.0-2-x86_64.pkg.tar.xz
That is it. I have this running now since several days. No problems. darktable is using opencl with this kernel. All good.