ar71xx: fix legacy image build error
[openwrt/openwrt.git] / target / linux / generic / patches-4.1 / 230-openwrt_lzma_options.patch
1 --- a/scripts/Makefile.lib
2 +++ b/scripts/Makefile.lib
3 @@ -324,7 +324,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^)
4
5 quiet_cmd_lzma = LZMA $@
6 cmd_lzma = (cat $(filter-out FORCE,$^) | \
7 - lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
8 + lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
9 (rm -f $@ ; false)
10
11 quiet_cmd_lzo = LZO $@
12 --- a/scripts/gen_initramfs_list.sh
13 +++ b/scripts/gen_initramfs_list.sh
14 @@ -226,7 +226,7 @@ cpio_list=
15 output="/dev/stdout"
16 output_file=""
17 is_cpio_compressed=
18 -compr="gzip -n -9 -f"
19 +compr="gzip -n -9 -f -"
20
21 arg="$1"
22 case "$arg" in
23 @@ -242,13 +242,13 @@ case "$arg" in
24 output=${cpio_list}
25 echo "$output_file" | grep -q "\.gz$" \
26 && [ -x "`which gzip 2> /dev/null`" ] \
27 - && compr="gzip -n -9 -f"
28 + && compr="gzip -n -9 -f -"
29 echo "$output_file" | grep -q "\.bz2$" \
30 && [ -x "`which bzip2 2> /dev/null`" ] \
31 - && compr="bzip2 -9 -f"
32 + && compr="bzip2 -9 -f -"
33 echo "$output_file" | grep -q "\.lzma$" \
34 && [ -x "`which lzma 2> /dev/null`" ] \
35 - && compr="lzma -9 -f"
36 + && compr="lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so"
37 echo "$output_file" | grep -q "\.xz$" \
38 && [ -x "`which xz 2> /dev/null`" ] \
39 && compr="xz --check=crc32 --lzma2=dict=1MiB"
40 @@ -315,7 +315,7 @@ if [ ! -z ${output_file} ]; then
41 if [ "${is_cpio_compressed}" = "compressed" ]; then
42 cat ${cpio_tfile} > ${output_file}
43 else
44 - (cat ${cpio_tfile} | ${compr} - > ${output_file}) \
45 + (cat ${cpio_tfile} | ${compr} > ${output_file}) \
46 || (rm -f ${output_file} ; false)
47 fi
48 [ -z ${cpio_file} ] && rm ${cpio_tfile}
49 --- a/lib/decompress.c
50 +++ b/lib/decompress.c
51 @@ -48,6 +48,7 @@ static const struct compress_format comp
52 { {0x1f, 0x9e}, "gzip", gunzip },
53 { {0x42, 0x5a}, "bzip2", bunzip2 },
54 { {0x5d, 0x00}, "lzma", unlzma },
55 + { {0x6d, 0x00}, "lzma-openwrt", unlzma },
56 { {0xfd, 0x37}, "xz", unxz },
57 { {0x89, 0x4c}, "lzo", unlzo },
58 { {0x02, 0x21}, "lz4", unlz4 },