nxp-imx / imx-kobs

Tool to create and write Freescale/NXP I.MX NAND boot related boot data structure to nand flash
GNU General Public License v2.0
29 stars 26 forks source link

Unable to dump boot structures #20

Open alberanid opened 5 years ago

alberanid commented 5 years ago

Hi, We get an error using the "dump", "imgverify" and "extract" commands (latest version from this repository) on an imx6ull.

We succesfully flashed u-boot with this command: kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 u-boot.imx

Now we'd like to dump the loader to verify its integrity (we are investigating some cases of NAND corruption).

The error running the "dump" command:

# kobs-ng dump -v 
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       : 40
    Page Size in Bytes : 8762
    Metadata size      : 10
    ECC Chunk Size in byte : 1024
    ECC Chunk count        : 8
    Block Mark Byte Offset : 7692
    Block Mark Bit Offset  : 0
====================================================
mtd: opened '/dev/mtd0' - '(null)'
mtd: partition #0
  type = 8
  flags = 1024
  size = 67108864
  erasesize = 2097152
  writesize = 8192
  oobsize = 744
  blocks = 32
mtd: fingerprints mismatch @0:0x0
mtd: fingerprints mismatch @0:0x200000
mtd: fingerprints mismatch @0:0x400000
mtd: fingerprints mismatch @0:0x600000
mtd: NCB0 not found
mtd: fingerprints mismatch @0:0x800000
mtd: fingerprints mismatch @0:0xa00000
mtd: fingerprints mismatch @0:0xc00000
mtd: fingerprints mismatch @0:0xe00000
mtd: NCB1 not found
mtd: neither NCB1 or NCB2 found ERROR
Unable to load boot structures

Same error also adding the -x --chip_0_device_path=/dev/mtd0 arguments.

Any help will be greatly appreciated.

jmistr01 commented 5 years ago

@alberanid, We've had the same issue with an imx6ull and nand storage as well. Were you able to resolve this issue?

alberanid commented 5 years ago

@jmistr01 nope, sorry.

On top of this (but probably unrelated) we are facing a reliability issue on i.MX6ULL on NAND which may or may not be related to what kobs-ng writes on it (especially in regards of BCH code). More info here, since you may also be affected, even if you use a different kind of NAND:

I've seen your issue #23 and I'd double check if in your case is ok to have BCHType set to 0, since from what I understand it means no BCH error correction for you, leaving you exposed to bitflips.

alberanid commented 5 years ago

@jmistr01 please ignore the part on BCHType, since it's ok to be 0; the important parameter is BCH Strength, which is 8 for you (should be ok on a small NAND, I guess)

vmuthusu commented 5 years ago

Hi We are using a IMX8DXP based board and i am facing the same issue of finger print mismatch when i run kobs-ng update. Have you been able to resolve the above issue? Do you have any workaround or solution.

Thanks V.Muthusubramanian

alberanid commented 5 years ago

@vmuthusu no, and we no longer need it so we stopped investigating, sorry.

am-dev-75 commented 5 years ago

NXP confirmed that kobs-ng does not fully support newer bootroms. Therefore, it can write the images correctly, but it can't read them back properly. For more details, please refer to this thread. I developed a dirty hack to fix this issue for to the i.MX6SoloX's bootrom.

am-dev-75 commented 5 years ago

By the way, I still have not understood if there is an official kobs-ng version supporting all the bootrom versions out there.

joseddg92 commented 5 years ago

@am-dev-75 Hi, Would you be willing to share that patch (or "dirty hack" :) ) ?

allenxh commented 5 years ago

a workaround to dump boot structure and update the firmware 2 only. Refer to https://github.com/allenxh/imx-kobs/tree/partial_update

These changes won't merge to mainline code.

am-dev-75 commented 5 years ago

@am-dev-75 Hi, Would you be willing to share that patch (or "dirty hack" :) ) ?

It is available here. I take the opportunity to remember that it's really ugly because I haven't had the time to fully understand the original code and implement a better solution.