从Android的init.rc执行静态程序 [英] executing static program from android init.rc

查看:538
本文介绍了从Android的init.rc执行静态程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图黑客华硕TF201的引导过程。结果
我要开始在init进程的自定义程序。结果
我编这个程序静态地从我启动了Android的股票ROM运行良好。

i'm trying to hacking the boot process of the asus TF201.
i want to start a custom program in the init process.
i compiled this program statically that run fine from my booted up android stock rom.

从Android init.rc文档我读了 EXEC 命令是我需要的。结果
BTW我所能的dmesg看到的是,我与code程序退出-1(我不能返回)

from the android init.rc docs i read that the exec command is what i need.
BTW all i can see in dmesg is that my program exit with code -1 ( i can't return that )

init.rc段

on post-fs-data
write /dev/kmsg "launching test"
exec /data/test

所有我的dmesg看到的是这个...

all i see in dmesg is this...

<4>[    6.336816] launching test
<6>[    6.336902] init: command 'write' r=0
<6>[    6.337115] init: command 'exec' r=-1

在这里你是一个可执行源代码code: http://pastebin.com/Hym1APWx

在前进,结果谢谢
tux_mind。

thanks in advance,
tux_mind.

------ UPDATE ------结果
我试图静态编译并运行此程序:结果
INT的main(){返回0; } 结果
但结果始终是命令'EXEC'R = -1 。结果
也许用户的 uselen 是正确的,也许我不能运行/在早期引导阶段数据的可执行文件。

------UPDATE------
i tried to statically compile and run this program:
int main(){return 0; }
but the result is always command 'exec' r=-1.
maybe user uselen are right, maybe i cannot run executables from /data in the early-boot phase.

推荐答案

基督教说,它看起来象exec甚至没有实现。我开始想很多的记载为init.rc功能都没有实现。这里有一个方法可以让你的程序却推出。

As christian said, it looks like exec isn't even implemented. I'm beginning to think that a lot of features documented for init.rc aren't implemented. Here's a way you can get your program to launch however.

而不是运行它作为一个执行命令,设置此作为一种服务,而不是

Instead of running this as an "exec" command, set this up as a service instead.

在您的init.rc,或将其包含另一个文件:

In your init.rc, or another file included by it:

service my_service /data/test
    class main
    oneshot 

如果这是在课堂上主要的,而不是禁止,应该/数据安装后运行。

If it's in class main, and not disabled, it should run after /data is mounted.

这篇关于从Android的init.rc执行静态程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