Hi all,
TL;DR, GRUB 2.04 is released, and the below is fixed in there, including one important bit for arm64.
Around the dawn of time, I started working on a GRUB port to 32-bit ARM on UEFI. By the time we got to the linux loader, the EFI stub support was still being developed for the kernel - and the boot/runtime UEFI support wasn't merged yet. So I bodged up the existing loader I had put together for the GRUB U-Boot port to at least check it wasn't overwriting anything important, and put some info into the chosen node to tell Linux what it needed to do to boot in UEFI mode and that was that.
UEFI on 32-bit ARM never took off, and hence the relevant GRUB port, but you could kind of use it with the bodged U-Boot loader.
Then that mischievous scoundrel Alex Graf went and implemented some basic UEFI interfaces for U-Boot, and the long-buried sins of the past were brought to the surface for all to see.
So, anyway, I had to provide a *real* linux loader for 32-bit ARM on UEFI, so I went and genericised the arm64 UEFI linux loader. Of course, this had some spectacular fallout in various parts of the GRUB source tree. Finally, this all got merged upstream in September 2018. However, the timing of the next GRUB release was not clear, so I set up a branch with the minimum amount of patches required to go on top of the Debian Buster 2.02 GRUB (so Debian wouldn't have to wait until 2021-22): https://git.linaro.org/people/leif.lindholm/grub.git/log/?h=debian-buster-ar....
This roughly corresponds to cherry-picking upstream: a0e4ee533dc0c6a78ecc55e97ac0fb98755f7fe7 linux, efi, arm*, fdt: Break FDT extra allocation space out into a #define 9bfba354bbd9f1541b1e5593549809aa3e720992 loader/multiboot_mbi2: Use central copy of grub_efi_find_mmap_size() 9415914e0fb4d0e09f49431cfb591551bd20f63a loader/ia64/linux: Use central copy of grub_efi_find_mmap_size() ad2bebc6fc3d77e38294aaa824362a0851239703 loader/i386/linux: Use central copy of grub_efi_find_mmap_size() c79ebcd18cf3e208e9dda5e2ae008f76c92fe451 i386: Don't include lib/i386/reset.c in EFI builds a2f26adfef2fc8a7d7392c3704031df4624c67b0 efi: Restrict arm/arm64 linux loader initrd placement 77808dd66bda72ff14873bcd701ec25a0db1dfee arm: Delete unused efi support from loader/arm d0c070179d4d78c297364e41ece54fd7755c4b58 arm/efi: Switch to arm64 linux loader d24dd120864ed72a80d7bb9c0288c4f29934f79d arm64/linux/loader: Rename functions and macros and move to common headers bad144c60f664a83f5a7d3a014927bffaa2abbf1 efi: Add grub_efi_get_ram_base() function for arm64 8ec18d1a4c26129c0a018ee7a61739a929ee1a25 efi: Add central copy of grub_efi_find_mmap_size 9b37229f013db1b150082ac130be7c20b3db8cea commands/file: Use definitions from arm64/linux.h 40dc61ed75e08e7dc2951bdae5c59fecb15bbb72 commands/file: Use definitions from arm/linux.h 347210a5d5ce655b95315f320faa515afb723c11 efi/fdt: Set address/size cells to 2 for empty tree e93fd6b776a7e6cef36c445d00436e5a23cfeba5 fdt: Move prop_entry_size to fdt.h a244d9ebc7547f7ed373d9796a3bf186e7c035a1 arm: make linux.h safe to include for non-native builds cda033298680b6984044563b2ef6374a725b8aac arm: switch linux loader to linux_arm_kernel_header struct 7fd9722d0c5e9c5a85b782ef435c80085da308b2 arm64: align linux kernel magic macro naming with i386 ff1cf2548a3f33da19278829687d074ad746dd0a arm64: align linux kernel header struct naming with i386 7d36709d5e769eb49b41cca709bd64336b47ab4f i386: make struct linux_kernel_header architecture specific 3245f02d9d7274e942426541cf73dc73e7298f02 make GRUB_LINUX_MAGIC_SIGNATURE architecture-specific 8776e5a942582adaadc67865ed74cdd199e56a16 Make arch-specific linux.h include guards architecture unique 083c6e2455dcd4aafb6062d89fd6029dd3adddb6 arm64/efi: move EFI_PAGE definitions to efi/memory.h f826330683675f0deb55b58fd229afd7d65fb053 efi: change heap allocation type to GRUB_EFI_LOADER_CODE 91212e0aa07e704a61e4540c18a27f149f5e51c3 arm64 linux loader: improve type portability c5841ba7f0d14c193f20854e7e55b4f7ce9207d5 efi: Add GRUB_PE32_MAGIC definition 8c9465fac901caac6802d6872a1374518b001517 efi: move fdt helper library 4bc909bf89f5b4ff86c9e4e609d4fe0c11a66b0c Remove grub_efi_allocate_pages. dd5fde2df83c5c03b7ba04d2cc5b7be96de8da7b efi: refactor grub_efi_allocate_pages
Additionally, I would strongly recommend cherry-picking the following two 2d55ffecbb966d3e42023729d8bbf3c21c59e049 configure: Disable arm movw/movt relocations for GCC 566b16a0dc23d72357d2d75b781d3c7895b8a234 arm64/efi: Fix grub_efi_get_ram_base()
The latter sorts out a brainfart wreaking havoc on the arm64 port. But with that, both arm and arm64 actually respect the kernel's initrd placement rules (meaning you can actually boot on arm64 systems with tons of RAM, or large holes in the memory map).
But as I said, GRUB 2.04 has been released, and if moving to that is an option, please do.
My intent is to also bring RISC-V into the fold and use the same loader for all three.
Anyway, if you got this far, have (another) cup of coffee.
/ Leif