imls: Add support to list images in NAND device
PATCH v3 1/1 imls: Add support to list images in NAND device
This patch adds support to list images in NAND flash through imls
--- README | 3 +- common/cmd_bootm.c | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 167 insertions(+), 2 deletions(-)
README +2 -1
@@ -831,7 +831,8 @@ The following options need to be configured: CONFIG_CMD_I2C * I2C serial bus support CONFIG_CMD_IDE * IDE harddisk support CONFIG_CMD_IMI iminfo - CONFIG_CMD_IMLS List all found images + CONFIG_CMD_IMLS List all images found in NOR flash + CONFIG_CMD_IMLS_NAND List all images found in NAND flash CONFIG_CMD_IMMAP * IMMR dump support CONFIG_CMD_IMPORTENV * import an environment CONFIG_CMD_INI * import data from an ini file into the env
common/cmd_bootm.c +165 -1
187 lines not on this page · raw message
Signature · 1 line
1.8.0
PATCH v3 1/1 imls: Add support to list images in NAND device
common/cmd_bootm.c next_sector: ; · line 1344
Quoted 13 lines · Vipin Kumar
(quoted diff) +1
-0+ for (off = 0; off < nand->size; off += nand->erasesize){
common/cmd_bootm.c +11
-0+const image_header_t *header; +int ret; + +if (nand_block_isbad (nand, off)) +continue ; + + len =sizeof (buffer); + + ret =nand_read (nand, off, &len, (u8 *)buffer); +if (ret <0 && ret != -EUCLEAN ) +continue ;
Might want to make some noise if you get an uncorrectable error.
Quoted 12 lines
common/cmd_bootm.c +7
-0+ +switch (genimg_get_format (buffer)) { +case IMAGE_FORMAT_LEGACY : + header = (const image_header_t *)buffer; + len =image_get_image_size (header); + + ret = nand_imls_legacyimage(nand,
nand_dev,common/cmd_bootm.c +4
-0+ off, len); +if (ret <0 && ret != -ENOMEM ) +return ret; +break ;
common/cmd_bootm.c next_sector: ; · line 1365
Quoted 10 lines
common/cmd_bootm.c +10
-0+#if defined(CONFIG_FIT ) +case IMAGE_FORMAT_FIT : + len =fit_get_size (buffer); + ret =nand_imls_fitimage (nand, nand_dev, + off, len); +if (ret <0 && ret != -ENOMEM ) +return ret; +break ; +#endif + }
Do you really mean to return from the main imls function just because one image has an error? By "use return" I meant return from the subfunction.
-Scott
PATCH v3 1/1 imls: Add support to list images in NAND device
Quoted 16 lines · Scott Wood
common/cmd_bootm.c next_sector: ; · line 1344
Quoted 12 lines · Vipin Kumar
+ for (off = 0; off <
nand->size; off +=nand->erasesize) {
+ constimage_header_t*header;
+ int ret;common/cmd_bootm.c +9
-0+ +if (nand_block_isbad (nand, off)) +continue ; + + len =sizeof (buffer); + + ret =nand_read (nand, off, &len, (u8 *)buffer); +if (ret <0 && ret != -EUCLEAN ) +continue ;Might want to make some noise if you get an uncorrectable error.
OK..
Quoted 17 lines
Quoted 17 lines
common/cmd_bootm.c +17
-0+ +switch (genimg_get_format (buffer)) { +case IMAGE_FORMAT_LEGACY : + header = (const image_header_t *)buffer; + len =image_get_image_size (header); + + ret =nand_imls_legacyimage (nand, nand_dev, + off, len); +if (ret <0 && ret != -ENOMEM ) +return ret; +break ; +#if defined(CONFIG_FIT ) +case IMAGE_FORMAT_FIT : + len =fit_get_size (buffer); + ret =nand_imls_fitimage (nand, nand_dev, + off, len); +if (ret <0 && ret != -ENOMEM )
Quoted 9 lines
Quoted 4 lines
+ return ret;
+ break;
+#endif
+ }Do you really mean to return from the main imls function just because one image has an error? By "use return" I meant return from the subfunction.
I thought about it a little bit. How do you suggest
Quoted 2 lines
-Scott
PATCH v3 1/1 imls: Add support to list images in NAND device
In reply to Scott WoodQuoted 18 lines
Quoted 18 lines
common/cmd_bootm.c +7
-0+ +switch (genimg_get_format (buffer)) { +case IMAGE_FORMAT_LEGACY : + header = (const image_header_t *)buffer; + len =image_get_image_size (header); + + ret = nand_imls_legacyimage(nand,
nand_dev,common/cmd_bootm.c +10
-0+ off, len); +if (ret<0 && ret != -ENOMEM ) +return ret; +break ; +#if defined(CONFIG_FIT ) +case IMAGE_FORMAT_FIT : + len =fit_get_size (buffer); + ret =nand_imls_fitimage (nand, nand_dev, + off, len); +if (ret<0 && ret != -ENOMEM )
Quoted 9 lines
common/cmd_bootm.c next_sector: ; · line 1365
Quoted 4 lines
common/cmd_bootm.c +4
-0+return ret; +break ; +#endif + }Do you really mean to return from the main imls function just because one image has an error? By "use return" I meant return from the subfunction.
This return only corresponds to the situation when there is an error returned from nand read routine. In that case, I don't think there is any use reading the NAND any further.
What do you think ?
Quoted 2 lines
-Scott
PATCH v3 1/1 imls: Add support to list images in NAND device
Quoted 28 lines · Vipin Kumar
Quoted 18 lines
Quoted 18 lines
common/cmd_bootm.c +7
-0+ +switch (genimg_get_format (buffer)) { +case IMAGE_FORMAT_LEGACY : + header = (const image_header_t *)buffer; + len =image_get_image_size (header); + + ret = nand_imls_legacyimage(nand,
nand_dev,common/cmd_bootm.c +10
-0+ off, len); +if (ret<0 && ret != -ENOMEM ) +return ret; +break ; +#if defined(CONFIG_FIT ) +case IMAGE_FORMAT_FIT : + len =fit_get_size (buffer); + ret =nand_imls_fitimage (nand, nand_dev, + off, len); +if (ret<0 && ret != -ENOMEM )Quoted 9 lines
common/cmd_bootm.c next_sector: ; · line 1365
Quoted 4 lines
common/cmd_bootm.c +4
-0+return ret; +break ; +#endif + }Do you really mean to return from the main imls function just because one image has an error? By "use return" I meant return from the subfunction.
Quoted 3 lines
This return only corresponds to the situation when there is an error returned from nand read routine. In that case, I don't think there is any use reading the NAND any further.
Just because one page has an uncorrectable error doesn't mean the entire NAND is bad. Note that this is different from what you currently do if you get an error on the initial read where you look for a header.
Might want to bail out if you get an excessive amount of errors (particularly consecutive), though, suggesting that the NAND might not be working at all. The user probably doesn't want to wait for thousands of error messages to scroll by in that case.
-Scott