Chinaunix首页 | 论坛 | 博客
  • 博客访问: 694678
  • 博文数量: 79
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 1338
  • 用 户 组: 普通用户
  • 注册时间: 2012-06-12 08:51
个人简介

XMU->九天揽月->五湖抓鳖->DSP->driver->kernel/OpenWRT->ISP/RTOS

文章分类

全部博文(79)

文章存档

2020年(2)

2018年(3)

2016年(7)

2015年(42)

2014年(25)

分类: LINUX

2014-12-23 10:55:01

 

因为一些问题,研究下kernel.release的产生机制,实际上就是shell下的uname –r.
1. uname -r 
2.6.36.4brcmarm+
2.6.36.4
这个好说,主Makefile定义的版本号和补丁号
brcmarm
哪来的?

2. grep -rn "brcmarm" --exclude=*.o
   
在内核编译后,找到include/config/kernel.release,这个目录在未编译的内核中是不存在的,所以肯定是编译过程中生成的

3.
再查发现kernel.release是主Makefile下生成的
# Store (new) KERNELRELASE string in include/config/kernel.release
include/config/kernel.release: include/config/auto.conf FORCE
      $(Q)rm -f $@
      $(Q)echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" > $@
  setlocalversion
这个脚本肯定是起关键作用的

4.
版本release


点击(此处)折叠或打开

  1. # CONFIG_LOCALVERSION and LOCALVERSION (if set)
  2. res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"

  3. # scm version string if not at a tagged commit
  4. if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
  5.     # full scm version string
  6.     res="$res$(scm_version)"
  7. else
  8.     # apped a plus sign if the repository is not in a clean tagged
  9.     # state and LOCALVERSION= is not specified
  10.     if test "${LOCALVERSION+set}" != "set"; then
  11.     echo "scm_version=${scm_version}" >&2
  12.     echo "scm=$(scm_version --short)" >&2
  13.         scm=$(scm_version --short)
  14.         res="$res${scm:++}"
  15.     fi
  16. fi

CONFIG_LOCALVERSION 和 CONFIG_LOCALVERSION_AUTO,看名字就知道是kernel的kconfig,打开menu从fig,果然CONFIG_LOCALVERSION被设置为了"brcmarm"
CONFIG_LOCALVERSION是直接添加到release code(2.6.36.4)后缀的,而LOCALVERSION实际上是内核根目录下的localversion文件,若存在也会被添加到后缀。
还有个加号咋来的呢?

CONFIG_LOCALVERSION_AUTO = y 

  会从内核目录下的.git.svn中自动提取出版本ID,即为$(scm_version),添加到kernel.release
CONFIG_LOCALVERSION_AUTO!=y
    
添加一个'+'表示版本信息不完整并且LOCALVERSION为空


 


阅读(2992) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

polejo2014-12-23 11:12:29

http://blog.csdn.net/adaptiver/article/details/7225980
这篇文章讲得更好