编译系统镜像时,不可能把所有源码都放到一起,需要把一些固定下来的代码编入库文件。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] - 保留文件的原始日期
完整参数如下
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好多年!
一起学习,共同进步!