source: trunk/target/linux/generic/patches-3.0/006-arm_kernel_xz_support.patch @ 27518

Last change on this file since 27518 was 27518, checked in by kaloz, 5 years ago

[generic/3.0]: add support for and switch to XZ compressed kernels on ARM

File size: 3.6 KB
  • arch/arm/Kconfig

    From 2d303b4683145f7dbc918bd14d04e1396581b2ce Mon Sep 17 00:00:00 2001
    From: Imre Kaloz <kaloz@openwrt.org>
    Date: Thu, 7 Jul 2011 12:05:21 +0200
    Subject: [PATCH] ARM: support XZ compressed kernels
    
    Wire up support for the XZ decompressor
    
    Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
    ---
     arch/arm/Kconfig                        |    1 +
     arch/arm/boot/compressed/Makefile       |   11 +++++++++--
     arch/arm/boot/compressed/decompress.c   |    4 ++++
     arch/arm/boot/compressed/piggy.xzkern.S |    6 ++++++
     lib/xz/xz_dec_stream.c                  |    1 +
     5 files changed, 21 insertions(+), 2 deletions(-)
     create mode 100644 arch/arm/boot/compressed/piggy.xzkern.S
    
    diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
    index c2e5f3d..489fe16 100644
    a b config ARM 
    2020        select HAVE_KERNEL_GZIP 
    2121        select HAVE_KERNEL_LZO 
    2222        select HAVE_KERNEL_LZMA 
     23        select HAVE_KERNEL_XZ 
    2324        select HAVE_IRQ_WORK 
    2425        select HAVE_PERF_EVENTS 
    2526        select PERF_USE_VMALLOC 
  • arch/arm/boot/compressed/Makefile

    diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
    index 23aad07..e5db34e 100644
    a b SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ 
    8282suffix_$(CONFIG_KERNEL_GZIP) = gzip 
    8383suffix_$(CONFIG_KERNEL_LZO)  = lzo 
    8484suffix_$(CONFIG_KERNEL_LZMA) = lzma 
     85suffix_$(CONFIG_KERNEL_XZ)   = xzkern 
    8586 
    8687targets       := vmlinux vmlinux.lds \ 
    8788                 piggy.$(suffix_y) piggy.$(suffix_y).o \ 
    8889                 font.o font.c head.o misc.o $(OBJS) 
    8990 
    9091# Make sure files are removed during clean 
    91 extra-y       += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S 
     92extra-y       += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern lib1funcs.S ashldi3.S 
    9293 
    9394ifeq ($(CONFIG_FUNCTION_TRACER),y) 
    9495ORIG_CFLAGS := $(KBUILD_CFLAGS) 
    bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \ 
    133134  ( echo "following symbols must have non local/private scope:" >&2; \ 
    134135    echo "$$bad_syms" >&2; rm -f $@; false ) 
    135136 
     137# For __aeabi_llsl 
     138ashldi3 = $(obj)/ashldi3.o 
     139 
     140$(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S FORCE 
     141        $(call cmd,shipped) 
     142 
    136143$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ 
    137                 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE 
     144                $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) FORCE 
    138145        $(call if_changed,ld) 
    139146        @$(check_for_bad_syms) 
    140147 
  • arch/arm/boot/compressed/decompress.c

    diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
    index 07be5a2..0ecd8b4 100644
    a b extern void error(char *); 
    4444#include "../../../../lib/decompress_unlzma.c" 
    4545#endif 
    4646 
     47#ifdef CONFIG_KERNEL_XZ 
     48#include "../../../../lib/decompress_unxz.c" 
     49#endif 
     50 
    4751int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) 
    4852{ 
    4953        return decompress(input, len, NULL, NULL, output, NULL, error); 
  • new file arch/arm/boot/compressed/piggy.xzkern.S

    diff --git a/arch/arm/boot/compressed/piggy.xzkern.S b/arch/arm/boot/compressed/piggy.xzkern.S
    new file mode 100644
    index 0000000..5703f30
    - +  
     1        .section .piggydata,#alloc 
     2        .globl  input_data 
     3input_data: 
     4        .incbin "arch/arm/boot/compressed/piggy.xzkern" 
     5        .globl  input_data_end 
     6input_data_end: 
  • lib/xz/xz_dec_stream.c

    diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
    index ac809b1..9a60cc2 100644
    a b  
    99 
    1010#include "xz_private.h" 
    1111#include "xz_stream.h" 
     12#include <linux/kernel.h> 
    1213 
    1314/* Hash used to validate the Index field */ 
    1415struct xz_dec_hash { 
Note: See TracBrowser for help on using the repository browser.