AnsweredAssumed Answered

kobs-ng unable to extract NCB or update bootstream

Question asked by Jared Mistretta on Mar 14, 2019

Hello all,

 


We've been using the UUU (mfgtools 3.0) to program an IMX6ULL processor using Toshiba TH58NVG3S0H NAND Flash Storage. U-boot programs and operates properly; loading and booting the linux image that we've been using. We are now attempting to update one of the uboot 'slots' using the kobs-ng tool's update command. We believe the tool is unable to properly decode the NCB. We receive the same error with both the 'update' command and the 'dump' command.

 


Output when programming uboot with kobs-ng:

 


MTD CONFIG:
  chip_0_device_path = "/dev/mtd0"
  chip_1_device_path = "(null)"
  search_exponent = 2
  data_setup_time = 80
  data_hold_time = 60
  address_setup_time = 25
  data_sample_time = 6
  row_address_size = 3
  column_address_size = 2
  read_command_code1 = 0
  read_command_code2 = 48
  boot_stream_major_version = 1
  boot_stream_minor_version = 0
  boot_stream_sub_version = 0
  ncb_version = 3
  boot_stream_1_address = 0
  boot_stream_2_address = 0
     -- We add the 1k-padding to the uboot.
.tmp_kobs_ng: verifying using key '00000000000000000000000000000000'
.tmp_kobs_ng: is a valid bootstream for key '00000000000000000000000000000000'
mtd: use new bch layout raw access mode
mtd: opening: "/dev/mtd0"
NFC geometry :
    ECC Strength       : 8
    Page Size in Bytes : 4210
    Metadata size      : 10
    ECC Chunk Size in byte : 512
    ECC Chunk count        : 8
    Block Mark Byte Offset : 3995
    Block Mark Bit Offset  : 0
====================================================
mtd: opened '/dev/mtd0' - '(null)'
mtd: max_boot_stream_size_in_bytes = 3145728
mtd: boot_stream_size_in_bytes = 589824
mtd: boot_stream_size_in_pages = 144
mtd: #1 0x00200000 - 0x00500000 (0x00290000)
mtd: #2 0x00500000 - 0x00800000 (0x00590000)
FCB
  m_u32Checksum = 0x00000000
  m_u32FingerPrint = 0x20424346
  m_u32Version = 0x01000000
  m_NANDTiming.m_u8DataSetup = 80
  m_NANDTiming.m_u8DataHold = 60
  m_NANDTiming.m_u8AddressSetup = 25
  m_NANDTiming.m_u8DSAMPLE_TIME = 6
  m_u32PageDataSize = 4096
  m_u32TotalPageSize = 4352
  m_u32SectorsPerBlock = 64
  m_u32NumberOfNANDs = 0
  m_u32TotalInternalDie = 0
  m_u32CellType = 0
  m_u32EccBlockNEccType = 4
  m_u32EccBlock0Size = 512
  m_u32EccBlockNSize = 512
  m_u32EccBlock0EccType = 4
  m_u32MetadataBytes = 10
  m_u32NumEccBlocksPerPage = 7
  m_u32EccBlockNEccLevelSDK = 0
  m_u32EccBlock0SizeSDK = 0
  m_u32EccBlockNSizeSDK = 0
  m_u32EccBlock0EccLevelSDK = 0
  m_u32NumEccBlocksPerPageSDK = 0
  m_u32MetadataBytesSDK = 0
  m_u32EraseThreshold = 0
  m_u32Firmware1_startingPage = 512
  m_u32Firmware2_startingPage = 1280
  m_u32PagesInFirmware1 = 144
  m_u32PagesInFirmware2 = 144
  m_u32DBBTSearchAreaStartAddress = 256
  m_u32BadBlockMarkerByte = 3995
  m_u32BadBlockMarkerStartBit = 0
  m_u32BBMarkerPhysicalOffset = 4096
  m_u32BCHType = 0
  m_NANDTMTiming.m_u32TMTiming2_ReadLatency = 0
  m_NANDTMTiming.m_u32TMTiming2_PreambleDelay = 0
  m_NANDTMTiming.m_u32TMTiming2_CEDelay = 0
  m_NANDTMTiming.m_u32TMTiming2_PostambleDelay = 0
  m_NANDTMTiming.m_u32TMTiming2_CmdAddPause = 0
  m_NANDTMTiming.m_u32TMTiming2_DataPause = 0
  m_NANDTMTiming.m_u32TMSpeed = 0
  m_NANDTMTiming.m_u32TMTiming1_BusyTimeout = 0
  m_u32DISBBM = 0
  m_u32BBMarkerPhysicalOffsetInSpareData = 0
  m_u32OnfiSyncEnable = 0
  m_NANDONFITiming.m_u32ONFISpeed = 0
  m_NANDONFITiming.m_u32ONFITiming_ReadLatency = 0
  m_NANDONFITiming.m_u32ONFITiming_CEDelay = 0
  m_NANDONFITiming.m_u32ONFITiming_PreambleDelay = 0
  m_NANDONFITiming.m_u32ONFITiming_PostambleDelay = 0
  m_NANDONFITiming.m_u32ONFITiming_CmdAddPause = 0
  m_NANDONFITiming.m_u32ONFITiming_DataPause = 0
  m_NANDONFITiming.m_u32ONFITiming_BusyTimeout = 0
  m_u32DISBBSearch = 0
  m_u32RandomizerEnable = 0
  m_u32ReadRetryEnable = 0
  m_u32ReadRetrySeqLength = 0
