How to create and use a Jffs2 File System

Source: Internet
Author: User
Tags inotify
Article Title: how to create and use a Jffs2 file system. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

This article describes how to create and use the jffs2 File System on the AT91SAM9261EK board, using the linux-2.6.21 kernel.

First, configure MTD

     
      
$ Make menuconfig enter Memory Technology Devices (MTD) ---> <*> Memory Technology Device (MTD) support [*] Debugging [*] MTD partitioning support [*] Command line partition table parsing [*] Direct char device access to MTD devices [*] Caching block device access to MTD devices RAM /ROM/Flash chip drivers -----> <*> Detect non-cfi amd/JEDEC-compatible flash chips <*> Support for AMD/Fujitsu flash chips Mapping drivers for chip access ---> [*] Support non-linear mappings of flash chips Self-contained MTD device drivers ---> [*] Support for at45... dataFlash NAND Flash Device Drivers ----> [*] NAND Device Support [*] Support for NAND Flash/SmartMedia on AT91 File systems ----> <*> Second extended fs support [*] Inotify file change notification support [*] Inotify support for user space <*> Filesystem in Userspace support Miscellaneous filesystems <*> Journalling Flash File System v2 (JFFS2) support [*] JFFS2 write-buffering support <*> Compressed ROM file system support (cramfs)
     

None of the above configurations are selected. The configurations are for reference only and can be configured as needed.

$ Make all

Second: Create mtd-util tools

Downloading zlib-1.2.3.tar.gz from the network $ cd zlib-1.2.3

$./Configure? Prefix =/usr/local/arm/3.4.1/arm-linux -- shared

Modify the Makefile as follows:

CC = arm-linux-gcc

LDSHARED = arm-linux-ld-shared

$ Make all

$ Make install

Note: the installation is in the/usr/local/arm/3.4.1/arm-linux directory.

Because zlib. H files are required for cross-Compilation of mtd tools, zlib library files must be installed before compilation.

Download mtd-snapshot-20050519.tar.bz2 extract $ cd mtd/util from the Web

Modify the Makefile in this directory:

CROSS = arm-linux-

$ Make all

Then generate flash_erase, flash_eraseall, mkfs. the jffs2 tool is stored in the ramdisk File System (I put it in the/bin directory here). In addition, ensure that mtd0 ~ is available in the dev directory of the ramdisk file system ~ Mtd9, mtdblock0 ~ If you do not have mtdblock9 devices, you can copy them from the same directory on your PC by referring to the ramdisk file system.

In addition, libz. so, libz. so.1, libz. so.1.2.3 copy the file to the/lib directory of the ramdisk file system. Otherwise, mkfs. jffs2 is unavailable.

Finally, download the new uImage and ramdisk files to the board, start the system, and run the command cat/proc/mtd to see

Dev: size erasesize name

Mtd0: 00040000 00020000 "Partition 1"

Mtd1: 0ffc0000 00020000 "Partition 2"

Mtd2: 00420000 00000210 "spi0.0-AT45DB321x"

Here, mtd0 and mtd1 are partitions on nandflash; mtd2 is partitions on dataflsh with u-boot and uImage. img, ramdisk. img, so we can use two empty nandflash partitions here. Before use, use the flash_erase or flash_eraseall tool to erase nandflash. The specific steps are as follows:

# Flash_erase/dev/mtd1

Create a jffs2 Image

# Cd/var/tmp

# Mkdir jffs2 (directories under jffs2 can be created as needed)

# Mkfs. jffs2? D jffs2/-o jffs2.img

# Cp/var/tmp/jffs2/jffs2.img/dev/mtdblock1

Last # mount-t jffs2/dev/mtdblock1/mnt/mtd. You can use $ umount/mnt/mtd to uninstall the SDK.

If you only use dataflash or nandflash as a common jffs2 image, you do not have to create a jffs2 image. You only need the last step.

# Mount-t jffs2/dev/mtdblock1/mnt/mtd.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.