This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/OMAP-L138: re-flashing U-Boot partition from a Linux shell script

Part Number: OMAP-L138
Other Parts Discussed in Thread: FLASHTOOL

Tool/software: Linux

Hello,

We have two products deployed using the OMAP-L138 processor.  The problem is that many of these (unfortunately a LOT of these) have a very old version of U-Boot on them installed that has a very old NAND flash driver on them that causes the units in the field to become a brick when the NAND devices develops bit errors.

The challenge is, since these units are in hundreds of locations, this needs to happen from a Linux shell script.  I would greatly appreciate help in being able to write over the U-Boot partition from Linux.

Much thanks,

Bill

  • Hi,

    We're looking into this.

    Best Regards,
    Yordan
  • Have you checked this e2e thread:
    e2e.ti.com/.../1259113

    Also are you trying to enable just the u-boot image or the ais generated file as well? I am not sure that you can update the ais signed image from linux...

    Best Regards,
    Yordan
  • Hello, yes, that was my old thread 4 years ago!

    Unfortunately I was never really able to get that old solution to work reliably.  However, as I was dreading, this problem has come to a head and we have to address it and try to come up with a solution so that units in the field can be re-programmed and don't have to be RMA'ed to get re-flashed. 

    So where I'm at now is trying to build the latest U-Boot with doesn't require a separate UBL.  I got the code base URL from the last thread you mentioned (I pasted it below, but for some reason, after pasting it, it was "covered up" by the following large icon).  The URL is still listed in the thread: e2e.ti.com/.../1259113

     

    Here's what happens when I try to build it:  I'm building it on the following VM:

    $ uname -a
    CYGWIN_NT-6.1 Volga-Win7 2.10.0(0.325/5/3) 2018-02-02 15:16 x86_64 Cygwin

    bgoetz@Volga-Win7 ~/ap4/board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04
    $

    Here's the output from when I attempt to build on it:

    bgoetz@Volga-Win7 ~/ap4/board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04
    $ make CROSS_COMPILE=arm-linux-gnueabi- distclean
    /home/bgoetz/ap4/gcc-linaro-6.2.1-ti2017.01-armv5-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc: /home/bgoetz/ap4/gcc-linaro-6.2.1-ti2017.01-armv5-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc: cannot execute binary file
    /bin/sh: /home/bgoetz/ap4/gcc-linaro-6.2.1-ti2017.01-armv5-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc: cannot execute binary file: Exec format error
    dirname: missing operand
    Try 'dirname --help' for more information.
    make: *** [Makefile:1455: _clean_drivers] Interrupt


    bgoetz@Volga-Win7 ~/ap4/board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04
    $ objdump -f /home/bgoetz/ap4/gcc-linaro-6.2.1-ti2017.01-armv5-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc

    /home/bgoetz/ap4/gcc-linaro-6.2.1-ti2017.01-armv5-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc: file format elf64-x86-64
    architecture: i386:x86-64, flags 0x00000112:
    EXEC_P, HAS_SYMS, D_PAGED
    start address 0x0000000000403040


    bgoetz@Volga-Win7 ~/ap4/board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04
    $ which ls
    /usr/bin/ls

    bgoetz@Volga-Win7 ~/ap4/board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04
    $ objdump -f /usr/bin/ls

    /usr/bin/ls: file format pei-x86-64
    architecture: i386:x86-64, flags 0x0000010a:
    EXEC_P, HAS_DEBUG, D_PAGED
    start address 0x0000000100401000


    bgoetz@Volga-Win7 ~/ap4/board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04
    $

    If I want to build U-Boot, what's the Ubuntu version of a VM should I install on my PC?

    Much thanks,

    Bill

  • So here's how the current partitions look on our box:
    Would love to combine the UBL and U-Boot partitions if possible using the new AIS format.

    # Here's what the partitions look like:

    root@arago:~# cat /proc/partitions
    major minor #blocks name

    31 0 128 mtdblock0
    31 1 128 mtdblock1
    31 2 512 mtdblock2
    31 3 2048 mtdblock3
    31 4 16384 mtdblock4
    31 5 16384 mtdblock5
    31 6 487424 mtdblock6
    root@arago:~#
    root@arago:~#
    root@arago:~# cat /proc/mtd
    dev: size erasesize name
    mtd0: 00020000 00020000 "u-boot env"
    mtd1: 00020000 00020000 "UBL"
    mtd2: 00080000 00020000 "u-boot"
    mtd3: 00200000 00020000 "kernel"
    mtd4: 01000000 00020000 "filesystem"
    mtd5: 01000000 00020000 "ap4_fs"
    mtd6: 1dc00000 00020000 "filesystem_large"
    root@arago:~#
    root@arago:~#
  • So here's a bit more information. Looking at the contents of the flash a bit more closely, we're actually not using MTD2. The partition MTD1 is actually a concatenation of "UBL" + "U-boot". Here's the contents of that partition: (I've shortened it).

    So the problem is (the details are coming back...) that format of the OOB for THIS partition (the one with UBL + U-Boot) is actually DIFFERENT from the format of the OOB in all of the other partitions! (where the Bad Bit Table is stored for each sector.)

    So I believe when Linux tries to overwrite this partition using the standard commands:
    flash_eraseall /dev/mtd1
    nandwrite -p /dev/mtd1 <new_ubl_and_uboot.bin_file>

    The files gets written using an INCORRECT mapping of the OOB!

    This causes the box to BRICK with the error:

    OMAP-L138 initialization passed!
    Booting TI User Boot Loader
    UBL Version: 1.65
    UBL Flashtype: NAND
    Starting NAND Copy...
    No valid boot image found!
    NAND Boot failed.
    Aborting...



    root@arago:~#
    root@arago:~#
    root@arago:~# nanddump -l 0x47f0 -p /dev/mtd1
    ECC failed: 216
    ECC corrected: 0
    Number of bad blocks: 0
    Number of bbt blocks: 0
    Block size 131072, page size 2048, OOB size 64
    Dumping data starting at 0x00000000 and ending at 0x000047f0...
    ECC: 3 uncorrectable bitflip(s) at offset 0x00000000
    0x00000000: 54 49 50 41 01 59 53 58 00 00 00 80 e0 2e 00 00
    0x00000010: 00 00 0f e1 1f 00 c0 e3 d3 00 80 e3 00 f0 29 e1
    0x00000020: 10 0f 11 ee 33 0c c0 e3 87 00 c0 e3 02 00 80 e3
    0x00000030: 01 0a 80 e3 10 0f 01 ee 18 00 9f e5 18 10 9f e5
    0x00000040: 01 00 80 e0 04 d0 40 e2 07 d0 cd e3 0c 00 9f e5
    0x00000050: 00 f0 a0 e1 fe ff ff ea e0 2e 00 80 00 08 00 00
    0x00000060: 54 00 00 80 70 40 2d e9 00 00 a0 e3 5e 04 00 eb
    0x00000070: cc 02 00 eb 00 00 50 e3 2d 00 00 1a 02 00 80 e2
    0x00000080: ad 01 00 eb b4 30 9f e5 02 00 a0 e3 00 10 93 e5
    0x00000090: dd 03 00 eb a8 50 9f e5 00 00 85 e5 a4 00 9f e5
    0x000000a0: 47 04 00 eb a0 00 9f e5 45 04 00 eb 9c 00 9f e5
    0x000000b0: 43 04 00 eb 98 00 9f e5 41 04 00 eb 94 00 9f e5
    0x000000c0: 3f 04 00 eb 90 00 9f e5 3d 04 00 eb 8c 00 9f e5
    0x000000d0: 3b 04 00 eb 13 0b 00 eb 00 00 50 e3 02 00 00 0a
    0x000000e0: 7c 00 9f e5 36 04 00 eb 11 00 00 ea 74 40 9f e5
    0x000000f0: 74 00 9f e5 32 04 00 eb 70 00 9f e5 30 04 00 eb
    0x00000100: 00 00 94 e5 21 04 00 eb 64 00 9f e5 2c 04 00 eb
    0x00000110: 60 00 9f e5 5d 04 00 eb 00 00 95 e5 b4 03 00 eb
    0x00000120: 00 20 94 e5 50 30 9f e5 00 20 83 e5 32 ff 2f e1
    0x00000130: 70 80 bd e8 44 00 9f e5 21 04 00 eb fe ff ff ea
    0x00000140: d4 2f 00 80 d4 32 00 80 ad 2f 00 80 e0 2e 00 80
    0x00000150: fa 2e 00 80 18 2f 00 80 27 2f 00 80 2c 2f 00 80
    0x00000160: 3f 2f 00 80 46 2f 00 80 d8 32 00 80 5a 2f 00 80
    0x00000170: 62 2f 00 80 89 2f 00 80 10 27 00 00 cc 32 00 80
    0x00000180: 7f 2f 00 80 0c 30 9f e5 24 00 93 e5 30 00 00 e2
    0x00000190: 20 02 a0 e1 1e ff 2f e1 00 40 c1 01 00 00 50 e3
    0x000001a0: 10 40 2d e9 80 00 9f 05 01 40 a0 e1 03 10 a0 e1
    0x000001b0: 02 00 00 0a 01 00 50 e3 10 80 bd 18 6c 00 9f e5
    0x000001c0: 01 30 a0 e3 13 c2 a0 e1 28 31 90 e5 03 00 1c e1
    0x000001d0: fc ff ff 1a 02 3c 84 e2 03 31 90 e7 1f 30 03 e2
    0x000001e0: 01 00 53 e1 10 80 bd 08 0a 3d 84 e2 03 21 90 e7
    0x000001f0: 1f 20 c2 e3 01 20 82 e1 03 21 80 e7 20 31 90 e5
    0x00000200: 03 30 8c e1 20 31 80 e5 28 31 90 e5 03 00 1c e1
    0x00000210: fc ff ff 1a 02 3c 84 e2 03 31 90 e7 1f 30 03 e2
    0x00000220: 01 00 53 e1 fa ff ff 1a 10 80 bd e8 00 00 c1 01
    0x00000230: 00 70 e2 01 18 c0 9f e5 48 00 80 e2 00 31 9c e7

    ...

    0x00000780: 0c 10 a0 e3 00 20 a0 e3 03 30 a0 e3 82 fe ff eb
    0x00000790: 04 00 a0 e3 ff 14 a0 e3 22 24 a0 e3 a4 fe ff eb
    0x000007a0: 00 00 a0 e3 10 80 bd e8 03 30 a0 e3 01 00 a0 e3
    0x000007b0: 0d 10 a0 e3 00 20 a0 e3 77 fe ff eb 04 00 a0 e3
    0x000007c0: ff 18 a0 e3 22 28 a0 e3 99 fe ff eb 00 00 a0 e3
    0x000007d0: 10 80 bd e8 01 00 50 e3 10 40 2d e9 00 40 a0 e1
    0x000007e0: 14 00 00 8a 00 00 50 e3 02 00 00 0a 01 00 50 e3
    0x000007f0: 10 00 00 1a 05 00 00 ea 04 00 a0 e3 ff 1c a0 e3
    OOB Data: ff ff ff ff ff ff 46 f9 a0 b4 bf de 2e b7 53 b6
    OOB Data: ff ff ff ff ff ff 85 02 1b f5 0a 59 fa d0 43 4e
    OOB Data: ff ff ff ff ff ff fb f3 04 7d 02 f5 43 0a a7 6e
    OOB Data: ff ff ff ff ff ff ab c6 e7 e6 b9 fd 4b 86 62 9b
    ECC: 3 uncorrectable bitflip(s) at offset 0x00000800
    0x00000800: 22 2c a0 e3 8a fe ff eb 04 00 a0 e1 10 80 bd e8
    0x00000810: 0b 10 a0 e3 00 20 a0 e3 03 30 a0 e3 5e fe ff eb
    0x00000820: 04 00 a0 e3 ff 18 a0 e3 11 27 a0 e3 80 fe ff eb
    0x00000830: 00 00 a0 e3 10 80 bd e8 01 00 a0 e3 10 80 bd e8
    0x00000840: 01 00 50 e3 10 40 2d e9 00 40 a0 e1 20 00 00 8a
    0x00000850: 00 00 50 e3 02 00 00 0a 01 00 50 e3 1c 00 00 1a
    0x00000860: 0d 00 00 ea 03 30 a0 e3 00 20 a0 e1 05 10 a0 e3
    0x00000870: 49 fe ff eb 0a 00 a0 e3 00 10 e0 e3 58 20 9f e5
    0x00000880: 6b fe ff eb 0b 00 a0 e3 ff 10 a0 e3 22 20 a0 e3
    0x00000890: 67 fe ff eb 04 00 a0 e1 10 80 bd e8 03 30 a0 e3

    ...

    0x00000f60: 00 00 50 e3 00 40 a0 03 01 40 04 12 00 00 54 e3
    0x00000f70: f6 ff ff 1a 00 00 50 e3 01 00 00 1a 02 00 80 e2
    0x00000f80: f0 81 bd e8 05 30 d6 e7 01 50 85 e2 00 30 88 e5
    0x00000f90: 07 00 55 e1 ec ff ff ba 00 00 a0 e3 f0 81 bd e8
    0x00000fa0: 1f 40 2d e9 1c c0 a0 e3 00 20 a0 e3 31 3c a0 e1
    0x00000fb0: 0f 30 03 e2 09 00 53 e3 07 30 83 82 07 e0 8d e2
    0x00000fc0: 30 30 83 e2 02 30 ce e7 01 20 82 e2 08 00 52 e3
    0x00000fd0: 04 c0 4c e2 f4 ff ff 1a 00 30 a0 e3 0e 10 a0 e1
    0x00000fe0: 03 20 a0 e1 0f 30 cd e5 c9 ff ff eb 14 d0 8d e2
    0x00000ff0: 00 80 bd e8 04 20 90 e5 08 00 9f e5 00 30 a0 e3
    OOB Data: ff ff ff ff ff ff 79 7c 18 f0 0d ab e6 10 66 0d
    OOB Data: ff ff ff ff ff ff 1c f1 a3 d7 cc a6 55 5d 5a bc
    OOB Data: ff ff ff ff ff ff 53 4d 0d f6 53 63 95 18 5a 50
    OOB Data: ff ff ff ff ff ff 1c 74 f2 b4 ab 52 20 80 68 48
    ECC: 3 uncorrectable bitflip(s) at offset 0x00001000
    0x00001000: 30 30 82 e5 a1 00 00 ea 10 27 00 00 70 40 2d e9
    0x00001010: 00 40 a0 e1 0c 00 a0 e3 01 50 a0 e1 76 00 00 eb
    0x00001020: 0c 31 9f e5 00 40 80 e5 04 21 93 e7 00 60 a0 e1
    0x00001030: 04 20 80 e5 14 30 92 e5 40 00 13 e3 fc ff ff 0a
    0x00001040: 00 00 55 e3 ec 30 9f 05 08 50 86 15 04 50 96 e5
    0x00001050: 08 30 86 05 06 00 a0 e1 e5 ff ff eb 30 30 95 e5
    0x00001060: 08 20 96 e5 02 39 c3 e3 30 30 85 e5 30 30 95 e5
    0x00001070: 00 20 92 e5 02 39 83 e3 02 00 52 e3 30 30 85 e5
    0x00001080: 01 30 a0 03 02 00 00 0a 01 00 52 e3 26 00 00 1a
    0x00001090: 00 30 a0 e3 34 30 85 e5 0c 30 95 e5 64 00 a0 e3
    0x000010a0: 80 30 83 e3 0c 30 85 e5 78 00 00 eb 08 30 96 e5
    0x000010b0: 00 40 a0 e3 0e 30 d3 e5 64 00 a0 e3 20 30 c5 e5

    ...

    0x00001750: 02 00 00 0a 00 00 54 e3 00 00 50 13 f0 ff ff 0a
    0x00001760: 00 00 a0 e3 3e 80 bd e8 10 40 2d e9 10 10 a0 e3
    0x00001770: ff 20 a0 e3 00 40 a0 e1 2a ff ff eb 04 00 a0 e1
    0x00001780: 02 1c a0 e3 10 40 bd e8 e1 ff ff ea 13 40 2d e9
    0x00001790: 00 40 a0 e1 04 10 8d e5 10 10 a0 e3 70 20 a0 e3
    0x000017a0: 04 00 a0 e1 1f ff ff eb 04 00 a0 e1 32 ff ff eb
    0x000017b0: 04 30 9d e5 01 30 43 e2 04 30 8d e5 04 30 9d e5
    0x000017c0: 00 00 53 e3 01 00 00 0a 40 00 10 e3 f1 ff ff 0a
    0x000017d0: 04 30 9d e5 00 00 53 e3 01 00 a0 03 01 00 00 12
    0x000017e0: 1c 80 bd e8 70 40 2d e9 60 20 a0 e3 00 50 a0 e1
    0x000017f0: 01 40 a0 e1 10 10 a0 e3 0a ff ff eb b0 31 d5 e1
    OOB Data: ff ff ff ff ff ff 0a e1 2f 85 97 a2 7e 09 bb ed
    OOB Data: ff ff ff ff ff ff 87 d5 95 5e a4 93 56 16 fd 0d
    OOB Data: ff ff ff ff ff ff 68 9b 2d 52 93 d9 36 22 e4 ed
    OOB Data: ff ff ff ff ff ff 49 90 f8 b5 0a 70 32 32 bc eb
    ECC: 3 uncorrectable bitflip(s) at offset 0x00001800
    0x00001800: 05 00 a0 e1 93 04 01 e0 39 ff ff eb 05 00 a0 e1
    0x00001810: 10 10 a0 e3 d0 20 a0 e3 02 ff ff eb 05 00 a0 e1
    0x00001820: 0a 1b a0 e3 ba ff ff eb 00 00 50 e3 01 00 00 0a
    0x00001830: 01 00 a0 e3 70 80 bd e8 05 00 a0 e1 0a 1b a0 e3
    0x00001840: 70 40 bd e8 d0 ff ff ea 70 40 2d e9 00 60 a0 e1
    0x00001850: 01 30 41 e2 01 00 a0 e1 0c 10 96 e5 02 50 83 e0
    0x00001860: 01 00 55 e1 01 00 a0 23 00 40 a0 31 01 00 00 3a
    0x00001870: 70 80 bd e8 da ff ff eb 05 00 54 e1 04 10 a0 e1
    0x00001880: 06 00 a0 e1 00 20 a0 e3 01 40 84 e2 f8 ff ff 9a

    ...

    0x00001f20: 08 f0 93 e5 00 80 50 e2 02 00 00 0a b8 72 c4 e1
    0x00001f30: 01 00 a0 e3 17 00 00 ea b0 32 d4 e1 00 00 53 e3
    0x00001f40: 0d 00 00 0a b0 21 d4 e1 05 10 a0 e1 01 20 42 e2
    0x00001f50: 0d 30 a0 e1 04 00 a0 e1 6f ff ff eb 0d 10 a0 e1
    0x00001f60: 34 30 94 e5 04 00 a0 e1 0f e0 a0 e1 08 f0 93 e5
    0x00001f70: 00 00 50 e3 b8 82 c4 11 ec ff ff 1a 01 30 a0 e3
    0x00001f80: b8 32 c4 e1 00 00 a0 e3 02 00 00 ea b8 32 d4 e1
    0x00001f90: 01 00 73 e2 00 00 a0 33 01 dc 8d e2 f0 81 bd e8
    0x00001fa0: f0 41 2d e9 11 de 4d e2 00 60 a0 e1 03 80 a0 e1
    0x00001fb0: 0d 30 a0 e1 01 50 a0 e1 02 40 a0 e1 56 ff ff eb
    0x00001fc0: 06 00 a0 e1 10 10 a0 e3 00 20 a0 e3 15 fd ff eb
    0x00001fd0: 00 10 a0 e3 01 20 a0 e1 06 00 a0 e1 2d fe ff eb
    0x00001fe0: 00 70 a0 e1 07 10 a0 e1 06 00 a0 e1 67 fd ff eb
    0x00001ff0: b0 31 d6 e1 06 00 a0 e1 93 45 21 e0 3c fd ff eb
    OOB Data: ff ff ff ff ff ff b0 7f cd 35 18 21 d4 0a 8d 89
    OOB Data: ff ff ff ff ff ff 38 12 2a cb 84 39 73 0e 03 25
    OOB Data: ff ff ff ff ff ff 1b 56 07 e2 e9 54 fb 98 5f c4
    OOB Data: ff ff ff ff ff ff 32 d7 a7 fa d5 31 ce 62 11 2b
    ECC: 3 uncorrectable bitflip(s) at offset 0x00002000
    0x00002000: be 31 d6 e1 00 00 53 e3 03 00 00 0a 06 00 a0 e1
    0x00002010: 10 10 a0 e3 30 20 a0 e3 02 fd ff eb 06 00 a0 e1
    0x00002020: 0a 1b a0 e3 ba fd ff eb 00 40 50 e2 42 00 00 1a
    0x00002030: 30 30 96 e5 06 00 a0 e1 0f e0 a0 e1 14 f0 93 e5
    0x00002040: 04 50 a0 e1 34 00 00 ea 30 30 96 e5 0f e0 a0 e1
    0x00002050: 10 f0 93 e5 b6 31 d6 e1 06 00 a0 e1 03 20 a0 e1
    0x00002060: 93 85 21 e0 83 fd ff eb 06 00 a0 e1 30 30 96 e5
    0x00002070: 0f e0 a0 e1 14 f0 93 e5 ff 20 05 e2 04 30 a0 e1
    0x00002080: 06 00 a0 e1 0d 10 a0 e1 30 c0 96 e5 0f e0 a0 e1
    0x00002090: 18 f0 9c e5 b6 31 d6 e1 04 20 a0 e1 93 85 21 e0

    ...

    0x00002780: 00 30 a0 e3 b8 32 c6 e1 06 30 d0 e5 06 00 a0 e1
    0x00002790: 1d 30 c6 e5 04 30 d2 e5 08 30 c6 e5 f1 fb ff eb
    0x000027a0: 00 00 50 e3 07 00 00 1a 06 00 a0 e1 9c fe ff eb
    0x000027b0: 00 00 50 e3 03 00 00 1a 06 00 a0 e1 e9 fb ff eb
    0x000027c0: 00 00 50 e3 00 00 00 0a 00 60 a0 e3 06 00 a0 e1
    0x000027d0: 70 80 bd e8 8c 30 00 80 60 30 00 80 80 30 00 80
    0x000027e0: e4 30 00 80 1a 03 a0 e3 c0 30 90 e5 2c 10 9f e5
    0x000027f0: 01 30 03 e0 00 30 82 e5 c4 30 90 e5 01 30 03 e0
    OOB Data: ff ff ff ff ff ff 19 61 09 1f 60 73 8d 23 65 1f
    OOB Data: ff ff ff ff ff ff 06 42 25 80 e2 e1 3f bc ec 96
    OOB Data: ff ff ff ff ff ff ea 8e 42 46 82 12 d3 ea ef 9d
    OOB Data: ff ff ff ff ff ff 6e 6d da 54 df be 52 43 46 a9
    ECC: 3 uncorrectable bitflip(s) at offset 0x00002800
    0x00002800: 04 30 82 e5 c8 30 90 e5 01 30 03 e0 08 30 82 e5
    0x00002810: cc 30 90 e5 01 30 03 e0 0c 30 82 e5 1e ff 2f e1
    0x00002820: ff 03 ff 03 f0 4f 2d e9 2c d0 4d e2 04 00 8d e5
    0x00002830: 01 b0 a0 e1 02 90 a0 e1 03 00 a0 e1 00 10 a0 e3
    0x00002840: 01 20 d0 e7 0c 30 8d e2 01 20 c3 e7 01 10 81 e2
    0x00002850: 10 00 51 e3 f9 ff ff 1a 10 70 9d e5 14 10 9d e5
    0x00002860: 18 80 9d e5 01 2b a0 e1 0c a0 9d e5 07 3b a0 e1
    0x00002870: 9c c0 9f e5 23 3b a0 e1 22 2b a0 e1 0c 60 a0 e1
    0x00002880: 03 48 07 e2 0c c0 01 e0 03 3a a0 e1 02 24 a0 e1
    0x00002890: 3f 1e 08 e2 0a 0b a0 e1 06 50 a0 e1 0c 21 82 e1
    0x000028a0: 04 37 83 e1 b6 c2 dd e1 20 0b a0 e1 06 60 08 e0

    ...

    0x00002f70: 65 64 2e 0d 0a 00 20 20 20 44 4f 4e 45 00 0d 0a
    0x00002f80: 4a 75 6d 70 69 6e 67 20 74 6f 20 65 6e 74 72 79
    0x00002f90: 20 70 6f 69 6e 74 20 61 74 20 00 41 62 6f 72 74
    0x00002fa0: 69 6e 67 2e 2e 2e 0d 0a 00 0c 0d 02 02 05 05 0e
    0x00002fb0: 0f 07 0a 06 06 09 09 03 03 04 00 08 0b 12 aa 10
    0x00002fc0: 11 13 13 16 17 14 15 01 00 4f 4d 41 50 2d 4c 31
    0x00002fd0: 33 38 00 00 00 20 c4 01 00 c0 d0 01 00 d0 d0 01
    0x00002fe0: 01 00 00 00 01 00 00 00 01 00 00 00 08 00 51 00
    0x00002ff0: c4 2f 00 80 02 00 00 00 01 00 00 00 01 00 00 00
    OOB Data: ff ff ff ff ff ff 0e bf 74 31 2b 89 e5 26 82 d0
    OOB Data: ff ff ff ff ff ff a6 4d a3 79 a6 83 70 ad a9 0b
    OOB Data: ff ff ff ff ff ff 95 1c 64 f0 b3 91 2b 4d 0b 78
    OOB Data: ff ff ff ff ff ff 11 64 ba d8 4e 0c 29 d4 45 ed
    ECC: 3 uncorrectable bitflip(s) at offset 0x00003000
    0x00003000: 08 00 12 00 d8 2f 00 80 30 78 00 00 00 00 00 60
    0x00003010: 00 00 00 62 00 00 00 64 00 00 00 66 00 00 00 02
    0x00003020: 00 00 00 02 00 00 00 02 00 00 00 02 01 00 00 00
    0x00003030: 00 00 00 68 04 00 00 00 f0 2f 00 80 00 30 00 80
    0x00003040: 01 00 00 00 10 30 00 80 a0 13 00 80 00 14 00 80
    0x00003050: 20 42 61 64 20 62 6c 6f 63 6b 20 61 74 20 62 6c
    0x00003060: 6f 63 6b 20 00 2e 20 45 72 61 73 69 6e 67 20 69

    ...

    0x000037a0: 20 01 80 04 82 04 00 60 80 00 00 00 00 00 22 00
    0x000037b0: 00 00 09 00 00 00 00 08 01 40 80 00 00 00 00 00
    0x000037c0: 08 00 82 40 40 00 00 20 00 00 00 00 40 80 40 00
    0x000037d0: 00 02 20 00 80 00 00 00 00 00 01 00 23 00 10 80
    0x000037e0: 12 02 01 00 40 42 00 00 40 01 80 00 04 04 10 08
    0x000037f0: 80 08 85 01 0a 88 20 00 01 00 02 40 04 00 40 40
    OOB Data: ff ff ff ff ff ff 61 ff d6 5b 6b 0b 7e 22 00 db
    OOB Data: ff ff ff ff ff ff 13 14 70 4b fc e9 ed 88 1d 97
    OOB Data: ff ff ff ff ff ff fc d7 56 4b 17 b2 67 6a 0a 3d
    OOB Data: ff ff ff ff ff ff 9d c0 5c 14 b6 ad f5 8c 32 cd
    ECC: 3 uncorrectable bitflip(s) at offset 0x00003800
    0x00003800: 4a 00 81 01 40 00 00 a0 00 10 81 00 00 80 00 00
    0x00003810: 02 80 00 80 42 60 00 40 00 00 11 00 00 02 01 00
    0x00003820: 00 20 00 48 00 40 01 00 00 00 00 00 02 00 00 20
    0x00003830: 00 00 a0 00 04 01 40 01 08 00 02 00 00 00 20 00
    0x00003840: 00 20 01 41 00 80 00 00 00 08 40 00 40 50 00 00
    0x00003850: 88 00 00 00 01 40 20 00 00 80 20 44 00 40 80 80
    0x00003860: 02 00 00 05 00 82 02 22 00 00 00 00 00 80 00 00
    0x00003870: 00 c2 20 00 00 00 08 02 00 00 00 00 00 04 01 40

    ...

    0x00003f40: 00 20 00 10 00 90 00 00 05 00 00 28 40 02 00 41
    0x00003f50: 00 80 00 01 00 81 01 00 00 00 40 42 10 60 00 04
    0x00003f60: 08 82 01 00 00 84 40 00 88 01 00 02 04 00 00 00
    0x00003f70: 00 38 40 01 40 01 00 01 91 a0 80 00 00 82 00 00
    0x00003f80: 00 00 40 00 80 0a 40 00 01 00 01 00 00 26 84 00
    0x00003f90: 04 00 00 02 40 00 44 02 00 00 00 00 08 84 08 41
    0x00003fa0: 40 40 41 02 81 00 40 00 50 00 00 62 40 04 02 00
    0x00003fb0: 00 80 08 00 80 00 81 44 00 00 00 00 00 02 10 42
    0x00003fc0: 00 05 00 84 00 40 80 06 40 00 04 88 40 00 80 00
    0x00003fd0: 00 02 20 00 a4 04 00 20 40 00 00 80 50 40 00 21
    0x00003fe0: 00 00 88 80 02 20 06 00 10 00 10 00 40 00 00 00
    0x00003ff0: 00 00 00 40 00 00 00 00 00 44 02 21 45 00 80 40
    OOB Data: ff ff ff ff ff ff 33 ff af 12 61 c7 f1 4d d2 d8
    OOB Data: ff ff ff ff ff ff a0 54 36 8e 6d b0 54 42 26 5a
    OOB Data: ff ff ff ff ff ff d8 33 94 89 03 5a b9 79 4c 0b
    OOB Data: ff ff ff ff ff ff a6 99 02 30 79 0d a3 b9 54 92
    0x00004000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    0x00004010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    0x00004020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    0x00004030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    0x00004040: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    0x00004050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

    ...

    0x000047c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    0x000047d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    0x000047e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    0x000047f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    root@arago:~#



    Now, look at how the Bad Bit Table is stored in the OOB of the following MTD partitions:
    Note that the following is how Linux device drivers writes the data to the NAND:

    Here's how the U-Boot environment variables are stores:
    Note that the 1st 24 bytes are 0xff in the OOB data:

    root@arago:~# nanddump -l 0x7f0 -p /dev/mtd0
    ECC failed: 0
    ECC corrected: 0
    Number of bad blocks: 0
    Number of bbt blocks: 0
    Block size 131072, page size 2048, OOB size 64
    Dumping data starting at 0x00000000 and ending at 0x000007f0...
    0x00000000: 15 af 7c 6f 62 61 75 64 72 61 74 65 3d 31 31 35
    0x00000010: 32 30 30 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00
    0x00000020: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 5f
    0x00000030: 32 2e 36 2e 33 33 00 65 74 68 61 63 74 3d 44 61
    0x00000040: 56 69 6e 63 69 2d 45 4d 41 43 00 65 74 68 61 64
    0x00000050: 64 72 3d 32 38 3a 63 37 3a 31 38 3a 30 30 3a 30
    0x00000060: 65 3a 32 39 00 67 61 74 65 77 61 79 69 70 3d 31
    0x00000070: 36 39 2e 32 35 34 2e 31 30 30 2e 31 00 68 77 5f
    0x00000080: 76 65 72 73 69 6f 6e 3d 31 2e 33 00 68 77 63 6f
    0x00000090: 6e 66 69 67 3d 64 73 70 3a 77 61 6b 65 3d 79 65
    0x000000a0: 73 00 69 70 61 64 64 72 3d 31 36 39 2e 32 35 34
    0x000000b0: 2e 31 30 30 2e 32 30 31 00 6e 65 74 6d 61 73 6b
    0x000000c0: 3d 32 35 35 2e 32 35 35 2e 32 35 35 2e 30 00 6e
    0x000000d0: 66 73 68 6f 73 74 3d 31 36 39 2e 32 35 34 2e 31
    0x000000e0: 30 30 2e 31 00 73 65 72 76 65 72 69 70 3d 31 36
    0x000000f0: 39 2e 32 35 34 2e 31 30 30 2e 31 00 73 74 64 65
    0x00000100: 72 72 3d 73 65 72 69 61 6c 00 73 74 64 69 6e 3d
    0x00000110: 73 65 72 69 61 6c 00 73 74 64 6f 75 74 3d 73 65
    0x00000120: 72 69 61 6c 00 76 65 72 3d 55 2d 42 6f 6f 74 20
    0x00000130: 32 30 31 32 2e 30 34 2e 30 31 2d 30 30 30 32 35
    0x00000140: 2d 67 39 66 34 35 32 35 37 2d 64 69 72 74 79 20
    0x00000150: 28 4a 75 6c 20 32 39 20 32 30 31 34 20 2d 20 31
    0x00000160: 32 3a 31 32 3a 35 30 29 00 62 6f 6f 74 63 6d 64
    0x00000170: 3d 6e 61 6e 64 20 72 65 61 64 2e 65 20 30 78 63
    0x00000180: 31 31 38 30 30 30 30 20 30 78 34 30 30 30 30 30
    0x00000190: 20 30 78 34 30 30 30 30 30 3b 20 6e 62 6f 6f 74
    0x000001a0: 2e 65 20 30 78 63 30 37 30 30 30 30 30 20 30 20
    0x000001b0: 30 78 32 30 30 30 30 30 3b 20 62 6f 6f 74 6d 00
    0x000001c0: 62 6f 6f 74 61 72 67 73 3d 64 61 76 69 6e 63 69
    0x000001d0: 5f 65 6d 61 63 2e 65 74 68 3d 32 38 3a 63 37 3a
    0x000001e0: 31 38 3a 30 30 3a 30 65 3a 32 39 20 6d 65 6d 3d
    0x000001f0: 31 32 38 4d 20 63 6f 6e 73 6f 6c 65 3d 74 74 79
    0x00000200: 53 32 2c 31 31 35 32 30 30 6e 38 20 72 6f 6f 74
    0x00000210: 3d 2f 64 65 76 2f 6d 74 64 62 6c 6f 63 6b 34 20
    0x00000220: 72 77 20 72 6f 6f 74 66 73 74 79 70 65 3d 6a 66
    0x00000230: 66 73 32 00 00 20 62 6f 6f 74 6d 00 00 00 00 00
    0x00000240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

    ...

    0x00000710: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000720: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000730: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000740: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000750: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000760: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000770: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000790: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x000007a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x000007b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x000007c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x000007d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x000007e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x000007f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB Data: ff ff ff ff ff ff ff ff e5 a6 33 7c c4 43 5c 54
    OOB Data: 9b 57 ef 7a b0 59 7b 2e 72 c1 c1 d5 00 00 00 00
    OOB Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    root@arago:~#


    Here's how Linux itself is stored:
    Same thing, the first 24 bytes in the OOB data are 0xff:

    root@arago:~# nanddump -l 0x7f0 -p /dev/mtd3
    ECC failed: 0
    ECC corrected: 0
    Number of bad blocks: 0
    Number of bbt blocks: 0
    Block size 131072, page size 2048, OOB size 64
    Dumping data starting at 0x00000000 and ending at 0x000007f0...
    0x00000000: 27 05 19 56 bb 52 a5 c9 4d 27 8b b3 00 1e b1 14
    0x00000010: c0 00 80 00 c0 00 80 00 b8 c4 11 d1 05 02 02 00
    0x00000020: 4c 69 6e 75 78 2d 32 2e 36 2e 33 33 2d 72 63 34
    0x00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000040: 00 00 a0 e1 00 00 a0 e1 00 00 a0 e1 00 00 a0 e1
    0x00000050: 00 00 a0 e1 00 00 a0 e1 00 00 a0 e1 00 00 a0 e1
    0x00000060: 02 00 00 ea 18 28 6f 01 00 00 00 00 14 b1 1e 00
    0x00000070: 01 70 a0 e1 02 80 a0 e1 00 20 0f e1 03 00 12 e3
    0x00000080: 01 00 00 1a 17 00 a0 e3 56 34 12 ef 00 20 0f e1
    0x00000090: c0 20 82 e3 02 f0 21 e1 00 00 00 00 00 00 00 00
    0x000000a0: d4 00 8f e2 7e 30 90 e8 01 00 50 e0 0a 00 00 0a
    0x000000b0: 00 50 85 e0 00 60 86 e0 00 c0 8c e0 00 20 82 e0
    0x000000c0: 00 30 83 e0 00 d0 8d e0 00 10 96 e5 00 10 81 e0
    0x000000d0: 04 10 86 e4 0c 00 56 e1 fa ff ff 3a 00 00 a0 e3
    0x000000e0: 04 00 82 e4 04 00 82 e4 04 00 82 e4 04 00 82 e4
    0x000000f0: 03 00 52 e1 f9 ff ff 3a 28 00 00 eb 0d 10 a0 e1
    0x00000100: 01 28 8d e2 02 00 54 e1 17 00 00 2a 05 30 4d e0
    0x00000110: 03 01 84 e0 05 00 50 e1 13 00 00 9a 02 50 a0 e1

    ...

    0x00000720: 1f 1f 07 ee 9a 1f 07 ee 0e f0 a0 e1 b1 af 10 ee
    0x00000730: 0f 08 1a e3 00 a0 a0 e3 01 00 00 0a 1e af 07 ee
    0x00000740: 23 00 00 ea ba af 07 ee ff 0e 2d e9 30 0f 30 ee
    0x00000750: 07 34 10 e2 a3 3b a0 e1 1a 00 00 0a 00 a0 a0 e3
    0x00000760: aa 20 8a e0 30 12 a0 e1 07 10 01 e2 02 00 51 e3
    0x00000770: 11 00 00 ba 10 af 40 ee 95 af 07 ee 10 1f 30 ee
    0x00000780: 07 20 01 e2 04 20 82 e2 dc 40 9f e5 a1 41 14 e0
    0x00000790: 14 5f 6f e1 d4 70 9f e5 a1 76 17 e0 04 90 a0 e1
    0x000007a0: 19 b5 8a e1 17 b2 8b e1 5e bf 07 ee 01 90 59 e2
    0x000007b0: fa ff ff aa 01 70 57 e2 f7 ff ff aa 02 a0 8a e2
    0x000007c0: 0a 00 53 e1 e5 ff ff ca ff 0e bd e8 00 a0 a0 e3
    0x000007d0: 10 af 40 ee 9a af 07 ee 15 af 07 ee 9a af 07 ee
    0x000007e0: 95 af 07 ee 0e f0 a0 e1 7e ff 17 ee fd ff ff 1a
    0x000007f0: 15 0f 07 ee 9a 0f 07 ee 0e f0 a0 e1 01 28 a0 e3
    OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB Data: ff ff ff ff ff ff ff ff f6 fe ad 7a d6 43 8f 3e
    OOB Data: 9f 18 d9 45 a1 66 80 06 e2 78 14 d3 87 53 09 a7
    OOB Data: c6 b9 34 e7 96 77 a2 8f 7c 72 58 83 1d ba 96 35
    root@arago:~#


    Here's the File System:

    root@arago:~# nanddump -l 0x7f0 -p /dev/mtd4
    ECC failed: 0
    ECC corrected: 12
    Number of bad blocks: 0
    Number of bbt blocks: 0
    Block size 131072, page size 2048, OOB size 64
    Dumping data starting at 0x00000000 and ending at 0x000007f0...
    0x00000000: 85 19 01 e0 2b 00 00 00 e6 6e 26 7d 01 00 00 00
    0x00000010: 00 00 00 00 02 00 00 00 00 00 00 00 03 04 00 00
    0x00000020: eb a2 e0 9c ff 83 66 55 62 69 6e ff 85 19 02 e0
    0x00000030: 44 00 00 00 1d fb f7 98 02 00 00 00 01 00 00 00
    0x00000040: ed 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000060: 00 00 00 00 00 00 00 00 00 00 00 00 7f 02 93 49

    ...

    0x00000740: 07 0a 00 00 1e 86 8a 5c c5 d2 c1 7e 61 64 64 75
    0x00000750: 73 65 72 ff 85 19 02 e0 4d 00 00 00 97 b4 ff e5
    0x00000760: 12 00 00 00 01 00 00 00 ff a1 00 00 00 00 00 00
    0x00000770: 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x00000780: 00 00 00 00 09 00 00 00 09 00 00 00 00 00 00 00
    0x00000790: f5 7e 65 f9 cd 6e 2b 2a 74 69 6e 79 6c 6f 67 69
    0x000007a0: 6e ff ff ff 85 19 01 e0 2b 00 00 00 e6 6e 26 7d
    0x000007b0: 02 00 00 00 11 00 00 00 13 00 00 00 00 00 00 00
    0x000007c0: 03 0a 00 00 b7 cc 25 e6 48 62 6e 0e 61 73 68 ff
    0x000007d0: 85 19 02 e0 4b 00 00 00 4b eb 94 c0 13 00 00 00
    0x000007e0: 01 00 00 00 ff a1 00 00 00 00 00 00 07 00 00 00
    0x000007f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB Data: ff ff ff ff ff ff ff ff 16 58 c1 34 e5 a9 7c 21
    OOB Data: 54 ce 72 71 c4 63 d6 82 3a 01 1d 15 48 3b d9 e2
    OOB Data: 1a 78 e3 9d 52 72 e7 a5 e5 e0 f9 22 56 08 cc 92
    root@arago:~#

    And here's one of our partitions: (FWIW, we're using JFFS2):

    root@arago:~# nanddump -l 0x17f0 -p /dev/mtd5
    ECC failed: 0
    ECC corrected: 3
    Number of bad blocks: 0
    Number of bbt blocks: 0
    Block size 131072, page size 2048, OOB size 64
    Dumping data starting at 0x00000000 and ending at 0x000017f0...
    0x00000000: 85 19 02 e0 dc 04 00 00 8a 9a 0a e7 77 00 00 00
    0x00000010: 97 00 00 00 a4 81 00 00 00 00 00 00 00 10 09 00
    0x00000020: dd 46 8b 4b dd 46 8b 4b dd 46 8b 4b 68 0b 09 00
    0x00000030: 98 04 00 00 98 04 00 00 00 00 00 00 67 c4 2f e2
    0x00000040: 8d ba 04 b0 ff 35 17 f6 d8 cf e8 36 d6 7e b1 bf
    0x00000050: 4f e7 5e 10 dd a9 10 fd ec fc af 1e 9b 76 24 6f
    0x00000060: 70 99 ad ef 3d 2d be 00 1c 43 54 e9 b9 73 73 7a

    ...

    0x00000f80: 1e 98 f4 ff 9d 29 ca 7f 9c b1 70 25 d1 2e fb e1
    0x00000f90: 88 8a a3 9b 33 c1 e8 1b 38 f7 cd 03 e6 3e db 06
    0x00000fa0: e2 36 ea 53 23 64 bc 90 b3 85 76 49 ac dd b3 01
    0x00000fb0: 3d 97 23 64 2e bb ec f3 9d b9 94 ba da 6a 2e 25
    0x00000fc0: 26 ea f2 83 99 f8 27 c6 33 b9 99 27 26 c4 f8 4f
    0x00000fd0: 65 27 61 7f de 38 43 ed 69 5c f0 69 bf 3f d0 c2
    0x00000fe0: 6f 2a 1b e1 03 a4 47 e1 7e fa e7 d8 2b f3 01 87
    0x00000ff0: 59 a0 6f 25 02 7b 1c d0 9d 0e e4 0d 84 ff 2d 1a
    OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB Data: ff ff ff ff ff ff ff ff a7 7f 4c c7 6d 98 1c 3c
    OOB Data: 82 f2 e8 0f 68 44 cb 0e c7 27 43 9a 72 19 f3 ee
    OOB Data: 0f 76 b5 73 bb 19 93 32 d5 ce ce 6d 7c 4c 83 f4
    0x00001000: fe 21 0d ff 90 86 ff a9 43 c0 bf 21 5f f9 59 91
    0x00001010: 4e 31 af f6 cb 05 86 c8 00 3f fc a6 ce a1 56 af
    0x00001020: eb c8 0b dd b8 46 7c fc 5d 92 2f 8d 76 09 c8 f5
    0x00001030: 81 e5 52 6b 2d 3f b0 a4 b8 28 d0 56 ec 92 bd bd
    0x00001040: a8 f8 23 05 9d fd 4b 2d c7 9a a0 87 45 d0 f1 b7
    0x00001050: 99 1b 12 15 c0 a3 8a 02 95 3f e6 7f 30 8e 39 bd
    0x00001060: 93 93 a5 7c 1e fa df 6b c3 0d 91 19 19 57 c9 f5
    0x00001070: 45 dc 60 cd 85 6d e6 cb 89 d5 c1 25 76 45 0c e7
    0x00001080: 61 c8 54 05 ed b6 3b d0 f6 59 be b1 dc 66 6c 19
    0x00001090: e7 30 b4 47 f9 f5 15 1a c6 d3 8d 23 eb 53 27 65
    0x000010a0: 72 86 4d 93 dc 97 6c 97 72 e8 4e 81 d1 86 d4 4e
    0x000010b0: c0 68 20 ed 7b d4 56 72 d7 22 e5 3b 24 b1 76 cd
    0x000010c0: f6 7b ac 4d 65 31 e7 7b b3 5d d9 de 6c 5b d1 66
    0x000010d0: 7b b0 cf 91 92 bf 14 cd a6 9c f9 a4 d1 6d 33 b7

    ...

    0x00001760: 4f 1e f4 0c fe 3f a3 ed d1 6f 7f eb 80 e8 48 ac
    0x00001770: ef 72 05 9e ed e6 bb d1 0e fb b7 7e 43 f6 14 69
    0x00001780: 1b cf d8 8a 31 0f d4 d1 48 b7 67 a0 ef 46 d9 52
    0x00001790: db 2f ba 05 c6 61 2a 5a 4e fb bb 92 fd 57 da e5
    0x000017a0: 22 67 84 84 3e 56 4f 6c 03 4f c8 5a 7b 39 58 7b
    0x000017b0: 2e a9 01 b9 8e b2 fc cc c7 30 0f f3 db 6c ae e9
    0x000017c0: c3 e2 a6 ce 8f 52 f0 7f 11 37 d9 77 7e 8f 7d 27
    0x000017d0: 0d 33 24 8f 92 b1 8e 31 90 f4 f5 27 1d f7 1d 48
    0x000017e0: 2b ba a7 f3 c1 ab bd bb 41 b4 af 8a b4 af d1 2e
    0x000017f0: aa 1a 88 4b 16 74 ab c9 d0 ad 68 53 9f 4b f8 63
    OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB Data: ff ff ff ff ff ff ff ff e8 16 49 3d 2e 2b 7e b9
    OOB Data: 37 f8 53 fa 9c b4 d4 96 a3 4d 65 27 a5 83 53 cd
    OOB Data: 0f d7 9d cf 7f 38 a8 3b 75 cd 3f ff 8c 37 ce 52
    root@arago:~#
  • So all of the above said, I believe that if there's any hope of fixing this, I'm going to have to write a "special" program that does essentially what 'nandwrite' currently does, except that it stores the BBT in the OOB in the format that the OMAP L-138 understands upon boot up.

    It would be a SPECIAL version of that app, maybe called 'nandwrite_partition1' where it would write the "UBL + U-Boot" file to that partition using the following format for the OOB, where the there are 6 bytes of 0xff then 10 bytes of data, 4 times.

    OOB Data: ff ff ff ff ff ff 46 f9 a0 b4 bf de 2e b7 53 b6
    OOB Data: ff ff ff ff ff ff 85 02 1b f5 0a 59 fa d0 43 4e
    OOB Data: ff ff ff ff ff ff fb f3 04 7d 02 f5 43 0a a7 6e
    OOB Data: ff ff ff ff ff ff ab c6 e7 e6 b9 fd 4b 86 62 9b

    So, Yordan, or any other expert who may peruse this thread, could you possibly verify this is what I would need to do to successfully re-write the UBL + U-Boot partition from Linux?

    Anyone know of where THIS version of OOB is stored??

    Much thanks,
    Bill
  • Hi Bill,

    Sorry for the delay. We are looking into this.

    Best Regards,
    Yordan
  • Thanks a lot Yordan!

    Any help would be greatly appreciated!

    Best regards,

    Bill

  • Hello Yordan,

    So I've deciphered the NAND data in /dev/mtd1 :
    Just need to be able to take a copy of this and write it exactly the same way from Linux using the same OOB format.

    # This is the contents of /dev/mtd1 where the OMAP L-138 first reads and starts executing

    0x00000000: 54 49 50 41 - AIS magic word (0x41504954)

    01 59 53 58 - AIS Section Load Command (0x58535901)
    00 00 00 80 - Address where to load the data to: 0x800000
    e0 2e 00 00 - Size 0x00002ee0 (12000 bytes)

    0x00000010: 00 00 0f e1 1f 00 c0 e3 d3 00 80 e3 00 f0 29 e1
    0x00000020: 10 0f 11 ee 33 0c c0 e3 87 00 c0 e3 02 00 80 e3
    0x00000030: 01 0a 80 e3 10 0f 01 ee 18 00 9f e5 18 10 9f e5
    0x00000040: 01 00 80 e0 04 d0 40 e2 07 d0 cd e3 0c 00 9f e5
    0x00000050: 00 f0 a0 e1 fe ff ff ea e0 2e 00 80 00 08 00 00
    0x00000060: 54 00 00 80 70 40 2d e9 00 00 a0 e3 5e 04 00 eb
    0x00000070: cc 02 00 eb 00 00 50 e3 2d 00 00 1a 02 00 80 e2
    0x00000080: ad 01 00 eb b4 30 9f e5 02 00 a0 e3 00 10 93 e5
    0x00000090: dd 03 00 eb a8 50 9f e5 00 00 85 e5 a4 00 9f e5
    0x000000a0: 47 04 00 eb a0 00 9f e5 45 04 00 eb 9c 00 9f e5
    0x000000b0: 43 04 00 eb 98 00 9f e5 41 04 00 eb 94 00 9f e5
    0x000000c0: 3f 04 00 eb 90 00 9f e5 3d 04 00 eb 8c 00 9f e5
    0x000000d0: 3b 04 00 eb 13 0b 00 eb 00 00 50 e3 02 00 00 0a
    0x000000e0: 7c 00 9f e5 36 04 00 eb 11 00 00 ea 74 40 9f e5
    0x000000f0: 74 00 9f e5 32 04 00 eb 70 00 9f e5 30 04 00 eb
    0x00000100: 00 00 94 e5 21 04 00 eb 64 00 9f e5 2c 04 00 eb
    0x00000110: 60 00 9f e5 5d 04 00 eb 00 00 95 e5 b4 03 00 eb
    0x00000120: 00 20 94 e5 50 30 9f e5 00 20 83 e5 32 ff 2f e1
    0x00000130: 70 80 bd e8 44 00 9f e5 21 04 00 eb fe ff ff ea
    0x00000140: d4 2f 00 80 d4 32 00 80 ad 2f 00 80 e0 2e 00 80
    0x00000150: fa 2e 00 80 18 2f 00 80 27 2f 00 80 2c 2f 00 80
    0x00000160: 3f 2f 00 80 46 2f 00 80 d8 32 00 80 5a 2f 00 80
    0x00000170: 62 2f 00 80 89 2f 00 80 10 27 00 00 cc 32 00 80
    0x00000180: 7f 2f 00 80 0c 30 9f e5 24 00 93 e5 30 00 00 e2
    0x00000190: 20 02 a0 e1 1e ff 2f e1 00 40 c1 01 00 00 50 e3
    0x000001a0: 10 40 2d e9 80 00 9f 05 01 40 a0 e1 03 10 a0 e1
    0x000001b0: 02 00 00 0a 01 00 50 e3 10 80 bd 18 6c 00 9f e5
    0x000001c0: 01 30 a0 e3 13 c2 a0 e1 28 31 90 e5 03 00 1c e1
    0x000001d0: fc ff ff 1a 02 3c 84 e2 03 31 90 e7 1f 30 03 e2
    0x000001e0: 01 00 53 e1 10 80 bd 08 0a 3d 84 e2 03 21 90 e7
    0x000001f0: 1f 20 c2 e3 01 20 82 e1 03 21 80 e7 20 31 90 e5
    0x00000200: 03 30 8c e1 20 31 80 e5 28 31 90 e5 03 00 1c e1
    0x00000210: fc ff ff 1a 02 3c 84 e2 03 31 90 e7 1f 30 03 e2
    0x00000220: 01 00 53 e1 fa ff ff 1a 10 80 bd e8 00 00 c1 01
    0x00000230: 00 70 e2 01 18 c0 9f e5 48 00 80 e2 00 31 9c e7

    ...

    0x00002740: 05 10 a0 e1 03 00 a0 e3 d8 fa ff eb 00 30 e0 e3
    0x00002750: 24 30 86 e5 78 30 9f e5 00 00 86 e5 2c 30 86 e5
    0x00002760: 70 30 9f e5 04 50 86 e5 30 30 86 e5 68 30 9f e5
    0x00002770: 00 20 a0 e1 34 30 86 e5 60 30 9f e5 38 30 86 e5
    0x00002780: 00 30 a0 e3 b8 32 c6 e1 06 30 d0 e5 06 00 a0 e1
    0x00002790: 1d 30 c6 e5 04 30 d2 e5 08 30 c6 e5 f1 fb ff eb
    0x000027a0: 00 00 50 e3 07 00 00 1a 06 00 a0 e1 9c fe ff eb
    0x000027b0: 00 00 50 e3 03 00 00 1a 06 00 a0 e1 e9 fb ff eb
    0x000027c0: 00 00 50 e3 00 00 00 0a 00 60 a0 e3 06 00 a0 e1
    0x000027d0: 70 80 bd e8 8c 30 00 80 60 30 00 80 80 30 00 80
    0x000027e0: e4 30 00 80 1a 03 a0 e3 c0 30 90 e5 2c 10 9f e5
    0x000027f0: 01 30 03 e0 00 30 82 e5 c4 30 90 e5 01 30 03 e0
    OOB Data: ff ff ff ff ff ff 19 61 09 1f 60 73 8d 23 65 1f
    OOB Data: ff ff ff ff ff ff 06 42 25 80 e2 e1 3f bc ec 96
    OOB Data: ff ff ff ff ff ff ea 8e 42 46 82 12 d3 ea ef 9d
    OOB Data: ff ff ff ff ff ff 6e 6d da 54 df be 52 43 46 a9
    ECC: 3 uncorrectable bitflip(s) at offset 0x00002800
    0x00002800: 04 30 82 e5 c8 30 90 e5 01 30 03 e0 08 30 82 e5
    0x00002810: cc 30 90 e5 01 30 03 e0 0c 30 82 e5 1e ff 2f e1
    0x00002820: ff 03 ff 03 f0 4f 2d e9 2c d0 4d e2 04 00 8d e5
    0x00002830: 01 b0 a0 e1 02 90 a0 e1 03 00 a0 e1 00 10 a0 e3
    0x00002840: 01 20 d0 e7 0c 30 8d e2 01 20 c3 e7 01 10 81 e2
    0x00002850: 10 00 51 e3 f9 ff ff 1a 10 70 9d e5 14 10 9d e5
    0x00002860: 18 80 9d e5 01 2b a0 e1 0c a0 9d e5 07 3b a0 e1
    0x00002870: 9c c0 9f e5 23 3b a0 e1 22 2b a0 e1 0c 60 a0 e1
    0x00002880: 03 48 07 e2 0c c0 01 e0 03 3a a0 e1 02 24 a0 e1
    0x00002890: 3f 1e 08 e2 0a 0b a0 e1 06 50 a0 e1 0c 21 82 e1
    0x000028a0: 04 37 83 e1 b6 c2 dd e1 20 0b a0 e1 06 60 08 e0
    0x000028b0: 21 12 a0 e1 00 30 83 e1 05 50 0a e0 26 15 81 e1
    0x000028c0: 08 2e 82 e1 ff 77 07 e2 0c 18 81 e1 25 33 83 e1
    0x000028d0: 27 29 82 e1 24 10 8d e5 1c 30 8d e5 20 20 8d e5
    0x000028e0: 00 10 a0 e3 04 30 9d e5 b8 21 d3 e1 01 30 8b e0
    0x000028f0: 99 32 22 e0 1c 30 8d e2 01 30 d3 e7 01 10 81 e2
    0x00002900: 0a 00 51 e3 06 30 c2 e5 f5 ff ff 1a 2c d0 8d e2
    0x00002910: f0 8f bd e8 00 00 ff 03 1a 23 a0 e3 60 30 92 e5
    0x00002920: 08 d0 4d e2 30 30 c3 e3 60 30 82 e5 1d 30 d0 e5
    0x00002930: 60 10 92 e5 03 32 a0 e1 30 30 03 e2 01 30 83 e1
    0x00002940: 60 30 82 e5 60 30 92 e5 01 3a 83 e3 60 30 82 e5
    0x00002950: 00 30 92 e5 04 30 8d e5 08 d0 8d e2 1e ff 2f e1
    0x00002960: 1d 30 d0 e5 04 20 90 e5 03 00 53 e3 fe 34 82 02
    0x00002970: 02 34 82 12 00 30 93 e5 08 d0 4d e2 04 30 8d e5
    0x00002980: 1a 33 a0 e3 c0 30 93 e5 04 30 8d e5 08 d0 8d e2
    0x00002990: 1e ff 2f e1 f0 47 2d e9 00 c0 a0 e3 20 d0 4d e2
    0x000029a0: 02 40 a0 e1 03 90 a0 e1 b8 21 d0 e1 0c 30 81 e0
    0x000029b0: 92 34 23 e0 06 20 d3 e5 14 30 8d e2 0c 20 c3 e7
    0x000029c0: 01 c0 8c e2 0a 00 5c e3 f6 ff ff 1a 18 a0 9d e5
    0x000029d0: 1c 30 9d e5 14 40 9d e5 8c 00 9f e5 8c 50 9f e5
    0x000029e0: 3f 10 03 e2 88 80 9f e5 ff 20 0a e2 84 60 9f e5
    0x000029f0: 84 70 9f e5 05 50 03 e0 02 29 a0 e1 00 00 0a e0
    0x00002a00: 01 12 a0 e1 04 cb a0 e1 03 31 04 e2 23 27 82 e1
    0x00002a10: 06 60 04 e0 05 15 81 e1 08 80 04 e0 2c cb a0 e1
    0x00002a20: 07 70 0a e0 20 01 a0 e1 26 2a 82 e1 08 c3 8c e1
    0x00002a30: 27 04 80 e1 2a 1e 81 e1 08 20 8d e5 04 c0 8d e5
    0x00002a40: 0c 00 8d e5 10 10 8d e5 00 20 a0 e3 04 30 8d e2
    0x00002a50: 02 30 d3 e7 02 30 c9 e7 01 20 82 e2 10 00 52 e3
    0x00002a60: f9 ff ff 1a 20 d0 8d e2 f0 87 bd e8 00 00 fc 0f
    0x00002a70: c0 ff 00 00 00 fc 0f 00 00 00 f0 3f 00 ff 03 00
    0x00002a80: 1f 40 2d e9 02 c0 a0 e1 01 40 a0 e1 02 10 a0 e1
    0x00002a90: be 20 d1 e1 10 30 4c e2 02 10 41 e2 02 2b a0 e1
    0x00002aa0: 22 2b a0 e1 1a 03 a0 e3 03 00 51 e1 bc 20 80 e5
    0x00002ab0: f6 ff ff 1a 00 30 90 e5 0c 30 8d e5 c0 20 90 e5
    0x00002ac0: c4 30 90 e5 c8 10 90 e5 02 30 83 e1 cc 20 90 e5
    0x00002ad0: 01 30 83 e1 02 30 83 e1 3f 33 c3 e3 3f 3b c3 e3
    0x00002ae0: 0c 30 8d e5 0c 30 9d e5 00 00 53 e3 71 00 00 0a
    0x00002af0: 60 30 90 e5 02 3a 83 e3 60 30 80 e5 1a 33 a0 e3
    0x00002b00: 64 30 93 e5 0f 3c 03 e2 23 34 a0 e1 08 30 8d e5
    0x00002b10: 08 30 9d e5 03 00 53 e3 f7 ff ff 9a 0a 2b a0 e3
    0x00002b20: 1a 33 a0 e3 64 30 93 e5 01 20 52 e2 0f 3c 03 e2
    0x00002b30: 23 34 a0 e1 08 30 8d e5 02 00 00 0a 08 30 9d e5
    0x00002b40: 03 00 53 e3 f5 ff ff 8a 08 30 9d e5 01 00 53 e3
    0x00002b50: 02 00 00 0a 08 30 9d e5 03 00 53 e3 03 00 00 9a
    0x00002b60: 1a 33 a0 e3 d8 30 93 e5 01 00 a0 e3 04 00 00 ea
    0x00002b70: 08 00 9d e5 00 00 50 e3 03 00 00 1a 1a 33 a0 e3
    0x00002b80: d8 30 93 e5 0c 30 8d e5 4d 00 00 ea 1a 33 a0 e3
    0x00002b90: 64 30 93 e5 03 38 03 e2 23 38 a0 e1 04 30 8d e5
    0x00002ba0: 04 30 9d e5 03 00 53 e3 03 f1 9f 97 41 00 00 ea
    0x00002bb0: 6c 2c 00 80 28 2c 00 80 f4 2b 00 80 b0 2b 00 80
    0x00002bc0: 1a 13 a0 e3 d4 30 91 e5 fc 20 9f e5 02 20 03 e0
    0x00002bd0: 22 28 a0 e1 81 2f 62 e2 03 20 82 e2 ec 30 9f e5
    0x00002be0: 02 08 a0 e1 20 08 53 e1 34 00 00 3a dc 30 91 e5
    0x00002bf0: d4 20 9f e5 20 18 d4 e7 02 20 03 e0 22 18 21 e0
    0x00002c00: 20 18 c4 e7 1a 23 a0 e3 d4 30 92 e5 3f 3b c3 e3
    0x00002c10: 81 3f 63 e2 03 30 83 e2 03 18 a0 e1 ac 30 9f e5
    0x00002c20: 21 08 53 e1 25 00 00 3a dc 30 92 e5 21 28 d4 e7
    0x00002c30: 02 30 23 e0 21 38 c4 e7 1a 13 a0 e3 d0 30 91 e5
    0x00002c40: 84 20 9f e5 02 20 03 e0 22 28 a0 e1 81 2f 62 e2
    0x00002c50: 03 20 82 e2 74 30 9f e5 02 08 a0 e1 20 08 53 e1
    0x00002c60: 16 00 00 3a d8 30 91 e5 5c 20 9f e5 20 18 d4 e7
    0x00002c70: 02 20 03 e0 22 18 21 e0 20 18 c4 e7 1a 23 a0 e3
    0x00002c80: d0 30 92 e5 3f 3b c3 e3 81 3f 63 e2 03 30 83 e2
    0x00002c90: 03 18 a0 e1 34 30 9f e5 21 08 53 e1 07 00 00 3a
    0x00002ca0: d8 30 92 e5 21 28 d4 e7 00 00 a0 e3 02 30 23 e0
    0x00002cb0: 21 38 c4 e7 02 00 00 ea 00 00 a0 e3 00 00 00 ea
    0x00002cc0: 01 00 a0 e3 10 d0 8d e2 10 80 bd e8 00 00 ff 03
    0x00002cd0: ff 01 00 00 30 40 2d e9 00 40 a0 e1 01 50 a0 e1
    0x00002ce0: 00 00 a0 e3 09 00 00 ea 00 c0 a0 e3 b8 31 d4 e1
    0x00002cf0: 0c 10 85 e0 93 00 02 e0 01 c0 8c e2 00 30 a0 e3
    0x00002d00: 06 00 5c e3 02 30 c1 e7 f7 ff ff 1a 01 00 80 e2
    0x00002d10: 1a 30 d4 e5 03 00 50 e1 f2 ff ff 3a 30 80 bd e8
    0x00002d20: 00 00 a0 e3 1e ff 2f e1 f8 4f 2d e9 90 31 9f e5
    0x00002d30: a3 b1 a0 e1 0b 00 a0 e1 2f f9 ff eb 00 50 a0 e1
    0x00002d40: 80 01 9f e5 1e f9 ff eb 7c 31 9f e5 0c 30 93 e5
    0x00002d50: 04 40 93 e5 cd f5 ff eb ff 10 00 e2 04 00 a0 e1
    0x00002d60: 6f fe ff eb 00 90 50 e2 60 01 9f 05 05 60 a0 11
    0x00002d70: 06 70 a0 13 00 a0 a0 13 26 00 00 1a 28 00 00 ea
    0x00002d80: 09 00 a0 e1 07 10 a0 e1 00 20 a0 e3 06 30 a0 e1
    0x00002d90: 82 fc ff eb 00 00 50 e3 1d 00 00 1a 00 40 96 e5
    0x00002da0: 2c 31 9f e5 03 00 54 e1 19 00 00 1a 24 01 9f e5
    0x00002db0: 03 f9 ff eb 04 00 a0 e1 f4 f8 ff eb 18 01 9f e5
    0x00002dc0: ff f8 ff eb 07 00 a0 e1 f0 f8 ff eb 0c 01 9f e5
    0x00002dd0: fb f8 ff eb 04 30 96 e5 04 21 9f e5 04 30 82 e5
    0x00002de0: 08 30 96 e5 08 30 82 e5 0c 30 96 e5 0c 30 82 e5
    0x00002df0: 10 30 96 e5 10 30 82 e5 14 30 96 e5 14 30 82 e5
    0x00002e00: 14 60 92 e5 f4 f8 ff eb 00 00 6b e0 f6 f8 ff eb
    0x00002e10: 06 00 00 ea 01 70 87 e2 32 00 57 e3 d7 ff ff 9a
    0x00002e20: c0 00 9f e5 e6 f8 ff eb 01 00 a0 e3 f8 8f bd e8
    0x00002e30: ac 30 9f e5 00 50 a0 e3 0c 80 93 e5 10 40 93 e5
    0x00002e40: 15 00 00 ea b0 31 d9 e1 03 00 54 e1 b2 31 d9 e1
    0x00002e50: 01 80 88 22 00 40 a0 23 04 20 a0 e1 95 63 23 e0
    0x00002e60: 08 10 a0 e1 4d fc ff eb 00 00 50 e3 08 00 00 0a
    0x00002e70: 00 00 5a e3 01 a0 8a 02 ec ff ff 0a 01 70 87 e2
    0x00002e80: 33 00 57 e3 01 a0 a0 e3 e2 ff ff 1a 0a 00 a0 e1
    0x00002e90: f8 8f bd e8 01 40 84 e2 01 50 85 e2 40 20 9f e5
    0x00002ea0: 09 00 a0 e1 08 30 92 e5 03 00 55 e1 e4 ff ff 3a
    0x00002eb0: 04 20 92 e5 30 30 9f e5 00 00 a0 e3 00 20 83 e5
    0x00002ec0: f8 8f bd e8 00 00 00 10 44 32 00 80 10 30 00 80
    0x00002ed0: 5c 32 00 80 bb 4c 42 55 89 32 00 80 9a 32 00 80
    0x00002ee0: 89 2f 00 80 dc 32 00 80 ac 32 00 80 d8 32 00 80

    # The above ends the contents read into 0x80000000
    # The OOB data for this block is below

    0x00002ef0: 01 59 53 58 - Next AIS command: Section Load Command (0x58535901)

    e0 2e 00 80 - Address to load to: 0x80002ee0
    ec 03 00 00 - Size: 0x000003ec (1004 bytes)

    1st data word starts at 0x00002efc: 20 69 6e 69
    Next AIS command starts at: 0x00002efc + 0x000003ec = 0x000032E8

    0x00002f00: 74 69 61 6c 69 7a 61 74 69 6f 6e 20 70 61 73 73
    0x00002f10: 65 64 21 0d 0a 00 42 6f 6f 74 69 6e 67 20 54 49
    0x00002f20: 20 55 73 65 72 20 42 6f 6f 74 20 4c 6f 61 64 65
    0x00002f30: 72 0d 0a 00 09 55 42 4c 20 56 65 72 73 69 6f 6e
    0x00002f40: 3a 20 00 31 2e 36 35 00 0d 0a 09 55 42 4c 20 46
    0x00002f50: 6c 61 73 68 74 79 70 65 3a 20 00 4e 41 4e 44 0d
    0x00002f60: 0a 00 4e 41 4e 44 20 42 6f 6f 74 20 66 61 69 6c
    0x00002f70: 65 64 2e 0d 0a 00 20 20 20 44 4f 4e 45 00 0d 0a
    0x00002f80: 4a 75 6d 70 69 6e 67 20 74 6f 20 65 6e 74 72 79
    0x00002f90: 20 70 6f 69 6e 74 20 61 74 20 00 41 62 6f 72 74
    0x00002fa0: 69 6e 67 2e 2e 2e 0d 0a 00 0c 0d 02 02 05 05 0e
    0x00002fb0: 0f 07 0a 06 06 09 09 03 03 04 00 08 0b 12 aa 10
    0x00002fc0: 11 13 13 16 17 14 15 01 00 4f 4d 41 50 2d 4c 31
    0x00002fd0: 33 38 00 00 00 20 c4 01 00 c0 d0 01 00 d0 d0 01
    0x00002fe0: 01 00 00 00 01 00 00 00 01 00 00 00 08 00 51 00
    0x00002ff0: c4 2f 00 80 02 00 00 00 01 00 00 00 01 00 00 00
    OOB Data: ff ff ff ff ff ff 0e bf 74 31 2b 89 e5 26 82 d0
    OOB Data: ff ff ff ff ff ff a6 4d a3 79 a6 83 70 ad a9 0b
    OOB Data: ff ff ff ff ff ff 95 1c 64 f0 b3 91 2b 4d 0b 78
    OOB Data: ff ff ff ff ff ff 11 64 ba d8 4e 0c 29 d4 45 ed
    ECC: 3 uncorrectable bitflip(s) at offset 0x00003000
    0x00003000: 08 00 12 00 d8 2f 00 80 30 78 00 00 00 00 00 60
    0x00003010: 00 00 00 62 00 00 00 64 00 00 00 66 00 00 00 02
    0x00003020: 00 00 00 02 00 00 00 02 00 00 00 02 01 00 00 00
    0x00003030: 00 00 00 68 04 00 00 00 f0 2f 00 80 00 30 00 80
    ...
    0x000032e0: 64 21 0d 0a 00 00 00 00

    0x000032e8: 06 59 53 58 - AIS Jump & Close Command (0x58535906)

    Jump to the following address and start executing: 00 00 00 80 - 0x80000000

    We're DONE reading!!



    0x000032f0: 00 00 00 08 81 06 00 02 00 80 00 00 44 00 84 00
    0x00003300: 08 00 04 02 01 10 02 40 41 80 80 00 40 60 c2 40
    0x00003310: 00 40 00 00 00 60 01 02 01 00 00 00 02 80 06 02
    0x00003320: 00 02 00 01 01 00 00 44 02 01 00 00 00 00 00 40
    0x00003330: 40 80 01 40 00 02 00 00 00 80 01 01 00 00 00 01
    0x00003340: 00 80 00 00 80 01 00 40 00 80 01 82 02 04 80 00
    0x00003350: 06 13 a4 00 02 00 80 00 01 00 00 00 42 00 01 00
  • So it turns out (forgot this minor problem from 4 years ago...) that /dev/mtd1 is locked in the NAND partition table hardcoded in Linux (actually remember doing that.. :( Anyways, that's okay, I can just use an unused partition /dev/mtd6 to store UBL + U-Boot, then change the 'bootcmd' parameter using 'fw_setenv' from the Linux upgrade shell script to load THAT partition instead of loading the /dev/mtd1 partition.

    Hopefully that shouldn't be too much of a problem...

    So do you have a prebuilt UBL + U-Boot (or AIS + U-Boot) image I can just write into /dev/mtd6 and try it?
    That would be a huge help. Linux is in /dev/mtd3 and the filesystem is in /dev/mtd4 .

    On our systems, this was originally programmed using the 'sfh_OMAP-L138.exe' file. When I looked for the source code for that, I just found a bunch of code composer files after downloading the OMAP-L138_FlashAndBootUtils_2_40.tar.gz file. I'm not using Code Composer so I didn't go through these files to see how they worked.
  • Hello again..

    So it looks like if I just had the source code for 'nandwrite.c' I can probably fix this!

    I can read /dev/mtd1 from a working device (one that's been flashed with a working U-Boot without the bugs in the NAND driver), store that into a file. Then if I scp that file onto an AP with a really old U-Boot in /dev/mtd1, I can erase /dev/mtd6, then program it with the file I copied from the working device. The results are perfect EXCEPT for the OOB:

    The ORIGINAL device that has the NEW U-Boot programmed into /dev/mtd1, read from /dev

    0x000007e0: 14 00 00 8a 00 00 50 e3 02 00 00 0a 01 00 50 e3
    0x000007f0: 10 00 00 1a 05 00 00 ea 04 00 a0 e3 ff 1c a0 e3
    OOB Data: ff ff ff ff ff ff 46 f9 a0 b4 bf de 2e b7 53 b6
    OOB Data: ff ff ff ff ff ff 85 02 1b f5 0a 59 fa d0 43 4e
    OOB Data: ff ff ff ff ff ff fb f3 04 7d 02 f5 43 0a a7 6e
    OOB Data: ff ff ff ff ff ff ab c6 e7 e6 b9 fd 4b 86 62 9b
    0x00000800: 22 2c a0 e3 8a fe ff eb 04 00 a0 e1 10 80 bd e8
    0x00000810: 0b 10 a0 e3 00 20 a0 e3 03 30 a0 e3 5e fe ff eb


    The SAME data written to /dev/mtd6, the ONLY difference is how the OOB is formatted:

    0x000007e0: 14 00 00 8a 00 00 50 e3 02 00 00 0a 01 00 50 e3
    0x000007f0: 10 00 00 1a 05 00 00 ea 04 00 a0 e3 ff 1c a0 e3
    OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    OOB Data: ff ff ff ff ff ff ff ff 46 f9 a0 b4 bf de 2e b7
    OOB Data: 53 b6 85 02 1b f5 0a 59 fa d0 43 4e fb f3 04 7d
    OOB Data: 02 f5 43 0a a7 6e ab c6 e7 e6 b9 fd 4b 86 62 9b
    0x00000800: 22 2c a0 e3 8a fe ff eb 04 00 a0 e1 10 80 bd e8
    0x00000810: 0b 10 a0 e3 00 20 a0 e3 03 30 a0 e3 5e fe ff eb

    The OOB data is IDENTICAL, its just the 0xff bytes are in different places!

    Sooo, could you PLEASE point me to where 'nandwrite.c' is located?

    I just want to modify it so that the OOB data is written back to this partition using the original format.

    much thanks!
    Bill
  • found a version of nandwrite.c from github, should hopefully work!
  • Actually, thinking about it, it would be much more beneficial to me if I could use the actual source code for the nandwrite executable instead of just using one I found in someone git repository online.

    I noticed that that executable was NOT part of busybox.  Was that executable compiled using Code Composer or just the normal cross-compiler from a .c file?  Could you point me to where I could download it n the morning and compile it?

    Thanks again, Bill

  • So the plot thickens...

    I was able to download the MTD utilities from git.  Was then able to cross-compile and link it, then run in on our target device.  It's a slightly older version, but I think it should suffice.

    So when I looked into the code and followed all the way through where it actually WROTE the OOB data by calling  mtd_write_oob(), which then calls do_oob_op(). 

    In that routine, it calls an ioctl(), so the code that needs to be changed (to write the OOB in a different format) is actually INSIDE of Linux.. ouch...!

    The call that establishes a connection to the device driver is:

    if ((fd = open(mtd_device, O_RDWR)) == -1)
    sys_errmsg_die("%s", mtd_device);

    where mtd_device is "/dev/mtd1".

    In do_oob_op(), the call to write the OOB is:

    ret = ioctl(fd, cmd, &oob);

  • Bill,

    Can you take a look at the below link, written for U-Boot, and see if that provides any insights that might help you with Linux?

    git.denx.de/

    Thanks!
  • Hi Ron,

    Thanks for the information!

    So the problem I'm facing is that I'm not able to run the 'sfh_OMAP-L138.exe' file "as is" on these units currently installed at customers sites.  I need to be able to run that program on a system that is currently up and running.  That said, I need to be able to run it from Linux.  Something like this:

    Under Linux

    The serial flasher can be run on a Linux machine with the latest open-source Mono Framework installed. The steps are identical to the Windows environment except the command:

    • mono ./sfh_OMAP-L138.exe [options]


    Where the above would run DIRECTLY on the Linux system that HAS the L-138 on it!  In other words, on the device itself where U-Boot needs to get re-written.  So it looks like I could cross-compile the mono utility to run under the same OS as what is on our shipping systems.  I would need to modify it so that instead of loading the program over the UART connection, it simply loaded it out of the NAND flash into RAM.  Once loaded into RAM, jump to it to execute it somehow.  Once completed, go ahead and have the system reboot.  When the system comes up, the latest UBL/U-Boot will be running.

    So does that make sense, and is that possible??

    much thanks,

    Bill

     

  • Some additional information..

    I found that the 'nandwrite' utility uses ioctl() commands to actually perform the write functions inside of Linux. The device driver ultimately resides in the file "nand/davinci_nand.c". The actual structure that stores the ECC layout in the OOB data is in the following data structure:

    /* An ECC layout for using 4-bit ECC with large-page (2048bytes) flash,
    * storing ten ECC bytes plus the manufacturer's bad block marker byte,
    * and not overlapping the default BBT markers.
    */
    static struct nand_ecclayout hwecc4_2048 __initconst = {
    .eccbytes = 40,
    .eccpos = {
    /* at the end of spare sector */
    24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
    34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
    44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
    54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
    },
    .oobfree = {
    /* 2 bytes at offset 0 hold manufacturer badblock markers */
    {.offset = 2, .length = 22, },
    /* 5 bytes at offset 8 hold BBT markers */
    /* 8 bytes at offset 16 hold JFFS2 clean markers */
    },
    };

    As you can see, the ECC position of the data starts at byte 24 in the OOB. Unfortunately, I just can't change this to match what the OMAP L-138 seems to require when loading UBL and U-Boot (where the ECC mapping is having the first 8 bytes not uses in each of the four 32 byte values for each OOB). I've shown this in above comments.

    Unfortunately the above structure is used for ALL NAND partitions, NOT just MTD1, where the problem is. Looks like I would have to somehow modify the use of this structure wherever it is used in the device driver. The device driver would have to user EITHER the above mapping or the other mapping based upon which MTD device is being written to or read from.

    I don't really want to add this hack, but if I can't get the "sfh_OMAP-L138.exe" executable working from Linux, this may be my only option.

    Since this is such a hack, and has a big potential for errors, any other suggestions would be appreciated...

    thanks again,
    Bill
  • One more thing, so I did try years ago when I attempted this to do what you suggested, where I actually DID come up with a solution that actually used U-Boot to update the UBL + U-Boot partition by using 'fw_setenv' to modify the U-Boot 'bootcmd' environment variable to re-program the U-Boot partition. U-Boot actually writes the CORRECT OOB format to the NAND, at least the format that the L-138 requires when reading UBL + U-Boot.

    The problem our customer ran into was that the OLD U-Boot was being used to write the NEW U-Boot! Because of the fact that the OLD U-Boot NAND driver had bugs in it, the process of using it to write the NEW U-Boot had a failure rate of about 15 - 20%. This was deemed to high for the customer so that solution was abandoned.

    Good suggestion though!

    Thanks, Bill
  • So progress!

    I've been able to unlock the U-Boot partition, now when I use the tool https://github.com/jonpovey/flashtool  as suggested by mdeneen (thank you BTW!) I can write the UBL + U-Boot partition using the following command:

    root@arago:~# ./flashtool --legacy /dev/mtd2 -w -s 0 --ubi mtd1.hex

    This almost works, as it DOES, in fact, write the data AND the OOB data, however, the OOB data is written to the WRONG locations:

    It is writing to:

    0x00000200: ff ff ff ff ff ff 46 f9 a0 b4 bf de 2e b7 53 b6

    0x00000410: ff ff ff ff ff ff 85 02 1b f5 0a 59 fa d0 43 4e

    0x00000620: ff ff ff ff ff ff fb f3 04 7d 02 f5 43 0a a7 6e

      OOB Data: ff ff ff ff ff ff ab c6 e7 e6 b9 fd 4b 86 62 9b  (this is the fourth OOB Data line from the nanddump output)

    etc..  

    So it's CORRECTLY skipping the first 6 bytes, and writing the 10 CORRECT bytes, however, instead of writing it at the END of the block, it's writing it ever 0x200 bytes.  

    Here's how it's supposed to look:

    0x000007e0: 14 00 00 8a 00 00 50 e3 02 00 00 0a 01 00 50 e3
    0x000007f0: 10 00 00 1a 05 00 00 ea 04 00 a0 e3 ff 1c a0 e3


    OOB Data: ff ff ff ff ff ff 46 f9 a0 b4 bf de 2e b7 53 b6
    OOB Data: ff ff ff ff ff ff 85 02 1b f5 0a 59 fa d0 43 4e
    OOB Data: ff ff ff ff ff ff fb f3 04 7d 02 f5 43 0a a7 6e
    OOB Data: ff ff ff ff ff ff ab c6 e7 e6 b9 fd 4b 86 62 9b


    0x00000800: 22 2c a0 e3 8a fe ff eb 04 00 a0 e1 10 80 bd e8
    0x00000810: 0b 10 a0 e3 00 20 a0 e3 03 30 a0 e3 5e fe ff eb

    Notice that the OOB data IS correct though!

    Close!

    I'm guessing I'll need to modify flashtool.c and figure out how to get the actual block size (or just hardcode it since I just need to write it correctly, then never use it again since the problem will be fixed..)

    thanks again,

    Bill

  • So an update..

    flashtool.c DID work, no changes were needed!

    Just needed to use it with the following options:

    ./flashtool -w -s 0 --dm365-rbl --ubi /dev/mtd1 uboot_and_ubl.bin

    Again, thanks to Mark Deneen for the advice.  Both the device driver to unlock all blocks as well as flashtool worked great!

    Bill