This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Error in JFFS2 file system

Other Parts Discussed in Thread: AM1705

I'm facing issue with booting the kernel from flash using JFF2 format.

I'm using the Linux kernel version 3.20.00.12 for the custom board using AM1705 with 32MB SDRAM and 8MB Atmel serial SPI dataflash AT45DB642D.

 

In the host system, I have created the JFFS image: block size 8KB (-e option) and page size = 1KB (-s option). This is as per the AT45DB642D datasheet.

host$ mkfs.jffs2 -lnp -e 8 -s 1024 -r target -o rootfs.jffs2

 

When I boot, from the u-boot, I receive the following error message:

 

JFFS2 version 2.2. (NAND) (SUMMARY) 2001-2006 Red Hat, Inc.

 

 

mtd_dataflash spi1.0: at45db642d (8192 KBytes) pagesize 1024 bytes, OTP

Creating 4 MTD partitions on "mtd_dataflash":

0x000000000000-0x000000020000 : "U-Boot"

0x000000020000-0x000000024000 : "U-Boot Environment"

0x000000024000-0x000000224000 : "Linux kernel"

0x000000224000-0x000000800000 : "Linux File system"

spi_davinci spi_davinci.1: Controller at 0xfee12000

JFFS2 write-buffering enabled buffer (1024) erasesize (8192)

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000: 0xbd14 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000004: 0xc43e instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000008: 0x58b5 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000000c: 0x6e08 instead

Further such events for this erase block will not be printed

Empty flash at 0x00000ffc ends at 0x00001000

Empty flash at 0x000017fc ends at 0x00001800

 

I suspect the issue to be in erase blocksize. B'cos when I execute the below command in NFS mode,  (Instead of 8192 bytes, the erase block size is showing as 1024 bytes).

I receive the the output as

 

 

root@arago:/# cat /proc/mtd

dev: size erasesize name

mtd0: 00020000 00000400 "U-Boot"

mtd1: 00004000 00000400 "U-Boot Environment"

mtd2: 00200000 00000400 "Linux kernel"

mtd3: 005da000 00000400 "Linux File system"

root@arago:/#

 

 

 

I have been fiddling with this issue for the past 1 week. I really appreciate your help.

 

Regards,

Arul

Other observation, that I found while trying to read and write the partition via NFS mode is

1. Erase the filesystem partition:

root@arago:~# flash_eraseall /dev/mtd3

Erasing 1 Kibyte @ 5da000 -- 100 % complete.

2. Mount the partition and create a file.

root@arago:~# mkdir /mnt/flash

root@arago:~# mount -t jffs2 /dev/mtdblock3 /mnt/flash

JFFS2 write-buffering enabled buffer (1024) erasesize (8192)

root@arago:/# cd /mnt/flash

root@arago:/mnt/flash# ls

root@arago:/mnt/flash# cat ~/hello.c > hello.c

root@arago:/mnt/flash# cd ../..

root@arago:/# umount /mnt/flash

3. Reboot the target system

4. Again mount the partition

root@arago:~# mkdir /mnt/flash_new

root@arago:~# mount -t jffs2 /dev/mtdblock3 /mnt/flash_new

(Here I receive errors.....)

JFFS2 write-buffering enabled buffer (1024) erasesize (8192)

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000: 0xfd33 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000004: 0x7ffe instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000008: 0x3eb0 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000000c: 0x7fff instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000010: 0xffff instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000014: 0x77fe instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000018: 0x0f3f instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000001c: 0x73ff instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000020: 0x77f6 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000024: 0x7d7e instead

Further such events for this erase block will not be printed

Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes

empty_blocks 0, bad_blocks 0, c->nr_blocks 749

mount: /dev/mtdblock3: can't read superblock

  • I think your mkfs.jffs2 arguments are wrong.  If you want to say eraseblock is 8 kB, use -e 8192 (or -e 0x2000).

  • I have tried this option too. mkfs.jffs2 with -e 8192 and -e 8 generates the same binary image ( I have verified by comparing it).

    The command cat /proc/mtd returns the wrong erasesize (as in shown above discussion). Is that correct ?

  • You might need the -j option. Something to do with clean markers.

    flash_eraseall -j /dev/mtd3
    mkdir /mnt/flash
    mount -t jffs2 /dev/mtdblock3 /mnt/flash

    I've seen mention of using the -rw on mount if -j doesn't work.

    flash_eraseall /dev/mtd3
    mkdir /mnt/flash
    mount -t jffs2 /dev/mtdblock3 /mnt/flash -rw

    I've used these steps on the target:

    flash_eraseall -j /dev/mtd3
    flashcp -v rootfs.jffs2 /dev/mtd3

    I usually do the above in /tmp if I am currently booted off of mtd3.