qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Support for multiboot images in elf64 (EM_X86_64) forma


From: Paul Brook
Subject: Re: [Qemu-devel] Support for multiboot images in elf64 (EM_X86_64) format
Date: Thu, 9 Feb 2012 13:36:35 +0000
User-agent: KMail/1.13.7 (Linux/3.1.0-1-amd64; KDE/4.6.5; x86_64; ; )

> Paul Brook <address@hidden> writes:
> >> > starting your own toy kernel is a fun thing to do and there are many
> >> > tutorials out there on how to do it. Unfortunately when one wants to
> >> > write a kernel in 64bit it becomes much harder because one can't
> >> > compile 64bit code as elf32 image and converting a elf64 image to
> >> > elf32 format is a major hassle and looses debug information and
> >> > symbols.
> > 
> > So just have two versions of your image:
> > - The elf64 image that has debug info, symbols, etc.  Point gdb at this.
> > - An elf32 image that you give to the bootloader (in this case kvm)
> > 
> > Generating the latter from the former is a trivial objcopy invocation.
> 
> Is it? I tried for a while and couldn't figure it out. I checked how
> linux does it and it does quite a dance to achieve it.

"objcopy -I elf64-x86-64 -O elf32-i386 64.elf 32.elf" worked for me.  
Relocations get a bit confused, but you shouldn't have relocations in your 
multiboot images to start with.

Linux is a bit special because it has its own boot protocol. AFAIK it can't be 
used as a regular multiboot image directly, you need to add a wrapper (i.e. a 
secondary bootloader).

Paul



reply via email to

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