FAQ: jffs2 error(2011-01-05)

Document created by Aaronwu Employee on Aug 28, 2013Last modified by sonic on Sep 8, 2013
Version 2Show Document
  • View in full screen mode

2011-01-05 05:05:10     jffs2 error

Shyam sundar (INDIA)

Message: 97183   

 

Hello world,

 

I do get following error "jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at..."

 

Below is the log

 

bfin> tftpboot 0x1000000 vmImage   

Using Blackfin EMAC device

TFTP from server 10.7.143.58; our IP address is 10.7.143.99

Filename 'vmImage'.

Load address: 0x1000000

Loading: ###########################################################

done

Bytes transferred = 852383 (d019f hex)

bfin> sf write 0x1000000 0x40000 0xd019f

bfin> tftpboot 0x1000000 rootfs.jffs2 

Using Blackfin EMAC device

TFTP from server 10.7.143.58; our IP address is 10.7.143.99

Filename 'rootfs.jffs2'.

Load address: 0x1000000

Loading: #################################################################

         #################################################################

         #################################################################

         ###################################################

done

Bytes transferred = 3604480 (370000 hex)

bfin> sf write 0x1000000 0x1C0000 0x370000

bfin> sfread read 0x1360000 0x1C0000 0x2

Unknown command 'sfread' - try 'help'

bfin> sf read 0x1360000 0x1C0000 0x2  

bfin> md.b 0x1360000 0x02

01360000: 85 19    ..

bfin> setenv bootargs root=/dev/mtdblock2 rw rootfstype=jffs2

bfin> setenv sfboot 'sf probe 1; sf read 0x1000000 0x40000 0xd019f; bootm 0x1000000'

bfin> setenv bootcmd run sfboot

bfin> save

Saving Environment to SPI Flash...

Erasing SPI flash...Erase: 20 01 00 00

Erase: 20 01 10 00

Erase: 20 01 20 00

Erase: 20 01 30 00

Erase: 20 01 40 00

Erase: 20 01 50 00

Erase: 20 01 60 00

Erase: 20 01 70 00

Erase: 20 01 80 00

Erase: 20 01 90 00

Erase: 20 01 a0 00

Erase: 20 01 b0 00

Erase: 20 01 c0 00

Erase: 20 01 d0 00

Erase: 20 01 e0 00

Erase: 20 01 f0 00

Writing to SPI flash...done

 

bfin> print

bootdelay=5

baudrate=57600

loads_echo=1

autoload=no

rootpath=/romfs

hostname=bf537-VOIP

loadaddr=0x1000000

ubootfile=u-boot.ldr

update=tftp $(loadaddr) $(ubootfile);eeprom write $(loadaddr) 0x0 $(filesize)

addip=set bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):eth0:off

ramargs=set bootargs root=/dev/mtdblock0 rw clkin_hz=24576000 earlyprintk=serial,uart0,57600 console=ttyBF0,57600

ramboot=tftp $(loadaddr) uImage;run ramargs;run addip;bootm

nfsargs=set bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath),tcp,nfsvers=3

nfsboot=tftp $(loadaddr) vmImage;run nfsargs;run addip;bootm

flashboot=bootm 0x20100000

ethact=Blackfin EMAC

ethaddr=50:01:50:01:50:01

filesize=370000

fileaddr=1000000

gatewayip=10.200.1.1

netmask=255.255.255.0

ipaddr=10.7.143.99

serverip=10.7.143.58

bootargs=root=/dev/mtdblock2 rw rootfstype=jffs2

sfboot=sf probe 1; sf read 0x1000000 0x40000 0xd019f; bootm 0x1000000

bootcmd=run sfboot

stdin=serial

stdout=serial

stderr=serial

 

Environment size: 995/8188 bytes

 

 

bfin> run sfboot

SF: Got idcode ef 40 17

Entering wibond probe

8192 KiB W25Q64 at 0:1 is now current device

## Booting kernel from Legacy Image at 01000000 ...

   Image Name:   Linux-2.6.28.10-ADI-2009R1.1-svn

   Created:      2011-01-05   7:41:39 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    852319 Bytes = 832.3 kB

   Load Address: 00001000

   Entry Point:  00181f50

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 00181f50

console [ttyBF0] enabled, bootconsole disabled

Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)

Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)

Memory available: 29840k/32768k RAM, (124k init code, 1012k kernel code, 472k data, 1024k dma, 292k reserved)

