首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

VxWorks压缩技术 01

VxWorks压缩技术 01

在嵌入式系统中,我们通常会要求VxWorks文件尽量小,比如通过串口、软盘或tffs加载VxWorks的时候,如果文件太大,可能无法存储,或加载失败。下面介绍一种利用Tornado和VxWorks自带的deflate和inflate,对VxWorks文件进行压缩和解压缩的技术。希望对大家有所帮助。

1  使用Tornado创建bootable的project,包括应用程序。对VxWorks进行适当的裁减和配置。

2  如果准备将VxWorks存储于硬盘,软盘或tffs上,应该在usrAppInit中使用usrNetEndDevStart和usrNetIfConfig启动网络接口。如果存储于tffs上,还要修改usrNetBoot.c中:

if ( (strncmp (sysBootParams.bootDev, "scsi", 4) == 0)
|| (strncmp (sysBootParams.bootDev, "ide", 3) == 0)
|| (strncmp (sysBootParams.bootDev, "ata", 3) == 0)
|| (strncmp (sysBootParams.bootDev, "fd", 2) == 0))
为:
if ( (strncmp (sysBootParams.bootDev, "scsi", 4) == 0)
|| (strncmp (sysBootParams.bootDev, "ide", 3) == 0)
|| (strncmp (sysBootParams.bootDev, "ata", 3) == 0)
|| (strncmp (sysBootParams.bootDev, "tffs", 4) == 0)
|| (strncmp (sysBootParams.bootDev, "fd", 2) == 0))
3  在dos下运行 tornado/host/x86-win32/bin/torvars。

4  进入VxWorks所在的目录,运行:

deflate VxWorks.z。这里我们默认.z文件是压缩文件。

5  如果准备将VxWorks.z存储于硬盘,软盘或tffs上,需要首先创建相应的设备,并用dosFS初始化。如果是通过串口或网络加载VxWorks.z,则需要初始化相应的接口。

6  修改bootConfig.c文件:

a. 在LOCAL STATUS netLoad 函数的 tftpXfer和 ftpXfer这一部分代码结束的地方添加:
if ( strstr(fileName,".z") || strstr(fileName,".Z") )
{        
printf("
file %s is compressed, now begin uncompressing...
",fileName);
if (bootLoadModuleInflate(fd, pEntry) != OK)
    goto readErr;
}
    else if (bootLoadModule (fd, pEntry) != OK)
goto readErr;
  b. 在 LOCAL STATUS tffsLoad 函数的 usrTffsConfig和open这一部分代码结束的地方添加:
    if ( strstr(fileName,".z") || strstr(fileName,".Z") )
    {        
printf("
file %s is compressed, now begin uncompressing...
",fileName);
if (bootLoadModuleInflate(fd, pEntry) != OK)
    goto readErr;
    }
    else if (bootLoadModule (fd, pEntry) != OK)
goto readErr;
返回列表