
Dear Stefan,
In message 1242468262-25814-1-git-send-email-sr@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