3030#include <linux/init.h>
3131#include <linux/uaccess.h>
3232
33- /**************************************************/
34- /* the actual current config file */
35-
3633/*
37- * Define kernel_config_data and kernel_config_data_size, which contains the
38- * wrapped and compressed configuration file. The file is first compressed
39- * with gzip and then bounded by two eight byte magic numbers to allow
40- * extraction from a binary kernel image:
41- *
42- * IKCFG_ST
43- * <image>
44- * IKCFG_ED
34+ * "IKCFG_ST" and "IKCFG_ED" are used to extract the config data from
35+ * a binary kernel image or a module. See scripts/extract-ikconfig.
4536 */
46- #define MAGIC_START "IKCFG_ST"
47- #define MAGIC_END "IKCFG_ED"
48- #include "config_data.h"
49-
50-
51- #define MAGIC_SIZE (sizeof(MAGIC_START) - 1)
52- #define kernel_config_data_size \
53- (sizeof(kernel_config_data) - 1 - MAGIC_SIZE * 2)
37+ asm (
38+ " .pushsection .rodata, \"a\" \n"
39+ " .ascii \"IKCFG_ST\" \n"
40+ " .global kernel_config_data \n"
41+ "kernel_config_data: \n"
42+ " .incbin \"kernel/config_data.gz\" \n"
43+ " .global kernel_config_data_end \n"
44+ "kernel_config_data_end: \n"
45+ " .ascii \"IKCFG_ED\" \n"
46+ " .popsection \n"
47+ );
5448
5549#ifdef CONFIG_IKCONFIG_PROC
5650
51+ extern char kernel_config_data ;
52+ extern char kernel_config_data_end ;
53+
5754static ssize_t
5855ikconfig_read_current (struct file * file , char __user * buf ,
5956 size_t len , loff_t * offset )
6057{
6158 return simple_read_from_buffer (buf , len , offset ,
62- kernel_config_data + MAGIC_SIZE ,
63- kernel_config_data_size );
59+ & kernel_config_data ,
60+ & kernel_config_data_end -
61+ & kernel_config_data );
6462}
6563
6664static const struct file_operations ikconfig_file_ops = {
@@ -79,7 +77,7 @@ static int __init ikconfig_init(void)
7977 if (!entry )
8078 return - ENOMEM ;
8179
82- proc_set_size (entry , kernel_config_data_size );
80+ proc_set_size (entry , & kernel_config_data_end - & kernel_config_data );
8381
8482 return 0 ;
8583}
0 commit comments