kernel版本号修改方法如下

修改文件:

[code] kernel/fs/proc/version.c
 kernel/init/version.c


具体修改如下:

kernel/fs/proc/version.c

[code]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打印结果如下:

[code]%s version %s (weitf@sofia-X8DAL) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) %s


utsname()->sysname 通过log打印结果如下:

[code]Linux


utsname()->release, 通过log打印结果如下:

[code]3.14.0


修改如下:

[code]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
var cpro_id="u2496340";
(window["cproStyleApi"] = window["cproStyleApi"] || {})[cpro_id]={at:"3",rsi0:"750",rsi1:"250",pat:"6",tn:"baiduCustNativeAD",rss1:"#FFFFFF",conBW:"1",adp:"1",ptt:"0",titFF:"%E5%BE%AE%E8%BD%AF%E9%9B%85%E9%BB%91",titFS:"14",rss2:"#000000",titSU:"0",ptbg:"90",piw:"0",pih:"0",ptp:"0"}

id="iframeu2496340_0" src="http://pos.baidu.com/tcfm?sz=750x250&rdid=2496340&dc=3&di=u2496340&dri=0&dis=0&dai=1&ps=2705x97&coa=at%3D3%26rsi0%3D750%26rsi1%3D250%26pat%3D6%26tn%3DbaiduCustNativeAD%26rss1%3D%2523FFFFFF%26conBW%3D1%26adp%3D1%26ptt%3D0%26titFF%3D%2525E5%2525BE%2525AE%2525E8%2525BD%2525AF%2525E9%25259B%252585%2525E9%2525BB%252591%26titFS%3D14%26rss2%3D%2523000000%26titSU%3D0%26ptbg%3D90%26piw%3D0%26pih%3D0%26ptp%3D0&dcb=___adblockplus&dtm=HTML_POST&dvi=0.0&dci=-1&dpt=none&tsr=0&tpr=1503475325699&ti=Linux%20%E5%AD%A6%E4%B9%A0%EF%BC%883%EF%BC%89--%20kernel%E7%89%88%E6%9C%AC%E5%8F%B7%E7%9A%84%E4%BF%AE%E6%94%B9%20-%20Lai18.com%20IT%E6%8A%80%E6%9C%AF%E6%96%87%E7%AB%A0%E6%94%B6%E8%97%8F%E5%A4%B9&ari=2&dbv=0&drs=1&pcs=1361x803&pss=1361x2735&cfv=0&cpl=0&chi=1&cce=true&cec=UTF-8&tlm=1503475325&rw=803&ltu=http%3A%2F%2Fwww.lai18.com%2Fcontent%2F8537906.html&ltr=https%3A%2F%2Fwww.google.com.tw%2F&ecd=1&uc=1375x876&pis=-1x-1&sr=1440x900&tcn=1503475326&qn=e3d3d317dc1fa4c1&tt=1503475325636.69.70.74" vspace="0" hspace="0" scrolling="no" width="750" height="250" align="center,center">


Logo

更多推荐