• 欢迎访问少将全栈,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 吐槽,投稿,删稿,交个朋友,商务沟通v:ai_draw
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将全栈吧

u-boot中的version命令

点滴 admin 11年前 (2013-12-09) 1516次浏览 已收录 0个评论 扫描二维码

1. Source Code

common/cmd_version.c

2. Usage

U-Boot help version

version – print monitor version

U-boot version

U-Boot 2013.04 (May 11 2013 – 18:08:59)
arm-none-linux-gnueabi-gcc (Sourcery CodeBench Lite 2012.09-64) 4.7.2
GNU ld (Sourcery CodeBench Lite 2012.09-64) 2.23.51.20120829

3. Source code go through

[cpp]

  1. constchar__weakversion_string[]=U_BOOT_VERSION_STRING;
  2. staticintdo_version(cmd_tbl_t*cmdtp,intflag,intargc,char*constargv[])
  3. {
  4. printf(
    %s
    ,version_string);
  5. #ifdefCC_VERSION_STRING
  6. puts(CC_VERSION_STRING
    );
  7. #endif
  8. #ifdefLD_VERSION_STRING
  9. puts(LD_VERSION_STRING
    );
  10. #endif
  11. #ifdefCONFIG_SYS_COREBOOT
  12. printf(“coreboot-%s(%s)
    ,lib_sysinfo.version,lib_sysinfo.build);
  13. #endif
  14. return0;
  15. }

其中,U_BOOT_VERSION_STRINGinclude/version.h定义:

[cpp]

  1. #defineU_BOOT_VERSION_STRINGU_BOOT_VERSION”(“U_BOOT_DATE”-“
  2. U_BOOT_TIME“)”CONFIG_IDENT_STRING

U_BOOT_VERSION,CC_VERSION_STRING,LD_VERSION_STRING: 定义在include/generated/version_autogenerated.h此文件通过名字可以看出是自动生成的。其具体生成代码在顶层目录中的Makefile里面。代码如下:

[cpp]

  1. $(VERSION_FILE):
  2. @mkdir-p$(dir$(VERSION_FILE))
  3. @(localvers=’$(shell$(TOPDIR)/tools/setlocalversion$(TOPDIR))’;
  4. printf’#definePLAIN_VERSION”%s%s”
  5. “$(U_BOOT_VERSION)”“$${localvers}”;
  6. printf’#defineU_BOOT_VERSION”U-Boot%s%s”
  7. “$(U_BOOT_VERSION)”“$${localvers}”;
  8. )[email protected]
  9. @(printf’#defineCC_VERSION_STRING”%s”
  10. ’$(shell$(CC)–version|head-n1)’)[email protected]
  11. @(printf’#defineLD_VERSION_STRING”%s”
  12. ’$(shell$(LD)-v|head-n1)’)[email protected]
  13. @cmp-s$@[email protected][email protected]||[email protected]$@


喜欢 (0)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址