在system.img和data.img,我们发现目录和文件有自己的UID/GID及相应的访问权限
但在Android的编译环境中,这些目录和文件目录并没有对此有相应的配置。
事实上,这些修改是有mkyaffs2image工具完成的。分析mkyaffs2image.c源代码,其过程如下:1. 预制条件. 当我们使用 mkyaffs2image 工具生成yaffs2文件系统时,这里有两个预制条件:
a. 使用'-f'标志
/external/yaffs2/yaffs2/utils/mkyaffs2image.c.
如果'-f',代码中fixstats标志会被设置,一些特殊操作将会根据标志来操作
??????? if (strcmp(argv[1], "-f") == 0) {
??????????? fixstats = 1;
??????????? argc--;
??????????? argv++;
??????? }b. 输入的文件夹的名字必须是"data"或者"system"
??? if (fixstats) {
??????? int len = strlen(argv[1]);
???????
??????? if((len >= 4) && (!strcmp(argv[1] + len - 4, "data"))) {
??????????? source_path_len = len - 4;
??????? } else if((len >= 7) && (!strcmp(argv[1] + len - 6, "system"))) {
??????????? source_path_len = len - 6;
??????? } else {???????????
??????????? fprintf(stderr,"Fixstats (-f) option requested but filesystem is not data or android!\n");
??????????? exit(1);
??????? }
??????? fix_stat(argv[1], &stats);
??? }2. 正常配置:访问权限、UID/GID.
mkyaffs2image 给所有的目录和文件uid:gid/ROOT:ROOT,使用在编译环境中得到原始的访问权限3. Android特殊的配置如果fixstats标志被设置了,mkyaffs2image 将会做一些特殊的配置用于Android操作系统 /external/yaffs2/yaffs2/utils/mkyaffs2image.c.
main() -> process_directory() -> fix_stat() -> fs_config() -> fs_config() 定义在 sysem/core/include/private/android_filesystem_config.h.
该函数根据android_dirs和android_files数据结构做Android相关的配置4. android_dirs和android_files数据结构定义在system/core/include/private/android_filesystem_config.h文件中:static struct fs_path_config android_dirs[] = {
??? { 00770, AID_SYSTEM, AID_CACHE,? "cache" },
??? { 00771, AID_SYSTEM, AID_SYSTEM, "data/app" },
??? { 00771, AID_SYSTEM, AID_SYSTEM, "data/app-private" },
??? { 00771, AID_SYSTEM, AID_SYSTEM, "data/dalvik-cache" },
??? { 00771, AID_SYSTEM, AID_SYSTEM, "data/data" },
??? { 00771, AID_SHELL,? AID_SHELL,? "data/local/tmp" },
??? { 00771, AID_SHELL,? AID_SHELL,? "data/local" },
??? { 01771, AID_SYSTEM, AID_MISC,?? "data/misc" },
??? { 00770, AID_DHCP,?? AID_DHCP,?? "data/misc/dhcp" },
??? { 00771, AID_SYSTEM, AID_SYSTEM, "data" },
??? { 00750, AID_ROOT,?? AID_SHELL,? "sbin" },
??? { 00755, AID_ROOT,?? AID_SHELL,? "system/bin" },
??? { 00755, AID_ROOT,?? AID_SHELL,? "system/xbin" },
??? { 00755, AID_ROOT,?? AID_ROOT,?? "system/etc/ppp" },
??? { 00777, AID_ROOT,?? AID_ROOT,?? "sdcard" },
??? { 00755, AID_SYSTEM, AID_SYSTEM, "system/midletbox" },
??? { 00777, AID_SYSTEM, AID_SYSTEM, "system/bin/midletvm" },
??? { 00755, AID_ROOT,?? AID_ROOT,?? 0 },
};
static struct fs_path_config android_files[] = {
??? { 00440, AID_ROOT,????? AID_SHELL,???? "system/etc/init.goldfish.rc" },
??? { 00550, AID_ROOT,????? AID_SHELL,???? "system/etc/init.goldfish.sh" },
??? { 00440, AID_ROOT,????? AID_SHELL,???? "system/etc/init.trout.rc" },
??? { 00550, AID_ROOT,????? AID_SHELL,???? "system/etc/init.ril" },
??? { 00550, AID_ROOT,????? AID_SHELL,???? "system/etc/init.testmenu" },
??? { 00550, AID_DHCP,????? AID_SHELL,???? "system/etc/dhcpcd/dhcpcd-run-hooks" },
??? { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/dbus.conf" },
??? { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluez/main.conf" },
??? { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluez/input.conf" },
??? { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluez/audio.conf" },
??? { 00444, AID_RADIO,???? AID_AUDIO,???? "system/etc/AudioPara4.csv" },
??? { 00555, AID_ROOT,????? AID_ROOT,????? "system/etc/ppp
??? { 02755, AID_ROOT,????? AID_NET_RAW,?? "system/bin/ping" },
??? { 02755, AID_ROOT,????? AID_INET,????? "system/bin/netcfg" },
?? ??? ?
??? { 06755, AID_ROOT,????? AID_ROOT,????? "system/xbin/su" },
??? { 06755, AID_ROOT,????? AID_ROOT,????? "system/xbin/librank" },
??? { 06755, AID_ROOT,????? AID_ROOT,????? "system/xbin/procrank" },
??? { 06755, AID_ROOT,????? AID_ROOT,????? "system/xbin/procmem" },
??? { 06755, AID_ROOT,????? AID_ROOT,????? "system/xbin/tcpdump" },
??? { 04755, AID_ROOT,????? AID_ROOT,????? "system/bin/fota" },
??? { 00755, AID_ROOT,????? AID_SHELL,???? "system/bin/*" },
??? { 00755, AID_ROOT,????? AID_SHELL,???? "system/xbin/*" },
??? { 00750, AID_ROOT,????? AID_SHELL,???? "sbin/*" },
??? { 00755, AID_ROOT,????? AID_ROOT,????? "bin/*" },
??? { 00750, AID_ROOT,????? AID_SHELL,???? "init*" },
??? { 00644, AID_ROOT,????? AID_ROOT,?????? 0 },
};
详细解决方案
android- 起动文件权限
热度:23 发布时间:2016-05-01 15:40:17.0
相关解决方案
- android 读取byte[]中的元素解决方案
- android 标题栏兑现方式
- android 中Activity向BroadcastReceiver发送数据,该怎么解决
- Android 4.0 为什么模拟器老是提示小弟我谷歌拼音输入法已停止
- android:getSharedPreferences() 这是哪个类的方法解决思路
- android 怎么判断一个程序是否联网
- android 大量数据按周分组,该如何解决
- android RadioButton如何设置默认选中
- ksoap2-android-这个包,连接webService怎么设置超时
- android 怎么重新设置锚点
- android UI界面设计解决方案
- android 图片对象获取的有关问题
- android 怎么调用淘宝支付宝接口
- Android 沿袭InputMethodService自定义输入法
- android 关于服务连接的疑义
- android 两个activity如何通信
- android 怎么实现对view的放大和缩小
- android 教程解决方法
- android ID,该如何处理
- 准备复习2-3个月,看java+android,请问有经验者,怎么看效果最好》
- android UI线程与AsyncTask的有关问题
- android(java)中的java.net能不能和c#的system.net.sockets进行tcp通信,该如何解决
- android ListView 中的onItemClick Intent 没法跳转
- android(java) 中文乱码的有关问题
- c#c++,android,ios(iphone),php,java视屏课程 散分
- android Post文件到ASP.NET的有关问题,能收到参数收不到文件
- RIM 替 Android 开发者提供免费的 PlayBook!2月13日前
- android 动态设立控件高度
- Android test project 编译方法
- android -相机使用教程(1)解决方法