Android SDK

The Android SDK provides tools for developing software program Android.

Make an Image of Internal Storage

PYK 2015-04-29: Here is an example of making an image of a block device in an Android system via adb:

#! /bin/env tclsh

proc send {chan msg} {
    puts $chan [format %04x%s [string length $msg] $msg]
    flush $chan
    set response [read $chan 4]
    if {[string equal $response OKAY]} {
        return $response
    } else {
        return -code error [list $response $msg]
    }
}

proc main {argc argv} {
    set hostname localhost
    #set hostname 127.0.0.1
    set port 5037
    set chan [socket $hostname $port]
    send $chan host:transport-any
    
    send $chan {shell:sh -c 'su -c "dd bs=8192 if=/dev/block/mmcblk0p27"'}
    set chan2 [open mmcblk0.img wb]
    while {![eof $chan]} {
        set data [read $chan 8192]
        if {$data ne {}} {
            puts [list [info cmdcount] {writing some more}]
            puts -nonewline $chan2 $data 
        }
    }
    close $chan
}

main $argc $argv

This script was informed by ADB (Android Debug Bridge): How it works? , Tetsuyuki Kobayashi, 2012-02-06.