From: Lothar Waßmann Date: Thu, 14 Aug 2014 12:21:48 +0000 (+0200) Subject: karo: tx53: prevent boot failure do to bad blocks inside the U-Boot partition X-Git-Tag: KARO-TX-2014-08-21~4 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=commitdiff_plain;h=2ec0a6b9c0056bb357f2fc47c91f66a404df7056 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. --- 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)