All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Nyberg <jens.nyberg@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Multiboot using -kernel and -initrd stopped working
Date: Sat, 20 Jul 2013 23:07:38 +0200	[thread overview]
Message-ID: <CALXW-VDFPXpQ=jiSKMRQoqy19id8zky7XD2bcGB5feCCnZ_JiQ@mail.gmail.com> (raw)
In-Reply-To: <CALXW-VBdWpB=QrHnpFGir5YSGPw9WFEASJVG9FHjwmmV-2GJAA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3066 bytes --]

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) {
    continue
}

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 <jens.nyberg@gmail.com>

> 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_KERNEL_SIZE: 0x4c578
> 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 <jens.nyberg@gmail.com>
>
>> Hi!
>>
>> 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.
>>
>> Thanks
>>
>> Jens
>>
>
>

[-- Attachment #2: Type: text/html, Size: 4500 bytes --]

      reply	other threads:[~2013-07-20 21:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-20 19:36 [Qemu-devel] Multiboot using -kernel and -initrd stopped working Jens Nyberg
2013-07-20 20:13 ` Jens Nyberg
2013-07-20 21:07   ` Jens Nyberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALXW-VDFPXpQ=jiSKMRQoqy19id8zky7XD2bcGB5feCCnZ_JiQ@mail.gmail.com' \
    --to=jens.nyberg@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.