PLOG(ERROR) << "execv(\"" << path << "\") failed"; security_failure(); } // At this point we're in the second stage of init. InitKernelLogging(argv); LOG(INFO) << "init second stage started!"; // Set up a session keyring that all processes will have access to. It //...
整体代码: system/core/init/init.cpp int SecondStageMain(int argc, char** argv) { if (REBOOT_BOOTLOADER_ON_PANIC) { InstallRebootSignalHandlers(); } SetStdioToDevNull(argv); InitKernelLogging(argv); LOG(INFO) << "init second stage started!"; // Set init and its forked children's oom...
unsetenv(kEnvSelinuxStartedAt);if(selinux_start_time_ns ==-1)return;if(first_stage_start_time_ns ==-1)return; SetProperty("ro.boottime.init.first_stage",std::to_string(selinux_start_time_ns - first_stage_start_time_ns)); SetProperty("ro.boottime.init.selinux",std::to_string(sec...
FirstStage 挂载一些基础文件系统和加载内核模块等 selinux_setup 执行selinux的初始化 SecondStage 挂载其他文件系统,启动属性服务,执行boot流程等,主要逻辑都在这里实现/// @system/core/init/main.cpp int main(int argc, char** argv) { #if __has_feature(address_sanitizer) __asan_set_error_report_call...
InitKernelLogging(argv); LOG(INFO) << "init second stage started!"; ... //创建一块共享的内存空间,用于属性服务【见小节5.1】 property_init(); ... //初始化epoll功能 epoll_fd = epoll_create1(EPOLL_CLOEXEC); if (epoll_fd == -1) { PLOG(FATAL) << "epoll_create1 failed"; } //初...
LOG(INFO) <<"init second stage started!"; // Update $PATH in the case the second stage init is newer than first stage init, where it is // first set. if(setenv("PATH", _PATH_DEFPATH, 1) != 0) { PLOG(FATAL) <<"Could not set $PATH to '"<< _PATH_DEFPATH <<"' in sec...
//这个lambda函数被赋值给trigger_shutdown变量 trigger_shutdown = [](const std::string& command) { shutdown_state.TriggerShutdown(command); }; SetStdioToDevNull(argv); InitKernelLogging(argv); LOG(INFO) << "init second stage started!"; SelinuxSetupKernelLogging(); // Update $PATH in ...
LOG(INFO) <<"init first stage started!";autoold_root_dir =std::unique_ptr<DIR, decltype(&closedir)>{opendir("/"), closedir};if(!old_root_dir) { PLOG(ERROR) <<"Could not opendir(\"/\"), not freeing ramdisk"; }structstatold_root_info;if(stat("/", &old_root_info) !=0) ...
count() / 1000.0f << " seconds"; } void NotifyPropertyChange(const std::string& name, const std::string& value) { // If init hasn't started its main loop, then it won't be handling property changed messages // anyway, so there's no need to try to send them. auto lock = ...
(1)ueventd_main init进程创建子进程ueventd,* 并将创建设备节点文件的工作托付给ueventd,ueventd通过两种方式创建设备节点文件* (2)FirstStageMain 启动第一阶段* (3)SetupSelinux 加载selinux规则,并设置selinux日志,完成SELinux相关工作* (4)SecondStageMain 启动第二阶段*/intmain(intargc,char**argv){//当...