On Wed, 30 Sep 2015, Stefano Stabellini wrote:
Hi Fu,
I backported your patches to the CentOS aarch64 grub2 rpm. I am testing it on X-Gene with EFI firmware. It works fine when booting Xen, but booting native kernels (no Xen) doesn't work anymore. Grub prints
error: out of memory.
Press any key to continue...
grub is still able to continue and load Linux, but then the kernel fails to boot with "Cannot open root device", even though the grub config is still same as before and the rootfs (which is xfs) hasn't changed. Reverting the patches solved the problem.
Do you have any ideas on what is causing the issue? Maybe the initramfs hasn't been properly loaded?
It looks like the following chunk of commit f8451af8251a3866cb8b7307b9917dd5d34fbd0a "arm64: Export useful functions from linux.c" causes troubles:
diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c index 117232f..a63a11a 100644 --- a/grub-core/loader/linux.c +++ b/grub-core/loader/linux.c @@ -205,7 +205,8 @@ grub_initrd_init (int argc, char *argv[], initrd_ctx->nfiles++; initrd_ctx->components[i].size = grub_file_size (initrd_ctx->components[i].file); - initrd_ctx->size += ALIGN_UP (initrd_ctx->components[i].size, 4); + if (argc != 1) + initrd_ctx->size += ALIGN_UP (initrd_ctx->components[i].size, 4); }
if (newc)
Simply removing this change seems to fix the issue and Xen still boots fine.