public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] [FIT] Delay FIT format check on sector based devices
@ 2008-06-06 21:07 Marian Balakowicz
  2008-06-06 21:51 ` Grant Erickson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marian Balakowicz @ 2008-06-06 21:07 UTC (permalink / raw)
  To: u-boot

Global FIT image operations like format check cannot be performed on
a first sector data, defer them to the point when whole FIT image was
uploaded to a system RAM.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---

Grant,

Please give this patch a try on your system and let me know if it helped to
solve the nand booting issue.

Thanks,
m.

 common/cmd_doc.c  |   19 ++++++++++---------
 common/cmd_fdc.c  |   15 ++++++++-------
 common/cmd_ide.c  |   19 ++++++++++---------
 common/cmd_nand.c |   38 ++++++++++++++++++++------------------
 common/cmd_scsi.c |   15 ++++++++-------
 common/cmd_usb.c  |   15 ++++++++-------
 6 files changed, 64 insertions(+), 57 deletions(-)


diff --git a/common/cmd_doc.c b/common/cmd_doc.c
index 83aba37..d7b2f53 100644
--- a/common/cmd_doc.c
+++ b/common/cmd_doc.c
@@ -206,7 +206,7 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	image_header_t *hdr;
 	int rcode = 0;
 #if defined(CONFIG_FIT)
-	const void *fit_hdr;
+	const void *fit_hdr = NULL;
 #endif
 
 	show_boot_progress (34);
@@ -275,12 +275,6 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
 		fit_hdr = (const void *)addr;
-		if (!fit_check_format (fit_hdr)) {
-			show_boot_progress (-130);
-			puts ("** Bad FIT image format\n");
-			return 1;
-		}
-		show_boot_progress (131);
 		puts ("Fit image detected...\n");
 
 		cnt = fit_get_size (fit_hdr);
@@ -304,8 +298,15 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
-	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-		fit_print_contents ((const void *)addr);
+	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+		if (!fit_check_format (fit_hdr)) {
+			show_boot_progress (-130);
+			puts ("** Bad FIT image format\n");
+			return 1;
+		}
+		show_boot_progress (131);
+		fit_print_contents (fit_hdr);
+	}
 #endif
 
 	/* Loading ok, update default load address */
diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c
index 0293d18..e4fbf29 100644
--- a/common/cmd_fdc.c
+++ b/common/cmd_fdc.c
@@ -787,7 +787,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	char *ep;
 	int rcode = 0;
 #if defined(CONFIG_FIT)
-	const void *fit_hdr;
+	const void *fit_hdr = NULL;
 #endif
 
 	switch (argc) {
@@ -847,10 +847,6 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
 		fit_hdr = (const void *)addr;
-		if (!fit_check_format (fit_hdr)) {
-			puts ("** Bad FIT image format\n");
-			return 1;
-		}
 		puts ("Fit image detected...\n");
 
 		imsize = fit_get_size (fit_hdr);
@@ -879,8 +875,13 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
-	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-		fit_print_contents ((const void *)addr);
+	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+		if (!fit_check_format (fit_hdr)) {
+			puts ("** Bad FIT image format\n");
+			return 1;
+		}
+		fit_print_contents (fit_hdr);
+	}
 #endif
 
 	/* Loading ok, update default load address */
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 6560702..97a873d 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -367,7 +367,7 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	image_header_t *hdr;
 	int rcode = 0;
 #if defined(CONFIG_FIT)
-	const void *fit_hdr;
+	const void *fit_hdr = NULL;
 #endif
 
 	show_boot_progress (41);
@@ -465,12 +465,6 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
 		fit_hdr = (const void *)addr;
-		if (!fit_check_format (fit_hdr)) {
-			show_boot_progress (-140);
-			puts ("** Bad FIT image format\n");
-			return 1;
-		}
-		show_boot_progress (141);
 		puts ("Fit image detected...\n");
 
 		cnt = fit_get_size (fit_hdr);
@@ -496,8 +490,15 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
-	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-		fit_print_contents ((const void *)addr);
+	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+		if (!fit_check_format (fit_hdr)) {
+			show_boot_progress (-140);
+			puts ("** Bad FIT image format\n");
+			return 1;
+		}
+		show_boot_progress (141);
+		fit_print_contents (fit_hdr);
+	}
 #endif
 
 	/* Loading ok, update default load address */
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 37198d2..e20c1af 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -484,7 +484,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	image_header_t *hdr;
 	int jffs2 = 0;
 #if defined(CONFIG_FIT)
-	const void *fit_hdr;
+	const void *fit_hdr = NULL;
 #endif
 
 	s = strchr(cmd, '.');
@@ -526,12 +526,6 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
 		fit_hdr = (const void *)addr;
-		if (!fit_check_format (fit_hdr)) {
-			show_boot_progress (-150);
-			puts ("** Bad FIT image format\n");
-			return 1;
-		}
-		show_boot_progress (151);
 		puts ("Fit image detected...\n");
 
 		cnt = fit_get_size (fit_hdr);
@@ -564,8 +558,15 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 
 #if defined(CONFIG_FIT)
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
-	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-		fit_print_contents ((const void *)addr);
+	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+		if (!fit_check_format (fit_hdr)) {
+			show_boot_progress (-150);
+			puts ("** Bad FIT image format\n");
+			return 1;
+		}
+		show_boot_progress (151);
+		fit_print_contents (fit_hdr);
+	}
 #endif
 
 	/* Loading ok, update default load address */
@@ -952,7 +953,7 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	image_header_t *hdr;
 	int rcode = 0;
 #if defined(CONFIG_FIT)
-	const void *fit_hdr;
+	const void *fit_hdr = NULL;
 #endif
 
 	show_boot_progress (52);
@@ -1021,12 +1022,6 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
 		fit_hdr = (const void *)addr;
-		if (!fit_check_format (fit_hdr)) {
-			show_boot_progress (-150);
-			puts ("** Bad FIT image format\n");
-			return 1;
-		}
-		show_boot_progress (151);
 		puts ("Fit image detected...\n");
 
 		cnt = fit_get_size (fit_hdr);
@@ -1050,8 +1045,15 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
-	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-		fit_print_contents ((const void *)addr);
+	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+		if (!fit_check_format (fit_hdr)) {
+			show_boot_progress (-150);
+			puts ("** Bad FIT image format\n");
+			return 1;
+		}
+		show_boot_progress (151);
+		fit_print_contents (fit_hdr);
+	}
 #endif
 
 	/* Loading ok, update default load address */
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index 69028f3..e648f7d 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -212,7 +212,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	image_header_t *hdr;
 	int rcode = 0;
 #if defined(CONFIG_FIT)
-	const void *fit_hdr;
+	const void *fit_hdr = NULL;
 #endif
 
 	switch (argc) {
@@ -291,10 +291,6 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
 		fit_hdr = (const void *)addr;
-		if (!fit_check_format (fit_hdr)) {
-			puts ("** Bad FIT image format\n");
-			return 1;
-		}
 		puts ("Fit image detected...\n");
 
 		cnt = fit_get_size (fit_hdr);
@@ -317,8 +313,13 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
-	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-		fit_print_contents ((const void *)addr);
+	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+		if (!fit_check_format (fit_hdr)) {
+			puts ("** Bad FIT image format\n");
+			return 1;
+		}
+		fit_print_contents (fit_hdr);
+	}
 #endif
 
 	/* Loading ok, update default load address */
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 9be86b8..f2795d3 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -316,7 +316,7 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	image_header_t *hdr;
 	block_dev_desc_t *stor_dev;
 #if defined(CONFIG_FIT)
-	const void *fit_hdr;
+	const void *fit_hdr = NULL;
 #endif
 
 	switch (argc) {
@@ -404,10 +404,6 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
 		fit_hdr = (const void *)addr;
-		if (!fit_check_format (fit_hdr)) {
-			puts ("** Bad FIT image format\n");
-			return 1;
-		}
 		puts ("Fit image detected...\n");
 
 		cnt = fit_get_size (fit_hdr);
@@ -430,8 +426,13 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #if defined(CONFIG_FIT)
 	/* This cannot be done earlier, we need complete FIT image in RAM first */
-	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT)
-		fit_print_contents ((const void *)addr);
+	if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
+		if (!fit_check_format (fit_hdr)) {
+			puts ("** Bad FIT image format\n");
+			return 1;
+		}
+		fit_print_contents (fit_hdr);
+	}
 #endif
 
 	/* Loading ok, update default load address */

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH] [FIT] Delay FIT format check on sector based devices
  2008-06-06 21:07 [U-Boot-Users] [PATCH] [FIT] Delay FIT format check on sector based devices Marian Balakowicz
@ 2008-06-06 21:51 ` Grant Erickson
  2008-06-09 18:11 ` Scott Wood
  2008-07-05 22:32 ` Wolfgang Denk
  2 siblings, 0 replies; 4+ messages in thread
