CubieBoard博客-HomeCubieTech公司网站

cubie.cc CubieBoard中文论坛

 找回密码
 立即注册
搜索
热搜: unable
查看: 3237|回复: 3

如何让A20,android开机自动启动C程序

[复制链接]

22

主题

4

好友

1万

积分

论坛元老

Rank: 8Rank: 8

贡献
2230
金钱
5223
威望
2245
买家信用
卖家信用
积分
12147
发表于 2014-12-26 11:36:14 |显示全部楼层
本帖最后由 jiangdou 于 2014-12-26 11:38 编辑

1,修改 android/device/    init.sun7i.rc
增加:
  1. ........(略)

  2. #add by jiangdou
  3.     chmod 777 /system/bin/hello
  4.     chmod 777 /system/bin/dou.sh
  5. service init-setup /system/bin/dou.sh
  6.     class main
  7.     user root
  8.     group root
  9.     oneshot

  10. ........(略)
复制代码
2,在device/softwinner/sugar-cubieboard2/新建dou.sh  文件,内容:
  1. #! /system/bin/sh

  2. #hello是C编译的文件,是静态编译,,放在system/bin/
  3. /system/bin/hello     
  4. #or
  5. hello

  6. echo "jiangdou"
  7. exit
复制代码
3,vi device/softwinner/sugar-cubieboard2/sugar_cubieboard2.mk   ///目的是执行make -j48  复制到out/target/product/sugar-cubieboard2/system/bin/
  1. ........(略)

  2. #add by jiangdou
  3. PRODUCT_COPY_FILES += \
  4.         device/softwinner/sugar-cubieboard2/hello:system/bin/hello \
  5.         device/softwinner/sugar-cubieboard2/dou.sh:system/bin/dou.sh

  6. ........(略)
复制代码
4,开机,,效果,,运行了两个hello
root@android:/ # ps | busybox grep hello
root      1409  1     652    108   c006bf0c 0001090c S /system/bin/hello
root      1411  1     652    108   c006bf0c 0001090c S hello
root@android:/ #

证明开机自动运行了


5, C代码内容,,,,编译$  arm-linux-androideabi-gcc -o  hello hello.c  -static
  1. #include<stdio.h>
  2. #include <signal.h>
  3. int main(void)
  4. {

  5.    int i;
  6.     signal(SIGCHLD, SIG_IGN);

  7.     daemon(0, 0);//fork 强制后台运行!
  8.    // for(i = 0; i < 10; i++)
  9.    while(1)
  10.     {
  11.      sleep(1);
  12.      printf("hello......by jiangdou\n");
  13.     }
  14. return 0;
  15. }
复制代码

回复

使用道具 举报

34

主题

10

好友

1万

积分

版主

Rank: 7Rank: 7Rank: 7

贡献
2209
金钱
4277
威望
2210
买家信用
卖家信用
积分
11629
发表于 2014-12-29 09:09:08 |显示全部楼层
Mark  给力
回复

使用道具 举报

18

主题

10

好友

6796

积分

论坛元老

Rank: 8Rank: 8

贡献
1279
金钱
2576
威望
1279
买家信用
卖家信用
积分
6796
发表于 2014-12-29 15:09:21 |显示全部楼层
sunbeyond 发表于 2014-12-29 09:09
Mark  给力

:):):):)
喵星人已回喵星球。
回复

使用道具 举报

0

主题

0

好友

137

积分

注册会员

Rank: 2

