Home

cubie.cc CubieBoard中文论坛

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

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

[复制链接]

22

主题

4

好友

1万

积分

论坛元老

Rank: 8Rank: 8

贡献
2011
金钱
4681
威望
2026
买家信用
卖家信用
积分
10947
发表于 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

贡献
2193
金钱
4237
威望
2194
买家信用
卖家信用
积分
11541
发表于 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

好友

441

积分

中级会员

Rank: 3Rank: 3

贡献
92
金钱
100
威望
92
买家信用
卖家信用
积分
441
发表于 2016-9-20 19:00:31 |显示全部楼层
chanyuan0920
fitflops shoes
asics
louis vuitton handbags
canada goose outlet
louis vuitton handbags
versace sunglasses
ugg outlet
kobe shoes
michael kors outlet
ferragamo shoes
instyler ionic styler
beats by dr dre
longchamp outlet
ugg boots
oakley sunglasses
michael kors handbags
michael kors handbags
swarovski jewelry
longchamp solde
nike air force 1
ferragamo outlet
ugg boots
mcm outlet
hollister uk
nike free 5
fitflops sale
michael kors outlet online
christian louboutin outlet
fitflops shoes
rolex watches
celine outlet
ferragamo outlet
michael kors outlet
salomon shoes
louis vuitton outlet
hermes bags
uggs clearance
true religion jeans
canada goose outlet
prada sunglasses
louis vuitton
canada goose jackets
coach outlet online
michael kors outlet store
cheap nhl jerseys
michael kors wallet
ralph lauren uk
michael kors outlet online
hermes belt
beats by dre
ugg boots
rolex watches
tiffany jewellery
the north face jackets
kobe bryant shoes
herve leger outlet
louis vuitton pas cher
ray ban sunglasses
ugg outlet
the north face jacket
cheap ugg boots
nike outlet store
michael kors handbags
longchamp pliage
canada goose
cheap mlb jerseys
canada goose jackets
louis vuitton handbags
juicy couture outlet
michael kors factory outlet
reebok outlet store
ralph lauren pas cher
nike outlet store
true religion outlet
louis vuitton
nfl jerseys wholesale
michael kors outlet online
longchamp handbags
cazal sunglasses
cheap nba jerseys
chaussure louboutin
the north face jacket
michael kors factory outlet
swarovski crystal
oakley sunglasses
true religion outlet
ugg boots
toms shoes
cartier watches
ray ban sunglasses
michael kors handbags
oakley sunglasses
gucci outlet
ralph lauren uk
true religion jeans
coach outlet store
cheap mlb jerseys
michael kors outlet clearance
hollister canada
ralph lauren polo shirts

回复

使用道具 举报

0

主题

0

好友

121

积分

注册会员

Rank: 2

贡献
28
金钱
36
威望
28
买家信用
卖家信用
积分
121
发表于 2017-1-2 20:46:51 |显示全部楼层
nike store
Burberry Factory Outlet
michael kors purses
michael kors outlet online
pandora bracelets
nike australia
coach factory
mk outlet
Chanel bags Outlet
pandora uk
Nike Air Jordan
michael kors bags outlet
Lebron 13
chanel australia
michael kors black friday
ray ban new wayfarer
kate spade outlet online
abercrombie us
prada handbags
canada goose sale online
michael kors outlet online
nike outlet
ugg boots
nike shoes
michael kors outlet
Michael Kors Watches Outlet
coach outlet
michael kors
pandora princess ring
chanel tote bag
oakley sunglasses
beats headphones
longchamps
moncler jacket mens
Nike KD 8
coach
balenciaga bag
nike id
pandora charms
longchamp outlet
coach purses
coach outlet store
moncler outlet
balenciaga us
Basketball shoes
hermes bag
prada handbags
nike air huarache
coach outlet
pandora rings
michael kors outlet
michael kors outlet
ray-ban sunglasses
burberry outlet
Prada bags
nike jordan shoes
sheepskin boots
michael kors bags
prada outlet
prada bags
oakley sunglasses
prada outlet online
michael kors outlet
ray ban prescription sunglasses
pandora rings jewelry
coach bags
air jordan shoes
michael kors
Prada Shopper Tote
coach outlet
nike huarache shoes
shoes sale
Nike Lebron Shoes
adidas australia
ugg slippers
sac longchamp
ugg uk
mk handbags
ate spade handbags
Longchamp Bags
coach outlet
moncler jacket
Burberry Outlet
oakley sunglasses
Mizuno Running Shoes
pandora uk
ray ban outlet
Oakley Holbrook
oakley frogskins
Bed and Breakfast in chesterfield
sheepskin boots for women
coach australia
nike shoes
Mizuno Wave
asics shoes
tiffany co
moncler coats
Nike Kobe 9
kate spade bags
true religion
mlb shop
ray ban polarized
Coach Outlet Store
abercrombie outlet
coach carter
ralph lauren shirts
kate spade
kate spade outlet online
abercrombie outlet
ray ban sunglasses
Michael Kors Outlet
Nike Air Jordan
prada outlet online
Prada Factory Outlet
michael kors
nike shox
canada goose jacket
Jordan retro
abssice 360
coach outlet
lzm1.2
回复

使用道具 举报

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

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

GMT+8, 2017-2-23 01:42 , Processed in 0.045615 second(s), 12 queries , Apc On.

Powered by Discuz! X2.5 Licensed

© 2001-2012 Comsenz Inc. | Style by Coxxs

回顶部