From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0dX4-00054C-6g for qemu-devel@nongnu.org; Sat, 20 Jul 2013 16:13:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V0dX1-0004FK-8Q for qemu-devel@nongnu.org; Sat, 20 Jul 2013 16:13:34 -0400 Received: from mail-la0-x22b.google.com ([2a00:1450:4010:c03::22b]:59201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0dX0-0004FF-Sk for qemu-devel@nongnu.org; Sat, 20 Jul 2013 16:13:31 -0400 Received: by mail-la0-f43.google.com with SMTP id fh20so2535755lab.30 for ; Sat, 20 Jul 2013 13:13:30 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: Date: Sat, 20 Jul 2013 22:13:29 +0200 Message-ID: From: Jens Nyberg Content-Type: multipart/alternative; boundary=089e0160bc50aae9da04e1f71390 Subject: Re: [Qemu-devel] Multiboot using -kernel and -initrd stopped working List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --089e0160bc50aae9da04e1f71390 Content-Type: text/plain; charset=ISO-8859-1 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 > 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 > --089e0160bc50aae9da04e1f71390 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I have some information to go on:

The problem occurs because of a failed call to rom_copy from hw/i386/multi= boot.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. I= f 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 0x= 4210. Now something goes wrong here. I suspect it doesnt take into the acco= unt that there can be more program headers for elf so it just takes the fir= st one.

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

Program Headers:
=A0 Type =A0 =A0 =A0 =A0 =A0 Offset =A0 Vi= rtAddr =A0 PhysAddr =A0 FileSiz MemSiz =A0Flg Align
=A0 LOAD =A0 =A0 =A0 =A0 =A0 0x001000 0x00100000 0x00100000 0x04210 0x= 04210 R E 0x1000
=A0 LOAD =A0 =A0 =A0 =A0 =A0 0x006000 0x00105000= 0x00105000 0x00000 0x47578 RW =A00x1000
=A0 GNU_STACK =A0 =A0 = =A00x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4


As you can see the Mem= Siz field contains the value 0x4210 meaning rom_copy only copys the first p= rogram 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 a= nd I have been using this command to start my operating system:
<= br>
$ qemu-system-x86_64 -kernel fudge -initrd initrd.tar

I just recently upgraded the qemu package fo= r arch linux and now this does not seem to work anymore. I get this error m= essage:

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.

<= div>Now I havent made any changes to my kernel so I know I havent screwed a= nything up in that regard. It is a normal 32 bit x86 multiboot compliant ke= rnel 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 o= ut what change made this not work but it will take some time so if anyone h= as an idea what commit-id it is please let me know.

Thanks

Jens

--089e0160bc50aae9da04e1f71390--