From: Ilya Yanok <yanok@emcraft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] JFFS2 scanning bug
Date: Sat, 14 Mar 2009 03:59:22 +0300 [thread overview]
Message-ID: <49BB016A.5060009@emcraft.com> (raw)
In-Reply-To: <54418.87.113.82.207.1236369998.squirrel@mailhost.mimc.co.uk>
Hi Mark,
mpfj-list at mimc.co.uk wrote:
>> Hi Mark,
>>
>> Don't you have JTAG debugger so you could find where exactly it hangs?
>> Or you can try adding debugging printf's to the source... I can't
>> reproduce your problem myself so that info would be useful.
>>
>
>
Thanks for clearing this out.
> Okay, I think I've found the problem.
>
> When *not* using JFFS2_CMDLINE mode, U-Boot tries to work out the MTD
> table automatically (for me using NOR flash, it's in the function
> get_part_sector_size_nor() in cmd_jffs2.c).
>
> Without specifying CONFIG_JFFS2_PART_SIZE, part->size defaults to
> 0xffffffff (use whole device).
>
> However, the scanning code contains the line ...
>
> end_phys = start_phys + flash->size;
>
> ... which, in this case, simply sets end_phys to (start_phys - 1).
>
> Then the code has the lines ...
>
> if (flash->start[i] >= end_phys)
> break;
>
This is wrong actually as sector_size is not an attribute of a partition
but is an attribute of a whole mtd device and we don't want to get
smaller sector size (this would make generic scanning slower and can
break summary support). So just need to remove this break.
I'll prepare the patch and will post it in some days. (We can just drop
the above two lines and it should work but the most clean way would be
to calculate sector_size after flash_init() and then just use that value
but that means a lot of patching... Maybe someone has any ideas?)
[...]
> start_phys = flash->start[0] + part->offset;
> - end_phys = start_phys + part->size;
> +
> + if (part->size == SIZE_REMAINING) {
> + end_phys = start_phys + flash->size;
>
I can still imagine an overflow here.
Regards, Ilya.
next prev parent reply other threads:[~2009-03-14 0:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 13:07 [U-Boot] JFFS2 scanning bug Mark Jackson
2009-02-26 14:48 ` Ilya Yanok
2009-02-26 15:18 ` Mark Jackson
2009-02-26 15:46 ` Ilya Yanok
2009-02-26 16:19 ` Mark Jackson
2009-03-06 20:06 ` mpfj-list at mimc.co.uk
2009-03-14 0:59 ` Ilya Yanok [this message]
2009-04-30 13:05 ` Mark Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49BB016A.5060009@emcraft.com \
--to=yanok@emcraft.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox