[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230306030305.15595-5-kernelfans@gmail.com>
Date: Mon, 6 Mar 2023 11:03:03 +0800
From: Pingfan Liu <kernelfans@...il.com>
To: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: Pingfan Liu <kernelfans@...il.com>,
Ard Biesheuvel <ardb@...nel.org>, kexec@...ts.infradead.org
Subject: [PATCH 4/6] lib/decompress: Keep decompress routines based on selection
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@...il.com>
Cc: Ard Biesheuvel <ardb@...nel.org>
Cc: kexec@...ts.infradead.org
To: linux-kernel@...r.kernel.org
---
include/linux/decompress/mm.h | 9 ++++++++-
lib/decompress.c | 5 +++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h
index 9192986b1a73..33d8fd13a5c6 100644
--- a/include/linux/decompress/mm.h
+++ b/include/linux/decompress/mm.h
@@ -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 */
diff --git a/lib/decompress.c b/lib/decompress.c
index 8dd6f87e885f..33f097fe4b51 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -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;
--
2.31.1
Powered by blists - more mailing lists