public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Problem of "JFFS2 summary"
@ 2006-04-06 13:50 phAntOm yAng
  2006-04-07  6:28 ` Holger Schurig
  0 siblings, 1 reply; 8+ messages in thread
From: phAntOm yAng @ 2006-04-06 13:50 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org

Dear All:

My board is OMAP5912 running kernel 2.6.14-omap2.

These days, I tried to use "Erase Block Summary" in JFFS2 by following steps:
1)Get the newest MTD by CVS and the original 2.6.14 kernel
2)Doing MTD patch by
SHELL>./patchkernel.sh -c -2 -3 -y -v /opt/linux-2.6.14
3)Doing OMAP2 patch(Get some conflicts)
4)Fix conflicts
5)Build kernel with "JFFS2 summary support"
6)Build jffs2 image by
SHELL>./mkfs.jffs2 -l -e 128KiB -r rootfs2.6 -o pure.jffs2
7)Convert jffs2 image by
SHELL>./sumtool -p -l -e 128KiB -i pure.jffs2 -o pure-sum.jffs2

If I use original omap2 kernel with pure-sum.jffs2,
booting is OK and no error mssage.

If I use mtd patched kernel with pure-sum.jffs2,
while mount jffs2 it will show error message and halt:

Starting kernel ...
[Skip..........]
Creating 4 MTD partitions on "omapflash.0":
0x00000000-0x00020000 : "bootloader"
0x00020000-0x00040000 : "params"
0x00040000-0x00240000 : "kernel"
0x00240000-0x02000000 : "filesystem"
[Skip..........]
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080000: 0x00b0 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080004: 0x00b0 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080008: 0x00b0 instead
[Skip..........]
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x01da0010: 0x0080 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x01da0014: 0x0080 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x01da0018: 0x0080 instead
[Skip..........]
JFFS2 notice: (1) read_unknown: node header CRC failed at 0x000400. But it must have been OK earlier.
JFFS2 notice: (1) read_unknown: node header CRC failed at 0x000390. But it must have been OK earlier.
[Skip..........]
JFFS2 notice: (1) read_unknown: node header CRC failed at 0x000000. But it must have been OK earlier.
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 112K
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

My jffs2 image size is 0x80000, and the "Magic bitmask 0x1985 not found"
message begin after 0x80000.

How to resolve this problem?
Thanks in advance.

Following is my patch for conflicts of MTD and omap2 patches:
diff -Nur linux-2.6.14/drivers/mtd/maps/omap_nor.c linux-2.6.14-mtd/drivers/mtd/maps/omap_nor.c
--- linux-2.6.14/drivers/mtd/maps/omap_nor.c 2006-04-05 20:13:07.000000000 +0800
+++ linux-2.6.14-mtd/drivers/mtd/maps/omap_nor.c 2006-04-01 00:10:50.000000000 +0800
@@ -30,7 +30,7 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/platform_device.h>
+#include <linux/device.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -72,10 +72,11 @@
  }
 }
 
-static int __devinit omapflash_probe(struct platform_device *pdev)
+static int __devinit omapflash_probe(struct device *dev)
 {
  int err;
  struct omapflash_info *info;
+ struct platform_device *pdev = to_platform_device(dev);
  struct flash_platform_data *pdata = pdev->dev.platform_data;
  struct resource *res = pdev->resource;
  unsigned long size = res->end - res->start + 1;
@@ -120,7 +121,7 @@
 #endif
  add_mtd_device(info->mtd);
 
- platform_set_drvdata(pdev, info);
+ dev_set_drvdata(&pdev->dev, info);
 
  return 0;
 
@@ -134,11 +135,12 @@
  return err;
 }
 
-static int __devexit omapflash_remove(struct platform_device *pdev)
+static int __devexit omapflash_remove(struct device *dev)
 {
- struct omapflash_info *info = platform_get_drvdata(pdev);
+struct platform_device *pdev = to_platform_device(dev);
+struct omapflash_info *info = dev_get_drvdata(&pdev->dev);
 
- platform_set_drvdata(pdev, NULL);
+ dev_set_drvdata(&pdev->dev, NULL);
 
  if (info) {
  if (info->parts) {
@@ -155,22 +157,21 @@
  return 0;
 }
 
-static struct platform_driver omapflash_driver = {
+static struct device_driver omapflash_driver = {
+ .name = "omapflash",
+ .bus = &platform_bus_type,
  .probe = omapflash_probe,
  .remove = __devexit_p(omapflash_remove),
- .driver = {
- .name = "omapflash",
- },
 };
 
 static int __init omapflash_init(void)
 {
- return platform_driver_register(&omapflash_driver);
+ return driver_register(&omapflash_driver);
 }
 
 static void __exit omapflash_exit(void)
 {
- platform_driver_unregister(&omapflash_driver);
+ driver_unregister(&omapflash_driver);
 }
 
 module_init(omapflash_init);
diff -Nur linux-2.6.14/drivers/mtd/nand/Kconfig linux-2.6.14-mtd/drivers/mtd/nand/Kconfig
--- linux-2.6.14/drivers/mtd/nand/Kconfig 2006-04-05 20:13:07.000000000 +0800
+++ linux-2.6.14-mtd/drivers/mtd/nand/Kconfig 2006-03-31 23:20:25.000000000 +0800
@@ -195,6 +195,15 @@
    load time (assuming you build diskonchip as a module) with the module
    parameter "inftl_bbt_write=1".
 
+
+config MTD_NAND_OMAP_HW
+ bool "OMAP HW NAND Flash controller support"
+ depends on ARM && ARCH_OMAP16XX && MTD_NAND
+
+ help
+   Driver for TI OMAP16xx hardware NAND flash controller.
+
+
 config MTD_NAND_SHARPSL
  bool "Support for NAND Flash on Sharp SL Series (C7xx + others)"
  depends on MTD_NAND && ARCH_PXA
diff -Nur linux-2.6.14/drivers/mtd/nand/Makefile linux-2.6.14-mtd/drivers/mtd/nand/Makefile
--- linux-2.6.14/drivers/mtd/nand/Makefile 2006-04-05 20:13:07.000000000 +0800
+++ linux-2.6.14-mtd/drivers/mtd/nand/Makefile 2006-03-31 23:23:35.000000000 +0800
@@ -18,6 +18,8 @@
 obj-$(CONFIG_MTD_NAND_RTC_FROM4) += rtc_from4.o
 obj-$(CONFIG_MTD_NAND_SHARPSL) += sharpsl.o
 obj-$(CONFIG_MTD_NAND_NANDSIM) += nandsim.o
+obj-$(CONFIG_MTD_NAND_OMAP)            += omap-nand-flash.o
+obj-$(CONFIG_MTD_NAND_OMAP_HW)         += omap-hw.o
 obj-$(CONFIG_MTD_NAND_AT91) += at91_nand.o
 
 nand-objs = nand_base.o nand_bbt.o
diff -Nur linux-2.6.14/fs/Makefile linux-2.6.14-mtd/fs/Makefile
--- linux-2.6.14/fs/Makefile 2006-04-05 20:12:20.000000000 +0800
+++ linux-2.6.14-mtd/fs/Makefile 2006-04-01 00:15:08.000000000 +0800
@@ -82,7 +82,7 @@
 obj-$(CONFIG_UFS_FS) += ufs/
 obj-$(CONFIG_EFS_FS) += efs/
 obj-$(CONFIG_JFFS_FS) += jffs/
-obj-$(CONFIG_JFFS3_FS)          += jffs3/
+#obj-$(CONFIG_JFFS3_FS)          += jffs3/
 obj-$(CONFIG_JFFS2_FS) += jffs2/
 obj-$(CONFIG_AFFS_FS) += affs/
 obj-$(CONFIG_ROMFS_FS) += romfs/


-- 
____________________________________________________
Get your own Hello Kitty email @ www.sanriotown.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem of "JFFS2 summary"
  2006-04-06 13:50 Problem of "JFFS2 summary" phAntOm yAng
@ 2006-04-07  6:28 ` Holger Schurig
  2006-04-07  8:12   ` Sascha Hauer
  0 siblings, 1 reply; 8+ messages in thread
From: Holger Schurig @ 2006-04-07  6:28 UTC (permalink / raw)
  To: linux-mtd

> jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at
> 0x00080000: 0x00b0 instead jffs2_scan_eraseblock(): Magic bitmask
> 0x1985 not found at 0x00080004: 0x00b0 instead

I got similar problems with stock kernel 2.6.16.1 and sumtool from 
mtd-utils, CVSDATE 2006-02-23.

After this, I thought "nice idea", recompiled my kernel without 
CONFIG_JFFS2_SUMMARY and flashed the normal jffs2 image to get a 
working system.

However, no one answered my question from 2006-04-03 about 
JFFS2/JFFS2+SUMMARY, so I guess not many people here are either willing 
to answer (e.g. no time, ignoring silly questions) or only a few are 
working with JFFS2+SUMMARY.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem of "JFFS2 summary"
  2006-04-07  6:28 ` Holger Schurig
