Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1228607
  • 博文数量: 699
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 4970
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 13:45
文章分类

全部博文(699)

文章存档

2011年(1)

2008年(698)

我的朋友

分类:

2008-10-15 13:50:34

      在系统中,我们通常会要求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;
--------------------next---------------------

阅读(639) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~