From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCH v3 0/4] arm64: Add Xen boot support (via fdt) Date: Thu, 1 Oct 2015 17:19:21 +0100 Message-ID: References: <=fu.wei@linaro.org> <1437628583-23667-1-git-send-email-fu.wei@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: The development of GNU GRUB , xen-devel@lists.xensource.com, Ian Campbell , Andrei Borzenkov , Vladimir Serbinenko , Leif Lindholm , Ryan Harkin , Linaro UEFI Mailman List , Jon Masters , Fu Wei List-Id: xen-devel@lists.xenproject.org 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.