Skip to content

Instantly share code, notes, and snippets.

@fmayer
Last active June 23, 2022 21:16
Show Gist options
  • Save fmayer/8900b52636574ee079fa1943e5da918e to your computer and use it in GitHub Desktop.
Save fmayer/8900b52636574ee079fa1943e5da918e to your computer and use it in GitHub Desktop.
# Device bootloader does not support memtag, so it leaves it alone on normal
# boots.
$ adb shell su root setenforce 0
$ adb shell su root /data/local/tmp/mtectrl memtag-once
$ adb shell su root dd bs=1 skip=32768 if=/dev/block/bootdevice/by-name/misc count=32768 | xxd
[...]
00000040: 015a fefe 5a02 0000 0000 0000 0000 0000 .Z..Z...........
[...]
[[ FACTORY RESET IN RECOVERY ]]
$ adb shell su root dd bs=1 skip=32768 if=/dev/block/bootdevice/by-name/misc count=32768 | xxd
00000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................
$ adb shell su root /data/local/tmp/mtectrl memtag-once
$ adb shell su root dd bs=1 skip=32768 if=/dev/block/bootdevice/by-name/misc count=32768 | xxd
[...]
00000040: 015a fefe 5a02 0000 0000 0000 0000 0000 .Z..Z...........
[...]
[[ FACTORY RESET IN SETTINGS ]]
$ adb shell su root dd bs=1 skip=32768 if=/dev/block/bootdevice/by-name/misc count=32768 | xxd
[...]
00000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment