Device with Linux embedded system on NAND flash memory. I did memory dump of some MTD devices partitions use serial console, from U-boot bootloader use available commands. First I read MTD partition to address in the memory, then dumped memory from that address to the terminal window. For example, MTD partition 0x01d60000-0x01e60000 : "FPAR" MTD partition size is 0x00100000 = 1048576 bytes
nand read 0x20000000 0x01d60000 0x00100000 NAND read: device 0 offset 0x1d60000, size 0x100000 1048576 bytes read: OK md.b 0x20000000 0x00100000 Then saved log file with dump as text file, cut out extra stuff before and after the dump and coverted it to binary use
xxd -r -p dump.txt dump.bin Resulting bin file size 1,310,860 bytes is mismatching MTD partion size (1,048,576 bytes), its much larger. Is the problem related to hex data conversion or the dump process have errors? I understand that MTD partion size of 1048576 bytes is size assigned to the whole MTD partition, the actual data on partition takes much smaller space, the large space filled with hex 'ff' values. Additionally, can anyone advice good utility for hex to bin data conversion?
Edit: I tried the same steps with 64 bytes data size, edited dump with gedit: resulting ascii file size = 318 bytes. So gedit corrupts the file. When I open saved log with Gedit, it show alert:
'There was a problem opening the file “/home/../Documents/64bytes-test.log. The file you opened has some invalid characters. If you continue editing this file you could corrupt this document. You can also choose another character encoding and try again. Character encoding: Current locale (UTF-8)' So probably I have to redirect raw serial data to disk.