From 2ec0a6b9c0056bb357f2fc47c91f66a404df7056 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lothar=20Wa=C3=9Fmann?= Date: Thu, 14 Aug 2014 14:21:48 +0200 Subject: [PATCH] karo: tx53: prevent boot failure do to bad blocks inside the U-Boot partition Currently booting from NAND will fail, if the u-boot partition contains any bad block, since the image_len in the IVT is set to the u-boot partition size. Apparently the ROM code has a bug and does not load the last block of a flash image when the block does not end on a 4KiB boundary. This leads to boot failures or random U-Boot crashes, because the relocation table is most affected by this bug. Workaround this by padding the image_len stored in the IVT to the next 4KiB boundary. --- board/karo/tx53/lowlevel_init.S | 5 ++--- board/karo/tx53/u-boot.lds | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/board/karo/tx53/lowlevel_init.S b/board/karo/tx53/lowlevel_init.S index 555b5d5730..21ee4d8785 100644 --- a/board/karo/tx53/lowlevel_init.S +++ b/board/karo/tx53/lowlevel_init.S @@ -346,8 +346,7 @@ fcb_start: .org 0x68 .word 0x0 /* primary image starting page number */ .word 0x0 /* secondary image starting page number */ - .word 0x6b - .word 0x6b + .org 0x78 .word 0x0 /* DBBT start page (0 == NO DBBT) */ .word 0 /* Bad block marker offset in main area (unused) */ .org 0xac @@ -373,7 +372,7 @@ app_code_csf: boot_data: .long fcb_start image_len: - .long CONFIG_U_BOOT_IMG_SIZE + .long __rel_dyn_end - fcb_start plugin: .word 0 ivt_end: diff --git a/board/karo/tx53/u-boot.lds b/board/karo/tx53/u-boot.lds index d775349e8e..1ce1e2ff87 100644 --- a/board/karo/tx53/u-boot.lds +++ b/board/karo/tx53/u-boot.lds @@ -62,6 +62,11 @@ SECTIONS *(.rel*) } + /* Workaround for an apparent bug in i.MX53 ROM Code, + * that skips loading the last block if it doesn't + * end on a 4KiB boundary. + */ + . = ALIGN(4096); .rel_dyn_end : { *(.__rel_dyn_end) -- 2.39.2