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

Booting uncompressed kernel images



Hi,

I have a scenario[1] where the default Linux kernel compressed with XZ
(from Jessie and up) cannot be booted. The first thing that I've tried
was to uncompress it using "extract-linux"[2] and it didn't worked by
the time, so I decided to rebuild the entire "linux-image-*" package
changing "CONFIG_KERNEL_XZ=y" to "CONFIG_KERNEL_GZIP=y". This, of
course, implies that it would be needed to recompile the kernel every
time a new version of the package is released, which is an overkill
for a such simple requirement.

Yesterday, Ben Hutchings itself suggested[3] me to write a hook that
decompresses the kernel at package installation time, something which
I find a great idea. The problem is that, again, I couldn't boot a
machine (tried on VirtualBox and Xen) after uncompressing its
"/boot/vmlinuz-*" using "extract-linux". I can generate an initrd file
from this uncompressed image, "update-grub" detects it fine, but if I
reboot it the following error appears:

    Loading Linux 3.16.0-4-amd64 ...
    error: invalid magic number.
    Loading initial ramdisk ...
    error: you need to load the kernel first.

The same error happens if this uncompressed image is compressed again
with "gzip", for instance.

Given this situation, I have two questions:

- If a kernel is configured to be compressed at build time, it can't
be booted if uncompressed later? I have some doubts about this,
because there is more than one report of successfully booting
uncompressed kernels[4][5].
- Is "extract-linux" stripping some essential information (the script
looks for an offset to start the decompression process) from the
kernel image that is needed to boot it later? If so, is there a way to
recover and insert it on the uncompressed image?

Regards,
Tiago.

[1]: https://lists.debian.org/debian-cloud/2016/01/msg00052.html
[2]: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/scripts/extract-vmlinux
[3]: https://lists.debian.org/debian-cloud/2016/01/msg00060.html
[4]: http://www.he1ix.org/2015/01/creating-a-xen-domu-on-debian-squeeze-6-0-6/
[5]: http://noone.org/blog/English/Computer/Debian/Running%20a%20Sid%20DomU%20on%20a%20Squeeze%20Dom0.html

-- 
Tiago "Myhro" Ilieve
Blog: https://blog.myhro.info/
GitHub: https://github.com/myhro
LinkedIn: https://br.linkedin.com/in/myhro
Montes Claros - MG, Brasil


Reply to: