Skip to content

Instantly share code, notes, and snippets.

@ToQoz
Last active February 9, 2016 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ToQoz/96bb1de05f8b03a09c90 to your computer and use it in GitHub Desktop.
Save ToQoz/96bb1de05f8b03a09c90 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Unlock docomo NEXT series GALAXY NEXUS SC-04D SC-04D's sim
set -e
adb-reboot() {
adb reboot
adb wait-for-device
echo "rebooted!" >> /dev/stderr
}
# Restore default
adb shell rm /data/radio/nv_data.bin
adb shell rm /data/radio/nv_data.bin.md5
adb shell rm /factory/nv_data.bin
adb shell rm /factory/nv_data.bak
adb shell rm /factory/nv_data.bin.md5
adb shell rm /factory/nv_data.bak.md5
adb-reboot
cd /tmp
adb root
# Modify nv_data.bin. 01 -> 00 at 0x181460
adb pull /data/radio/nv_data.bin .
mv /tmp/nv_data.bin /tmp/nv_data.bin.bak
xxd -g 1 /tmp/nv_data.bin.bak |
sed "s/^\(0*181460: .* .* .* .* .* .* .* .* .*\) 01 \(.*\)/\1 00 \2/" |
xxd -r > /tmp/nv_data.bin
openssl md5 nv_data.bin | awk '{print $2}' | tr -d "\n" > nv_data.bin.md5
# Write /factory/nv_data
# Remount readonly /factory as writable
adb shell mount -o remount,rw -t ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/efs /factory
adb push nv_data.bin /factory/nv_data.bin
adb push nv_data.bin /factory/.nv_data.bak
adb push nv_data.bin.md5 /factory/nv_data.bin.md5
adb push nv_data.bin.md5 /factory/.nv_data.md5.bak
adb shell rm /data/radio/nv_data.bin
adb shell rm /data/radio/nv_data.bin.md5
adb-reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment