但使书种多,会有岁稔时。这篇文章主要讲述如何让A20,android开机自动启动C程序相关的知识,希望能为你提供帮助。
本文转载自:http://blog.csdn.net/u011258134/article/details/50749174
如何让A20,android开机自动启动C程序2014-12-26 11:32
557人阅读
评论(3)收藏
举报
文章图片
分类: 作者同类文章X【如何让A20,android开机自动启动C程序】版权声明:本文为博主原创文章,未经博主允许不得转载。
/// xinit 增加: xinit /usr/local/bin/xfreerdp 192.168.1.196
1,修改 android/device/ init.sun7i.rc
........(略)
#add by jiangdou
chmod 777 /system/bin/hello
chmod 777 /system/bin/dou.sh
service init-setup /system/bin/dou.sh
class main
user root
group root
oneshot
........(略)
2,在device/softwinner/sugar-cubieboard2/新建dou.sh 文件,内容:
#! /system/bin/sh
#hello是C编译的文件,是静态编译,,放在system/bin/
/system/bin/hello
#or
hello
echo "jiangdou"
exit
3,vi device/softwinner/sugar-cubieboard2/sugar_cubieboard2.mk ///目的是执行make -j48 复制到out/target/product/sugar-cubieboard2/system/bin/
........(略)
#add by jiangdou
PRODUCT_COPY_FILES += \
device/softwinner/sugar-cubieboard2/hello:system/bin/hello \
device/softwinner/sugar-cubieboard2/dou.sh:system/bin/dou.sh
........(略)
4,开机,,效果
[email protected]:/ # ps | busybox grep hello
root 1409 1 652 108 c006bf0c 0001090c S /system/bin/hello
root 1411 1 652 108 c006bf0c 0001090c S hello
[email protected]:/ #
证明开机自动运行了
5, C代码内容,,,,编译$ arm-linux-androideabi-gcc -o hello hello.c -static
[html] view plain copy
文章图片
文章图片
- #include< stdio.h>
- #include < signal.h>
- int main(void)
- {
- int i;
- signal(SIGCHLD, SIG_IGN);
- daemon(0, 0); //fork 强制后台运行! daemon祥见下面的文章
- // for(i = 0; i < 10; i++)
- while(1)
- {
- sleep(1);
- printf("hello......by jiangdou\n");
- }
- return 0;
- }
- #include< stdio.h>
- #include < signal.h>
- int main(void)
- {
- int i;
- signal(SIGCHLD, SIG_IGN);
- daemon(0, 0); //fork 强制后台运行!
- // for(i = 0; i < 10; i++)
- while(1)
- {
- sleep(1);
- printf("hello......by jiangdou\n");
- }
- return 0;
- }
adb push xxx /system ----> ERROR "Readonly-----file system"
adb shell & & mount -o remount -o rw /system
原帖:http://blog.csdn.net/jiangdou88/article/details/42169263#comments
推荐阅读
- monkey-获取app包名
- RULES OF SURVIVAL 1.115153.115248 Full Apk + Data for Android
- 利用微信公众号快速推广APP应用
- APP垂直市场应用趋势(女性APP)
- Android7.0手机程序保活(附源码下载)
- bzoj2127: happiness
- Docker与Android Studio的冲突问题
- android studio 消除RadioButton中的圆圈
- AppScan安全扫描(已解密的登录请求)