1
0

230-openwrt_lzma_options.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. From b3d00b452467f621317953d9e4c6f9ae8dcfd271 Mon Sep 17 00:00:00 2001
  2. From: Imre Kaloz <kaloz@openwrt.org>
  3. Date: Fri, 7 Jul 2017 17:06:55 +0200
  4. Subject: use the librecmc lzma options for now
  5. lede-commit: 548de949f392049420a6a1feeef118b30ab8ea8c
  6. Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
  7. ---
  8. lib/decompress.c | 1 +
  9. scripts/Makefile.lib | 2 +-
  10. scripts/gen_initramfs_list.sh | 10 +++++-----
  11. 3 files changed, 7 insertions(+), 6 deletions(-)
  12. --- a/lib/decompress.c
  13. +++ b/lib/decompress.c
  14. @@ -49,6 +49,7 @@ static const struct compress_format comp
  15. { {0x1f, 0x9e}, "gzip", gunzip },
  16. { {0x42, 0x5a}, "bzip2", bunzip2 },
  17. { {0x5d, 0x00}, "lzma", unlzma },
  18. + { {0x6d, 0x00}, "lzma-librecmc", unlzma },
  19. { {0xfd, 0x37}, "xz", unxz },
  20. { {0x89, 0x4c}, "lzo", unlzo },
  21. { {0x02, 0x21}, "lz4", unlz4 },
  22. --- a/scripts/Makefile.lib
  23. +++ b/scripts/Makefile.lib
  24. @@ -348,7 +348,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^)
  25. quiet_cmd_lzma = LZMA $@
  26. cmd_lzma = (cat $(filter-out FORCE,$^) | \
  27. - lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
  28. + lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
  29. (rm -f $@ ; false)
  30. quiet_cmd_lzo = LZO $@
  31. --- a/scripts/gen_initramfs_list.sh
  32. +++ b/scripts/gen_initramfs_list.sh
  33. @@ -229,7 +229,7 @@ cpio_list=
  34. output="/dev/stdout"
  35. output_file=""
  36. is_cpio_compressed=
  37. -compr="gzip -n -9 -f"
  38. +compr="gzip -n -9 -f -"
  39. arg="$1"
  40. case "$arg" in
  41. @@ -245,13 +245,13 @@ case "$arg" in
  42. output=${cpio_list}
  43. echo "$output_file" | grep -q "\.gz$" \
  44. && [ -x "`which gzip 2> /dev/null`" ] \
  45. - && compr="gzip -n -9 -f"
  46. + && compr="gzip -n -9 -f -"
  47. echo "$output_file" | grep -q "\.bz2$" \
  48. && [ -x "`which bzip2 2> /dev/null`" ] \
  49. - && compr="bzip2 -9 -f"
  50. + && compr="bzip2 -9 -f -"
  51. echo "$output_file" | grep -q "\.lzma$" \
  52. && [ -x "`which lzma 2> /dev/null`" ] \
  53. - && compr="lzma -9 -f"
  54. + && compr="lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so"
  55. echo "$output_file" | grep -q "\.xz$" \
  56. && [ -x "`which xz 2> /dev/null`" ] \
  57. && compr="xz --check=crc32 --lzma2=dict=1MiB"
  58. @@ -320,7 +320,7 @@ if [ ! -z ${output_file} ]; then
  59. if [ "${is_cpio_compressed}" = "compressed" ]; then
  60. cat ${cpio_tfile} > ${output_file}
  61. else
  62. - (cat ${cpio_tfile} | ${compr} - > ${output_file}) \
  63. + (cat ${cpio_tfile} | ${compr} > ${output_file}) \
  64. || (rm -f ${output_file} ; false)
  65. fi
  66. [ -z ${cpio_file} ] && rm ${cpio_tfile}