Skip to content

Commit d4bab98

Browse files
Pingfan LiuKernel Patches Daemon
authored andcommitted
lib/decompress: Keep decompressor when CONFIG_KEEP_COMPRESSOR
The KEXE PE format parser needs the kernel built-in decompressor to decompress the kernel image. So moving the decompressor out of __init sections. Signed-off-by: Pingfan Liu <[email protected]> Cc: Andrew Morton <[email protected]> To: [email protected]
1 parent a6d3ef8 commit d4bab98

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

include/linux/decompress/mm.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,14 @@ MALLOC_VISIBLE void free(void *where)
9292
#define large_malloc(a) vmalloc(a)
9393
#define large_free(a) vfree(a)
9494

95+
#ifdef CONFIG_KEEP_DECOMPRESSOR
96+
#define INIT
97+
#define INITCONST
98+
#else
9599
#define INIT __init
100+
#define INITCONST __initconst
101+
#endif
102+
96103
#define STATIC
97104

98105
#include <linux/init.h>

lib/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ config RANDOM32_SELFTEST
165165
#
166166
# compression support is select'ed if needed
167167
#
168+
config KEEP_DECOMPRESSOR
169+
bool
170+
168171
config 842_COMPRESS
169172
select CRC32
170173
tristate

lib/decompress.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
#include <linux/decompress/generic.h>
9-
9+
#include <linux/decompress/mm.h>
1010
#include <linux/decompress/bunzip2.h>
1111
#include <linux/decompress/unlzma.h>
1212
#include <linux/decompress/unxz.h>
@@ -48,7 +48,7 @@ struct compress_format {
4848
decompress_fn decompressor;
4949
};
5050

51-
static const struct compress_format compressed_formats[] __initconst = {
51+
static const struct compress_format compressed_formats[] INITCONST = {
5252
{ {0x1f, 0x8b}, "gzip", gunzip },
5353
{ {0x1f, 0x9e}, "gzip", gunzip },
5454
{ {0x42, 0x5a}, "bzip2", bunzip2 },
@@ -60,7 +60,7 @@ static const struct compress_format compressed_formats[] __initconst = {
6060
{ {0, 0}, NULL, NULL }
6161
};
6262

63-
decompress_fn __init decompress_method(const unsigned char *inbuf, long len,
63+
decompress_fn INIT decompress_method(const unsigned char *inbuf, long len,
6464
const char **name)
6565
{
6666
const struct compress_format *cf;

0 commit comments

Comments
 (0)