nxp-imx/mfgtools

Is it possible to write arbitrary data to flash memory?

Opened this issue · 1 comments

Hi,

I need to write some data that's generated on the fly (e.g not part of a .wic file) to flash as part of a manufacturing process. There are three ways I can see to approach this:

  1. Simply write the bytes to some pre-defined flash address. This seems like the simplest solution, and the one I think I prefer.
  2. Have an empty FAT partition specified in the .wic file, then run uuu commands to write a file to that FAT partition.
  3. Write the data to a u-boot environment variable and save that environment variable.

Does uuu have a way to achieve these things? I have looked into SDP: write in an attempt to implement solution 1, but haven't had much success. Nothing in uuu indicates failure, but the data simply isn't in the /dev/mmcblk2 block device after boot, so I might have misunderstood something.

For solution 3, FB: ucmd env save fails because u-boot doesn't know how to persist environment variables while in the uuu flashing mode. I haven't investigated thoroughly why this is.

I found a way to achieve solution 1: using the u-boot command mw, I can write the data I need into memory, and then using mmc write, I can copy from memory to MMC. I'll leave this issue open since I'm still interested in suggestions for other/better ways to achieve this, but feel free to close it at will.