Skip to contentSkip to conversation

Confusion regarding LZ4-compressed kernel support and Xen (PV)

DISCUSSION Andy Smith 1 participant 2 messages Apr 25, 2020 – Apr 26, 2020

lore
Share & tools
lore

Andy Smith

author
#0 lore raw

Hi,

I am booting Xen PV guests using a grub image compiled as a PV guest and then having that parse the /boot/grub/grub.cfg from within the guest.

When this encounters an LZ4-compressed kernel I get this:

Loading Linux 5.4.0-26-generic ...
error: not xen image. [ vmlinuz-5.4.0-26-gen 10B 0% 0.00B/s ]
Loading initial ramdisk ...
error: you need to load the kernel first.

Press any key to continue...

I know it is a problem related to LZ4 compression because if I manually decompress that kernel image then I am able to boot it fine.

Cloning https://git.savannah.gnu.org/git/grub.git just now and rebuilding my PV grub image gives the same result.

I see the error message comes from:

grub-core/loader/i386/xen_file.c
92: grub_error (GRUB_ERR_BAD_OS, "not xen image");

I cannot see any evidence that there is LZ4 support in that file, but I don't really know what I'm looking for so quite possibly I am wrong.

Searching the web finds articles about Ubuntu's decision to switch to LZ4-compressed kernels and some of these mention that this required changes to grub. I was also unable to find any actual details of the patch/commit for that. Again, if it's present at:

https://git.launchpad.net/~ubuntu-core-dev/grub/+git/ubuntu

…then it's not obvious to me.

Does upstream grub have support for booting LZ4-compressed kernels?

Is that also expected to work when grub is booted as a Xen PV image?

I am just a bit lost as to where to look to find a solution to this, so any pointers would be much appreciated.

Thanks,
Andy

author
#1 lore raw
Quoted 4 lines · Andy Smith

I see the error message comes from:

grub-core/loader/i386/xen_file.c
92: grub_error (GRUB_ERR_BAD_OS, "not xen image");

Some further investigation reveals that if I boot these kernels with the PVH image (./configure --target=x86_64 --with-platform=xen_pvh …) then it does work.

I guess that will be the path of least resistance since I was planning to switch everything to PVH mode anyway.

Cheers,
Andy