Android调试底层服务

  之前调试过VOLD,调试起来极为麻烦,稍微改一点就要编译整个系统,然后烧写system.img。极为耗时,经过多时经验总结出来了类似调试应用程序的调试方法,高效快速。这里先还以VOLD为例子。
  
  修改源码后单独编译VOLD:
  $ mmm system/vold

然后执行以下脚本,就可以直接观察现象了:
#!/bin/sh
# vold 调试脚本
# 作者:kangear
# 2014-02-09

# build vold
# mmm system/vold  &&

# send vold
# sz out/target/product/rk30sdk/system/bin/vold  &&

# push
adb push /root/ybk-hw/ybkMisc/out/target/product/rk30sdk/system/bin/vold /system/bin &&

# chmod
adb shell busybox chmod 777 /system/bin/vold   &&

# stop vold
adb shell setprop ctl.stop vold  &&

# start vold
adb shell setprop ctl.start vold

#!/bin/sh
# services 调试脚本
# 作者:kangear
# 2014-02-09

# build vold
# mmm frameworks/base/services/java/ &&
/root/remount.sh &&
# send vold
# sz out/target/product/rk30sdk/system/bin/vold  &&

# push
adb push /root/ybk-hw/ybkMisc/out/target/product/rk30sdk/system/framework/services.jar /system/framework/ &&

# reboot
adb shell reboot

20140625更:

最为方便的是adb sync来同步代码,其中启动和关闭部分还算有用。adb push那些太麻烦了。

20141226更:

# author: kangear
# data  : 2014-12-26

### sync file between PC and target device
# system dir
adb -p /out/to/path sync system
# data dir
adb -p /out/to/path sync data

### build modules
# frameworks
make framework-res && make framework && make services && make android.policy
# vold
mmm system/vold
# service jni
mmm frameworks/base/services/jni
# service java
mmm frameworks/base/services/java
# core
mmm frameworks/base
# hardware modules
mmm hardware/libhardware/modules/

### restart xxx
# whole android os(about kernel/bootloader)
adb shell reboot
# only android os without kernel/bootloader/c_service(vold/..)
adb shell "stop && start"
# only vold
adb shell "setprop ctl.stop vold && setprop ctl.start vold"

# ...



你可能感兴趣的:(Android调试底层服务)