I am willing to learn compiling kernel and also some packages on my own. I have learnt somewhat about PKGBUILD, so that's not what I want to ask now.
The question is, if I compile and install packages manually, how can I manage their updates?
To make my question more clear, mainly I want to understand what hardware needs what and debloat unnecessary things (for example, there are so many iwlwifi drivers in the kernel, but I want to get rid of every unwanted ones). But if I get an update, they add again those junk, and if I add them to ignored packages I would lose the updates. Is there a way to have a patch on what changes should be on every update (like if I can have a patch to PKGBUILD and that patch would remain on every update)?
Since there are some people here who compile kernels on their own, I would like to know how they handle it.
As for updates, GitHub notifications for new software updates has proven to be a good way to get notified about updates - once a PKGBUILD has been written properly its only a matter of changing the version and updating checksums to get going
If you have your own version of package that is in the Arch repos and want to maintain it yourself longterm I wouldn't recommend fighting a version battle.
Instead, use provides and conflicts in your PKGBUILD. In other words, if you want to build your own version of gcc, you can call your package gcc-se and have it provide gcc and conflict with gcc. The fact that it provides gcc means it will satisfy other packages dependent on gcc. Having it conflict means it won't allow gcc-se and gcc to be installed at the same time which will avoid conflicts in the filesystem.
I don't know about or build my own kernels, but maybe what you are looking for is not exactly "building your own kernel".
AFAIK when installing a kernel, it is installed in the filesystem as a package with all provided modules/drivers. Then there is a pacman hook that builds the actual/local kernel image which is then installed and used at /boot/.
Depending on the order of mkinitcpio.conf HOOKS and the placement of autodetect in this array, the final/working kernel image is filled with the required modules to boot your specific/own HW. Not everything is installed in the final image. (Edit: all the rest of the skipped modules are added in the fallback kernel image). Also, IIRC some modules from firmware package are added (which are not in the kernel package, but I am not sure about that.
If it's about saving disk space is different from learning how to compile a kernel.
So it's about doing what you want/need
I hope others correct my mistaken perceptions, so I keep learning
Actually I got this idea by looking in my PinePhone. There there is nothing related to Intel, NVIDIA, AMD, etc. (AFAIK, at least no such files). So I thought that it's possible. I also want to learn how compiling works in Arch so that I can understand much about hardware, I'll maybe find out if it serves this purpose also or not
Exactly. That's what I want, a kernel not from Arch repo but compiled on my own.
This is I am interested in learning. I think it's a long run, but I'm happy to start learning
To get started, I'll pick a PKGBUILD from AUR (maybe cacule) and try to tweak. Maybe not get very deep in source code now (I don't know all the programming languages, just try setting/unsetting variables in PKGBUILDs and looking for files and removing, etc.)