@ 2006-04-07  8:12   ` Sascha Hauer
  2006-04-07  8:21     ` Alexander Belyakov
  0 siblings, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2006-04-07  8:12 UTC (permalink / raw)
  To: Holger Schurig; +Cc: linux-mtd

On Fri, Apr 07, 2006 at 08:28:33AM +0200, Holger Schurig wrote:
> > jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at
> > 0x00080000: 0x00b0 instead jffs2_scan_eraseblock(): Magic bitmask
> > 0x1985 not found at 0x00080004: 0x00b0 instead
> 
> I got similar problems with stock kernel 2.6.16.1 and sumtool from 
> mtd-utils, CVSDATE 2006-02-23.
> 
> After this, I thought "nice idea", recompiled my kernel without 
> CONFIG_JFFS2_SUMMARY and flashed the normal jffs2 image to get a 
> working system.

Just for the sake of completeness: I too tried it yesterday with
2.6.16-git and sumtool from mtd cvs and got the same errors.
Continued to work without summary support then.

Sascha

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem of "JFFS2 summary"
  2006-04-07  8:12   ` Sascha Hauer
@ 2006-04-07  8:21     ` Alexander Belyakov
  2006-04-07 10:02       ` Ferenc Havasi
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Belyakov @ 2006-04-07  8:21 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Holger Schurig, linux-mtd

Sascha Hauer wrote:
> On Fri, Apr 07, 2006 at 08:28:33AM +0200, Holger Schurig wrote:
>   
>>> jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at
>>> 0x00080000: 0x00b0 instead jffs2_scan_eraseblock(): Magic bitmask
>>> 0x1985 not found at 0x00080004: 0x00b0 instead
>>>       
>> I got similar problems with stock kernel 2.6.16.1 and sumtool from 
>> mtd-utils, CVSDATE 2006-02-23.
>>
>> After this, I thought "nice idea", recompiled my kernel without 
>> CONFIG_JFFS2_SUMMARY and flashed the normal jffs2 image to get a 
>> working system.
>>     
>
> Just for the sake of completeness: I too tried it yesterday with
> 2.6.16-git and sumtool from mtd cvs and got the same errors.
> Continued to work without summary support then.
>
> Sascha
>   

I came across the same problem with wrong magic bitmarks, CRC error and 
finally Kernel panic at rootfs mount time. I  used sumtool-processed 
rootfs image and recompiled kernel with CONFIG_JFFS2_SUMMARY enabled 
(MTD snapshot 20060315 on 2.6.15.6 kernel).

Brief code analysis showed that I do not understand some summary feature 
related code in jffs2_scan_eraseblock() function.

...
    if (!buf_size) {
        buf_len = c->sector_size;

        if (jffs2_sum_active()) {
            /* must reread because of summary test */
            err = jffs2_flash_read_safe(c, buf_ofs, buf_len, buf);
            if (err)
                return err;
        }

    }
...

Here jffs2_flash_read_safe() uses buffer (unsigned char *buf) to read 
to, despite pointer to that buffer has been assigned by point() function 
in jffs2_scan_medium() routine. Is this correct?

I have disabled that code and got my rootfs successfully mounted with 
JFFS2_SUMMARY enabled..

...
    if (!buf_size) {
        buf_len = c->sector_size;

#if 0
        if (jffs2_sum_active()) {
            /* must reread because of summary test */
            err = jffs2_flash_read_safe(c, buf_ofs, buf_len, buf);
            if (err)
                return err;
        }
#endif

    }
...

Probably someone who is in charge of JFFS2_SUMMARY feature can elaborate 
on this.

Regards,
Alexander Belyakov

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem of "JFFS2 summary"
  2006-04-07  8:21     ` Alexander Belyakov
