[U-Boot] [RFC/PATCH] jffs2/mtdparts: Fix problem with usage from JFFS2 and MTDPARTS together

Wolfgang Denk wd at denx.de
Sun May 17 15:54:28 CEST 2009


Dear Stefan,

In message <1242468262-25814-1-git-send-email-sr at denx.de> you wrote:
> Currently using JFFS2 with MTDPARTS enabled doesn't work. This is because
> mtdparts_init() is available in both files, cmd_mtdparts.c and
> cmd_jffs2.c. Please note that in the original cmd_jffs2.c file (before
> the jffs2/mtdparts command/file split those 2 different versions
> already existed. So this is nothing new. The main problem is that the
> variables "current_dev" and "current_partnum" are declared in both
> files now. This doesn't work.
> 
> This patch now changes the names of those variable to more specific
> names: "current_mtd_dev" and "current_mtd_partnum". This is because
> this patch also changes the declaration from static to global, so
> that they can be used from both files.
> 
> Please note that my first tests were not successful. The MTD devices
> selected via mtdparts are now accessed but I'm failing to see the
> directory listed via the "ls" command. Nothing is displayed. Perhaps
> I didn't generate the JFFS2 image correctly (I never used JFFS2 in
> U-Boot before). Not sure. Perhaps somebody else could take a look at
> this as well. I'll continue looking into this on Monday.

My tests are not succesful wither. I tested on TQM8548; when booting
Linux I see this:

...
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron NAND 512MiB
3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 628 at 0x000004e80000
Bad eraseblock 995 at 0x000007c60000
Bad eraseblock 2051 at 0x000010060000
Bad eraseblock 3608 at 0x00001c300000
Bad eraseblock 3992 at 0x00001f300000
cmdlinepart partition parsing not available
Creating 1 MTD partitions on "e3010000.nand":
0x000000000000-0x000001000000 : "fs"
...
-bash-3.2# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00200000 00040000 "kernel"
mtd1: 00300000 00040000 "root"
mtd2: 07a00000 00040000 "user"
mtd3: 00040000 00040000 "env1"
mtd4: 00040000 00040000 "env2"
mtd5: 00080000 00040000 "u-boot"
mtd6: 01000000 00020000 "fs"
-bash-3.2# mount -t jffs2 /dev/mtdblock6 /mnt
-bash-3.2# ls -l /mnt 
total 8601
-rwxr-xr-x 1 root root   3660 Apr  2  2008 arch
-rwxr-xr-x 1 root root 342308 Apr  2  2008 awk
-rwxr-xr-x 1 root root  16008 Apr  2  2008 basename
-rwxr-xr-x 1 root root 745340 Apr  2  2008 bash
-rwxr-xr-x 1 root root  19352 Apr  2  2008 cat
-rwxr-xr-x 1 root root  47796 Apr  2  2008 chgrp
-rwxr-xr-x 1 root root  39412 Apr  2  2008 chmod
-rwxr-xr-x 1 root root  48556 Apr  2  2008 chown
-rwxr-xr-x 1 root root  60620 Apr  2  2008 cp
-rwxr-xr-x 1 root root 117200 Apr  2  2008 cpio
-rwxr-xr-x 1 root root  31116 Apr  2  2008 cut
-rwxr-xr-x 1 root root  49372 Apr  2  2008 date
-rwxr-xr-x 1 root root  52088 Apr  2  2008 dd
...

In U-Boot - with your patch applied - I get this:

=> mtdparts

device nor1 <f8000000.flash>, # parts = 6
 #: name                size            offset          mask_flags
 0: kernel              0x00200000      0x00000000      0
 1: root                0x00300000      0x00200000      0
 2: user                0x07a00000      0x00500000      0
 3: env1                0x00040000      0x07f00000      0
 4: env2                0x00040000      0x07f40000      0
 5: u-boot              0x00080000      0x07f80000      0

device nand0 <e3010000.nand>, # parts = 1
 #: name                size            offset          mask_flags
 0: fs                  0x01000000      0x00000000      0

active partition: nand0,0 - (fs) 0x01000000 @ 0x00000000

