Freescale Yocto i.MX6 U-Boot NAND Boot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Freescale Yocto i.MX6 U-Boot NAND Boot

Jump to solution
6,871 Views
alexgreen
Contributor I

We are attempting to program U-Boot for the i.MX6 on an external NAND chip. We have been using the Yocto based build system with the 'wandboard-solo' machine as our base (with customized recipes, U-Boot, and kernel). Things to note are:

  • The processor is able to successfully boot U-Boot (u-boot.imx) from an SD-card
  • U-Boot is able to read/write to NAND using U-Boot commands (nand read, nand write)

With a kernel booted via TFTP and  NFS, we have attempted to use 'kobs-ng'. See the output below:

root@graphic-board:~# kobs-ng init -v /boot/u-boot.imx

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

/boot/u-boot.imx: verifying using key '00000000000000000000000000000000'

/boot/u-boot.imx: is a valid bootstream for key '00000000000000000000000000000000'

mtd: opening: "/dev/mtd0"

mtd: '/dev/mtd0' bad block @ 0x1ff80000 (MTD)

mtd: '/dev/mtd0' bad block @ 0x1ffa0000 (MTD)

mtd: '/dev/mtd0' bad block @ 0x1ffc0000 (MTD)

mtd: '/dev/mtd0' bad block @ 0x1ffe0000 (MTD)

NFC geometry :

        ECC Strength       : 8

        Page Size in Bytes : 2112

        Metadata size      : 10

        ECC Chunk Size in byte : 512

        ECC Chunk count        : 4

        Block Mark Byte Offset : 1999

        Block Mark Bit Offset  : 0

====================================================

mtd: opened '/dev/mtd0' - '(null)'

mtd: max_boot_stream_size_in_bytes = 267911168

mtd: boot_stream_size_in_bytes = 388096

mtd: boot_stream_size_in_pages = 190

mtd: #1 0x00100000 - 0x10080000 (0x0015ec00)

mtd: #2 0x10080000 - 0x20000000 (0x100dec00)

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 = 2048

  m_u32TotalPageSize = 2112

  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 = 3

  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 = 131328

  m_u32PagesInFirmware1 = 190

  m_u32PagesInFirmware2 = 190

  m_u32DBBTSearchAreaStartAddress = 256

  m_u32BadBlockMarkerByte = 1999

  m_u32BadBlockMarkerStartBit = 0

  m_u32BBMarkerPhysicalOffset = 2048

  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

DBBT

  m_u32Checksum = 0x00000000

  m_u32FingerPrint = 0x54424244

  m_u32Version = 0x01000000

  m_u32DBBTNumOfPages = 1

BBTN#0

  uNAND = 0

  uNumberBB = 4

  BADBLOCKS:

     0xffc 0xffd 0xffe 0xfff

Firmware: image #0 @ 0x100000 size 0x5f000 - available 0xff80000

Firmware: image #1 @ 0x10080000 size 0x5f000 - available 0xff80000

-------------- Start to write the [ FCB ] -----

mtd: erasing @0:0x0-0x20000

mtd: Writing FCB0 [ @0:0x0 ] (840) *

mtd: erasing @0:0x20000-0x40000

mtd: Writing FCB1 [ @0:0x20000 ] (840) *

mtd: erasing @0:0x40000-0x60000

mtd: Writing FCB2 [ @0:0x40000 ] (840) *

mtd: erasing @0:0x60000-0x80000

mtd: Writing FCB3 [ @0:0x60000 ] (840) *

mtd_commit_bcb(FCB): status 0

-------------- Start to write the [ DBBT ] -----

mtd: erasing @0:0x80000-0xa0000

mtd: Writing DBBT0 [ @0:0x80000 ] (800) *

mtd: erasing @0:0xa0000-0xc0000

mtd: Writing DBBT1 [ @0:0xa0000 ] (800) *

mtd: erasing @0:0xc0000-0xe0000

mtd: Writing DBBT2 [ @0:0xc0000 ] (800) *

