Wednesday, August 16, 2023

[GUIDE] How to create 'mmcblk0.img' from a working device?

 Below are the steps I followed to create a mmcblk0.img from a working device.


What is needed? -

a) A Working device of same model XT179x where 'x' could be 2,3,4,5,etc depending on region.

b) It should be a rooted one.

c) A working linux system. Any variant would do.


Steps to follow in working device:

1) Reboot device to TWRP recovery.

2) Take a backup of system,data and boot partitions. While taking backup, select the storage as Micro SDCard.

3) Once backup is complete, do a factory reset. This step is required as you don't want your friends personal files and settings.

3a) Power off the device.

4) Remove the SIM and existing SDCard.

5) Insert a new 32GB SDCard Class 10 UHS-1 into the device. This should be formatted as FAT32 or exFAT.

6) Boot the device.

7) Once booted, connect the device to computer using USB.

8) Open a terminal in your linux.

9) adb devices (This step assumes that adb and fastboot are in linux system path)

10) adb shell

11) su -

12) You are in root shell now.

13) cat /proc/partitions.

13a) Above step would list out all partitions.

14) Note the size of mmcblk0 partition.

15) Now run 'dd if=/dev/block/mmcblk0 of=/storage/<STORAGE-ID>/mmcblk0.img bs=1000000000 count=30' without quotes. 'bs' stands for block size. Here in the above command I am giving a block size of 1GB. In my case mmcblk0 partition size was nearly 30GB. So the above command worked for me. If you are experiencing problem, then play with the numbers. For example you could try decreasing the 'bs' value and increase the 'count' value. Ultimately 'bs' multiplied by count should be the partition size. If everything goes fine, you will have a mmcblk0.img in your sdcard. One more point to note. <STORAGE-ID> in the command is the place holder. The actual ID would be a hexadecimal value. You can get your storage id by doing a 'ls /storage' in root shell. In my case the SDCard was referred as 7368-9BEE.

16)Above step would take some time as it has to create a image of 30G size. Once complete, copy the image from SDcard to your computer.

17) Power off the device and remove the SDcard from device.

18) Insert your friend's SIM card and SDCard.

19) Boot to TWRP recovery.

20) Restore the backup you took in step 2 above.

.

.

I have 2 mmcblk0 images:

1) Moto G5S and

2) Moto G5.


My Moto G5 (Cedric): XT1676, model M2675 (3Gb mem + 16Gb storage), NPP25.137-93 (1nov2017), reteu, android 7.0

download link: https://www.androidfilehost.com/?fid=11050483647474830935

MD5 of 7z-file: fc8617eb3957e2b4df16400f722f8095

MD5 of img-file (after unzip): 90efa172d7881f7268bb58708f3d9935


My Moto G5S (Montana): XT1794, model 2996, (3Gb + 32Gb), NPPS26.102-49-8 (1apr2018), reteu, android 7.1.1

download link https://www.androidfilehost.com/?fid=11050483647474830875

MD5 of 7z-file: dd10315797b78c359a2887b149cc8f44

MD5 of img-file (after unzip): ffeca74973f0b38b0996e13cde667c38

.

.

Source: https://forum.xda-developers.com/t/guide-how-to-create-mmcblk0-img-from-a-working-device.3803176/

No comments:

Post a Comment