Calibrating delay loop... 1175.55 BogoMIPS (lpj=2351104)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (15 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 48 KB (37 KB free)

net_namespace: 288 bytes

NET: Registered protocol family 16

Blackfin DMA Controller

stamp_init(): registering device resources

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 1024 (order: 1, 8192 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP reno registered

NET: Registered protocol family 1

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

msgmni has been set to 58

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler cfq registered

simple-gpio: now handling 48 GPIOs: 0 - 47

Serial: Blackfin serial driver

bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART

bfin-uart.1: ttyBF1 at MMIO 0xffc02000 (irq = 20) is a BFIN-UART

brd: module loaded

PPP generic driver version 2.4.2

bfin_mii_bus: probed

bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:10, irq=-1, mdc_clk=2500000Hz(mdc_div=18)@sclk=98MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

m25p80 spi0.1: w25q64 (8192 Kbytes)

Creating 3 MTD partitions on "m25p80":

0x00000000-0x00040000 : "bootloader(spi)"

0x00040000-0x001c0000 : "linux kernel(spi)"

0x001c0000-0x00800000 : "file system(spi)"

bfin-spi bfin-spi.0: chipselect 1 already in use

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@7

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

TCP cubic registered

NET: Registered protocol family 17

Node at 0x00000dc4 with length 0x000007b4 would run over the end of the erase block

Perhaps the file system was created with the wrong erase size?

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000dc8: 0x07b4 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000dcc: 0xfb3f instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000dd0: 0x0013 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000dd4: 0x0002 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000dd8: 0x81ed instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000de0: 0xd290 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000de4: 0x20be instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000de8: 0x20be instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000dec: 0x20be instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000df0: 0x1000 instead

Further such events for this erase block will not be printed

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001000: 0x2096 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001004: 0x01bf instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001008: 0xed62 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000100c: 0xdbba instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001010: 0x56bc instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001014: 0xf095 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001018: 0x86cc instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000101c: 0x6bcc instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001020: 0xd159 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001024: 0x10f7 instead

Further such events for this erase block will not be printed

Node at 0x00001d68 with length 0x00000831 would run over the end of the erase block

Perhaps the file system was created with the wrong erase size?

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00002000: 0x946d instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00002004: 0xbf9b instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00002008: 0x008f instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000200c: 0xfcff instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00002010: 0x0776 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00002014: 0x9d64 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00002018: 0x4fa9 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000201c: 0xff0d instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00002020: 0x1ff5 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00002024: 0xf409 instead

Further such events for this erase block will not be printed

Node at 0x00002cfc with length 0x000008dd would run over the end of the erase block

Perhaps the file system was created with the wrong erase size?

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00003000: 0x6398 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00003004: 0x0520 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00003008: 0xeb22 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000300c: 0x8b63 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00003010: 0xec77 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00003014: 0x82fb instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00003018: 0x7357 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000301c: 0xc319 instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00003020: 0xb6da instead

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00003024: 0x6594 instead

Further such events for this erase block will not be printed

Node at 0x000035dc with length 0x00000a3f would run over the end of the erase block

Perhaps the file system was created with the wrong erase size?

 

 

Content of stamp.c

 

static struct mtd_partition bfin_spi_flash_partitions[] = {

    {

        .name = "bootloader(spi)",

        .size = 0x00040000,

        .offset = 0,

        .mask_flags = MTD_CAP_ROM

    }, {

        .name = "linux kernel(spi)",

        .size = 0x180000,            //.size = 0x680000,

        .offset = MTDPART_OFS_APPEND,

    }, {

        .name = "file system(spi)",

        .size = MTDPART_SIZ_FULL,

        .offset = MTDPART_OFS_APPEND,

    }

};

 

Settings used in kernel build

 

Device Drivers  --->

Memory Technology Devices (MTD)  --->

<*> Memory Technology Device (MTD) support

[*]   Direct char device access to MTD devices

[*]   Caching block device access to MTD devices

Mapping drivers for chip access  --->

[*] Support non-linear mappings of flash chips

< > Generic uClinux RAM/ROM filesystem support (disable this option)

Self-contained MTD device drivers  --->

  <*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...)

 

<*> Journalling Flash File System v2 (JFFS2) support

          (0)   JFFS2 debugging verbosity (0 = quiet, 2 = noisy)

       [*]   JFFS2 write-buffering support

 

Added the following line in path uclinuxdist-2009R1/linux-2.6.x/drivers/mtd/devices/m25p80.c

 

static struct flash_info __devinitdata m25p_data [] = {

 

 

    { "w25q64", 0xef4017, 0, 64 * 1024, 128, SECT_4K, },

};

 

 

 

When I tried

 

bfin> tftpboot 0x1000000 uImage.initramfs

bfin> bootm 0x1000000

and gave the following command

 

root:~> mount -t jffs2 /dev/mtdblock2 /mnt

I got the same error

 

QuoteReplyEditDelete

 

 

2011-01-05 05:25:59     Re: jffs2 error

Aaron Wu (CHINA)

Message: 97185   

 

In the SPI Flash case, have you tried to compare if the whole jffs2 image read back from the SPI flash is the same as the original one located in the RAM?

QuoteReplyEditDelete

 

 

2011-01-05 05:42:57     Re: jffs2 error

Shyam sundar (INDIA)

Message: 97186   

 

Hi Aaron,

 

This the result of comparison

 

bfin> tftpboot 0x1000000 rootfs.jffs2   

Using Blackfin EMAC device

TFTP from server 10.7.143.58; our IP address is 10.7.143.99

Filename 'rootfs.jffs2'.

Load address: 0x1000000

Loading: #################################################################

         #################################################################

         #################################################################

         ###################################################

done

Bytes transferred = 3604480 (370000 hex)

bfin> sf write 0x1000000 0x1C0000 0x370000

bfin> sf read 0x1a00000 0x1C0000 0x370000

bfin> cmp.b 0x1000000 0x1a00000 0x370000

Total of 3604480 bytes were the same

QuoteReplyEditDelete

 

 

2011-01-05 06:21:33     Re: jffs2 error

Mike Frysinger (UNITED STATES)

Message: 97187   

 

please read the documentation:

  www.linux-mtd.infradead.org/faq/jffs2.html#L_magicnfound

 

further, your own output already tells you:

Perhaps the file system was created with the wrong erase size?

QuoteReplyEditDelete

 

 

2011-01-07 01:29:12     Re: jffs2 error

Shyam sundar (INDIA)

Message: 97240   

 

Hello mike,

 

I am not getting any clue!!

 

How can I specify the erase size? Do i need to build the rootfs.jffs2 manually?

 

In the path uclinuxdist-2009R1/linux-2.6.x/drivers/mtd/devices/m25p80.c, I do have specified the correct block and sector size of the flash.

 

When I booted the kernel using uImage.initramfs and gave the following command

 

root:/> cat /proc/mtd

dev:    size   erasesize  name

mtd0: 00040000 00001000 "bootloader(spi)"

mtd1: 00180000 00001000 "linux kernel(spi)"

mtd2: 00640000 00001000 "file system(spi)"

 

I do see the erasesize as 0x1000. Do i need to change this erase size?

QuoteReplyEditDelete

 

 

2011-01-07 08:21:49     Re: jffs2 error

Shyam sundar (INDIA)

Message: 97252   

 

 

 

I went to file path uclinuxdist-2009R1/user/mtd-utils and executed the following command to create a jffs2 image.

 

mkfs.jffs2 -l -e 0x10000 -p -d /uclinuxdist-2009R1/romfs -o /tftpboot/rootfs

 

The block size for my serial flash is 64KB.Even after ensuring the flash erasure before the filesystem image is burnt into the flash, I do face the same "Magic bitmask 0x1985 not found" error

 

When the flash is erased and when I boot the kernel using uImage.initramfs, executions of following commands dont lead to kernel crash

 

mount -t jffs2 /dev/mtdblock2 /mnt/

flash_eraseall /dev/mtd2

 

 

When the content of mnt was listed,it didnt show up anything as the flash was erased before the kernel was loaded.

 

 

When I just burn the jffs2 image into the flash and load the kernel (without burning the kernel image into the flash)

I do get the following messages

 

 

bfin> tftpboot 0x1000000 rootfs

Using Blackfin EMAC device

TFTP from server 10.7.143.58; our IP address is 10.7.143.99

Filename 'rootfs'.

Load address: 0x1000000

Loading: #################################################################

         #################################################################

         #################################################################

         ################################################################

done

Bytes transferred = 3801088 (3a0000 hex)

bfin> sf write 0x1000000 0x1C0000 0x3a0000

bfin> tftpboot 0x1000000 vmImage

Using Blackfin EMAC device

TFTP from server 10.7.143.58; our IP address is 10.7.143.99

Filename 'vmImage'.

Load address: 0x1000000

Loading: ###########################################################

done

Bytes transferred = 861300 (d2474 hex)

bfin> bootm

## Booting kernel from Legacy Image at 01000000 ...

   Image Name:   Linux-2.6.28.10-ADI-2009R1.1-svn

   Created:      2011-01-07  12:34:47 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    861236 Bytes = 841.1 kB

   Load Address: 00001000

   Entry Point:  00185f50

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 00185f50

Linux version 2.6.28.10-ADI-2009R1.1-svn9124 (root@tcoe-desktop) (gcc version 4.1.2 (ADI svn)) #524 Fri Jan 7 18:04:44 IST 2011

bootconsole [early_shadow0] enabled

bootconsole [early_BFuart0] enabled

early printk enabled on early_BFuart0

Board Memory: 32MB

Kernel Managed Memory: 32MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x00100c20

  rodata    = 0x00100c20-0x00155888

  bss       = 0x00156000-0x001680b0

  data      = 0x001680b0-0x00178000

    stack   = 0x00176000-0x00178000

  init      = 0x00178000-0x00197000

  available = 0x00197000-0x01eff000

  DMA Zone  = 0x01f00000-0x02000000

Hardware Trace Active and Enabled

Boot Mode: 3

Blackfin support (C) 2004-2009 Analog Devices, Inc.

Compiled for ADSP-BF537 Rev 0.3

Blackfin Linux support by   blackfin.uclinux.org/

Processor Speed: 589 MHz core clock and 98 MHz System Clock

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

Data Cache Enabled for CPU0 (write-back)

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 7873

Kernel command line: root=/dev/mtdblock2 rw rootfstype=jffs2 clkin_hz=24576000 earlyprintk=serial,uart0,57600 console=ttyBF0,57600

Configuring Blackfin Priority Driven Interrupts

PID hash table entries: 128 (order: 7, 512 bytes)

console [ttyBF0] enabled, bootconsole disabled

console [ttyBF0] enabled, bootconsole disabled

Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)

Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)

Memory available: 29824k/32768k RAM, (124k init code, 1023k kernel code, 477k data, 1024k dma, 292k reserved)

Calibrating delay loop... 1175.55 BogoMIPS (lpj=2351104)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (15 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 48 KB (37 KB free)

net_namespace: 288 bytes

NET: Registered protocol family 16

Blackfin DMA Controller

stamp_init(): registering device resources

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 1024 (order: 1, 8192 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP reno registered

NET: Registered protocol family 1

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

msgmni has been set to 58

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler cfq registered

simple-gpio: now handling 48 GPIOs: 0 - 47

Serial: Blackfin serial driver

bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART

bfin-uart.1: ttyBF1 at MMIO 0xffc02000 (irq = 20) is a BFIN-UART

brd: module loaded

PPP generic driver version 2.4.2

bfin_mii_bus: probed

bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:10, irq=-1, mdc_clk=2500000Hz(mdc_div=18)@sclk=98MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

m25p80 spi0.1: w25q64 (8192 Kbytes)

Creating 3 MTD partitions on "m25p80":

0x00000000-0x00040000 : "bootloader(spi)"

0x00040000-0x001c0000 : "linux kernel(spi)"

0x001c0000-0x00800000 : "file system(spi)"

bfin-spi bfin-spi.0: chipselect 1 already in use

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@7

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

TCP cubic registered

NET: Registered protocol family 17

VFS: Mounted root (jffs2 filesystem).

Freeing unused kernel memory: 124k freed

Warning: unable to open an initial console.

Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

 

Can anybody tell me where am I going wrong?

 

 

QuoteReplyEditDelete

 

 

2011-01-07 11:50:35     Re: jffs2 error

Mike Frysinger (UNITED STATES)

Message: 97254   

 

do not touch the driver code

QuoteReplyEditDelete

 

 

2011-01-07 11:51:13     Re: jffs2 error

Mike Frysinger (UNITED STATES)

Message: 97255   

 

use MKFS_JFFS2_FLAGS in your board's uclinux-dist Makefile and let the build system do the rest.  if you try to build the image yourself, you're on your own.

Attachments

    Outcomes