aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@canonical.com>2008-11-27 19:12:07 +0000
committerJohn Rigby <john.rigby@linaro.org>2011-08-21 21:28:09 -0600
commitd0ec33dbc8d44a0b6fb360a231ae223453347a37 (patch)
tree6bdcbcdbd70b652c8f006bfe9b95b4a3121f8f11
parent54e2079240f76b225736d2d8d1309d1d7ecf7bbc (diff)
UBUNTU: SAUCE: (no-up) version: Implement version_signature proc file.
Signed-off-by: Andy Whitcroft <apw@canonical.com> Acked-by: Tim Gardener <tim.gardner@canonical.com>
-rw-r--r--fs/proc/Makefile1
-rw-r--r--fs/proc/version_signature.c31
-rw-r--r--init/Kconfig9
-rw-r--r--init/version.c6
4 files changed, 46 insertions, 1 deletions
diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index c1c72933592..cc68b63d572 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -28,3 +28,4 @@ proc-$(CONFIG_PROC_VMCORE) += vmcore.o
proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
proc-$(CONFIG_PRINTK) += kmsg.o
proc-$(CONFIG_PROC_PAGE_MONITOR) += page.o
+proc-y += version_signature.o
diff --git a/fs/proc/version_signature.c b/fs/proc/version_signature.c
new file mode 100644
index 00000000000..859fb6092a6
--- /dev/null
+++ b/fs/proc/version_signature.c
@@ -0,0 +1,31 @@
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+#include <linux/utsname.h>
+
+static int version_signature_proc_show(struct seq_file *m, void *v)
+{
+ seq_printf(m, "%s\n", CONFIG_VERSION_SIGNATURE);
+ return 0;
+}
+
+static int version_signature_proc_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, version_signature_proc_show, NULL);
+}
+
+static const struct file_operations version_signature_proc_fops = {
+ .open = version_signature_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static int __init proc_version_signature_init(void)
+{
+ proc_create("version_signature", 0, NULL, &version_signature_proc_fops);
+ return 0;
+}
+module_init(proc_version_signature_init);
diff --git a/init/Kconfig b/init/Kconfig
index 412c21b00d5..d47ace970a1 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -212,6 +212,15 @@ config DEFAULT_HOSTNAME
but you may wish to use a different default here to make a minimal
system more usable with less configuration.
+config VERSION_SIGNATURE
+ string "Arbitrary version signature"
+ help
+ This string will be created in a file, /proc/version_signature. It
+ is useful in determining arbitrary data about your kernel. For instance,
+ if you have several kernels of the same version, but need to keep track
+ of a revision of the same kernel, but not affect it's ability to load
+ compatible modules, this is the easiest way to do that.
+
config SWAP
bool "Support for paging of anonymous memory (swap)"
depends on MMU && BLOCK
diff --git a/init/version.c b/init/version.c
index 86fe0ccb997..3a9433a39d2 100644
--- a/init/version.c
+++ b/init/version.c
@@ -40,7 +40,11 @@ EXPORT_SYMBOL_GPL(init_uts_ns);
/* FIXED STRINGS! Don't touch! */
const char linux_banner[] =
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
- LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
+ LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION
+#ifdef CONFIG_VERSION_SIGNATURE
+ " (" CONFIG_VERSION_SIGNATURE ")"
+#endif
+ "\n";
const char linux_proc_banner[] =
"%s version %s"