I wanted to change a few things in the kernel, so I built a new one from the source, with a few things changed in the .config file. I am booting in UEFI mode using GRUB 2. When I use the new kernel, I get this message from GRUB:
error: invalid magic number.
error: you need to load the kernel first.
Everything I have read about this error doesn't apply to my situation, and are usually about legacy boot, not UEFI boot.