]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
karo: tx53: prevent boot failure do to bad blocks inside the U-Boot partition
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 14 Aug 2014 12:21:48 +0000 (14:21 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 14 Aug 2014 12:30:52 +0000 (14:30 +0200)
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
board/karo/tx53/u-boot.lds

index 555b5d57308399d78cb82577251f1ec8b8dd57b0..21ee4d87856b4f8ecb65d3bd9a3037fab0e20ac6 100644 (file)
@@ -346,8 +346,7 @@ fcb_start:
        .org    0x68
        .word   0x0     /* primary image starting page number */
        .word   0x0     /* secondary image starting page number */
        .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
        .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:
 boot_data:
        .long   fcb_start
 image_len:
-       .long   CONFIG_U_BOOT_IMG_SIZE
+       .long   __rel_dyn_end - fcb_start
 plugin:
        .word   0
 ivt_end:
 plugin:
        .word   0
 ivt_end:
index d775349e8ee4e47e0e21b8b9efbec330848e2683..1ce1e2ff87383ea7bfad11a5d32bfa9fa16f25d4 100644 (file)
@@ -62,6 +62,11 @@ SECTIONS
                *(.rel*)
        }
 
                *(.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)
        .rel_dyn_end :
        {
                *(.__rel_dyn_end)