@ 2006-04-07 10:02       ` Ferenc Havasi
  2006-04-18  8:06         ` Alexander Belyakov
  0 siblings, 1 reply; 8+ messages in thread
From: Ferenc Havasi @ 2006-04-07 10:02 UTC (permalink / raw)
  To: Alexander Belyakov; +Cc: Holger Schurig, Sascha Hauer, linux-mtd

Alexander Belyakov wrote:

> I have disabled that code and got my rootfs successfully mounted with
> JFFS2_SUMMARY enabled..
>
> ...
>    if (!buf_size) {
>        buf_len = c->sector_size;
>
> #if 0
>        if (jffs2_sum_active()) {
>            /* must reread because of summary test */
>            err = jffs2_flash_read_safe(c, buf_ofs, buf_len, buf);
>            if (err)
>                return err;
>        }
> #endif
>
>    }
> ...
>
> Probably someone who is in charge of JFFS2_SUMMARY feature can
> elaborate on this.

You are right. It was a forgatten code. We removed it with a patch
commited now.

Thanks!

Ferenc

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem of "JFFS2 summary"
  2006-04-07 10:02       ` Ferenc Havasi
@ 2006-04-18  8:06         ` Alexander Belyakov
  2006-04-21  1:58           ` Ferenc Havasi
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Belyakov @ 2006-04-18  8:06 UTC (permalink / raw)
  To: Ferenc Havasi; +Cc: Holger Schurig, Sascha Hauer, linux-mtd

Ferenc Havasi wrote:
>
> You are right. It was a forgatten code. We removed it with a patch
> commited now.
>
> Thanks!
>
> Ferenc
>

Ferenc, I have just looked at Centralized summary patch. It seems it is 
good idea to add check c->mtd->block_isbad against NULL before call in 
jffs2_cs_build_filesystem_jeb() function. I understand that your patch 
at the moment is for NAND only but someone, for example, may have rootfs 
on NOR where block_isbad() method is not provided. Adding that check you 
will just get message "...cs_block is not valid..." for JFFS2 at NOR, 
otherwise Kernel panic.

.......
int jffs2_cs_build_filesystem_jeb(struct jffs2_sb_info *c)
{
int i, ret;
uint32_t offset;

for (i=0; i < CENT_SUM_RETRY_EMPTY; i++) {
offset = c->blocks[i]->offset;
if(c->mtd->block_isbad) {
if (c->mtd->block_isbad(c->mtd, offset) == 2) {
dbg_cs2("Erase block #%d (offset 0x08%x) is bad! Skip", i, offset);
continue;
}
}
.......

Thanks,
Alexander Belyakov

-------
The content of this message is my personal opinion only and although I 
am an employee of Intel, the statements I make here in no way represent 
Intel’s position on the issue
**

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem of "JFFS2 summary"
  2006-04-18  8:06         ` Alexander Belyakov
