第7课第2节_Binder系统_c++实现_编译测试
?
設(shè)置執(zhí)行環(huán)境:
.setenv lunch 23(.full_tiny4412-eng)進(jìn)入到代碼所在目錄執(zhí)行
mmm .
?
?
七. Binder系統(tǒng)之服務(wù)的c++實(shí)現(xiàn)
1. 編寫代碼
參考文件:
frameworks\av\include\media\IMediaPlayerService.h (IMediaPlayerService,BnMediaPlayerService)
frameworks\av\media\libmedia\IMediaPlayerService.cpp (BpMediaPlayerService)
frameworks\av\media\libmediaplayerservice\MediaPlayerService.h
frameworks\av\media\libmediaplayerservice\MediaPlayerService.cpp
frameworks\av\media\mediaserver\Main_mediaserver.cpp (server, addService)
第一次:
git clone https://github.com/weidongshan/APP_0004_Binder_CPP_App.git
更新:
git pull origin
取出指定版本:
git checkout v1 // 初始版本, 未調(diào)試
2. 編譯測(cè)試
參考frameworks\av\media\mediaserver\Android.mk
編譯: a. 文件放入frameworks/testing/APP_0004_Binder_CPP_App b. cd /work/android-5.0.2/ . setenv lunch //選擇23. full_tiny4412-eng c. cd frameworks/testing/APP_0004_Binder_CPP_App mmm .?
?
?
測(cè)試:
a. 重新編譯內(nèi)核讓它支持NFS
make menuconfig
<*> NFS client support | |
[*] NFS client support for NFS version 3 | |
[*] NFS client support for the NFSv3 ACL protocol extension | |
[*] NFS client support for NFS version 4 | |
[*] NFS client support for NFSv4.1 (EXPERIMENTAL)
make zImage, 并使用新的zImage啟動(dòng)單板
b. mount nfs
su
ifconfig eth0 192.168.1.100
busybox mount -t nfs -o nolock,vers=2 192.168.1.123:/work/nfs_root /mnt ? (在Android系統(tǒng)中不支持mount,必須使用busybox mount)
c. 執(zhí)行 test_server, test_client
./test_server &
logcat HelloService:* *:S &
./test_client hello
./test_client hello weidongshan
?程序運(yùn)行執(zhí)行的結(jié)果:
?
?
?
?
注意如果使用的是上一節(jié)的內(nèi)核,即修改了binder.c的,含有打印信息的。應(yīng)恢復(fù)為原來的,否則啟動(dòng)非常慢。
?
?
?
?
執(zhí)行c語(yǔ)言編寫的代碼
首先修改makefile 編譯為靜態(tài)連接
?makeflie:
?
?
?
?現(xiàn)在使用c++實(shí)現(xiàn)的test_server和c語(yǔ)言實(shí)現(xiàn)的test_client之間可以互相通信
?
?現(xiàn)在使用c語(yǔ)言實(shí)現(xiàn)的test_server和c++語(yǔ)言實(shí)現(xiàn)的test_client之間可以互相通信
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/zhulinhaibao/p/7103272.html
總結(jié)
以上是生活随笔為你收集整理的第7课第2节_Binder系统_c++实现_编译测试的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SLAM优化位姿时,误差函数的雅可比矩阵
- 下一篇: 06奥德赛原车cd可以改u盘吗?