贡献
31
金钱
42
威望
31
买家信用
卖家信用
积分
137
发表于 2017-9-9 14:21:36 |显示全部楼层
<a href="http://coach.euro-us.net/"><strong>coach outlet online</strong></a>, <a href="http://www.pandora-charmscanada.ca/"><strong>pandora charms</strong></a>, <a href="http://www.jimmychoos-shoes.com/"><strong>jimmy choo</strong></a>, <a href="http://www.reeboks.com.de/"><strong>reebok</strong></a>, <a href="http://www.watches-omega.com/"><strong>omega watches</strong></a>, <a href="http://www.polosoutlet-store.com/"><strong>polo outlet online</strong></a>, <a href="http://www.australia-michaelkors.com/"><strong>michael kors australia</strong></a>, <a href="http://www.zcoachoutlet.com/"><strong>coach outlet usa</strong></a>, <a href="http://www.hollister-store.com.co.co/"><strong>hollister clothing store</strong></a>, <a href="http://www.polos-ralphlauren.com.co/"><strong>polo ralph lauren</strong></a>, <a href="http://www.raybans.com.de/"><strong>ray ban</strong></a>, <a href="http://www.burberrys-outletonline.in.net/"><strong>burberry</strong></a>, <a href="http://pacers.nba-jersey.com/"><strong>pacers jersey</strong></a>, <a href="http://www.outlet-pradas.com/"><strong>prada outlet</strong></a>, <a href="http://www.raybans-outlet.net.co/"><strong>ray ban wayfarer</strong></a>, <a href="http://www.adidas-store.net/"><strong>adidas shoes</strong></a>, <a href="http://jazz.nba-jersey.com/"><strong>jazz jersey</strong></a>, <a href="http://titans.nflvstore.com/"><strong>titans nfl jersey</strong></a>, <a href="http://www.true-religions.com/"><strong>cheap true religion</strong></a>, <a href="http://www.oakleys-outlets.net/"><strong>oakley vault</strong></a>, <a href="http://www.co-aol.com/"><strong>coach outlet</strong></a>, <a href="http://www.michael-kors.cc/"><strong>michael kors outlet</strong></a>, <a href="http://www.michaelkorsoutlet.se/"><strong>michael kors</strong></a>, <a href="http://www.ralphs-laurenspolos.com/"><strong>ralph lauren polo</strong></a>, <a href="http://saints.nflvstore.com/"><strong>saints nfl jersey</strong></a>, <a href="http://www.pandorajewellery-au.com/"><strong>pandora jewellery</strong></a>, <a href="http://www.rolexwatch-outlet.com/"><strong>rolex watches</strong></a>, <a href="http://www.chiflatiron-hair.com/"><strong>chi flat iron</strong></a>, <a href="http://www.nike-free5.com/"><strong>nike free 5.0</strong></a>, <a href="http://www.burberrys-handbags.com/"><strong>burberry handbags</strong></a>, <a href="http://www.nikeairforce.com.de/"><strong>air force</strong></a>, <a href="http://www.cheap-watches.in.net/"><strong>replica watches</strong></a>, <a href="http://www.fredperrypolos.co.uk/"><strong>fred perry outlet</strong></a>, <a href="http://www.dsquared2-outlet.com/"><strong>dsquared2</strong></a>, <a href="http://www.timberlandspaschere.fr/"><strong>timberland</strong></a>, <a href="http://www.danskoshoes.in.net/"><strong>dansko shoes</strong></a>, <a href="http://falcons.nflvstore.com/"><strong>falcons nfl jersey</strong></a>, <a href="http://www.kate-spadebags.com/"><strong>kate spade outlet</strong></a>, <a href="http://longchamp.blackofriday.com/"><strong>longchamp black friday</strong></a>, <a href="http://www.ralph-lauren-uk.co.uk/"><strong>ralph lauren</strong></a>, <a href="http://www.outletonline-ralphlauren.com/"><strong>ralph lauren outlet online</strong></a>, <a href="http://www.new-balanceshoes.es/"><strong>new balance</strong></a>, <a href="http://www.celinefactory.com/"><strong>celine handbags</strong></a>, <a href="http://www.oakleys-sunglasses.mex.com/"><strong>oakley sunglasses</strong></a>, <a href="http://www.barbours-factory.com/"><strong>barbour jackets</strong></a>, , <a href="http://www.nikeairmax.com.de/"><strong>nike air</strong></a>, <a href="http://bears.nflvstore.com/"><strong>bears nfl jersey</strong></a>, <a href="http://steelers.nflvstore.com/"><strong>steelers nfl jersey</strong></a>, <a href="http://www.burberry-outlets.org.uk/"><strong>burberry uk</strong></a>, <a href="http://trailblazers.nba-jersey.com/"><strong>trail blazers jersey</strong></a>, <a href="http://www.clothes-outletstore.com/"><strong>womens clothing</strong></a>, <a href="http://www.oakleysunglasses-canada.ca/"><strong>oakley sungalsses outlet</strong></a>, <a href="http://www.horlogesrolexs.co.nl/"><strong>horloges</strong></a>, <a href="http://www.nike-skos.com/"><strong>nike</strong></a>, <a href="http://www.airmax.com.se/"><strong>air max</strong></a>, <a href="http://49ers.nflvstore.com/"><strong>49ers nfl jersey</strong></a>, <a href="http://bucks.nba-jersey.com/"><strong>bucks jersey</strong></a>, <a href="http://www.ralph-lauren-polos.us.org/"><strong>ralph lauren factory store</strong></a>, <a href="http://www.northfacejackets.fr/"><strong>the north face jackets</strong></a>, <a href="http://www.burberry-outlets.ca/"><strong>burberry canada</strong></a>, <a href="http://bills.nflvstore.com/"><strong>bills nfl jersey</strong></a>, <a href="http://www.marc-jacobs.us.com/"><strong>marc jacobs</strong></a>, <a href="http://michaelkors.euro-us.net/"><strong>michael kors usa</strong></a>, <a href="http://www.adidassuper-star.de/"><strong>adidas</strong></a>, <a href="http://www.burberryoutletonline.com.de/"><strong>burberry</strong></a>, <a href="http://www.michaels-korsoutlet.com/"><strong>michael kors outlet</strong></a>, <a href="http://www.oakley-sunglassessale.com.co/"><strong>oakley sunglasses outlet</strong></a>, <a href="http://www.pandora-jewelry.com.de/"><strong>pandora</strong></a>, <a href="http://giants.nflvstore.com/"><strong>giants nfl jersey</strong></a>, <a href="http://bengals.nflvstore.com/"><strong>bengals nfl jersey</strong></a>, <a href="http://www.raybans.org.es/"><strong>ray ban</strong></a>, <a href="http://www.chiflatironhair.us.com/"><strong>flat iron</strong></a>, <a href="http://www.ray-bans.net.co/"><strong>ray bans</strong></a>, <a href="http://www.michael-korsukpurse.co.uk/"><strong>michael kors uk</strong></a>, <a href="http://www.hollister-clothings.us.com/"><strong>hollister clothing</strong></a>, <a href="http://www.barbour.in.net/"><strong>barbour jackets outlet</strong></a>, <a href="http://www.nike-airmax.com.de/"><strong>nike air max</strong></a>, <a href="http://www.burberrys-bags.com/"><strong>burberry outlet</strong></a>, <a href="http://www.michaelkors-ins.com/"><strong>michael kors outlet</strong></a>, <a href="http://colts.nflvstore.com/"><strong>colts nfl jersey</strong></a>, <a href="http://mavericks.nba-jersey.com/"><strong>dallas mavericks jersey</strong></a>, <a href="http://www.canada-michaelkors.ca/"><strong>michael kors</strong></a>, <a href="http://www.truereligions.net/"><strong>true religion outlet store</strong></a>, <a href="http://www.airmax-90.com/"><strong>air max 90</strong></a>, <a href="http://www.beatsbydre.com.co/"><strong>beats by dre headphones</strong></a>, <a href="http://www.outletburberrybags.com/"><strong>burberry outlet online</strong></a>, <a href="http://www.coachfactory.cc/"><strong>coach factory outlet online</strong></a>, <a href="http://www.outlet-oakleys.com/"><strong>eyeglasses online</strong></a>, <a href="http://www.cheap-iphonecases.com/"><strong>iphone cases</strong></a>, <a href="http://www.hoodies.us.com/"><strong>hoodies outlet</strong></a>, <a href="http://www.ed-hardy.us.com/"><strong>ed hardy</strong></a>, <a href="http://www.cheap-jerseys.mex.com/"><strong>cheap jerseys</strong></a>, <a href="http://www.long-champhandbags.com/"><strong>longchamp outlet</strong></a>, , <a href="http://www.hoganshoes.org.uk/"><strong>hogan shoes</strong></a>, <a href="http://www.scarpe-hoganshoes.it/"><strong>scarpe hogan</strong></a>, <a href="http://www.nike-shoes.com.co/"><strong>jordan release dates</strong></a>, <a href="http://thunder.nba-jersey.com/"><strong>oklahoma city thunder jerseys</strong></a>, , <a href="http://www.airmax2015.net/"><strong>air max 2015</strong></a>, <a href="http://ravens.nflvstore.com/"><strong>ravens nfl jersey</strong></a>,
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

QQ|Archiver|手机版|邮件群发|cubie.cc---深刻的嵌入式技术和应用讨论中文社区 ( 粤ICP备13051116号-1  

GMT+8, 2017-11-19 14:31 , Processed in 0.018767 second(s), 7 queries , Apc On.

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc. | Style by Coxxs

回顶部