APP下载

JFFS2文件系统在μClinux中的实现

2009-08-13行喜梁刘树东戴学丰

现代电子技术 2009年10期

行喜梁 刘树东 戴学丰

摘 要:FLASH作为新型非易失性半导体存储器在嵌入式系统的开发中占有重要的地位。为了在嵌入式系统中实现数据的动态操作,介绍μClinux下的FLASH文件系统,特别是日志型文件系统的设计原理及特点;利用Linux提供的MTD接口,通过添加与FLASH对应的map driver和FLASH驱动,修改设备节点,配置内核等步骤,将JFFS2文件系统移植到s3c44b0使用的FLASH芯片上。通过挂载,用户可以像使用普通硬盘分区一样对此目录下面的文件进行操作,从而实现对FLASH的动态操作和管理。结果表明,在JFFS2 文件系统下,保存的文件是可读写的,系统掉电后创建的文件也不会丢失。

关键词:FLASH;JFFS2;内存技术设备;嵌入式系统

中图分类号:TN302文献标识码:A

文章编号:1004-373X(2009)10-051-04

Realization of JFFS2 File System in μClinux

XING Xiliang,LIU Shudong,DAI Xuefeng

(School of Computer and Control Engineering,Qiqihaer University,Qiqihaer,161006,China)

Abstract:FLASH as a new type of non-volatile semiconductor memory plays an important role in embedded systems development.For achieving operating the data dynamically under embedded system,the FLASH file system under μClinux,in particular the design principles and charactertistecs of JFFS2(log-file system)is introduced.Using MTD interface provided by Linux,through adding map driver and FLASH driver,modifying the device nodes,such as configuring core etc,transplanting JFFS2 file system to the FLASH chips of s3c44b0.Through the mount,users can operate the files under this directory as an ordinary hard driver partition,achieving operating dynamicly and managing for FLASH.The results show that files can be read and write after the creation under the JFFS2 file system.The files can′t be lost even if the power is down.

Keywords:FLASH;JFFS2;MTD;embedded system

0 引 言

嵌入式系统开发中,一些重要的工艺参数在控制过程中需要动态地改变和保存,使用硬盘等存储介质又显得不太现实,而FLASH芯片以相对低廉的价格提供了高可靠性和高密度的存储,已成为嵌入式系统重要的存储设备。在很多嵌入式系统中,操作系统及应用程序直接固化在FLASH上,系统启动时,代码可以直接在FLASH上开始运行。但是仅将FLASH作为ROM使用是大材小用,需要充分发挥FLASH可擦写的优势,在系统运行过程中,动态擦写FLASH来保存数据。

然而,μClinux的文件系统可以有多种选择,ROMFS是使用得较多的文件系统。它是一种简单、紧凑的文件系统,占用的空间小,但由于是只读的,使用起来有局限性。若采用EXT2作为文件系统,虽然可以把信息保存在ramdisk盘中,但系统掉电后,ramdisk中的信息将丢失,这对于需要保存运行过程中参数的应用程序是不允许的。……

登录APP查看全文