--- //设定环境变量 add_environment("PATH", _PATH_DEFPATH); bool is_first_stage = (getenv("INIT_SECOND_STAGE") == nullptr); //判断是否是第一次 if (is_first_stage) { boot_clock::time_point start_time = boot_clock::now(); // Clear the umask. // 清楚权限掩码 umask(0); //-...
first_stage_init.cpp :353挂载设备树下的描述的文件系统,默认位置为/proc/device-tree/firmware/android/fstab 挂载完成后vfs根节点可能会被替换,如果替换了,则释放原先的ramfs。 设置环境变量FIRST_STAGE_STARTED_AT,这样后面的进程就可以知道first stage完成的时间。 :375:376重定向输出流到/dev/kmsg下,重新启动in...
简介: AVB源码学习(三):AVB2.0 Init阶段安全启动流程 一、Init中哪个阶段校验及校验哪些分区? 在引导boot kernel后进入init,主要是在init的first stage(第一阶段)进行AVB校验的。在android需要挂载的分区挂载前执行校验。 需要校验的分区是在fstab中配置的,详细配置请查看AVB编译配置 二、Init代码分析 1、FirstStage...
init进程第一阶段主要进行挂载分区、创建设备节点和一些关键目录、初始化日志输出系统、启用Selinux安全策略。 源码路径:system/core/init/first_stage_init.cpp 挂载了tmpsfs、devpts、proc、sysfs和selinuxfs五种文件系统,这些都是系统运行时目录,系统停止时会消失。 挂载mnt和tmpfs,分别创建vendor和product目录。 代码...
代码如下:system/core/init/first_stage_init.cpp AI检测代码解析 int FirstStageMain(int argc, char** argv) { if (REBOOT_BOOTLOADER_ON_PANIC) { InstallRebootSignalHandlers(); } boot_clock::time_point start_time = boot_clock::now();
ro.boottime.init.first_stage:运行第一阶段所花费的时间(以纳秒为单位)。 ro.boottime.init.selinux:运行SELinux阶段所花费的时间(以纳秒为单位)。 ro.boottime.init.cold_boot_wait:init等待ueventd冷启动阶段结束的时间(以纳秒为单位)。 ro.boottime.:服务首次启动后的时间(以纳秒为单位),使用 CLOCK_BOOTTI...
LOG(INFO) << "init first stage started!"; 1. 2. 3. 4. 5. 6. 意味着,如果我们需要在init进程中输出日志, 只需要调用 LOG(pri)即可。 二,LOG()实现逻辑 在init进程中一般使用LOG()或者PLOG()宏定义来构造一个std::ostringstream 字符串流,将需要打印的数据写入流中, 然后将io流重定向到内核日志...
LOG(INFO)<<"init first stage started!";if(!DoFirstStageMount()) { LOG(ERROR)<<"Failed to mount required partitions early ..."; panic(); } SetInitAvbVersionInRecovery();//Set up SELinux, loading the SELinux policy.selinux_initialize(true);//We're in the kernel domain, so re-exec...
("/dev/.booting", O_WRONLY | O_CREAT | O_CLOEXEC,0000));// See if need to load debug props to allow adb root, when the device is unlocked.// 这个属性会在first_stage_init阶段设置constchar* force_debuggable_env = getenv("INIT_FORCE_DEBUGGABLE");boolload_debug_prop =false;// ...
// 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 second stage"; ...