Blame view
kernel/configs.c
2.01 KB
2b089bf8d kernel/configs: R... |
1 |
// SPDX-License-Identifier: GPL-2.0-or-later |
1da177e4c Linux-2.6.12-rc2 |
2 3 4 5 6 |
/* * kernel/configs.c * Echo the kernel .config file used to build the kernel * * Copyright (C) 2002 Khalid Aziz <khalid_aziz@hp.com> |
f4b09ebc8 update the email ... |
7 |
* Copyright (C) 2002 Randy Dunlap <rdunlap@xenotime.net> |
1da177e4c Linux-2.6.12-rc2 |
8 9 |
* Copyright (C) 2002 Al Stone <ahs3@fc.hp.com> * Copyright (C) 2002 Hewlett-Packard Company |
1da177e4c Linux-2.6.12-rc2 |
10 |
*/ |
1da177e4c Linux-2.6.12-rc2 |
11 12 13 14 15 |
#include <linux/kernel.h> #include <linux/module.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> #include <linux/init.h> |
7c0f6ba68 Replace <asm/uacc... |
16 |
#include <linux/uaccess.h> |
1da177e4c Linux-2.6.12-rc2 |
17 |
|
1da177e4c Linux-2.6.12-rc2 |
18 |
/* |
13610aa90 kernel/configs: u... |
19 20 |
* "IKCFG_ST" and "IKCFG_ED" are used to extract the config data from * a binary kernel image or a module. See scripts/extract-ikconfig. |
1da177e4c Linux-2.6.12-rc2 |
21 |
*/ |
13610aa90 kernel/configs: u... |
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
asm ( " .pushsection .rodata, \"a\" " " .ascii \"IKCFG_ST\" " " .global kernel_config_data " "kernel_config_data: " " .incbin \"kernel/config_data.gz\" " " .global kernel_config_data_end " "kernel_config_data_end: " " .ascii \"IKCFG_ED\" " " .popsection " ); |
1da177e4c Linux-2.6.12-rc2 |
42 43 |
#ifdef CONFIG_IKCONFIG_PROC |
13610aa90 kernel/configs: u... |
44 45 |
extern char kernel_config_data; extern char kernel_config_data_end; |
1da177e4c Linux-2.6.12-rc2 |
46 47 48 49 |
static ssize_t ikconfig_read_current(struct file *file, char __user *buf, size_t len, loff_t * offset) { |
85badbdf5 use simple_read_f... |
50 |
return simple_read_from_buffer(buf, len, offset, |
13610aa90 kernel/configs: u... |
51 52 53 |
&kernel_config_data, &kernel_config_data_end - &kernel_config_data); |
1da177e4c Linux-2.6.12-rc2 |
54 |
} |
97a32539b proc: convert eve... |
55 56 57 |
static const struct proc_ops config_gz_proc_ops = { .proc_read = ikconfig_read_current, .proc_lseek = default_llseek, |
1da177e4c Linux-2.6.12-rc2 |
58 |
}; |
1da177e4c Linux-2.6.12-rc2 |
59 60 61 62 63 |
static int __init ikconfig_init(void) { struct proc_dir_entry *entry; /* create the current config file */ |
c33fff0af kernel: use non-r... |
64 |
entry = proc_create("config.gz", S_IFREG | S_IRUGO, NULL, |
97a32539b proc: convert eve... |
65 |
&config_gz_proc_ops); |
1da177e4c Linux-2.6.12-rc2 |
66 67 |
if (!entry) return -ENOMEM; |
13610aa90 kernel/configs: u... |
68 |
proc_set_size(entry, &kernel_config_data_end - &kernel_config_data); |
1da177e4c Linux-2.6.12-rc2 |
69 70 71 |
return 0; } |
1da177e4c Linux-2.6.12-rc2 |
72 73 |
static void __exit ikconfig_cleanup(void) { |
c74c120a2 proc: remove proc... |
74 |
remove_proc_entry("config.gz", NULL); |
1da177e4c Linux-2.6.12-rc2 |
75 76 77 78 |
} module_init(ikconfig_init); module_exit(ikconfig_cleanup); |
626a03125 kernel/configs.c:... |
79 |
#endif /* CONFIG_IKCONFIG_PROC */ |
1da177e4c Linux-2.6.12-rc2 |
80 81 82 |
MODULE_LICENSE("GPL"); MODULE_AUTHOR("Randy Dunlap"); MODULE_DESCRIPTION("Echo the kernel .config file used to build the kernel"); |