Skip to content

Instantly share code, notes, and snippets.

@MagneFire
Last active November 17, 2022 15:23
Show Gist options
  • Save MagneFire/f0bbd8f862c7f5c72840922e2add0461 to your computer and use it in GitHub Desktop.
Save MagneFire/f0bbd8f862c7f5c72840922e2add0461 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -x
dump_file=$1
if [[ -z "$dump_file" ]]; then
echo "No dump provided assuming \"mmcblk0\""
dump_file="mmcblk0"
fi
line=$(sfdisk -d $dump_file | grep "start" | awk -F'[, ]*' '{print "dd if='$dump_file' of=" substr($9, 7, length($9)-7) ".img skip=" $4 " count=" $6}')
while IFS= read -r l; do
$l
done <<< "$line"
@MagneFire
Copy link
Author

Use the command sfdisk -d mmcblk0 > partition_mapping to get a partition map.
Get the entire disk image by using adb pull /dev/mmcblk0 ..

@beroset
Copy link

beroset commented Nov 17, 2022

Another way to get the image using ssh access is to execute this on the host Linux computer:

ssh root@watch "dd bs=1M if=/dev/mmcblk0" | dd of=mmcblk0_b.img bs=1M

This assumes that watch has been set up with the IP address of the watch. This works over WiFi, but of course, transferring 4G via WiFi is going to be relatively slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment