Advertisement
ot_inc

Dump Android Device image.

Nov 9th, 2023 (edited)
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. 1. Preparation
  2. The following preparations are required before creating a Fastboot ROM.
  3. - Bootloader Unlocked device
  4. - GSI with built-in SU (Phh-AOSP, LineageOS GSI, etc.) or boot.img with patched Magisk or KernelSU boot.img
  5. - DSU Sideloader (GSI Only)
  6. - adb and fastboot environment
  7.  
  8. 2. Dump Image
  9. You can pull files as img by running certain commands with root privileges. In other words, you are doing that and pulling out img's such as boot and vbmeta.
  10. Let's do the necessary commands to save the img.
  11.  
  12. Note: boot GKI(⚠Don't use fastboot flash boot)
  13. fastboot boot KSU_boot.img
  14.  
  15. ## Dump Image Commands ##
  16. # 1. Superuser
  17.  
  18. su
  19.  
  20. # 2. Go to the path where each image is located (or /dev/block/by-name/ for MediaTek, etc.)
  21. ↓ Copy
  22. cd /dev/block/bootdevice/by-name/
  23.  
  24. # 3. Create backup directory
  25. ↓ Copy
  26. mkdir /sdcard/backup_img
  27.  
  28. # 4. Backup everything except cache and userdata to /sdcard
  29. ↓ Copy
  30. for file in *; do
  31. if [[ "${file}" = cache* || "${file}" = userdata* ]]; then continue ; else dd if=/dev/block/bootdevice/by-name/"${file}" of=/sdcard/backup_img/"${file}".img ; fi
  32. done
  33.  
  34. # 5. MD5 check list
  35. ↓ Copy
  36. echo "" > /sdcard/backup_img/md5.txt
  37. for file in *; do
  38. if [[ "${file}" = cache* || "${file}" = userdata* ]]; then continue ; else
  39. echo "${file}" >> /sdcard/backup_img/md5.txt
  40. md5sum /dev/block/bootdevice/by-name/"${file}" >> /sdcard/backup_img/md5.txt
  41. md5sum /sdcard/backup_img/"${file}".img >> /sdcard/backup_img/md5.txt
  42. echo "" >> /sdcard/backup_img/md5.txt
  43. fi
  44. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement