Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1581442

Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able
Date 2017-02-15 17:50 +0100
Message-ID <tbaWf-2oT-25@gated-at.bofh.it> (permalink)
References <tb9dM-1hF-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 15/02/2017 15:41, Chao Peng wrote:
> Multiboot specification (http://git.savannah.gnu.org/cgit/grub.git/tree/doc/multiboot.texi?h=multiboot2)
> 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?

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>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH] x86/boot: make ELF kernel multiboot-able Chao Peng <chao.p.peng@linux.intel.com> - 2017-02-15 16:00 +0100
  Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able Paolo Bonzini <pbonzini@redhat.com> - 2017-02-15 17:50 +0100
    Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able Chao Peng <chao.p.peng@linux.intel.com> - 2017-02-16 03:20 +0100
  Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able hpa@zytor.com - 2017-02-15 19:20 +0100
    Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-15 21:20 +0100
      Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able hpa@zytor.com - 2017-02-15 22:00 +0100
        Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able Chao Peng <chao.p.peng@linux.intel.com> - 2017-02-16 03:10 +0100
        Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able Daniel Kiper <dkiper@net-space.pl> - 2017-02-17 00:40 +0100
          Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able "H. Peter Anvin" <hpa@zytor.com> - 2017-02-17 06:10 +0100
            Re: [RFC PATCH] x86/boot: make ELF kernel multiboot-able Daniel Kiper <dkiper@net-space.pl> - 2017-02-20 19:50 +0100

csiph-web