* [U-Boot] nand sector size is zero in jffs2 cmds
@ 2008-12-23 1:02 Derek Ou
2008-12-23 21:44 ` Derek Ou
2009-01-06 19:03 ` [U-Boot] env_nand malloc not released Derek Ou
0 siblings, 2 replies; 8+ messages in thread
From: Derek Ou @ 2008-12-23 1:02 UTC (permalink / raw)
To: u-boot
Hi, all,
When I tested jffs2 command for NAND, I found that jffs2_1pass.c::
jffs2_1pass_build_lists() fails at
u32 nr_sectors = part->size/part->sector_size;
because part->sector_size is zero. And cause the "### ERROR ### Please
RESET the board ###" error when entering the for loop (i < nr_sectors),
I think.
It looks like the sector_size was not updated in mtdparts_init().
According to cmd_jffs2.c, the mtdparts_init in the #ifdef
CONFIG_JFFS2_CMDLINE section calls the parse_mtdparts() and eventually
reach the following lines in part_validate_nand():
nand = &nand_info[id->num];
part->sector_size = nand->erasesize;
However, the other mtdparts_init(), which is not in the #ifdef
CONFIG_JFFS2_CMDLINE section, does not call parse_mtdparts() and it may
lead to the part->sector_size not initialized.
I am not totally familiar with this jffs2 and nand code. Can someone
review this? Thanks.
Derek
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] nand sector size is zero in jffs2 cmds
2008-12-23 1:02 [U-Boot] nand sector size is zero in jffs2 cmds Derek Ou
@ 2008-12-23 21:44 ` Derek Ou
2009-01-24 0:53 ` Wolfgang Denk
2009-01-06 19:03 ` [U-Boot] env_nand malloc not released Derek Ou
1 sibling, 1 reply; 8+ messages in thread
From: Derek Ou @ 2008-12-23 21:44 UTC (permalink / raw)
To: u-boot
The "### ERROR ### Please RESET the board ###" error and the zero NAND
sector size problem can be fixed by the following patch. However, the
jffs2 scanning routine does not skip the bad blocks in NAND though.
Derek
************* patch **************
index 7866c80..f6966f3 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -1853,6 +1853,8 @@ int mtdparts_init(void)
if (part->size == SIZE_REMAINING)
part->size = id->size - part->offset;
+ part->sector_size = nand_info[id->num].erasesize;
+
DEBUGF("part : name = %s, size = 0x%08lx, offset =
0x%08lx\n",
part->name, part->size, part->offset);
Derek Ou wrote:
> Hi, all,
>
> When I tested jffs2 command for NAND, I found that jffs2_1pass.c::
> jffs2_1pass_build_lists() fails at
> u32 nr_sectors = part->size/part->sector_size;
> because part->sector_size is zero. And cause the "### ERROR ###
> Please RESET the board ###" error when entering the for loop (i <
> nr_sectors), I think.
>
> It looks like the sector_size was not updated in mtdparts_init().
> According to cmd_jffs2.c, the mtdparts_init in the #ifdef
> CONFIG_JFFS2_CMDLINE section calls the parse_mtdparts() and eventually
> reach the following lines in part_validate_nand():
> nand = &nand_info[id->num];
> part->sector_size = nand->erasesize;
> However, the other mtdparts_init(), which is not in the #ifdef
> CONFIG_JFFS2_CMDLINE section, does not call parse_mtdparts() and it
> may lead to the part->sector_size not initialized.
>
> I am not totally familiar with this jffs2 and nand code. Can someone
> review this? Thanks.
> Derek
>
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] env_nand malloc not released
2008-12-23 1:02 [U-Boot] nand sector size is zero in jffs2 cmds Derek Ou
2008-12-23 21:44 ` Derek Ou
@ 2009-01-06 19:03 ` Derek Ou
2009-01-07 22:15 ` Scott Wood
2009-01-24 0:53 ` Wolfgang Denk
1 sibling, 2 replies; 8+ messages in thread
From: Derek Ou @ 2009-01-06 19:03 UTC (permalink / raw)
To: u-boot
Hi, all,
In the common/env_nand.c, function env_relocate_spec (for
CONFIG_ENV_OFFSET_REDUND) malloc two memory areas in line 296 and 297.
If it hits line 308 when both environment areas not found, it will
return without freeing the two memory areas. Is this a bug or I am
missing something?
Thanks,
Derek
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] env_nand malloc not released
2009-01-06 19:03 ` [U-Boot] env_nand malloc not released Derek Ou
@ 2009-01-07 22:15 ` Scott Wood
2009-01-24 0:53 ` Wolfgang Denk
1 sibling, 0 replies; 8+ messages in thread
From: Scott Wood @ 2009-01-07 22:15 UTC (permalink / raw)
To: u-boot
On Tue, Jan 06, 2009 at 12:03:48PM -0700, Derek Ou wrote:
> Hi, all,
>
> In the common/env_nand.c, function env_relocate_spec (for
> CONFIG_ENV_OFFSET_REDUND) malloc two memory areas in line 296 and 297.
> If it hits line 308 when both environment areas not found, it will
> return without freeing the two memory areas. Is this a bug or I am
> missing something?
Looks like a bug.
-Scott
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] nand sector size is zero in jffs2 cmds
2008-12-23 21:44 ` Derek Ou
@ 2009-01-24 0:53 ` Wolfgang Denk
2009-01-26 18:18 ` Derek Ou
0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2009-01-24 0:53 UTC (permalink / raw)
To: u-boot
Dear Derek Ou,
In message <49515BD6.9030606@siconix.com> you wrote:
> The "### ERROR ### Please RESET the board ###" error and the zero NAND
> sector size problem can be fixed by the following patch. However, the
> jffs2 scanning routine does not skip the bad blocks in NAND though.
>
> Derek
> ************* patch **************
> index 7866c80..f6966f3 100644
> --- a/common/cmd_jffs2.c
> +++ b/common/cmd_jffs2.c
> @@ -1853,6 +1853,8 @@ int mtdparts_init(void)
> if (part->size == SIZE_REMAINING)
> part->size = id->size - part->offset;
>
> + part->sector_size = nand_info[id->num].erasesize;
> +
> DEBUGF("part : name = %s, size = 0x%08lx, offset =
> 0x%08lx\n",
> part->name, part->size, part->offset);
Can you please submit a proper patch (after fixing your mailer
configuration which wraps long lines, thus corrupting the patch)?
See http://www.denx.de/wiki/U-Boot/Patches for instructions.
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
Perl itself is usually pretty good about telling you what you
shouldn't do. :-) - Larry Wall in <11091@jpl-devvax.JPL.NASA.GOV>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] env_nand malloc not released
2009-01-06 19:03 ` [U-Boot] env_nand malloc not released Derek Ou
2009-01-07 22:15 ` Scott Wood
@ 2009-01-24 0:53 ` Wolfgang Denk
1 sibling, 0 replies; 8+ messages in thread
From: Wolfgang Denk @ 2009-01-24 0:53 UTC (permalink / raw)
To: u-boot
Dear Derek Ou,
In message <4963AB14.9010508@siconix.com> you wrote:
>
> In the common/env_nand.c, function env_relocate_spec (for
> CONFIG_ENV_OFFSET_REDUND) malloc two memory areas in line 296 and 297.
> If it hits line 308 when both environment areas not found, it will
> return without freeing the two memory areas. Is this a bug or I am
> missing something?
Can you please submit a patch?
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
Little known fact about Middle Earth: The Hobbits had a very sophi-
sticated computer network! It was a Tolkien Ring...
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] nand sector size is zero in jffs2 cmds
2009-01-24 0:53 ` Wolfgang Denk
@ 2009-01-26 18:18 ` Derek Ou
2009-01-27 21:01 ` Wolfgang Denk
0 siblings, 1 reply; 8+ messages in thread
From: Derek Ou @ 2009-01-26 18:18 UTC (permalink / raw)
To: u-boot
Hi, Wolfgang,
The following patch was tested some time ago. I am in the middle of
another task and can not
verify this patch with the latest code. Should I just reformat my patch
and submit it or should I
wait till I can test it with the latest code?
Also, I found that jffs2 scanning routine does not skip the bad blocks
in NAND in my
previous test. Does anybody else see this behavior?
BTW, what is the best way to submit patches? I tried git-format-patch
approach described in
http://www.denx.de/wiki/U-Boot/GnatsEmail
But git-send-email is not easy to use. I tried just copy and paste but
thunderbird convert all the
tabs into spaces. I ended up using copy and paste and webmail interface
to send out another
patch. But I will love to hear a better way of doing it.
Thanks,
Derek
Wolfgang Denk wrote:
> Dear Derek Ou,
>
> In message <49515BD6.9030606@siconix.com> you wrote:
>
>> The "### ERROR ### Please RESET the board ###" error and the zero NAND
>> sector size problem can be fixed by the following patch. However, the
>> jffs2 scanning routine does not skip the bad blocks in NAND though.
>>
>> Derek
>> ************* patch **************
>> index 7866c80..f6966f3 100644
>> --- a/common/cmd_jffs2.c
>> +++ b/common/cmd_jffs2.c
>> @@ -1853,6 +1853,8 @@ int mtdparts_init(void)
>> if (part->size == SIZE_REMAINING)
>> part->size = id->size - part->offset;
>>
>> + part->sector_size = nand_info[id->num].erasesize;
>> +
>> DEBUGF("part : name = %s, size = 0x%08lx, offset =
>> 0x%08lx\n",
>> part->name, part->size, part->offset);
>>
> Can you please submit a proper patch (after fixing your mailer
> configuration which wraps long lines, thus corrupting the patch)?
>
> See http://www.denx.de/wiki/U-Boot/Patches for instructions.
>
> Best regards,
> Wolfgang Den
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] nand sector size is zero in jffs2 cmds
2009-01-26 18:18 ` Derek Ou
@ 2009-01-27 21:01 ` Wolfgang Denk
0 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Denk @ 2009-01-27 21:01 UTC (permalink / raw)
To: u-boot
Dear Derek Ou,
In message <497DFE89.7020301@siconix.com> you wrote:
>
> The following patch was tested some time ago. I am in the middle of
> another task and can not
> verify this patch with the latest code. Should I just reformat my patch
> and submit it or should I
> wait till I can test it with the latest code?
I think the fix is obvious, so feel free to repost after adding your
signed-off-by line and fixing yourmailer not to cwrap long lines. I
recommend you use git-send-email to submit the patch.
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
Business is like a wheelbarrow. Nothing ever happens until you start
pushing.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-01-27 21:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-23 1:02 [U-Boot] nand sector size is zero in jffs2 cmds Derek Ou
2008-12-23 21:44 ` Derek Ou
2009-01-24 0:53 ` Wolfgang Denk
2009-01-26 18:18 ` Derek Ou
2009-01-27 21:01 ` Wolfgang Denk
2009-01-06 19:03 ` [U-Boot] env_nand malloc not released Derek Ou
2009-01-07 22:15 ` Scott Wood
2009-01-24 0:53 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox