summaryrefslogtreecommitdiff
path: root/tools/mksunxiboot.c
diff options
context:
space:
mode:
authorDaniel Kochmański <dkochmanski@turtle-solutions.eu>2015-05-26 17:00:39 +0200
committerHans de Goede <hdegoede@redhat.com>2015-05-29 13:46:36 +0200
commit1f6f61fe4c7c9637e2c8b2960a08f106fbe01134 (patch)
tree831f31393fc3e80501cd64f2388832635fafaf0d /tools/mksunxiboot.c
parent9d1111b70e20fc9dd4e45ada9a921da5591ee74a (diff)
sunxi/nand: change BLOCK_SIZE in mksunxiboot to match NAND block size
This change is necessary to calculate correct checksum for NAND boot. Works both for MMC and NAND. Without it BROM rejects boot image as invalid (bad checksum). (Changes block size from 0x200 to 0x2000). Signed-off-by: Daniel Kochmański <dkochmanski@turtle-solutions.eu> Signed-off-by: Roy Spliet <r.spliet@ultimaker.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'tools/mksunxiboot.c')
-rw-r--r--tools/mksunxiboot.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/mksunxiboot.c b/tools/mksunxiboot.c
index 0035f6ea265..3361251c8e7 100644
--- a/tools/mksunxiboot.c
+++ b/tools/mksunxiboot.c
@@ -65,7 +65,13 @@ int gen_check_sum(struct boot_file_head *head_p)
#define SUN4I_SRAM_SIZE 0x7600 /* 0x7748+ is used by BROM */
#define SRAM_LOAD_MAX_SIZE (SUN4I_SRAM_SIZE - sizeof(struct boot_file_head))
-#define BLOCK_SIZE 512
+
+/*
+ * BROM (at least on A10 and A20) requires NAND-images to be explicitly aligned
+ * to a multiple of 8K, and rejects the image otherwise. MMC-images are fine
+ * with 512B blocks. To cater for both, align to the largest of the two.
+ */
+#define BLOCK_SIZE 0x2000
struct boot_img {
struct boot_file_head header;