Unable to load multiboot kernel.
Marcelo Araujo
araujobsdport at gmail.com
Mon Mar 30 16:45:18 UTC 2015
2015-03-30 23:35 GMT+08:00 Roger Pau Monné <roger.pau at citrix.com>:
> 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-5500U
> > 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 next
> > KERNEL, but I reach out at:
> > sys/boot/i386/libi386/multiboot.c
> > 167 error = elf32_loadfile_raw(filename, dest, result, 1);
> > 168 if (error != 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=1024M dom0_max_vcpus=2 dom0pvh=1
> > console=com1,vga
> > boot/xen data=0x1e0090+0x7fd20f70 \
> > OK load /boot/kernel/kernel
> > /boot/kernel/kernel Unable to load /boot/kernel/kernel as a multiboot
> > payload kernel
> > /boot/kernel/kernel text=0x104c6a8 data=0x12dbb8+0x3fb0f0
> > sysms=[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)) == NULL) {
> + printf("Can not load a raw file without a kernel\n");
> command_errmsg = "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 = file_search(name, NULL);
> if (cp == NULL) {
> + printf("Cannot find %s file\n", name);
> sprintf(command_errbuf, "can't find '%s'", name);
> return(NULL);
> }
> name = cp;
>
> if ((fd = 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 = loadaddr;
> + printf("Trying to load a RAW file at 0x%lx ", laddr);
> for (;;) {
> /* read in 4k chunks; size is not really important */
> got = 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 at e550:/usr/src/sys/boot # du /boot/kernel/kernel
12885 /boot/kernel/kernel
Best Regards,
--
--
Marcelo Araujo (__)araujo at FreeBSD.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^
Power To Server. .\. /_)
More information about the freebsd-xen
mailing list