diff mbox

[U-Boot,2/2] common/cmd_source.c: Fix the source command failure under 64-bit platform

Message ID 1438236001-31047-1-git-send-email-Qianyu.Gong@freescale.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Gong Qianyu July 30, 2015, 6 a.m. UTC
Modify the data pointer type from ulong* to u32*.

For arm64 type "ulong" could be 64-bit. Then in line 89 of common/cmd_source.c:
"while (*data++);" data will point to the next 64 bits each time. As the uImage
file generated by mkimage tool keeps the same data format in either 32-bit or 64-bit
platform, the difference would cause failure in 64-bit platform.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

Comments

Tom Rini Aug. 13, 2015, 1:21 p.m. UTC | #1
On Thu, Jul 30, 2015 at 02:00:01PM +0800, Gong Qianyu wrote:

> Modify the data pointer type from ulong* to u32*.
> 
> For arm64 type "ulong" could be 64-bit. Then in line 89 of common/cmd_source.c:
> "while (*data++);" data will point to the next 64 bits each time. As the uImage
> file generated by mkimage tool keeps the same data format in either 32-bit or 64-bit
> platform, the difference would cause failure in 64-bit platform.
> 
> Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
> 
> diff --git a/common/cmd_source.c b/common/cmd_source.c
> index d2a881d..db7ab7e 100644

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/cmd_source.c b/common/cmd_source.c
index d2a881d..db7ab7e 100644
--- a/common/cmd_source.c
+++ b/common/cmd_source.c
@@ -33,7 +33,7 @@  source (ulong addr, const char *fit_uname)
 #if defined(CONFIG_IMAGE_FORMAT_LEGACY)
 	const image_header_t *hdr;
 #endif
-	ulong		*data;
+	u32		*data;
 	int		verify;
 	void *buf;
 #if defined(CONFIG_FIT)
@@ -74,7 +74,7 @@  source (ulong addr, const char *fit_uname)
 		}
 
 		/* get length of script */
-		data = (ulong *)image_get_data (hdr);
+		data = (u32 *)image_get_data (hdr);
 
 		if ((len = uimage_to_cpu (*data)) == 0) {
 			puts ("Empty Script\n");
@@ -128,7 +128,7 @@  source (ulong addr, const char *fit_uname)
 			return 1;
 		}
 
-		data = (ulong *)fit_data;
+		data = (u32 *)fit_data;
 		len = (ulong)fit_len;
 		break;
 #endif