前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Tool之ar

Tool之ar

作者头像
Taishan3721
发布2021-09-15 11:18:32
8900
发布2021-09-15 11:18:32
举报
文章被收录于专栏:这里只有VxWorks这里只有VxWorks

编译系统镜像时,不可能把所有源码都放到一起,需要把一些固定下来的代码编入库文件。VxWorks内核态用到的静态库是后缀为a的archive文件,GNU提供的ar命令用于管理这种文件

挑几个命令试一试

例如,VxWorks567创建了两个o文件:1.o和2.o。在文件里随便写几个字符

q - 添加文件到archive

r - 替换或添加文件到archive

t - 查看archive包含的文件

p - 查看archive里文件的内容

m - 移动archive里的文件

[a] - 将文件置于[member-name]之后

[b]或[i] - 将文件置于[member-name]之前

d - 删除archive里的文件

x - 提取archive里的文件

[o] - 保留文件的原始日期

完整参数如下

代码语言:javascript
复制
Usage: ar [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...
       ar -M [<mri-script]
 commands:
  d            - delete file(s) from the archive
  m[ab]        - move file(s) in the archive
  p            - print file(s) found in the archive
  q[f]         - quick append file(s) to the archive
  r[ab][f][u]  - replace existing or insert new file(s) into the archive
  t            - display contents of archive
  x[o]         - extract file(s) from the archive
 command specific modifiers:
  [a]          - put file(s) after [member-name]
  [b]          - put file(s) before [member-name] (same as [i])
  [D]          - use zero for timestamps and uids/gids
  [N]          - use instance [count] of name
  [f]          - truncate inserted file names
  [P]          - use full path names when matching
  [o]          - preserve original dates
  [u]          - only replace files that are newer than current archive contents
 generic modifiers:
  [c]          - do not warn if the library had to be created
  [s]          - create an archive index (cf. ranlib)
  [S]          - do not build a symbol table
  [T]          - make a thin archive
  [v]          - be verbose
  [V]          - display the version number
  @<file>      - read options from <file>
 emulation options:
  No emulation specific options

我是泰山,专注Vx好多年!

一起学习,共同进步!

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2021-08-20,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 这里只有VxWorks 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档