转:chmod in init.rc

本文探讨了在Android Eclair 2.1中,如何通过创建脚本和在init.rc文件中调用脚本来解决自定义内核模块在设备节点设置权限的问题。通过实例演示了使用脚本动态设置权限的方法,避免了直接修改核心元素的风险。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Copy自:http://groups.google.com/group/android-porting/browse_thread/thread/b6f1a0a2a153cb9e

问题:

I have added a new kernel module in my Android Eclair 2.1 which is
loaded in init.rc and makes a device node at /dev/mynode.

My problem is about setting the permission of this node:

If I do it by myself: "chmod 0777 /dev/mynode" the rights will be set,
till next reboot - but if I do this in init.rc it changes nothing?!

I also tried some kind of hack with service:
service setPermission /system/bin/chmod 0777 /dev/mynode
    oneshot

The same result --> no effect...

I don't wanna make to deeply changes, like in core elements at "system/
core/init/devices.c" ...

Any ideas for solving this bug?

解决:

create a script somewhere, for example, /system/bin/mymod.rc
#!/system/bin/sh
   chmod 0777 /dev/mynode

- add the following in /init.rc:
  service mymod /system/bin/mymod.rc
    oneshot

转载于:https://www.cnblogs.com/bpasser/archive/2011/10/22/2220921.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值