How to apply a ".patch" file?

So i’m having issues with the latest Kernel. (AMD 7000 Series doesn’t seem to boost correctly anymore). I have found some Gitlab Issue about it and the amdgpu dev seems to provide some patches. At this point non of t he patches seem to fix the issue. Though it made me wonder. How would you actually apply a patch like this one?

I guess normally you just wait till the devs fix your problem and download the newer 6.10 Kernel at a later time.

In the meantime i would use LTS Kernel 6.6 till this problem is fixed.

1 Like

Patching this way can be fairly risky unless you are sure on what you are doing. For a few reasons, but if you accept this…

.patch files are just output from diff (often with some extra metadata, as in this case). You install one off file patches by:

patch drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c < 0001-drm-amdgpu-swsmu-extend-state-reprogram-on-init.patch
1 Like

Thank you. I would indeed wait for a kernel update. I’m just curious how it would work in theory. Thank you for telling me :slight_smile:

Though why is it risky? Cant you just reinstall kernel in case something goes wrong?

Same reason you don’t run executables blindly from external sources. But this one seems low risk in that the department.

It’s nice that you can only compile a module, and not the entire kernel at least. I haven’t done it in a while myself, but it is a lot easier than it used to be with the Arch Build System. And you don’t have to modify source packages directly.

https://wiki.archlinux.org/title/Compile_kernel_module

But removing the kernel should remove the custom module you installed.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.