@@ -92,11 +92,18 @@ MALLOC_VISIBLE void free(void *where)
#define large_malloc(a) vmalloc(a)
#define large_free(a) vfree(a)
-#define INIT __init
#define STATIC
#include <linux/init.h>
+#ifndef CONFIG_HAVE_KEXEC_DECOMPRESS
+#define INIT __init
+#else
+#define INIT
+#undef __initconst
+#define __initconst
+#endif
+
#endif /* STATIC */
#endif /* DECOMPR_MM_H */
@@ -6,6 +6,7 @@
*/
#include <linux/decompress/generic.h>
+#include <linux/decompress/mm.h>
#include <linux/decompress/bunzip2.h>
#include <linux/decompress/unlzma.h>
@@ -60,7 +61,7 @@ static const struct compress_format compressed_formats[] __initconst = {
{ {0, 0}, NULL, NULL }
};
-decompress_fn __init decompress_method(const unsigned char *inbuf, long len,
+decompress_fn INIT decompress_method(const unsigned char *inbuf, long len,
const char **name)
{
const struct compress_format *cf;
@@ -83,7 +84,7 @@ decompress_fn __init decompress_method(const unsigned char *inbuf, long len,
return cf->decompressor;
}
-decompress_fn __init decompress_method_by_name(const unsigned char *name)
+decompress_fn INIT decompress_method_by_name(const unsigned char *name)
{
const struct compress_format *cf;
At present, many decompressing routines in lib/decompress*.c are in __section(".init.text"). But they are required to decompress the kernel image when kexec file load compressed kernel. To solve this issue, define 'INIT' conditional based on the macro CONFIG_HAVE_KEXEC_DECOMPRESS. Also make lib/decompress.c adopt this way. Signed-off-by: Pingfan Liu <kernelfans@gmail.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: kexec@lists.infradead.org To: linux-kernel@vger.kernel.org --- include/linux/decompress/mm.h | 9 ++++++++- lib/decompress.c | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-)