053-lzo_compression_for_initramfs.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. --- a/lib/Kconfig
  2. +++ b/lib/Kconfig
  3. @@ -126,6 +126,10 @@ config DECOMPRESS_LZMA
  4. config DECOMPRESS_LZMA_NEEDED
  5. boolean
  6. +config DECOMPRESS_LZO
  7. + select LZO_DECOMPRESS
  8. + tristate
  9. +
  10. #
  11. # Generic allocator support is selected if needed
  12. #
  13. --- a/lib/Makefile
  14. +++ b/lib/Makefile
  15. @@ -81,6 +81,7 @@ obj-$(CONFIG_LZMA_DECOMPRESS) += lzma/
  16. lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o
  17. lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o
  18. lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
  19. +lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o
  20. obj-$(CONFIG_TEXTSEARCH) += textsearch.o
  21. obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o
  22. --- a/lib/decompress.c
  23. +++ b/lib/decompress.c
  24. @@ -9,6 +9,7 @@
  25. #include <linux/decompress/bunzip2.h>
  26. #include <linux/decompress/unlzma.h>
  27. #include <linux/decompress/inflate.h>
  28. +#include <linux/decompress/unlzo.h>
  29. #include <linux/types.h>
  30. #include <linux/string.h>
  31. @@ -22,6 +23,9 @@
  32. #ifndef CONFIG_DECOMPRESS_LZMA
  33. # define unlzma NULL
  34. #endif
  35. +#ifndef CONFIG_DECOMPRESS_LZO
  36. +# define unlzo NULL
  37. +#endif
  38. static const struct compress_format {
  39. unsigned char magic[2];
  40. @@ -32,6 +36,7 @@ static const struct compress_format {
  41. { {037, 0236}, "gzip", gunzip },
  42. { {0x42, 0x5a}, "bzip2", bunzip2 },
  43. { {0x5d, 0x00}, "lzma", unlzma },
  44. + { {0x89, 0x4c}, "lzo", unlzo },
  45. { {0, 0}, NULL, NULL }
  46. };
  47. --- a/usr/Kconfig
  48. +++ b/usr/Kconfig
  49. @@ -72,6 +72,15 @@ config RD_LZMA
  50. Support loading of a LZMA encoded initial ramdisk or cpio buffer
  51. If unsure, say N.
  52. +config RD_LZO
  53. + bool "Support initial ramdisks compressed using LZO" if EMBEDDED
  54. + default !EMBEDDED
  55. + depends on BLK_DEV_INITRD && HAVE_KERNEL_LZO
  56. + select DECOMPRESS_LZO
  57. + help
  58. + Support loading of a LZO encoded initial ramdisk or cpio buffer
  59. + If unsure, say N.
  60. +
  61. choice
  62. prompt "Built-in initramfs compression mode" if INITRAMFS_SOURCE!=""
  63. help
  64. @@ -108,16 +117,15 @@ config INITRAMFS_COMPRESSION_GZIP
  65. bool "Gzip"
  66. depends on RD_GZIP
  67. help
  68. - The old and tried gzip compression. Its compression ratio is
  69. - the poorest among the 3 choices; however its speed (both
  70. - compression and decompression) is the fastest.
  71. + The old and tried gzip compression. It provides a good balance
  72. + between compression ratio and decompression speed.
  73. config INITRAMFS_COMPRESSION_BZIP2
  74. bool "Bzip2"
  75. depends on RD_BZIP2
  76. help
  77. Its compression ratio and speed is intermediate.
  78. - Decompression speed is slowest among the three. The initramfs
  79. + Decompression speed is slowest among the four. The initramfs
  80. size is about 10% smaller with bzip2, in comparison to gzip.
  81. Bzip2 uses a large amount of memory. For modern kernels you
  82. will need at least 8MB RAM or more for booting.
  83. @@ -128,7 +136,15 @@ config INITRAMFS_COMPRESSION_LZMA
  84. help
  85. The most recent compression algorithm.
  86. Its ratio is best, decompression speed is between the other
  87. - two. Compression is slowest. The initramfs size is about 33%
  88. + three. Compression is slowest. The initramfs size is about 33%
  89. smaller with LZMA in comparison to gzip.
  90. +config INITRAMFS_COMPRESSION_LZO
  91. + bool "LZO"
  92. + depends on RD_LZO
  93. + help
  94. + Its compression ratio is the poorest among the four. The kernel
  95. + size is about about 10% bigger than gzip; however its speed
  96. + (both compression and decompression) is the fastest.
  97. +
  98. endchoice