From: Grant Erickson @ 2008-06-06 21:51 UTC (permalink / raw)
  To: u-boot

On 6/6/08 2:07 PM, Marian Balakowicz wrote:
> Global FIT image operations like format check cannot be performed on
> a first sector data, defer them to the point when whole FIT image was
> uploaded to a system RAM.
> 
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
> ---
> 
> Grant,
> 
> Please give this patch a try on your system and let me know if it helped to
> solve the nand booting issue.

Marian:

Thanks for the prompt response on the patch. This matches what I mocked up
as a fix and testing your solution works for the 'cmd_nand' case on my AMCC
board. I did not test and cannot comment on the others so I'll partially ACK
it.

Partial Acked-by: Grant Erickson <gerickson@nuovations.com>

Thanks again,

Grant

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH] [FIT] Delay FIT format check on sector based devices
  2008-06-06 21:07 [U-Boot-Users] [PATCH] [FIT] Delay FIT format check on sector based devices Marian Balakowicz
  2008-06-06 21:51 ` Grant Erickson
@ 2008-06-09 18:11 ` Scott Wood
  2008-07-05 22:32 ` Wolfgang Denk
  2 siblings, 0 replies; 4+ messages in thread
From: Scott Wood @ 2008-06-09 18:11 UTC (permalink / raw)
  To: u-boot

On Fri, Jun 06, 2008 at 11:07:40PM +0200, Marian Balakowicz wrote:
> Global FIT image operations like format check cannot be performed on
> a first sector data, defer them to the point when whole FIT image was
> uploaded to a system RAM.
> 
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
> ---
> 
> Grant,
> 
> Please give this patch a try on your system and let me know if it helped to
> solve the nand booting issue.
> 
> Thanks,
> m.
> 
>  common/cmd_doc.c  |   19 ++++++++++---------
>  common/cmd_fdc.c  |   15 ++++++++-------
>  common/cmd_ide.c  |   19 ++++++++++---------
>  common/cmd_nand.c |   38 ++++++++++++++++++++------------------
>  common/cmd_scsi.c |   15 ++++++++-------
>  common/cmd_usb.c  |   15 ++++++++-------
>  6 files changed, 64 insertions(+), 57 deletions(-)

NAND and DOC bits Acked-by: Scott Wood <scottwood@freescale.com>

-Scott

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH] [FIT] Delay FIT format check on sector based devices
  2008-06-06 21:07 [U-Boot-Users] [PATCH] [FIT] Delay FIT format check on sector based devices Marian Balakowicz
  2008-06-06 21:51 ` Grant Erickson
  2008-06-09 18:11 ` Scott Wood
@ 2008-07-05 22:32 ` Wolfgang Denk
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2008-07-05 22:32 UTC (permalink / raw)
  To: u-boot

