I recently compiled and installed a Linux kernel on my Kubuntu computer. The way I did this was, I downloaded the source .tar.gz from kernel.org, extracted it and used the following commands (running in the top directory of the source package) to compile and install it:
sudo make modules_install
sudo make install
When I rebooted, however, I got a message saying "Error: out of memory" and when I pressed a key to continue it gave a kernel panic screen saying "not syncing: VFS: Unable to mount root fs on unknown-block(0,0)".
My other kernels work fine, so I can still boot up normally. But I'm curious to know why that kernel doesn't work and what I can do to get it working.
I tried this with a few versions (5.9.12, 5.9.14 and 5.10.2) and got the same result, so the exact version doesn't seem to be the issue here. But I know that I used to compile kernels like this all the time and they ran without issues. So I tried a bunch of stuff and eventually figured out that UEFI appears to be the culprit. This same kernel will work if I install it on a legacy system. Secure boot is disabled on the (UEFI) PC in question, so I figure it can't have to do with secure boot keys. It seems to be something about UEFI, but not secure boot, that breaks it.
However, upon searching the internet I couldn't find anything on getting a compiled Linux kernel to boot with UEFI. So is there really some additional thing I must do? Or is the problem something else?
Edit: I don't understand why my question was closed. But in case it requires more clarification, I am asking as follows: If I download the linux kernel source code from kernel.org or the code from which the Ubuntu kernels are built from here (https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.10.4/) and compile it using the commands above, I find that it will boot fine in BIOS but not UEFI. My question is why.