You are not logged in.

#1 2010-08-15 04:14:33

anonova
Member
Registered: 2009-07-22
Posts: 23

Recompressing the stock kernel

I read that recent Linux kernels have paravirtualized guest support and wanted to try it (to check if hopefully Arch's stock kernel had it enabled). For some reason, I'm getting an

ERROR Invalid kernel: xc_dom_probe_bzimage_kernel unable to LZMA decompress kernel

and would like to try to just recompress it. What's a way to recompress the kernel from lzma to something like gzip instead?

Offline

#2 2010-08-15 09:04:42

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: Recompressing the stock kernel

You can just check the kernel config to see if its enabled, you know?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2010-08-15 09:19:33

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Recompressing the stock kernel

ngoonee wrote:

You can just check the kernel config to see if its enabled, you know?

Like this

zgrep -i CONFIG_HZ /proc/config.gz

Just use your search term instead of CONFIG_HZ.

Offline

#4 2010-08-15 13:20:02

anonova
Member
Registered: 2009-07-22
Posts: 23

Re: Recompressing the stock kernel

Thanks, paravirtualized guest support seems to be enabled.

# zgrep -i CONFIG_PARAVIRT_GUEST /proc/config.gz
CONFIG_PARAVIRT_GUEST=y

Any idea how to recompress the kernel now?

Offline

#5 2010-08-15 13:41:27

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Recompressing the stock kernel

If you need to recompress the kernel, you'll need to recompile it. The kernel isn't compressed as a normal lzma or gzip archive is as there's special requirements.

Offline

#6 2010-08-15 13:43:44

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Recompressing the stock kernel

Use 'file' to check:

[karol@black boot]$ file kernel26.img 
kernel26.img: gzip compressed data, from Unix, last modified: Fri Aug 13 09:30:03 2010, max compression
[karol@black boot]$ file vmlinuz26 
vmlinuz26: Linux kernel x86 boot executable bzImage, version 2.6.34-ARCH (thomas@evey) #1 SM, RO-rootFS, swap_dev 0x1, Normal VGA

You can recompress your kernel26.img if you like.

[karol@black ~]$ tail -7 /etc/mkinitcpio.conf 
# COMPRESSION
# Use this to compress the initramfs image. With kernels earlier than
# 2.6.30, only gzip is supported, which is also the default. Newer kernels
# support gzip, bzip2 and lzma.
COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"

Last edited by karol (2010-08-15 13:46:16)

Offline

#7 2010-08-15 14:00:27

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Recompressing the stock kernel

kernel26.img is not the kernel. Changing the compression on it will have zero effect.

Offline

#8 2010-08-15 14:04:31

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Recompressing the stock kernel

falconindy wrote:

kernel26.img is not the kernel. Changing the compression on it will have zero effect.

I know it's not the kernel, I'm a bit confused about that re-compressing and I'm trying to guess what the OP might want to check instead.

Offline

#9 2010-08-15 14:27:34

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Recompressing the stock kernel

Seems more likely that the hypervisor is having issues decompressing an lzma kernel and the OP wants to try and use a more widely used compression algorithm. Hence, recompile the kernel.

Last edited by falconindy (2010-08-15 14:27:56)

Offline

#10 2010-08-15 14:57:56

anonova
Member
Registered: 2009-07-22
Posts: 23

Re: Recompressing the stock kernel

Sorry if the reasoning for recompressing the kernel is vague. I've been having quite some trouble getting Arch to boot under Xen and have resorted to just throwing things and seeing what sticks. I came across this Japanese blog entry with the same error, and with only, "...LZMA compressed kernel (CONFIG_KERNEL_LZMA) Does not support. ...gzip compressed kernel (CONFIG_KERNEL_GZIP) only seems to boot" (machine translation), to go by, I decided to try it.

I'm going to try to use ABS to compile the kernel, so to make sure, all I have to do is change in config.x86_64 is

# CONFIG_KERNEL_GZIP is not set
CONFIG_KERNEL_LZMA=y

to

CONFIG_KERNEL_GZIP=y
#CONFIG_KERNEL_LZMA=y

Offline

#11 2010-08-15 14:59:50

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Recompressing the stock kernel

'#CONFIG_KERNEL_LZMA is not set' - just to be safe :-)

Offline

#12 2010-08-15 15:01:55

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Recompressing the stock kernel

unset CONFIG_KERNEL_LZMA, or you're going to have a conflict (and I don't know how that's handled, nor do I want to know).

It's probably a lot easier to just use 'make menuconfig' which should be commented out in the PKGBUILD in ABS. You'll find the option under:

General Setup --->
    Kernel Compression Mode (LZMA)

Offline

#13 2010-08-15 18:42:20

anonova
Member
Registered: 2009-07-22
Posts: 23

Re: Recompressing the stock kernel

falconindy, thanks for suggesting menuconfig. That way I didn't have to mess with the checksums.

I successfully compiled and booted with the gzipped kernel! Thanks, everyone, for all the help.

Offline

#14 2010-08-15 18:43:00

anonova
Member
Registered: 2009-07-22
Posts: 23

Re: Recompressing the stock kernel

[duplicate post]

Last edited by anonova (2010-08-15 18:44:11)

Offline

#15 2010-08-15 19:08:11

djgera
Developer
From: Buenos Aires - Argentina
Registered: 2008-12-24
Posts: 723
Website

Re: Recompressing the stock kernel

Maybe for your purpose, can use the provided uncompressed kernel ELF that is at /usr/src/linux-2.6.34-ARCH/vmlinux

Offline

#16 2010-08-15 19:57:03

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Recompressing the stock kernel

djgera wrote:

Maybe for your purpose, can use the provided uncompressed kernel ELF that is at /usr/src/linux-2.6.34-ARCH/vmlinux

This isn't actually a bootable kernel. It's missing some necessary headers that are packed onto it before compression.

Offline

#17 2010-08-15 23:39:13

djgera
Developer
From: Buenos Aires - Argentina
Registered: 2008-12-24
Posts: 723
Website

Re: Recompressing the stock kernel

falconindy wrote:
djgera wrote:

Maybe for your purpose, can use the provided uncompressed kernel ELF that is at /usr/src/linux-2.6.34-ARCH/vmlinux

This isn't actually a bootable kernel. It's missing some necessary headers that are packed onto it before compression.

Sure, not booteable for normal system, but is usable for some Xen purposes ( http://wiki.xensource.com/xenwiki/XenParavirtOps ). Please fix me if I am wrong.

Offline

#18 2010-08-15 23:59:14

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Recompressing the stock kernel

Looks like you're spot on. My mistake.

Offline

Board footer

Powered by FluxBB