In message <20080606210025.17567.28404.stgit@hekate.izotz.org> you wrote:
> Global FIT image operations like format check cannot be performed on
> a first sector data, defer them to the point when whole FIT image was
> uploaded to a system RAM.
> 
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
> ---
> 
> Grant,
> 
> Please give this patch a try on your system and let me know if it helped to
> solve the nand booting issue.
> 
> Thanks,
> m.
> 
>  common/cmd_doc.c  |   19 ++++++++++---------
>  common/cmd_fdc.c  |   15 ++++++++-------
>  common/cmd_ide.c  |   19 ++++++++++---------
>  common/cmd_nand.c |   38 ++++++++++++++++++++------------------
>  common/cmd_scsi.c |   15 ++++++++-------
>  common/cmd_usb.c  |   15 ++++++++-------
>  6 files changed, 64 insertions(+), 57 deletions(-)

Applied, thanks.

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
If it happens once, it's a bug.
If it happens twice, it's a feature.
If it happens more than twice, it's a design philosophy.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-05 22:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-06 21:07 [U-Boot-Users] [PATCH] [FIT] Delay FIT format check on sector based devices Marian Balakowicz
2008-06-06 21:51 ` Grant Erickson
2008-06-09 18:11 ` Scott Wood
2008-07-05 22:32 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox