Signed-off-by: Bernhard Nortmann <[email protected]>
---
fel.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/fel.c b/fel.c
index 41b19c9..bbaeec9 100644
--- a/fel.c
+++ b/fel.c
@@ -215,8 +215,7 @@ void aw_fel_write(libusb_device_handle *usb, void *buf,
uint32_t offset, size_t
if (uboot_size > 0 && offset <= uboot_entry + uboot_size && offset +
len >= uboot_entry) {
fprintf(stderr, "ERROR: Attempt to overwrite U-Boot! "
"Request 0x%08X-0x%08X overlaps 0x%08X-0x%08X.\n",
- offset, offset + (int)len,
- uboot_entry, uboot_entry + uboot_size);
+ offset, offset + len, uboot_entry, uboot_entry +
uboot_size);
exit(1);
}
aw_send_fel_request(usb, AW_FEL_1_WRITE, offset, len);
@@ -752,9 +751,11 @@ void aw_fel_write_and_execute_spl(libusb_device_handle
*usb,
* image. Upon success, the image data gets transferred to the default memory
* address stored within the image header; and the function preserves the
* U-Boot entry point (offset) and size values.
+ * Note that for small files (SPL only, less than SPL_LEN_LIMIT bytes),
+ * len < 0 may be passed to this function; meaning there is no U-Boot image.
*/
void aw_fel_write_uboot_image(libusb_device_handle *usb,
- uint8_t *buf, size_t len)
+ uint8_t *buf, int len)
{
if (len <= HEADER_SIZE)
return; /* Insufficient size (no actual data), just bail out */
@@ -774,17 +775,16 @@ void aw_fel_write_uboot_image(libusb_device_handle *usb,
}
uint32_t data_size = be32toh(buf32[3]); /* Image Data Size */
uint32_t load_addr = be32toh(buf32[4]); /* Data Load Address */
- if ((size_t)data_size != len - HEADER_SIZE) {
+ if ((int)data_size != len - HEADER_SIZE) {
fprintf(stderr, "U-Boot image data size mismatch: "
- "expected %d, got %u\n", (int)len - HEADER_SIZE,
- data_size);
+ "expected %d, got %u\n", len - HEADER_SIZE, data_size);
exit(1);
}
/* TODO: Verify image data integrity using the checksum field ih_dcrc,
* available from be32toh(buf32[6])
*
* However, this requires CRC routines that mimic their U-Boot
- * counterparts, namely image_check_dcrc() in
${U-BOOT}/common/image.cabs
+ * counterparts, namely image_check_dcrc() in ${U-BOOT}/common/image.c
* and crc_wd() in ${U-BOOT}/lib/crc32.c
*
* It should be investigated if existing CRC routines in sunxi-tools
--
2.0.5
--
You received this message because you are subscribed to the Google Groups
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.