Dump memory to file from U-Boot console using Memory Display (md) log
Introduction
Dump firmware or other contents from memory of a device with U-Boot bootloader to a file by converting output of memory display (md) command to binary image.
Steps
1. Connect to U-Boot console using picocom and save all outputs in a log file using commad given below. Here the output is saved to log file named 'mdb.log'.
sudo picocom /dev/ttyUSB0 --baud 115200 --logfile mdb.log
2. Display the contents of the memory using command:
md.b <address> <length>
Figure below shows the command to display memory contents from address 0x400000000 and of length 0x20000 (128KB) . The data in this example corresponds to a jffs2 file system.
3. Once the execution completes, edit the log file and remove everything other than md.b output.
4. Clone the github project uboot-mdb-dump.git
git clone https://github.com/gmbnomis/uboot-mdb-dump.git
5. Generate the binary image file 'output.bin' from log file 'mdb.log'.
python3 uboot-mdb-dump/uboot_mdb_to_image.py < mdb.log > output.bin
Comments
Post a Comment