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

Wolfgang Denk wd at denx.de
Sun May 17 16:52: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.

I wonder how the mtdparts code is supposed to work at all. I was
running some more tests on a TQM823L boiard, which has two banks of
NOR flash, each 4 MiB, mapped at 0x40000000 and 0x40400000,
respective, to form a contiguous area of 8 MiB from
0x40000000...0x407FFFFF. This is also what the default MTDPARTS
setting assumes:

mtdparts=TQM8xxL-0:256k(u-boot),128k(dtb),1664k(kernel),2m(rootfs),4m(data)


However, it doesn't work. With DEBUGF enabled and an additional debug
output, I see this:

=> mtdparts default

---mtdparts_init---
last_ids  : 
env_ids   : nor0=TQM8xxL-0
last_parts: 
env_parts : mtdparts=TQM8xxL-0:256k(u-boot),128k(dtb),1664k(kernel),2m(rootfs),4m(data)

last_partition : 
env_partition  : <NULL>

---parse_mtdids---
mtdids = nor0=TQM8xxL-0

+ id nor0                4194304 bytes  TQM8xxL-0

---parse_mtdparts---
mtdparts = mtdparts=TQM8xxL-0:256k(u-boot),128k(dtb),1664k(kernel),2m(rootfs),4m(data)

--- current_save ---
=> partition NULL
--- index partitions ---
=> mtddevnum NULL
=> mtddevname NULL
===device_parse===
--- id_find_by_mtd_id: 'TQM8xxL-0' (len = 9)
entry: 'TQM8xxL-0' (len = 9)
dev type = 1 (nor), dev num = 0, mtd-id = TQM8xxL-0
parsing partitions 256k(u-boot),128k(dtb),1664k(kernel),2m(rootfs),4m(data)
+ partition: name u-boot                 size 0x00040000 offset 0xffffffff mask flags 0
part_validate: id: TQM8xxL-0  p->off: 00000000  p->sz: 00040000  end: 40000  id->sz: 00400000
+ partition: name dtb                    size 0x00020000 offset 0xffffffff mask flags 0
part_validate: id: TQM8xxL-0  p->off: 00040000  p->sz: 00020000  end: 60000  id->sz: 00400000
+ partition: name kernel                 size 0x001a0000 offset 0xffffffff mask flags 0
part_validate: id: TQM8xxL-0  p->off: 00060000  p->sz: 001A0000  end: 200000  id->sz: 00400000
+ partition: name rootfs                 size 0x00200000 offset 0xffffffff mask flags 0
part_validate: id: TQM8xxL-0  p->off: 00200000  p->sz: 00200000  end: 400000  id->sz: 00400000
+ partition: name data                   size 0x00400000 offset 0xffffffff mask flags 0
part_validate: id: TQM8xxL-0  p->off: 00400000  p->sz: 00400000  end: 800000  id->sz: 00400000
TQM8xxL-0: partitioning exceeds flash size


It seems that the part_validate() code increases the offset, such  as
if  both  banks of NOR flash were indeed just one big device (which I
consider correct behaviour), but then it compares it against the size
of the current bank instead of against the total flash size.

Am I missing something?

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
You'll learn something  about  men  and  women  --  the  way  they're
supposed  to  be. Caring for each other, being happy with each other,
being good to each other. That's what we call love. You'll like  that
a lot.
	-- Kirk, "The Apple", stardate 3715.6


More information about the U-Boot mailing list