您的位置:首页 > 移动开发 > Android开发

TaintDroid下载预编译(五):TaintDroid(Android)系统编译虚拟机和真机测试

2016-03-31 20:31 489 查看
光说不练非好汉,现在就让我们开启自己编译的系统测试!其实懂得这些过程,就知道了Android手机系统定制的整个流程。现有的智能机都是使用Google的android开源的系统然后添加一些自己的东西,就成为公司的系统!

TaintDroid(Android)虚拟机上测试

我们前面讲了如何编译,编译的成功的标识就是生成system.img文件,如下图:



sdk替换

拷贝system.img镜像文件,替换掉sdk中的镜像,如下图:



对于AVD创建很简单,这里几张图就可以看懂!





点击start就可以启动该虚拟机。Api一定是调用18的,因为该接口是我们编译生成的system.img

运行TaintDroid!这里我对该应用进行了修改,使其可以生成日志文件!



已经测试成功!

TaintDroid(Android)在真机上测试

在真机上比较复杂,需要下载驱动。我测试的手机是Galaxy Nexus i9250所以下载如下驱动
% cd ~/tdroid/tdroid-4.3_r1
% wget https://dl.google.com/dl/android/aosp/broadcom-maguro-jwr66y-5fa7715b.tgz % tar -zxvf broadcom-maguro-jwr66y-5fa7715b.tgz
% ./extract-broadcom-maguro.sh # (view the license and then type "I ACCEPT")
...
% wget https://dl.google.com/dl/android/aosp/imgtec-maguro-jwr66y-b0a4a1ef.tgz % tar -zxvf imgtec-maguro-jwr66y-b0a4a1ef.tgz
% ./extract-imgtec-maguro.sh # (view the license and then type "I ACCEPT")
...
% wget https://dl.google.com/dl/android/aosp/invensense-maguro-jwr66y-e0d2e531.tgz % tar -zxvf invensense-maguro-jwr66y-e0d2e531.tgz
% ./extract-invensense-maguro.sh # (view the license and then type "I ACCEPT")
...
% wget https://dl.google.com/dl/android/aosp/nxp-maguro-jwr66y-d8ac2804.tgz % tar -zxvf nxp-maguro-jwr66y-d8ac2804.tgz
% ./extract-nxp-maguro.sh # (view the license and then type "I ACCEPT")
...
% wget https://dl.google.com/dl/android/aosp/samsung-maguro-jwr66y-fb8f93b6.tgz % tar -zxvf samsung-maguro-jwr66y-fb8f93b6.tgz
% ./extract-samsung-maguro.sh # (view the license and then type "I ACCEPT")
...
% wget https://dl.google.com/dl/android/aosp/widevine-maguro-jwr66y-c49927ce.tgz % tar -zxvf widevine-maguro-jwr66y-c49927ce.tgz
% ./extract-widevine-maguro.sh # (view the license and then type "I ACCEPT")
建立buildspec.mk文件并输入以下内容!
% cd ~/tdroid/tdroid-4.3_r1
% edit/create buildspec.mk
# Enable core taint tracking logic (always add this)
WITH_TAINT_TRACKING := true

# Enable taint tracking for ODEX files (always add this)
WITH_TAINT_ODEX := true

# Enable taint tracking in the "fast" (aka ASM) interpreter (recommended)
WITH_TAINT_FAST := true

# Enable additional output for tracking JNI usage (not recommended)
#TAINT_JNI_LOG := true

# Enable byte-granularity tracking for IPC parcels
WITH_TAINT_BYTE_PARCEL := true
开始进行编译!
打开build/target/product/core.mk添加内容
PRODUCT_PACKAGES += \
BasicDreams \
...
voip-common \
TaintDroidNotify
重新编译
% . build/envsetup.sh
% lunch 12
% make clean
% make -j4
开始进行刷机
首先对手机fastboot状态调成UNCLOSE
% fastboot oem unlock



进行刷机!
% cd out/target/product/maguro
% fastboot flash boot boot.img
% fastboot flash system system.img
% fastboot flash userdata userdata.img


如下图:



测试结果





至此,实验终于完成了!

总结

看着图片很简单,操作起来相当麻烦!编译错误,刷机错误!反正一点一点调吧!整个过程走下来,至少还是能学点东西的!!(驱动一定要符合手机,否则刷机的开始也是板砖的开始。变板之后再想恢复,对于google手机比较难!如果SD卡外置就相当简单,可我实验的机子都是内置的SD卡~~~)
祝大家学习愉快!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息