In system.img and data.img, we can find directory and files have their own UID/GID, and also access permission.
but in Android build environment, they have not been given the configuration.
In fact, these modification are done by mkyaffs2image tool. In yaffs source code, we can get the real process.
1. Pre-condition.
while we use mkyaffs2image tool to generate yaffs2 file system, there are two pre-condition.
a. we need use '-f' flags as mkyaffs2image boot option.
In /external/yaffs2/yaffs2/utils/mkyaffs2image.c.
if we use '-f' option, it will set fixstats flag and do some special process according to this flag.
b. for the folder which will be transfered to yaffs file system, the folder name should be "system" or "data".
2. normal configuration for permission and uid/gid.
for all directory and files, mkyaffs2image tool give them ROOT:ROOT uid and gid. and also re-use access permission according to directory and file's original permission in build environment.
3. special configuration for Android.
if fixstats is set, mkyaffs2image tool will do special configuration for Android.
the process is as below:
In /external/yaffs2/yaffs2/utils/mkyaffs2image.c.
main() -> process_directory() -> fix_stat() -> fs_config() ->
fs_config() function is defined in sysem/core/include/private/android_filesystem_config.h. This function will do special configuration according to android_dirs and android_files data stuctures.
4. about android_dirs and android_files data stuctures.
the defination is in system/core/include/private/android_filesystem_config.h file.
本文介绍使用mkyaffs2image工具为YAFFS2文件系统生成镜像时如何配置文件和目录的权限及所有者。特别关注Android系统中特定文件夹和文件的权限设置。
700

被折叠的 条评论
为什么被折叠?



