How to apply patch from git.kernel?
Mia Lopez
I've just installed Ubuntu 20.04 on Lenovo Legion 5 15ARH05. The touchpad doesn't work and I read on multiple forums it's a common problem.
I tried to update kernel using Ubuntu Mainline Kernel Installer GUI app to 5.10.2 but I probably need (according to ) to apply this patch:
I can't figure out how to do that. I've downloaded the compressed tar.gz file but now I'm stuck since I don't know how to do the patch.
I've tried sudo patch linux-47a0001436352c9853d72bf2071e85b316d688a2.tar.gz but that seems to do nothing (just hangs).
Do you know how to fix it? It should be fixed in the next kernel version but I can't wait.
EDIT: The touchpad works in BIOS.
EDIT: After following @dariofac's answer, it looked good but it raises error:
BTF: .tmp_vmlinux.btf: pahole version v1.15 is too old, need at least v1.16
Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF
make: *** [Makefile:1164: vmlinux] Error 1 5 1 Answer
The following is a simple guide to compile and install a kernel starting from sources. I did not test this guide with the .tag.gz linked, so my recommendation is to take a backup of the whole system before trying to install it.
Requirements
To compile a kernel, you need to install some requirements first. To do so, issue:
sudo apt install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bisonExtract sources
From the directory where you downloaded the archive, issue:
tar -xvzf linux-47a0001436352c9853d72bf2071e85b316d688a2.tar.gzMove to the newly created directory using cd linux-47a0001436352c9853d72bf2071e85b316d688a2.
Configure kernel
Before compiling the kernel, you need to select which modules to include.
To copy the modules of your current kernel, just issue:
cp /boot/config-$(uname -r) .configIf now you issue make menuconfig a configuration window opens up and from there you can enable or disable every available module.
Compile and install kernel
To start compiling the kernel, issue:
makeand answer to the questions which may arise (they depend on the starting kernel and the kernel being compiled). This step will take a lot of time.
After this step, you have to install modules by issuing:
make modules_installAlso this step will take some time to complete.
Finally, to install the kernel issue:
sudo make installEnable kernel on boot
To enable kernel on boot, issue:
sudo update-initramfs -c -k <version>where you need to replace <version> with the version you actually compiled.
After this, update grub by issuing:
sudo update-grub 3