How to let a20,android boot automatically start C program "Go"

Source: Internet
Author: User

This article was reproduced from: http://blog.csdn.net/u011258134/article/details/50749174

How to let a20,android boot automatically start C program2014-12-26 11:32 557 people read comments (3) favorite reports Classification:C language Learning (Ten)Author of similar articlesX

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Xinit added: xinit/usr/local/bin/xfreerdp 192.168.1.196

1, modify Android/device/init.sun7i.rc

........ Slightly

#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

........ Slightly

2, in device/softwinner/sugar-cubieboard2/new dou.sh file, content:

#! /system/bin/sh

#hello是C编译的文件, is statically compiled, and placed in system/bin/
/system/bin/hello

#or

Hello

echo "Jiangdou"

Exit

3,vi DEVICE/SOFTWINNER/SUGAR-CUBIEBOARD2/SUGAR_CUBIEBOARD2.MK//purpose is to perform make-j48 copy to out/target/product/ sugar-cubieboard2/system/bin/

........ Slightly

#add by Jiangdou
Product_copy_files + = \
Device/softwinner/sugar-cubieboard2/hello:system/bin/hello \
device/softwinner/sugar-cubieboard2/dou.sh:system/bin/dou.sh

........ Slightly

4, boot,, effect

[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]:/#

Prove that the boot is running automatically.

5, C code content,,,, compiled $ arm-linux-androideabi-gcc-o Hello hello.c-static

[HTML] View plainCopy 
  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 Force background Run! Daemon See the following article
  8. for (i = 0; I < ; i++)
  9. while (1)
  10. {
  11. Sleep (1);
  12. printf ("Hello......by jiangdou\n");
  13. }
  14. return 0;
  15. }
[HTML]View PlainCopy
  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 Force background Run!
  8. for (i = 0; I < ; i++)
  9. while (1)
  10. {
  11. Sleep (1);
  12. printf ("Hello......by jiangdou\n");
  13. }
  14. return 0;
  15. }



ADB push xxx/system---->error "Readonly-----File System"

adb shell && mount-o remount-o Rw/system

Original posts: http://blog.csdn.net/jiangdou88/article/details/42169263#comments

How to let a20,android boot automatically start C program "Go"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.