I'm just curious, how to compress latest (2.6.32 at time of writing) kernel using UPX?
It worked well for older kernels but now repacked with UPX kernel fails to boot, standard compression methods (gzip, bzip2, lzma) work fine though.
I'm just curious, how to compress latest (2.6.32 at time of writing) kernel using UPX?
It worked well for older kernels but now repacked with UPX kernel fails to boot, standard compression methods (gzip, bzip2, lzma) work fine though.
Should be related with some config options from kernel.
$ zcat /proc/config.gz | grep -i lzma
CONFIG_HAVE_KERNEL_LZMA=y
<p>CONFIG_DECOMPRESS_LZMA=y</p>
Check your config in General Setup tab from kernel
I was able to compress Linux kernel 2.6.33.0 i386 bzImage and boot it with qemu-system-i386. Details:
make bzImage using the default CONFIG_KERNEL_GZIP=y in .config.upx.CONFIG_KERNEL_GZIP=y:
upx -f --no-lzma --best arch/x86/boot/bzImage -o bzImage.nolzma.upx
upx -f --lzma --best arch/x86/boot/bzImage -o bzImage.lzma.upx
bzImage files successfully using qemu-system-i386 version 2.11.1:
qemu-system-i386 -kernel bzImage.nolzma.upx -initrd ... ...
upx --no-lzma) decompression.vmlinux: 2 268 129 bytes including symbols (i386 ELF-32 executable, uncompressed, not stripped, not bootable by qemu-system-i386)
bzImage.nolzma.upx: 805 200 bytes (UPX NRV compression, bootable)bzImage.lzma.upx: 726 608 bytes (UPX LZMA compression, bootable)arch/x86/boot/bzImage: 857 264 bytes (gzip CONFIG_KERNEL_GZIP=y compression, bootable)arch/x86/boot/bzImage.lzma: 728 896 bytes (LZMA CONFIG_KERNEL_LZMA=y compression, bootable)