1 From 2d303b4683145f7dbc918bd14d04e1396581b2ce Mon Sep 17 00:00:00 2001
2 From: Imre Kaloz <kaloz@openwrt.org>
3 Date: Thu, 7 Jul 2011 12:05:21 +0200
4 Subject: [PATCH] ARM: support XZ compressed kernels
6 Wire up support for the XZ decompressor
8 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
10 arch/arm/Kconfig | 1 +
11 arch/arm/boot/compressed/Makefile | 11 +++++++++--
12 arch/arm/boot/compressed/decompress.c | 4 ++++
13 arch/arm/boot/compressed/piggy.xzkern.S | 6 ++++++
14 lib/xz/xz_dec_stream.c | 1 +
15 5 files changed, 21 insertions(+), 2 deletions(-)
16 create mode 100644 arch/arm/boot/compressed/piggy.xzkern.S
18 --- a/arch/arm/Kconfig
19 +++ b/arch/arm/Kconfig
20 @@ -20,6 +20,7 @@ config ARM
21 select HAVE_KERNEL_GZIP
22 select HAVE_KERNEL_LZO
23 select HAVE_KERNEL_LZMA
24 + select HAVE_KERNEL_XZ
26 select HAVE_PERF_EVENTS
27 select PERF_USE_VMALLOC
28 --- a/arch/arm/boot/compressed/Makefile
29 +++ b/arch/arm/boot/compressed/Makefile
30 @@ -92,6 +92,7 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/
31 suffix_$(CONFIG_KERNEL_GZIP) = gzip
32 suffix_$(CONFIG_KERNEL_LZO) = lzo
33 suffix_$(CONFIG_KERNEL_LZMA) = lzma
34 +suffix_$(CONFIG_KERNEL_XZ) = xzkern
36 # Borrowed libfdt files for the ATAG compatibility mode
38 @@ -115,7 +116,7 @@ targets := vmlinux vmlinux.lds \
39 lib1funcs.o lib1funcs.S font.o font.c head.o misc.o $(OBJS)
41 # Make sure files are removed during clean
42 -extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S $(libfdt) $(libfdt_hdrs)
43 +extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs)
45 ifeq ($(CONFIG_FUNCTION_TRACER),y)
46 ORIG_CFLAGS := $(KBUILD_CFLAGS)
47 @@ -170,8 +171,14 @@ if [ $(words $(ZRELADDR)) -gt 1 -a "$(CO
52 +ashldi3 = $(obj)/ashldi3.o
54 +$(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S FORCE
57 $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
58 - $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE
59 + $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) FORCE
60 @$(check_for_multiple_zreladdr)
62 @$(check_for_bad_syms)
63 --- a/arch/arm/boot/compressed/decompress.c
64 +++ b/arch/arm/boot/compressed/decompress.c
65 @@ -44,6 +44,10 @@ extern void error(char *);
66 #include "../../../../lib/decompress_unlzma.c"
69 +#ifdef CONFIG_KERNEL_XZ
70 +#include "../../../../lib/decompress_unxz.c"
73 int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
75 return decompress(input, len, NULL, NULL, output, NULL, error);
77 +++ b/arch/arm/boot/compressed/piggy.xzkern.S
79 + .section .piggydata,#alloc
82 + .incbin "arch/arm/boot/compressed/piggy.xzkern"
83 + .globl input_data_end
85 --- a/lib/xz/xz_dec_stream.c
86 +++ b/lib/xz/xz_dec_stream.c
89 #include "xz_private.h"
90 #include "xz_stream.h"
91 +#include <linux/kernel.h>
93 /* Hash used to validate the Index field */