[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Multiboot using -kernel and -initrd stopped working

From: Jens Nyberg
Subject: Re: [Qemu-devel] Multiboot using -kernel and -initrd stopped working
Date: Sat, 20 Jul 2013 23:07:38 +0200

Ok, another update. The problem seems to be that in rom_copy (hw/core/loader.c:776) where it iterates over all the roms it will fail at:

if (!rom->data) {

For the second program header. This means that it hasnt been able to allocate memory for that header because rom->data is supposed to be a pointer to a memory area. Because it just continues here the calculation for how much it has loaded will not correlate with what it is suppose to load.

So now I need to figure out how rom->data is set and why it is empty.

2013/7/20 Jens Nyberg <address@hidden>
I have some information to go on:

The problem occurs because of a failed call to rom_copy from hw/i386/multiboot.c

I print debugged some values:

ELF_LOW: 0x100000
ELF_HIGH: 0x14c578
MH_LOAD_ADDR: 0x100000
MH_ENTRY_ADDR: 0x10000c
COPY SIZE: 0x4210

The return value from rom_copy (found in hw/core/loader.c) is compared with mh_kernel_size to see they are the same. If they are not qemu will exit and print the error message I got. As you can see in this printout mh_kernel_size is 0x4c578 and the return value was 0x4210. Now something goes wrong here. I suspect it doesnt take into the account that there can be more program headers for elf so it just takes the first one.

So to confirm this I ran readelf -a fudge I get this information about my binary:

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x00100000 0x00100000 0x04210 0x04210 R E 0x1000
  LOAD           0x006000 0x00105000 0x00105000 0x00000 0x47578 RW  0x1000
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4

As you can see the MemSiz field contains the value 0x4210 meaning rom_copy only copys the first program header but not the second causing this problem.

I will try to see if I can fix this so that qemu takes into account all program headers.

// Jens

2013/7/20 Jens Nyberg <address@hidden>

I develop my own operating system and I have been using this command to start my operating system:

$ qemu-system-x86_64 -kernel fudge -initrd initrd.tar

I just recently upgraded the qemu package for arch linux and now this does not seem to work anymore. I get this error message:

Error while fetching elf kernel from rom

So I checked out the latest version of qemu from git today and did a build but it had the same result.

Now I havent made any changes to my kernel so I know I havent screwed anything up in that regard. It is a normal 32 bit x86 multiboot compliant kernel so it should work using these commands. I run qemu on a x86_64 machine.

I'd like to help sort this issue out. I will do my best to collect any data you might be interested in. I will try to figure out what change made this not work but it will take some time so if anyone has an idea what commit-id it is please let me know.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]