How do I add a custom kernel to the boot menu?

Hello. I need to use a kernel with some patches applied and I have no experience with it at all. I do have the patches in .patch format.

I am following this guide, pulling the 5.12 kernel from the Manjaro repository. I’m using that guide because it is my understanding that it is the easier/better way to do it in Manjaro.

I’m adding my patches as 1000-mypatch1.patch, 1001-mypatch2.patch, and so on, to the root of the local linux512 repository, and then running makepkg -s as the guide stated. This is still running, it seems to take a very long time.

(Edit: I just learned I need to add the .patch files to the PKGBUILD file and run updpkgsums before they are in effect. I also need to do makepkg -Cs so it will remove the previous build before attempting a new one. Correct me if I’m wrong here.)

I’m stumped as to what to do after this.

  • How do I add this Kernel to the grub menu with a custom name as to differentiate it from the official Manjaro kernels that are kept up-to-date by the system?
  • How do I update it later, do I just git pull, makepkg -s and install it over?
  • How do I uninstall it if I don’t want to have it on the menu anymore?
  • Will it get overwritten by updates from Manjaro?
  • How do I keep it as the default boot option even if Manjaro updates the official kernels?

Any guidance is appreciated. I just don’t want to break anything and be able to revert it if something goes wrong.

I’m documenting here what I figured out so far for the future:

  • I have to rename the .diff files to .patch files otherwise they don’t get applied (at least that’s what happened to me)
  • I changed pkgbase to linux512-custom` but it doesn’t look like it did anything
  • I was able to install it using pacman -U linux512-....pkg.tar.zst linux512-headers-...pkg.tar.zst, and I think I can uninstall the kernel just by uninstalling these two files with pacman -R linux512 linux512-headers but I’m not sure

I still don’t know if this will conflict in any way with the kernels Manjaro handles itself or if uninstalling would work, however.

A custom kernel e.g. 5.12 needs custom naming for the matching modules and you need a matching headers package - otherwise it will be overwritten the next time Manjaro updates the kernel.

If I remember correct there is threads on the subject in
the archive → https://archived.forum.manjaro.org

That is good information. How do I do this? Just change pkgbase, or do I need to do something else?