public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chao Peng <chao.p.peng@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org, x86@kernel.org, grub-devel@gnu.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@kernel.org>,
	Juergen Gross <jgross@suse.com>,
	"Luis R. Rodriguez" <mcgrof@kernel.org>,
	Borislav Petkov <bp@suse.de>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Thomas Garnier <thgarnie@google.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Amnon Ilan <ailan@redhat.com>
Subject: Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able
Date: Thu, 16 Feb 2017 10:12:10 +0800	[thread overview]
Message-ID: <1487211130.3019.7.camel@linux.intel.com> (raw)
In-Reply-To: <eba89c42-7185-3cda-ee5b-c0dbd986af68@redhat.com>

On Wed, 2017-02-15 at 17:42 +0100, Paolo Bonzini wrote:
> 
> On 15/02/2017 15:41, Chao Peng wrote:
> > 
> > Multiboot specification (http://git.savannah.gnu.org/cgit/grub.git/tree/doc/multiboot.texi?h=mul
> > tiboot2)
> > is an open standard that provides kernels with a uniform way to be booted
> > by multiboot-compliant bootloaders (like grub).
> > 
> > This patch is trying to make Linux ELF kernel image to be a
> > multiboot-compliant OS so that it can be loaded by a multiboot-comliant
> > bootloader. The benefit is eliminating the maintainance for realmode and
> > decompression code and especially when the kernel is loaded in a virtual
> > machine, the reducing for these code can greatly cuts down the boot time.
> > 
> > However, the current version of multiboot spec doesn't support 64 bit
> > well so for 64 bit kernel we need stub code to jump from 32 bit code to
> > 64 bit code. Besides, there are still some other issues:
> >   1). '-z max-page-size=0x1000' is used so the text segment start is in
> >   multiboot header search scope because GNU LD has default page size of
> >   0x00200000 for ELF64, which will fail multiboot test.
> > 
> >   2). The bootloader like grub has support for ELF kernel (even for ELF64)
> >   which makes the patch easier. However, the current grub implementaion
> >   thinks the entry address should be a VA. E.g. for 64 bit kernel, the entry
> >   address (0x1000000) is actually phiscial address, grub refuses to load it
> >   by saying: 'entry point isn't in a segment'.
> 
> For kvm-unit-tests, we do "objcopy -O elf32-i386 dest.32bit dest.64bit"
> and pass the resulting 32bit ELF file to grub.
> 
> Out of curiosity, what happens if you pass the resulting multiboot file
> to QEMU's -kernel option?
> 

The resulting kernel is a multiboot2 kernel. QEMU however supports loading
multiboot v1 only.

Chao
> Thanks,
> 
> Paolo
> 
> > 
> > This patch is sent out as RFC in case you have some ideas.
> > 
> > Signed-off-by: Chao Peng <chao.p.peng@linux.intel.com>

  reply	other threads:[~2017-02-16  2:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15 14:41 [RFC PATCH] x86/boot: make ELF kernel multiboot-able Chao Peng
2017-02-15 16:42 ` Paolo Bonzini
2017-02-16  2:12   ` Chao Peng [this message]
2017-02-15 18:12 ` hpa
2017-02-15 20:13   ` Luis R. Rodriguez
2017-02-15 20:58     ` hpa
2017-02-16  2:07       ` Chao Peng
2017-02-16 23:27       ` Daniel Kiper
2017-02-17  5:00         ` H. Peter Anvin
2017-02-20 18:46           ` Daniel Kiper

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=1487211130.3019.7.camel@linux.intel.com \
    --to=chao.p.peng@linux.intel.com \
    --cc=ailan@redhat.com \
    --cc=bp@suse.de \
    --cc=grub-devel@gnu.org \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thgarnie@google.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox