kernel版本号修改方法如下:
修改文件:
kernel/fs/proc/version.c kernel/init/version.c
具体修改如下:
kernel/fs/proc/version.c
static int version_proc_show(struct seq_file *m, void *v)
{
seq_printf(m, linux_proc_banner,
utsname()->sysname,
utsname()->release,
utsname()->version);
return 0;
}
static int version_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, version_proc_show, NULL);
}
static const struct file_operations version_proc_fops = {
.open = version_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int __init proc_version_init(void)
{
proc_create("version", 0, NULL, &version_proc_fops);
return 0;
}
module_init(proc_version_init);
linux_proc_banner 通过log打印结果如下:
%s version %s (weitf@sofia-X8DAL) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) %s
utsname()->sysname 通过log打印结果如下:
Linux
utsname()->release, 通过log打印结果如下:
3.14.0
修改如下:
From 027a89b7d3c86fa185293e5130809d2ea4877289 Mon Sep 17 00:00:00 2001
From: weitf <weitf@klinktek.com>
Date: Mon, 9 Nov 2015 12:00:17 +0800
Subject: [PATCH] kernel version
---
fs/proc/version.c | 3 ++-
init/version.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
mode change 100644 => 100755 fs/proc/version.c
mode change 100644 => 100755 init/version.c
diff --git a/fs/proc/version.c b/fs/proc/version.c
old mode 100644
new mode 100755
index d2154eb..8fca75e
--- a/fs/proc/version.c
+++ b/fs/proc/version.c
@@ -4,12 +4,13 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/utsname.h>
+#include <linux/string.h>
static int version_proc_show(struct seq_file *m, void *v)
{
seq_printf(m, linux_proc_banner,
utsname()->sysname,
- utsname()->release,
+ /*utsname()->release*/"3.10.17",
utsname()->version);
return 0;
}
diff --git a/init/version.c b/init/version.c
old mode 100644
new mode 100755
index 1a4718e..b313407
--- a/init/version.c
+++ b/init/version.c
@@ -46,5 +46,5 @@ const char linux_banner[] =
const char linux_proc_banner[] =
"%s version %s"
- " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
+ " (" "service" "@" "i-life.us" ")"
" (" LINUX_COMPILER ") %s\n";
--
1.7.9.5