path: root/lib/decompress.c
AgeCommit message (Collapse)AuthorLines
2015-07-17lib/decompress: set the compressor name to NULL on errorAneesh Kumar K.V-1/+4
Without this we end up using the previous name of the compressor in the loop in unpack_rootfs. For example we get errors like "compression method gzip not configured" even when we have CONFIG_DECOMPRESS_GZIP enabled. Signed-off-by: Aneesh Kumar K.V <> Cc: "H. Peter Anvin" <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2014-12-13lib/decompress.c: consistency of compress formats for kernel imageHaesung Kim-2/+2
Magic number of compress formats for kernel image is defined by two bytes. These numbers are written in hexadecimal number, nevertheless magic number for only gunzip is written in octal number. The formats should be consistent for readability. Therefore, magic numbers for gunzip are also defined by hexadecimal number. Signed-off-by: Haesung Kim <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2014-08-08initramfs: support initramfs that is bigger than 2GiBYinghai Lu-1/+1
Now with 64bit bzImage and kexec tools, we support ramdisk that size is bigger than 2g, as we could put it above 4G. Found compressed initramfs image could not be decompressed properly. It turns out that image length is int during decompress detection, and it will become < 0 when length is more than 2G. Furthermore, during decompressing len as int is used for inbuf count, that has problem too. Change len to long, that should be ok as on 32 bit platform long is 32bits. Tested with following compressed initramfs image as root with kexec. gzip, bzip2, xz, lzma, lzop, lz4. run time for populate_rootfs(): size name Nehalem-EX Westmere-EX Ivybridge-EX 9034400256 root_img : 26s 24s 30s 3561095057 root_img.lz4 : 28s 27s 27s 3459554629 root_img.lzo : 29s 29s 28s 3219399480 root_img.gz : 64s 62s 49s 2251594592 root_img.xz : 262s 260s 183s 2226366598 root_img.lzma: 386s 376s 277s 2901482513 root_img.bz2 : 635s 599s Signed-off-by: Yinghai Lu <> Cc: "H. Peter Anvin" <> Cc: Ingo Molnar <> Cc: Rashika Kheria <> Cc: Josh Triplett <> Cc: Kyungsik Lee <> Cc: P J P <> Cc: Al Viro <> Cc: Tetsuo Handa <> Cc: "Daniel M. Weeks" <> Cc: Alexandre Courbot <> Cc: Jan Beulich <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2014-04-07initramfs: debug detected compression methodDaniel M. Weeks-0/+3
This can greatly aid in narrowing down the real source of initramfs problems such as failures related to the compression of the in-kernel initramfs when an external initramfs is in use as well. Existing errors are ambiguous as to which initramfs is a problem and why. [ use pr_debug()] Signed-off-by: Daniel M. Weeks <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2013-07-09lib: add support for LZ4-compressed kernelKyungsik Lee-0/+5
Add support for extracting LZ4-compressed kernel images, as well as LZ4-compressed ramdisk images in the kernel boot process. Signed-off-by: Kyungsik Lee <> Cc: "H. Peter Anvin" <> Cc: Ingo Molnar <> Cc: Thomas Gleixner <> Cc: Russell King <> Cc: Borislav Petkov <> Cc: Florian Fainelli <> Cc: Yann Collet <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2013-04-30lib/decompress.c: fix initconstAndi Kleen-1/+1
Signed-off-by: Andi Kleen <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2012-10-06lib/decompress.c add __init to decompress_method and dataHein Tibosch-3/+6
Fix the warning: WARNING: vmlinux.o(.text+0x14cfd8): Section mismatch in reference from the variable compressed_formats to the function .init.text:gunzip() The function compressed_formats() references the function __init gunzip(). etc.. Within decompress.c, compressed_formats[] needs 'a __initdata annotation', because some of it's data members refer to functions which will be unloaded after init. Consequently, its user decompress_method() will get the __init prefix. Signed-off-by: Hein Tibosch <> Cc: Albin Tonnerre <> Cc: Phillip Lougher <> Cc: "H. Peter Anvin" <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2011-01-13decompressors: add boot-time XZ supportLasse Collin-0/+5
This implements the API defined in <linux/decompress/generic.h> which is used for kernel, initramfs, and initrd decompression. This patch together with the first patch is enough for XZ-compressed initramfs and initrd; XZ-compressed kernel will need arch-specific changes. The buffering requirements described in decompress_unxz.c are stricter than with gzip, so the relevant changes should be done to the arch-specific code when adding support for XZ-compressed kernel. Similarly, the heap size in arch-specific pre-boot code may need to be increased (30 KiB is enough). The XZ decompressor needs memmove(), memeq() (memcmp() == 0), and memzero() (memset(ptr, 0, size)), which aren't available in all arch-specific pre-boot environments. I'm including simple versions in decompress_unxz.c, but a cleaner solution would naturally be nicer. Signed-off-by: Lasse Collin <> Cc: "H. Peter Anvin" <> Cc: Alain Knaff <> Cc: Albin Tonnerre <> Cc: Phillip Lougher <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2010-01-11Add LZO compression support for initramfs and old-style initrdAlbin Tonnerre-0/+5
Signed-off-by: Albin Tonnerre <> Tested-by: Wu Zhangjin <> Acked-by: "H. Peter Anvin" <> Cc: Ingo Molnar <> Cc: Thomas Gleixner <> Tested-by: Russell King <> Acked-by: Russell King <> Cc: Ralf Baechle <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
2009-02-19bzip2/lzma: don't stop search at first unconfigured compressionAlain Knaff-1/+1
Impact: Bugfix, avoids kernels which build but panic on boot Fix a bug in decompress.c : only scanned until the first non-configured compressor (with disastrous result especially if that was gzip.) Signed-off-by: Alain Knaff <> Signed-off-by: H. Peter Anvin <>
2009-01-12bzip2/lzma: comprehensible error messages for missing decompressorH. Peter Anvin-6/+10
Instead of failing to identify a compressed image with a decompressor that we don't have compiled in, identify it and fail with a comprehensible panic message. Signed-off-by: H. Peter Anvin <>
2009-01-08bzip2/lzma: centralize format detectionH. Peter Anvin-0/+50
Centralize the compression format detection to a common routine in the lib directory, and use it for both initramfs and initrd. Signed-off-by: H. Peter Anvin <>