No.49836 作者:flycat2008 邮件:yuanxuan2006@126.com ID:114221 登陆:1次 文章数:40篇 最后登陆IP: 最后登陆:2008/7/14 12:15:37 注册:2008/7/14 12:15:37 财富:100 发帖时间:2008/7/22 15:26:52 发贴者IP:222.131.59.63 标题:flycat2008:VxWorks压缩技术 摘要:No.49836VxWorks压缩技术 在嵌入式系统中,我们通常会要求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; c. 在 LOCAL STATUS bootLoad 函数之前定义函 数 bootLoadModuleInflate的原型: #define DECOMP_BUF_SIZE (RAM_HIGH_ADRS - RAM_LOW_ADRS) #define COMP_BUF_SIZE (DECOMP_BUF_SIZE / 3) STATUS bootLoadModuleInflate(int zfd, FUNCPTR *pEntry) { char * ......
>>返回讨论的主题
|