@ 2006-04-21  1:58           ` Ferenc Havasi
  2006-04-21 13:44             ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Ferenc Havasi @ 2006-04-21  1:58 UTC (permalink / raw)
  To: Alexander Belyakov; +Cc: Holger Schurig, Sascha Hauer, linux-mtd

Hi Alexander,

> Ferenc, I have just looked at Centralized summary patch. It seems it 
> is good idea to add check c->mtd->block_isbad against NULL before call 
> in jffs2_cs_build_filesystem_jeb() function. I understand that your 
> patch at the moment is for NAND only but someone, for example, may 
> have rootfs on NOR where block_isbad() method is not provided. Adding 
> that check you will just get message "...cs_block is not valid..." for 
> JFFS2 at NOR, otherwise Kernel panic.

We've updated the centralized summary patch. Now if it does not find 
block_isbad() (NOR), centralized summary will be disabled for that 
filesystem.

Thank for your feedback.

Ferenc

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem of "JFFS2 summary"
  2006-04-21  1:58           ` Ferenc Havasi
@ 2006-04-21 13:44             ` David Woodhouse
  0 siblings, 0 replies; 8+ messages in thread
From: David Woodhouse @ 2006-04-21 13:44 UTC (permalink / raw)
  To: Ferenc Havasi; +Cc: Alexander Belyakov, Holger Schurig, Sascha Hauer, linux-mtd

On Fri, 2006-04-21 at 03:58 +0200, Ferenc Havasi wrote:
> We've updated the centralized summary patch. Now if it does not find 
> block_isbad() (NOR), centralized summary will be disabled for that 
> filesystem.

I've given you an account on git.infradead.org so that you can place git
trees there.

-- 
dwmw2

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-04-21 13:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-06 13:50 Problem of "JFFS2 summary" phAntOm yAng
2006-04-07  6:28 ` Holger Schurig
2006-04-07  8:12   ` Sascha Hauer
2006-04-07  8:21     ` Alexander Belyakov
2006-04-07 10:02       ` Ferenc Havasi
2006-04-18  8:06         ` Alexander Belyakov
2006-04-21  1:58           ` Ferenc Havasi
2006-04-21 13:44             ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox