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

Re: Booting uncompressed kernel images



On Tue, 2016-02-02 at 15:18 -0200, Tiago Ilieve wrote:
> Hi Ian,
> 
> On 2 February 2016 at 09:24, Ian Campbell <ijc@debian.org> wrote:
> > Did you see my other replies on debian-kernel yesterday? There are some
> > questions there which it would be useful to know the answers to.
> 
> It turned out that I though that I was subscribed to
> "debian-kernel@l.d.o", but I wasn't. This is solved now.
> 
> > What does file(1) say about them? For me I see:
> > 
> > _vmlinuz-3.16.0-4-amd64.extracted/2F6EF8.xz: XZ compressed data
> > _vmlinuz-3.16.0-4-amd64.extracted/47B4:      ELF 64-bit LSB executable,
> > x86-64, version 1 (SYSV), statically linked,
> > BuildID[sha1]=2883400c6927fe339cdd2c321d3d154c472ef418, stripped
> > _vmlinuz-3.16.0-4-amd64.extracted/47B4.xz:   XZ compressed data
> 
> Are you able to extract three files from it?

Yes, although I think/suspect that my 47B4 is created by binwalk
decompressing 47B4.xz as a convenience.

>  Here's what I got:
> 
> $ file _vmlinuz-3.16.0-4-amd64.extracted/*
> _vmlinuz-3.16.0-4-amd64.extracted/2F6EF8.tar: XZ compressed data
> _vmlinuz-3.16.0-4-amd64.extracted/47B4.tar:   XZ compressed data
> 
> Only two that I can't extract again.
> 
> > Do any of them match what you get out of extract-linux?
> 
> $ ./extract-vmlinux /boot/vmlinuz-3.16.0-4-amd64 > vmlinux
> $ file vmlinux
> vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
> statically linked,
> BuildID[sha1]=2883400c6927fe339cdd2c321d3d154c472ef418, stripped

This looks like a file which I would expect to be bootable as a Xen PV
guest. Using "readelf -n" should show lots of:

Displaying notes found at file offset 0x00716774 with length 0x000001d8:
  Owner                 Data size	Description
  Xen                  0x00000006	Unknown note type: (0x00000006)

Which would imply this.

> The SHA1 is the same.
> 
> > _vmlinuz-3.16.0-4-amd64.extracted/47B4 looks to me to be an ELF file
> > which
> > I would expect to be bootable as a Xen PV guest, it has the required
> > ELF
> > notes etc.
> 
> From your previous e-mails, looks like Grub2 can't boot it, opposite
> to a Xen PV guest, right?

It depends ;-).

Grub2 can support many different platforms, including "native PC" and "Xen
PV". http://wiki.xen.org/wiki/PvGrub2#Background:_Introduction_to_Xen_PV_Bo
otloaders has some background which I hope will be useful here (the second
part on actually using grub2 is not really relevant since you are at the
mercy of Oracle Cloud).

"Xen HVM" == "native PC" from a booting point of view, so in a Xen HVM
guest you would use the native grub, in a Xen PV guest it's possible that
you are using the "Xen PV" version of Grub2.

A native version of Grub will not be able to boot the raw ELF file
extracting from the vmlinuz, but it should be able to boot the vmlinuz
itself just fine.

Virtual box == "native PC" too, I think it unlikely it would be able to
boot a raw ELF file.

> On 1 February 2016 at 08:06, Ian Campbell <ijc@debian.org> wrote:
> 
> > Is this booting via pvgrub[1], if not then do you know how? What does
> > the
> > grub.cfg stanza look like?
> 
> This is hard to answer properly. The image has "grub2" (the last
> 2.02~beta2-22+deb8u1 available on Jessie) installed and I can boot it
> on a local Xen installation as well on Oracle Cloud (using the custom
> kernel compressed with gzip).

Do you need the custom kernel on your local install?

Having grub2 installed in a PV guest does not necessarily mean it is being
used, since the first stage bootloader is provided by the host. The package
supporting Xen PV is "grub-xen"

If you are booting PV grub2 then perhaps you just need to add "insmod xzio"
to your grub.cfg?

>  What I tried is the same process
> (extract-linux, generate initrd, update-grub) both on VirtualBox and
> Xen on Oracle Cloud. In VirtualBox, I got the error pasted on my first
> message.

I think you should ignore VirtualBox for the purposes of diagnosing what is
going on here, behaviour on VB tells us next to nothing about behaviour on
Xen.

>  In Oracle Cloud I have no access to the boot logs to confirm
> if it happens to be exactly the same.

You really need to figure out for sure if you are booting in an HVM or PV
guest, it makes a very large difference to what kernel features you
want/need. From there it should become pretty clear what bootloader is in
use.

If you can boot the guest in some way then virt-what ought to tell you for pretty sure what you are running in.

Ian.


Reply to: