From owner-freebsd-xen@FreeBSD.ORG Mon Mar 30 16:45:18 2015 Return-Path: Delivered-To: freebsd-xen@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 52B0B83F for ; Mon, 30 Mar 2015 16:45:18 +0000 (UTC) Received: from mail-ie0-x231.google.com (mail-ie0-x231.google.com [IPv6:2607:f8b0:4001:c03::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14816E29 for ; Mon, 30 Mar 2015 16:45:18 +0000 (UTC) Received: by iedfl3 with SMTP id fl3so138374028ied.1 for ; Mon, 30 Mar 2015 09:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=WmLtgurQxT0mlevSrrzWt/7X5P+IY2+dU3FttfRaiuo=; b=Wcdkmlc4kaOMrAE8+TpVa1R7xBNwzvYXJnnkUasSRTuxmEI0NpmxREr5e3XmUdbNAs X+KbNAHwuII18/F4LzWH0rAnBWKnPHN6ECXuvFJPuFMQ8CByoVDy+q+3zRm9CfhhFxc5 5lJoPAqB/eL/J1NJ57s0ZPnqnx4d73SHsZ1K5JRNo4/4GIrqnPqejsiyLHbAuLVedeaa wbOU2dmWWfJq8ok9BmvXzcgssgUbehzX2IAj3TOXnqRaxDZ8NYRM49/A+xCoXViiJgH1 Q8pe62VkszRga0tOO/RIoumtdUHNK1Zn1THzLxDPS8xJHdS8d7BSckLJ4T5vPWe8Nb7V lllw== MIME-Version: 1.0 X-Received: by 10.50.171.170 with SMTP id av10mr18952814igc.28.1427733917433; Mon, 30 Mar 2015 09:45:17 -0700 (PDT) Received: by 10.64.59.138 with HTTP; Mon, 30 Mar 2015 09:45:17 -0700 (PDT) Reply-To: araujo@FreeBSD.org In-Reply-To: <55196D2F.8040203@citrix.com> References: <55196D2F.8040203@citrix.com> Date: Tue, 31 Mar 2015 00:45:17 +0800 Message-ID: Subject: Re: Unable to load multiboot kernel. From: Marcelo Araujo To: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: freebsd-xen@freebsd.org X-BeenThere: freebsd-xen@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion of the freebsd port to xen - implementation and usage List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2015 16:45:18 -0000 2015-03-30 23:35 GMT+08:00 Roger Pau Monn=C3=A9 : > Hello, > > El 30/03/15 a les 16.27, Marcelo Araujo ha escrit: > > Hi guys, > > > > I'm attempting to boot FreeBSD as Dom0 on ThinkPad E550 with an i7-5500= U > > quad-core and 16G of ram. > > > > The FreeBSD is in the revision r280848 and Xen is the > 4.6-unstable(checkout > > today). The FreeBSD kernel was built as amd64. > > > > So, the problem that I'm facing is that not possible to load multiboot > > kernel. Right after to load the XEN kernel, its attempt to load the ne= xt > > KERNEL, but I reach out at: > > sys/boot/i386/libi386/multiboot.c > > 167 error =3D elf32_loadfile_raw(filename, dest, result, 1); > > 168 if (error !=3D 0) { > > 169 printf( > > 170 "elf32_loadfile_raw failed: %d unable to load multiboot > > kernel\n", > > 171 error); > > 172 goto out; > > 173 } > > > > I tried to boot at loader using: > > OK unload OK load /boot/xen dom0_mem=3D1024M dom0_max_vcpus=3D2 dom0pvh= =3D1 > > console=3Dcom1,vga > > boot/xen data=3D0x1e0090+0x7fd20f70 \ > > OK load /boot/kernel/kernel > > /boot/kernel/kernel Unable to load /boot/kernel/kernel as a multiboot > > payload kernel > > /boot/kernel/kernel text=3D0x104c6a8 data=3D0x12dbb8+0x3fb0f0 > > sysms=3D[0x8+0x148f98+0x8+0x164832] > > OK boot > > > > And the system is halted. > > > > Any idea? > > That's something new, I've never seen this before. IMHO it seems like > arch_readin is failing to load the kernel into memory, but due to the > lack of messages I'm not sure. Could you try the patch above? It should > make the errors a little bit more chatty. > > Roger. > > diff --git a/sys/boot/common/module.c b/sys/boot/common/module.c > index b48b493..53ce358 100644 > --- a/sys/boot/common/module.c > +++ b/sys/boot/common/module.c > @@ -380,6 +380,7 @@ file_loadraw(char *name, char *type, int insert) > > /* We can't load first */ > if ((file_findfile(NULL, NULL)) =3D=3D NULL) { > + printf("Can not load a raw file without a kernel\n"); > command_errmsg =3D "can't load file before kernel"; > return(NULL); > } > @@ -387,12 +388,14 @@ file_loadraw(char *name, char *type, int insert) > /* locate the file on the load path */ > cp =3D file_search(name, NULL); > if (cp =3D=3D NULL) { > + printf("Cannot find %s file\n", name); > sprintf(command_errbuf, "can't find '%s'", name); > return(NULL); > } > name =3D cp; > > if ((fd =3D open(name, O_RDONLY)) < 0) { > + printf("can't open '%s': %s", name, strerror(errno)); > sprintf(command_errbuf, "can't open '%s': %s", name, > strerror(errno)); > free(name); > return(NULL); > @@ -404,6 +407,7 @@ file_loadraw(char *name, char *type, int insert) > printf("%s ", name); > > laddr =3D loadaddr; > + printf("Trying to load a RAW file at 0x%lx ", laddr); > for (;;) { > /* read in 4k chunks; size is not really important */ > got =3D archsw.arch_readin(fd, laddr, 4096); > @@ -411,6 +415,7 @@ file_loadraw(char *name, char *type, int insert) > break; > if (got < 0) { /* error */ > sprintf(command_errbuf, "error reading '%s': %s", name, > strerror(errno)); > + printf("Error reading %s: %s\n", name, strerror(errno)); > free(name); > close(fd); > return(NULL); > diff --git a/sys/boot/i386/libi386/multiboot.c > b/sys/boot/i386/libi386/multiboot.c > index 11c35df..a3f3084 100644 > --- a/sys/boot/i386/libi386/multiboot.c > +++ b/sys/boot/i386/libi386/multiboot.c > @@ -373,7 +373,7 @@ multiboot_obj_loadfile(char *filename, u_int64_t dest= , > printf( > "Unable to load %s as a multiboot payload > kernel\n", > filename); > - return (EFTYPE); > + return (EINVAL); > } > > /* Load kernel metadata... */ > @@ -382,7 +382,7 @@ multiboot_obj_loadfile(char *filename, u_int64_t dest= , > if (error) { > printf("Unable to load kernel %s metadata error: > %d\n", > rfp->f_name, error); > - return (EFTYPE); > + return (EINVAL); > } > > /* > > > Hello Roger, Thanks for the prompt reply and for the patch. I made a test and now we have a bit more of information. Seems the problem is because the kernel is too large. OK load /boot/kernel/kernel /boot/kernel/kernel Trying to load a RAW file at 0x80001000 Error reading /boot/kernel/kernel: file too large Unable to load /boot/kernel/kernel as a multiboot payload kernel can't load file '/boot/kernel/kernel': invalid argument. Here is the size of my kernel: root@e550:/usr/src/sys/boot # du /boot/kernel/kernel 12885 /boot/kernel/kernel Best Regards, --=20 --=20 Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_)