diff options
| author | Lasse Collin <lasse.collin@tukaani.org> | 2011-01-12 20:01:23 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 11:03:25 -0500 |
| commit | 3ebe12439ba7fc62e1d6ecb569b7287771716ca1 (patch) | |
| tree | 65945a63ad1474489d80c8ca1fb1c1c8091fb7a2 /usr | |
| parent | 24fa0402a9b6a537e87e38341e78b7da86486846 (diff) | |
decompressors: add boot-time XZ support
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 <lasse.collin@tukaani.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Alain Knaff <alain@knaff.lu>
Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'usr')
| -rw-r--r-- | usr/Kconfig | 18 | ||||
| -rw-r--r-- | usr/Makefile | 5 |
2 files changed, 22 insertions, 1 deletions
diff --git a/usr/Kconfig b/usr/Kconfig index c2c7fe2f717..4780deac597 100644 --- a/usr/Kconfig +++ b/usr/Kconfig | |||
| @@ -72,6 +72,15 @@ config RD_LZMA | |||
| 72 | Support loading of a LZMA encoded initial ramdisk or cpio buffer | 72 | Support loading of a LZMA encoded initial ramdisk or cpio buffer |
| 73 | If unsure, say N. | 73 | If unsure, say N. |
| 74 | 74 | ||
| 75 | config RD_XZ | ||
| 76 | bool "Support initial ramdisks compressed using XZ" if EMBEDDED | ||
| 77 | default !EMBEDDED | ||
| 78 | depends on BLK_DEV_INITRD | ||
| 79 | select DECOMPRESS_XZ | ||
| 80 | help | ||
| 81 | Support loading of a XZ encoded initial ramdisk or cpio buffer. | ||
| 82 | If unsure, say N. | ||
| 83 | |||
| 75 | config RD_LZO | 84 | config RD_LZO |
| 76 | bool "Support initial ramdisks compressed using LZO" if EMBEDDED | 85 | bool "Support initial ramdisks compressed using LZO" if EMBEDDED |
| 77 | default !EMBEDDED | 86 | default !EMBEDDED |
| @@ -139,6 +148,15 @@ config INITRAMFS_COMPRESSION_LZMA | |||
| 139 | three. Compression is slowest. The initramfs size is about 33% | 148 | three. Compression is slowest. The initramfs size is about 33% |
| 140 | smaller with LZMA in comparison to gzip. | 149 | smaller with LZMA in comparison to gzip. |
| 141 | 150 | ||
| 151 | config INITRAMFS_COMPRESSION_XZ | ||
| 152 | bool "XZ" | ||
| 153 | depends on RD_XZ | ||
| 154 | help | ||
| 155 | XZ uses the LZMA2 algorithm. The initramfs size is about 30% | ||
| 156 | smaller with XZ in comparison to gzip. Decompression speed | ||
| 157 | is better than that of bzip2 but worse than gzip and LZO. | ||
| 158 | Compression is slow. | ||
| 159 | |||
| 142 | config INITRAMFS_COMPRESSION_LZO | 160 | config INITRAMFS_COMPRESSION_LZO |
| 143 | bool "LZO" | 161 | bool "LZO" |
| 144 | depends on RD_LZO | 162 | depends on RD_LZO |
diff --git a/usr/Makefile b/usr/Makefile index 6faa444b708..029ffe6cd0d 100644 --- a/usr/Makefile +++ b/usr/Makefile | |||
| @@ -15,6 +15,9 @@ suffix_$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) = .bz2 | |||
| 15 | # Lzma | 15 | # Lzma |
| 16 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA) = .lzma | 16 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA) = .lzma |
| 17 | 17 | ||
| 18 | # XZ | ||
| 19 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_XZ) = .xz | ||
| 20 | |||
| 18 | # Lzo | 21 | # Lzo |
| 19 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZO) = .lzo | 22 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZO) = .lzo |
| 20 | 23 | ||
| @@ -50,7 +53,7 @@ endif | |||
| 50 | quiet_cmd_initfs = GEN $@ | 53 | quiet_cmd_initfs = GEN $@ |
| 51 | cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) | 54 | cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) |
| 52 | 55 | ||
| 53 | targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 initramfs_data.cpio.lzma initramfs_data.cpio.lzo initramfs_data.cpio | 56 | targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 initramfs_data.cpio.lzma initramfs_data.cpio.xz initramfs_data.cpio.lzo initramfs_data.cpio |
| 54 | # do not try to update files included in initramfs | 57 | # do not try to update files included in initramfs |
| 55 | $(deps_initramfs): ; | 58 | $(deps_initramfs): ; |
| 56 | 59 | ||