defaults:
mtdids  : none
mtdparts: none
=> fsinfo
### filesystem type is JFFS2
Scanning JFFS2 FS:   read_nand_cached: error reading nand off 0xabfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xadfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xac0000 size 8192 bytes
read_nand_cached: error reading nand off 0xaffe00 size 8192 bytes
read_nand_cached: error reading nand off 0xae0000 size 8192 bytes
read_nand_cached: error reading nand off 0xb1fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xb00000 size 8192 bytes
read_nand_cached: error reading nand off 0xb3fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xb20000 size 8192 bytes
read_nand_cached: error reading nand off 0xb5fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xb40000 size 8192 bytes
read_nand_cached: error reading nand off 0xb7fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xb60000 size 8192 bytes
read_nand_cached: error reading nand off 0xb9fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xb80000 size 8192 bytes
read_nand_cached: error reading nand off 0xbbfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xba0000 size 8192 bytes
read_nand_cached: error reading nand off 0xbdfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xbc0000 size 8192 bytes
read_nand_cached: error reading nand off 0xbffe00 size 8192 bytes
read_nand_cached: error reading nand off 0xbe0000 size 8192 bytes
read_nand_cached: error reading nand off 0xc1fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xc00000 size 8192 bytes
read_nand_cached: error reading nand off 0xc3fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xc20000 size 8192 bytes
read_nand_cached: error reading nand off 0xc5fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xc40000 size 8192 bytes
read_nand_cached: error reading nand off 0xc7fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xc60000 size 8192 bytes
read_nand_cached: error reading nand off 0xc9fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xc80000 size 8192 bytes
read_nand_cached: error reading nand off 0xcbfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xca0000 size 8192 bytes
read_nand_cached: error reading nand off 0xcdfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xcc0000 size 8192 bytes
read_nand_cached: error reading nand off 0xcffe00 size 8192 bytes
read_nand_cached: error reading nand off 0xce0000 size 8192 bytes
read_nand_cached: error reading nand off 0xd1fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xd00000 size 8192 bytes
read_nand_cached: error reading nand off 0xd3fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xd20000 size 8192 bytes
read_nand_cached: error reading nand off 0xd5fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xd40000 size 8192 bytes
read_nand_cached: error reading nand off 0xd7fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xd60000 size 8192 bytes
read_nand_cached: error reading nand off 0xd9fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xd80000 size 8192 bytes
read_nand_cached: error reading nand off 0xdbfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xda0000 size 8192 bytes
read_nand_cached: error reading nand off 0xddfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xdc0000 size 8192 bytes
read_nand_cached: error reading nand off 0xdffe00 size 8192 bytes
read_nand_cached: error reading nand off 0xde0000 size 8192 bytes
read_nand_cached: error reading nand off 0xe1fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xe00000 size 8192 bytes
read_nand_cached: error reading nand off 0xe3fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xe20000 size 8192 bytes
read_nand_cached: error reading nand off 0xe5fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xe40000 size 8192 bytes
read_nand_cached: error reading nand off 0xe7fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xe60000 size 8192 bytes
read_nand_cached: error reading nand off 0xe9fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xe80000 size 8192 bytes
read_nand_cached: error reading nand off 0xebfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xea0000 size 8192 bytes
read_nand_cached: error reading nand off 0xedfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xec0000 size 8192 bytes
read_nand_cached: error reading nand off 0xeffe00 size 8192 bytes
read_nand_cached: error reading nand off 0xee0000 size 8192 bytes
read_nand_cached: error reading nand off 0xf1fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xf00000 size 8192 bytes
read_nand_cached: error reading nand off 0xf3fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xf20000 size 8192 bytes
read_nand_cached: error reading nand off 0xf5fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xf40000 size 8192 bytes
read_nand_cached: error reading nand off 0xf7fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xf60000 size 8192 bytes
read_nand_cached: error reading nand off 0xf9fe00 size 8192 bytes
read_nand_cached: error reading nand off 0xf80000 size 8192 bytes
read_nand_cached: error reading nand off 0xfbfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xfa0000 size 8192 bytes
read_nand_cached: error reading nand off 0xfdfe00 size 8192 bytes
read_nand_cached: error reading nand off 0xfc0000 size 8192 bytes                                    done.
Compression: NONE
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: ZERO
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: RTIME
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: RUBINMIPS
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: COPY
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: DYNRUBIN
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
Compression: ZLIB
        frag count: 0
        compressed sum: 0
        uncompressed sum: 0
=>

The addresses where the read errors occur don't seem to be related to
the bad blocks reported by Linux.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Eeeek!
'eval' on strings should have been named 'evil'.    -- Tom Phoenix in
        <Pine.GSO.3.96.980526121813.27437N-100000 at user2.teleport.com>


More information about the U-Boot mailing list