Chinaunix首页 | 论坛 | 博客
  • 博客访问: 571494
  • 博文数量: 169
  • 博客积分: 2656
  • 博客等级: 少校
  • 技术积分: 1685
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-30 13:03
文章分类

全部博文(169)

文章存档

2011年(1)

2010年(135)

2009年(33)

我的朋友

分类: 嵌入式

2010-05-14 13:08:02

vxWorks提供了缺省的压缩工具inflate,这是一个高速解压的工具。

在windows上实现压缩:
D:\Tornado2.2.2ForPpc\host\x86-win32\bin>deflate vxbuslog.z
Deflation: 89.23%

在target上实现解压:
void usrTestInflate(char *pFileName)
{
    char *pSrc, *pDst;
    int iRet = 0;
    int iLen, fd;
    fd = open(pFileName, 2, 0);
    if (fd == -1)
    {
        printf("\r\n can't open file");
        return;
    }
    pSrc = malloc(0x10000);
    iLen = read(fd, pSrc, 0x10000);
    pDst = malloc(0x10000);
    iRet = inflate(pSrc, pDst, iLen);
    printf("\r\n inflate file %s, from 0x%x to 0x%x, length is 0x%x, result is 0x%x",
        pFileName, pSrc, pDst, iLen, iRet);
}

下面是shell上的输出:
-> sp usrTestInflate,"vxbuslog.z"
task spawned: id = 0xae8f60, name = t1
value = 11439968 = 0xae8f60
->
inflate file vxbuslog.z, from 0xad4130 to 0xac4120, length is 0x1bb, result is 0x0
 
 
缺省的情况下会使用,例如make bootrom
如果make bootrom_uncmp就可以使用不压缩的版本
阅读(3064) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~