2
0

222-arm_zimage_none.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. ARM: implement "uncompressed zImage"
  2. Based on RFC patch by Uwe Kleine-König
  3. http://www.spinics.net/lists/arm-kernel/msg230153.html
  4. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5. ---
  6. --- a/arch/arm/boot/compressed/Makefile
  7. +++ b/arch/arm/boot/compressed/Makefile
  8. @@ -71,6 +71,7 @@ suffix_$(CONFIG_KERNEL_LZO) = lzo
  9. suffix_$(CONFIG_KERNEL_LZMA) = lzma
  10. suffix_$(CONFIG_KERNEL_XZ) = xzkern
  11. suffix_$(CONFIG_KERNEL_LZ4) = lz4
  12. +suffix_$(CONFIG_KERNEL_CAT) = cat
  13. # Borrowed libfdt files for the ATAG compatibility mode
  14. @@ -95,7 +96,7 @@ targets := vmlinux vmlinux.lds \
  15. bswapsdi2.S font.o font.c head.o misc.o $(OBJS)
  16. # Make sure files are removed during clean
  17. -extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \
  18. +extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 piggy.cat \
  19. lib1funcs.S ashldi3.S bswapsdi2.S $(libfdt) $(libfdt_hdrs) \
  20. hyp-stub.S
  21. --- a/arch/arm/boot/compressed/decompress.c
  22. +++ b/arch/arm/boot/compressed/decompress.c
  23. @@ -55,6 +55,10 @@ extern char * strstr(const char * s1, co
  24. #include "../../../../lib/decompress_unlz4.c"
  25. #endif
  26. +#ifdef CONFIG_KERNEL_CAT
  27. +#include "../../../../lib/decompress_uncat.c"
  28. +#endif
  29. +
  30. int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
  31. {
  32. return __decompress(input, len, NULL, NULL, output, 0, NULL, error);
  33. --- /dev/null
  34. +++ b/arch/arm/boot/compressed/piggy.cat.S
  35. @@ -0,0 +1,6 @@
  36. + .section .piggydata,#alloc
  37. + .globl input_data
  38. +input_data:
  39. + .incbin "arch/arm/boot/compressed/piggy.cat"
  40. + .globl input_data_end
  41. +input_data_end:
  42. --- a/init/Kconfig
  43. +++ b/init/Kconfig
  44. @@ -115,6 +115,9 @@ config HAVE_KERNEL_LZO
  45. config HAVE_KERNEL_LZ4
  46. bool
  47. +config HAVE_KERNEL_CAT
  48. + bool
  49. +
  50. choice
  51. prompt "Kernel compression mode"
  52. default KERNEL_GZIP
  53. @@ -181,9 +184,10 @@ config KERNEL_LZO
  54. bool "LZO"
  55. depends on HAVE_KERNEL_LZO
  56. help
  57. - Its compression ratio is the poorest among the choices. The kernel
  58. - size is about 10% bigger than gzip; however its speed
  59. - (both compression and decompression) is the fastest.
  60. + Its compression ratio is the poorest among the choices (apart from
  61. + uncompressed below). The kernel size is about 10% bigger than gzip;
  62. + however its speed (both compression and decompression) is the
  63. + fastest.
  64. config KERNEL_LZ4
  65. bool "LZ4"
  66. @@ -197,6 +201,12 @@ config KERNEL_LZ4
  67. is about 8% bigger than LZO. But the decompression speed is
  68. faster than LZO.
  69. +config KERNEL_CAT
  70. + bool "uncompressed"
  71. + depends on HAVE_KERNEL_CAT
  72. + help
  73. + Don't use compression at all.
  74. +
  75. endchoice
  76. config DEFAULT_HOSTNAME
  77. --- /dev/null
  78. +++ b/lib/decompress_uncat.c
  79. @@ -0,0 +1,17 @@
  80. +#include <linux/types.h>
  81. +#include <linux/compiler.h>
  82. +
  83. +#ifdef STATIC
  84. +
  85. +STATIC int __decompress(unsigned char *buf, long in_len,
  86. + long (*fill)(void*, unsigned long),
  87. + long (*flush)(void*, unsigned long),
  88. + unsigned char *output, long out_len,
  89. + long *posp,
  90. + void (*error)(char *x))
  91. +{
  92. + memmove(output, buf, in_len);
  93. + return 0;
  94. +}
  95. +
  96. +#endif
  97. --- a/scripts/Makefile.lib
  98. +++ b/scripts/Makefile.lib
  99. @@ -337,6 +337,13 @@ cmd_lz4 = (cat $(filter-out FORCE,$^) |
  100. lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
  101. (rm -f $@ ; false)
  102. +# uncompressed
  103. +# ---------------------------------------------------------------------------
  104. +quiet_cmd_cat = CAT $@
  105. +cmd_cat = (cat $(filter-out FORCE,$^) \
  106. + && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
  107. + (rm -f $@ ; false)
  108. +
  109. # U-Boot mkimage
  110. # ---------------------------------------------------------------------------
  111. --- a/arch/arm/Kconfig
  112. +++ b/arch/arm/Kconfig
  113. @@ -59,6 +59,7 @@ config ARM
  114. select HAVE_KERNEL_LZMA
  115. select HAVE_KERNEL_LZO
  116. select HAVE_KERNEL_XZ
  117. + select HAVE_KERNEL_CAT
  118. select HAVE_KPROBES if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !CPU_V7M
  119. select HAVE_KRETPROBES if (HAVE_KPROBES)
  120. select HAVE_MEMBLOCK