1.FirstStageMain
//android10\system\core\init\first_stage_init.cpp
int FirstStageMain(int argc, char** argv) {
const char* path = "/system/bin/init";
const char* args[] = {path, "selinux_setup", nullptr};
execv(path, const_cast<char**>(args));
}
2.main
//android10\system\core\init\main.cpp
int main(int argc, char** argv) {
if (argc > 1) {
if (!strcmp(argv[1], "selinux_setup")) {
return SetupSelinux(argv);
}
}
}
3.SetupSelinux
//android10\system\core\init\selinux.cpp
int SetupSelinux(char** argv) {
InitKernelLogging(argv); //为啥调用多次
// Set up SELinux, loading the SELinux policy.
SelinuxSetupKernelLogging();
SelinuxInitialize();
const char* path = "/system/bin/init";
const char* args[] = {path, "second_stage", nullptr};//4.second_stage
execv(path, const_cast<char**>(args));
}
文章来源地址https://www.toymoban.com/news/detail-813550.html
文章来源:https://www.toymoban.com/news/detail-813550.html
到了这里,关于android系列-init SetupSelinux的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!