mtd: erasing @0:0xe0000-0x100000

mtd: Writing DBBT3 [ @0:0xe0000 ] (800) *

mtd_commit_bcb(DBBT): status 0

mtd: PUTTING down DBBT0 BBTN0 @0x82000 (0x800)

mtd: PUTTING down DBBT1 BBTN0 @0xa2000 (0x800)

mtd: PUTTING down DBBT2 BBTN0 @0xc2000 (0x800)

mtd: PUTTING down DBBT3 BBTN0 @0xe2000 (0x800)

---------- Start to write the [ /boot/u-boot.imx ]----

mtd: Writting /boot/u-boot.imx: #0 @0: 0x00100000 - 0x0015f000

mtd: erasing @0:0x100000-0x120000

mtd: erasing @0:0x120000-0x140000

mtd: erasing @0:0x140000-0x160000

mtd: The last page is not full : 1024

mtd: We write one page for save guard. *

mtd: Writting /boot/u-boot.imx: #1 @0: 0x10080000 - 0x100df000

mtd: erasing @0:0x10080000-0x100a0000

mtd: erasing @0:0x100a0000-0x100c0000

mtd: erasing @0:0x100c0000-0x100e0000

mtd: The last page is not full : 1024

mtd: We write one page for save guard. *

When attempting to dump the data back, there are errors:

root@graphic-board:~# kobs-ng dump -v /boot/u-boot.imx

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: opening: "/dev/mtd0"

mtd: '/dev/mtd0' bad block @ 0x1ff80000 (MTD)

mtd: '/dev/mtd0' bad block @ 0x1ffa0000 (MTD)

mtd: '/dev/mtd0' bad block @ 0x1ffc0000 (MTD)

mtd: '/dev/mtd0' bad block @ 0x1ffe0000 (MTD)

NFC geometry :

        ECC Strength       : 8

        Page Size in Bytes : 2112

        Metadata size      : 10

        ECC Chunk Size in byte : 512

        ECC Chunk count        : 4

        Block Mark Byte Offset : 1999

        Block Mark Bit Offset  : 0

====================================================

mtd: opened '/dev/mtd0' - '(null)'

mtd: partition #0

  type = 4

  flags = 17408

  size = 536870912

  erasesize = 131072

  writesize = 2048

  oobsize = 64

  blocks = 4096

  BAD: 0x1ff80000 0x1ffa0000 0x1ffc0000 0x1ffe0000

mtd: fingerprints mismatch @0:0x0

mtd: fingerprints mismatch @0:0x20000

mtd: fingerprints mismatch @0:0x40000

mtd: fingerprints mismatch @0:0x60000

mtd: NCB0 not found

mtd: fingerprints mismatch @0:0x80000

mtd: fingerprints mismatch @0:0xa0000

mtd: fingerprints mismatch @0:0xc0000

mtd: fingerprints mismatch @0:0xe0000

mtd: NCB1 not found

mtd: neither NCB1 or NCB2 found ERROR

Any assistance is appreciated.

Many thanks.

Labels (4)
0 Kudos
1 Solution
1,268 Views
alexgreen
Contributor I

This issue has been solved. Note that one must add a 0x400 offset to the u-boot.imx binary before flashing to NAND (or SD-card for that matter). To do this:

dd if=u-boot.imx of=u-boot-nand.imx bs=512 seek=2

kobs-ng init -v /boot/u-boot-nand.imx

View solution in original post

0 Kudos
2 Replies
1,269 Views
alexgreen
Contributor I

This issue has been solved. Note that one must add a 0x400 offset to the u-boot.imx binary before flashing to NAND (or SD-card for that matter). To do this:

dd if=u-boot.imx of=u-boot-nand.imx bs=512 seek=2

kobs-ng init -v /boot/u-boot-nand.imx

0 Kudos
1,268 Views
jkobs2014
Contributor III

Easier: kobs-ng init -x -v /boot/u-boot.imx