DBBT
  m_u32Checksum = 0x00000000
  m_u32FingerPrint = 0x54424244
  m_u32Version = 0x01000000
  m_u32DBBTNumOfPages = 0
Firmware: image #0 @ 0x200000 size 0x90000 - available 0x300000
Firmware: image #1 @ 0x500000 size 0x90000 - available 0x300000
-------------- Start to write the [ FCB ] -----
mtd: erasing @0:0x0-0x40000
mtd: Writing FCB0 [ @0:0x0 ] (1100) *
mtd: erasing @0:0x40000-0x80000
mtd: Writing FCB1 [ @0:0x40000 ] (1100) *
mtd: erasing @0:0x80000-0xc0000
mtd: Writing FCB2 [ @0:0x80000 ] (1100) *
mtd: erasing @0:0xc0000-0x100000
mtd: Writing FCB3 [ @0:0xc0000 ] (1100) *
mtd_commit_bcb(FCB): status 0

 

-------------- Start to write the [ DBBT ] -----
mtd: erasing @0:0x100000-0x140000
mtd: Writing DBBT0 [ @0:0x100000 ] (1000) *
mtd: erasing @0:0x140000-0x180000
mtd: Writing DBBT1 [ @0:0x140000 ] (1000) *
mtd: erasing @0:0x180000-0x1c0000
mtd: Writing DBBT2 [ @0:0x180000 ] (1000) *
mtd: erasing @0:0x1c0000-0x200000
mtd: Writing DBBT3 [ @0:0x1c0000 ] (1000) *
mtd_commit_bcb(DBBT): status 0

 

---------- Start to write the [ .tmp_kobs_ng ]----
mtd: Writting .tmp_kobs_ng: #0 @0: 0x00200000 - 0x00290000
mtd: erasing @0:0x200000-0x240000
mtd: erasing @0:0x240000-0x280000
mtd: erasing @0:0x280000-0x2c0000
mtd: We write one page for save guard. *
mtd: Writting .tmp_kobs_ng: #1 @0: 0x00500000 - 0x00590000
mtd: erasing @0:0x500000-0x540000
mtd: erasing @0:0x540000-0x580000
mtd: erasing @0:0x580000-0x5c0000
mtd: We write one page for save guard. *

 


Output from "dump" command:

 

MTD CONFIG:
 chip_0_device_path = "/dev/mtd0"
 chip_1_device_path = "(null)"
 search_exponent = 2
 data_setup_time = 80
 data_hold_time = 60
 address_setup_time = 25
 data_sample_time = 6
 row_address_size = 3
 column_address_size = 2
 read_command_code1 = 0
 read_command_code2 = 48
 boot_stream_major_version = 1
 boot_stream_minor_version = 0
 boot_stream_sub_version = 0
 ncb_version = 3
 boot_stream_1_address = 0
 boot_stream_2_address = 0
mtd: use new bch layout raw access mode
mtd: opening: "/dev/mtd0"
NFC geometry :
 ECC Strength : 8
 Page Size in Bytes : 4210
 Metadata size : 10
 ECC Chunk Size in byte : 512
 ECC Chunk count : 8
 Block Mark Byte Offset : 3995
 Block Mark Bit Offset : 0
====================================================
mtd: opened '/dev/mtd0' - '(null)'

 

mtd: partition #0
  type = 4
  flags = 1024
  size = 8388608
  erasesize = 262144
  writesize = 4096
  oobsize = 256
  blocks = 32
mtd: fingerprints mismatch @0:0x0
mtd: fingerprints mismatch @0:0x40000
mtd: fingerprints mismatch @0:0x80000
mtd: fingerprints mismatch @0:0xc0000
mtd: NCB0 not found
mtd: fingerprints mismatch @0:0x100000
mtd: fingerprints mismatch @0:0x140000
mtd: fingerprints mismatch @0:0x180000
mtd: fingerprints mismatch @0:0x1c0000
mtd: NCB1 not found
mtd: neither NCB1 or NCB2 found ERROR
Unable to load boot structures

 

MTD0 is currently 8MB.

 


What could be causing the fingerprint mismatch?

 


The fingerprint locations that kobs-ng is checking are the same as where it programed them to.

 


This is the nand configuration info that we added to the 'nand_ids.c'

 


{"TH58NVG3S0H 8G 3.3V 8-bit",
        { .id = {0x98, 0xd3, 0x91, 0x26, 0x76, 0x16, 0x08, 0x00} },
          SZ_4K, SZ_1K, SZ_256K, 0, 8, 256, NAND_ECC_INFO(8, SZ_512) },

 


Any assistance would be greatly appreciated.

Outcomes