Commit f9b493ac authored by Kyungsik Lee's avatar Kyungsik Lee Committed by Linus Torvalds

arm: add support for LZ4-compressed kernel

Integrates the LZ4 decompression code to the arm pre-boot code.
Signed-off-by: default avatarKyungsik Lee <kyungsik.lee@lge.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Florian Fainelli <florian@openwrt.org>
Cc: Yann Collet <yann.collet.73@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e76e1fdf
...@@ -657,8 +657,9 @@ Protocol: 2.08+ ...@@ -657,8 +657,9 @@ Protocol: 2.08+
uncompressed data should be determined using the standard magic uncompressed data should be determined using the standard magic
numbers. The currently supported compression formats are gzip numbers. The currently supported compression formats are gzip
(magic numbers 1F 8B or 1F 9E), bzip2 (magic number 42 5A), LZMA (magic numbers 1F 8B or 1F 9E), bzip2 (magic number 42 5A), LZMA
(magic number 5D 00), and XZ (magic number FD 37). The uncompressed (magic number 5D 00), XZ (magic number FD 37), and LZ4 (magic number
payload is currently always ELF (magic number 7F 45 4C 46). 02 21). The uncompressed payload is currently always ELF (magic
number 7F 45 4C 46).
Field name: payload_length Field name: payload_length
Type: read Type: read
......
...@@ -41,6 +41,7 @@ config ARM ...@@ -41,6 +41,7 @@ config ARM
select HAVE_IDE if PCI || ISA || PCMCIA select HAVE_IDE if PCI || ISA || PCMCIA
select HAVE_IRQ_TIME_ACCOUNTING select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_KERNEL_GZIP select HAVE_KERNEL_GZIP
select HAVE_KERNEL_LZ4
select HAVE_KERNEL_LZMA select HAVE_KERNEL_LZMA
select HAVE_KERNEL_LZO select HAVE_KERNEL_LZO
select HAVE_KERNEL_XZ select HAVE_KERNEL_XZ
......
...@@ -6,6 +6,7 @@ piggy.gzip ...@@ -6,6 +6,7 @@ piggy.gzip
piggy.lzo piggy.lzo
piggy.lzma piggy.lzma
piggy.xzkern piggy.xzkern
piggy.lz4
vmlinux vmlinux
vmlinux.lds vmlinux.lds
......
...@@ -91,6 +91,7 @@ suffix_$(CONFIG_KERNEL_GZIP) = gzip ...@@ -91,6 +91,7 @@ suffix_$(CONFIG_KERNEL_GZIP) = gzip
suffix_$(CONFIG_KERNEL_LZO) = lzo suffix_$(CONFIG_KERNEL_LZO) = lzo
suffix_$(CONFIG_KERNEL_LZMA) = lzma suffix_$(CONFIG_KERNEL_LZMA) = lzma
suffix_$(CONFIG_KERNEL_XZ) = xzkern suffix_$(CONFIG_KERNEL_XZ) = xzkern
suffix_$(CONFIG_KERNEL_LZ4) = lz4
# Borrowed libfdt files for the ATAG compatibility mode # Borrowed libfdt files for the ATAG compatibility mode
...@@ -115,7 +116,7 @@ targets := vmlinux vmlinux.lds \ ...@@ -115,7 +116,7 @@ targets := vmlinux vmlinux.lds \
font.o font.c head.o misc.o $(OBJS) font.o font.c head.o misc.o $(OBJS)
# Make sure files are removed during clean # Make sure files are removed during clean
extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern \ extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \
lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) \ lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) \
hyp-stub.S hyp-stub.S
......
...@@ -51,6 +51,10 @@ extern char * strstr(const char * s1, const char *s2); ...@@ -51,6 +51,10 @@ extern char * strstr(const char * s1, const char *s2);
#include "../../../../lib/decompress_unxz.c" #include "../../../../lib/decompress_unxz.c"
#endif #endif
#ifdef CONFIG_KERNEL_LZ4
#include "../../../../lib/decompress_unlz4.c"
#endif
int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
{ {
return decompress(input, len, NULL, NULL, output, NULL, error); return decompress(input, len, NULL, NULL, output, NULL, error);
......
.section .piggydata,#alloc
.globl input_data
input_data:
.incbin "arch/arm/boot/compressed/piggy.lz4"
.globl input_data_end
input_data_end:
...@@ -65,6 +65,7 @@ config X86 ...@@ -65,6 +65,7 @@ config X86
select HAVE_KERNEL_LZMA select HAVE_KERNEL_LZMA
select HAVE_KERNEL_XZ select HAVE_KERNEL_XZ
select HAVE_KERNEL_LZO select HAVE_KERNEL_LZO
select HAVE_KERNEL_LZ4
select HAVE_HW_BREAKPOINT select HAVE_HW_BREAKPOINT
select HAVE_MIXED_BREAKPOINTS_REGS select HAVE_MIXED_BREAKPOINTS_REGS
select PERF_EVENTS select PERF_EVENTS
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
# create a compressed vmlinux image from the original vmlinux # create a compressed vmlinux image from the original vmlinux
# #
targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
KBUILD_CFLAGS += -fno-strict-aliasing -fPIC KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
...@@ -63,12 +64,15 @@ $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE ...@@ -63,12 +64,15 @@ $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
$(call if_changed,xzkern) $(call if_changed,xzkern)
$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
$(call if_changed,lzo) $(call if_changed,lzo)
$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
$(call if_changed,lz4)
suffix-$(CONFIG_KERNEL_GZIP) := gz suffix-$(CONFIG_KERNEL_GZIP) := gz
suffix-$(CONFIG_KERNEL_BZIP2) := bz2 suffix-$(CONFIG_KERNEL_BZIP2) := bz2
suffix-$(CONFIG_KERNEL_LZMA) := lzma suffix-$(CONFIG_KERNEL_LZMA) := lzma
suffix-$(CONFIG_KERNEL_XZ) := xz suffix-$(CONFIG_KERNEL_XZ) := xz
suffix-$(CONFIG_KERNEL_LZO) := lzo suffix-$(CONFIG_KERNEL_LZO) := lzo
suffix-$(CONFIG_KERNEL_LZ4) := lz4
quiet_cmd_mkpiggy = MKPIGGY $@ quiet_cmd_mkpiggy = MKPIGGY $@
cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false )
......
...@@ -145,6 +145,10 @@ static int lines, cols; ...@@ -145,6 +145,10 @@ static int lines, cols;
#include "../../../../lib/decompress_unlzo.c" #include "../../../../lib/decompress_unlzo.c"
#endif #endif
#ifdef CONFIG_KERNEL_LZ4
#include "../../../../lib/decompress_unlz4.c"
#endif
static void scroll(void) static void scroll(void)
{ {
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment