jffs2_scan_eraseblock() on re-imaging P1020WLAN

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

jffs2_scan_eraseblock() on re-imaging P1020WLAN

2,032 Views
arashaz_
Contributor II

  Hello,

I am working on a P1020WLAN-compatible board with only one NOR flash to boot it with a Linux image. Using LTIB, I build the image and put
three files UImage, .dtb file and root.squashfs in the flash, in the addresses determined by Freescale. I follow the instruction provided by Freescale (erasing the NOR flash , TFTP and then cp.b). When I boot the board and the kernel tries to switch to jfss2 mode, we encounter the famous errors of  jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at …. 0xdead instead.

If instead of my own root.squashfs, I use the original  root.squashfs file provided in the USB disk by Freescale for P1020WLAN (keeping the UImage and .dtb and only re-programming the root.squashfs file in the same address), it works well with no problem.  Note that using unsquashfs  -s tool, I compared both files and all details except the size are  the same (block size, version, compression, …).  I thought may be something is wrong with my LTIB. So, I decompressed the original root.squashfs file and just recompressed it with no change using mksquashfs4. It did not work on the board (the same jfss2 problem). I tried different switches (-nopad, -b 65536 , …), but none of them worked.

U-boot bootargs are the same as P1020WLAN and naturally the same for all squashfs files that I tried.  All the files have almost the
same size between 23 to 26 MB, so the space erased in the flash and assigned to the file is enough.

Note that  I can build a RamDisk image using LTIB and boot the board in RAM. So the board is OK. The flash is also OK because it works well with the original root.squashfs. So, I do not know what could be wrong .    I appreciate if you could kindly advise me.

The details are as follow:

  NOR Flash is S29GL512P . In U-boot, we can see:

  Bank # 1: CFI conformant FLASH (16 x 16)  Size: 64 MB in 512 Sectors           

  AMD Standard command set, Manufacturer ID: 0x89, Device ID: 0x227E           

  Erase timeout: 4096 ms, write timeout: 2 ms                                  

  Buffer write timeout: 5 ms, buffer size: 1024 bytes                          

U-boot bootargs:

  bootargs=root=/dev/mtdblock1 rw console=ttyS0,115200
init=/etc/preinit cache-sram-size=0x10000

Labels (1)
Tags (4)
0 Kudos
7 Replies

971 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please make sure "the erase block size" parameter is set correctly, in ltib run ./ltib -c, and specify an appropriate value from --- Target Image Generation->jffs2 erase block size in KB.

0 Kudos

971 Views
arashaz_
Contributor II

Hi.

Thank you Yiping. As explained, I build a root.squashfs image (LTIB by default does that for P1020WLAN) not a jffs2. As you may know, this idea is taken from OpenWRT. When the kernel comes up, it uses some scripts to "switch to jfss2" (mounting). Therefore, in LTIB, there is no such an option for squashfs image type. For squashfs, we have only data block size and no erase block size. I played with data block size parameter and nothing changed.

Thank you for your comment and if you had any idea, please advise me.


0 Kudos

971 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please don't use the parameter "-nopad", actually when generating jffs2 filesystem, it is needed to specify "--pad" parameter.

0 Kudos

971 Views
arashaz_
Contributor II

Hello,

Thank you. It did not change. Note that in LTIB, I could not find the place where I can enable/disable padding. What I did was manually making a squashfs image using -nopad and without using it. But, it did not work.

I just realized that there is a script called firstboot in the bin folder of the rootfs. But, by default, the init in bootargs of the U-boot  is set to /etc/preinit. As am I am imaging the board for the first time, is not the problem related to the init configuration in bootargs? Maybe it should be set in a different way in the first boot! I appreciate if you have any comment on that.


0 Kudos

971 Views
yipingwang
NXP TechSupport
NXP TechSupport


I got the following information in "P1 Tower System Module LTIB OS.pdf".

If wanting to create squashfs filesystem, please follow below command:

/opt/freescale/ltib/usr/bin/mksquashfs4  ./rootfs.tmp  ./release/root.squashfs  -nopad  -noappend

-root-owned -comp lzma -processors 1

0 Kudos

971 Views
arashaz_
Contributor II

Hi. Thank you. I am working on that and will let you know the result soon.


0 Kudos

971 Views
arashaz_
Contributor II

Hello,

Thank you for your support. I tried different switches with mksquashfs4 command and none of them solved the problem. However, I finally found a solution, which may also be useful for others. 

It seems that JFFS2 is looking for special erased blocks with a magic marker. However, when we erase the NOR flash with U-boot (erase 0x… ), by default, U-boot writes 0xFF values. JFFS2 thus generates later the error jffs2_scan_eraseblock(): Magic bitmask...

Instead, I first boot the board in RAM and from there, using mtd-utils (i.e.,  flash_eraseall ) I erased the flash with the switch –j  (i.e., flash_eraseall   -j mtd3). The switch –j does the job and writes the magic marker. Then, using flashcp, I copied the root.squashfs file into the flash. The problem was resolved. I did not try, but maybe U-boot has a similar switch while erasing, which makes the flash ready for JFFS2, so no need to boot first in RAM.  This link helped me a lot:  http://www.linux-mtd.infradead.org/faq/jffs2.html


0 Kudos