免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1675 | 回复: 3
打印 上一主题 下一主题

关于uClinux 下 建立可读写文件系统的问题。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-05-02 20:35 |只看该作者 |倒序浏览
您好。我是uClinux个新手。谢谢帮助哈~~。

贴子有点长,我把问题先写出来吧:
1.zlib库应该怎么安装呢?是用gcc安装 还是交叉编译? 装到哪里?
2.可不可以直接对mtd设备文件读写呢?

我在uClinux 下跑 boa server 。现在问题是这样的,我想保存一些用户密码,配置之类的用户信息。
但是我的板子上跑的romfs是不可写入的。在网上搜了一下。一般的做法是挂载jffs2文件系统到romfs文件系统下。
简略步聚如下:
  1.配置mtd相关,使系统认到flash
  2.配置file system 使系统支持 jffs2 。
  3.配置flash -->tools erase erase_all mkfs.jffs2 及挂载工具
  4.挂载
  5.测试。
现在我只完成了第一步,即在uClinux的启动信息中可以看到:
*********
firefox flash device:20000 at ffe0000
Amd/Fujitsu Extended Query Table v1.0 at 0x0040
FIREFOX flash device: JEDEC Device ID is 0xFF.Assuming broken CFI table.
FIREFOX flash device: Swapping erase regions for broken CFI table.
Number of CFI chips :1
Creating 2 MTD partitions on “FIREFOX flash device”:
0x00000000-0x00100000:”user partition (1024 KB)
mtd:Giving out device 0 to user partion (1024 KB)
0x00100000-0x00200000:”kernel and armboot partition (1024KB)
mtd:Giving out device 1 to user partition (1024KB)
*********
2.系统启动后, 进入命今行。
Sash command shell(version 1.1.1)
/>cd proc
/proc>cat mtd
dev: size erasesize name
mtd0: 00100000 00020000 “user partition(1920KB)”
mtd1: 000100000 00020000 “kernel and user partition(1920KB)”


在第二步时出现问题如下:  
....
....
compr_zlib -c -o compr_zlib.o comr_zlib.c
compr_zlib.c: 38: zlib.h: ?????????
compr_zlib.c: In function 'zlib_compress';
compr_zlib.c: 82: 'z_stream' undeclared(first use in this function)
....
....(警告之类的undeclared)
....   
make[4]:***[compr_zlib.o]Error 1
make[4]:leaving directory '/work/uClinux-dist/linux-2.4.x/fs/jffs2'
make[3]:***[first_rule]Error 2
make[3]:leaving directory '/work/uClinux-dist/linux-2.4.x/fs/jffs2'
make[2]:***[_subdir_jffs2]Error 2
make[2]:leaving directory '/work/uClinux-dist/linux-2.4.x/fs'
make[1]:***[_dir_fs] Error 2
make[1]:leaving directory '/work/uClinux-dist/linux-2.4.x'
make:***[linux]Error 1


网上搜了之后 应该中zlib库没有安装。
请问大侠们,我这个zlib库应该怎么安装呢?是用gcc安装 还是交叉编译? 安装路径是什么?
我下的版本是 zlib-1.2.3.tar.gz arm-elf-tools-20011219.tar.gz




另外还有一个问题:
Sash command shell(version 1.1.1)
/>cd proc
/proc>cat mtd
dev: size erasesize name
mtd0: 00100000 00020000 “user partition(1920KB)”
mtd1: 000100000 00020000 “kernel and user partition(1920KB)”

即然系统已然识别,我可不可以直接对mtd设备文件读写呢?
我实际操作时好像是不行的,这是为什么?

/******* mtdRead.c **********8
#include<sys/file.h>
#include<stdio.h>
//#include<syscalls.h>

int main()
{
  int f1;
  int n;
  int max = 20;
  char buf[ max ];
  char *filePath = "/dev/mtd0";

  if( ( f1 = open(filePath ,O_RDWR ,0 ) ) == -1 )
  {
  printf("can not open %s ",filePath);
  }
  else
  {
  if( ( n = read( f1 , buf , max) ) > 0 )
  {  
  if( write( 1 , buf , n ) != n ) /* 写到 stdout */
  {
printf("write error.");   
  }
  }
  }   
  return 0;
}
/********************************************/



/*************** mtdWrite.c ****************/
#include<sys/file.h>
#include<stdio.h>
#include<string.h>
//#include<syscalls.h>

int main()
{
  int f1;
  int n;
  char buf[ ] = "test mtd write.";
  char *filePath = "/dev/mtd0";

  n = strlen(buf) ;
  if( ( f1 = open(filePath ,O_RDWR ,0 ) ) == -1 )
  {
  printf("can not open %s ",filePath);
  }
  else
  {
  
  if ( write( f1 , buf , n ) != n )
  {
  printf("write error.");
  }   

  }   
  return 0;
}
/******************************************/

读的时候运行提示如下(这个没有用笔记下来,大概如下)
MTD_OPEN
MTD_READ
????????????????????????
MTD_CLOSE

写的时候运行提示如下
MTD_OPEN
MTD_WRITE
last[3] is ffff, datum is 6574.
write error. MTD_CLOSE.



谢谢您的阅读与帮助。

论坛徽章:
5
摩羯座
日期:2014-07-22 09:03:552015元宵节徽章
日期:2015-03-06 15:50:392015亚冠之大阪钢巴
日期:2015-06-12 16:01:352015年中国系统架构师大会
日期:2015-06-29 16:11:2815-16赛季CBA联赛之四川
日期:2018-12-17 14:10:21
2 [报告]
发表于 2010-05-02 21:47 |只看该作者
ls /lib
ls /usr/lib下面有没有libz.a 或者libz.so一类的?
没有的话应该是得交叉编译一个

论坛徽章:
0
3 [报告]
发表于 2010-05-02 22:00 |只看该作者
回复 2# T-Bagwell

  谢谢。
    是 uClinux 下的默认的romfs下的  /lib   /usr/lib
   还是我的宿主机?
  
  我的romfs下 都没有。。。。
  我的宿主机里的  /lib 里没有  /usr/lib 里有。。。。

论坛徽章:
5
摩羯座
日期:2014-07-22 09:03:552015元宵节徽章
日期:2015-03-06 15:50:392015亚冠之大阪钢巴
日期:2015-06-12 16:01:352015年中国系统架构师大会
日期:2015-06-29 16:11:2815-16赛季CBA联赛之四川
日期:2018-12-17 14:10:21
4 [报告]
发表于 2010-05-03 12:51 |只看该作者
看你的运行情况
应该是rom下的
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP