Loading init/init.cpp +27 −20 Original line number Diff line number Diff line Loading @@ -588,37 +588,24 @@ int main(int argc, char** argv) { mount("sysfs", "/sys", "sysfs", 0, NULL); mount("selinuxfs", "/sys/fs/selinux", "selinuxfs", 0, NULL); mknod("/dev/kmsg", S_IFCHR | 0600, makedev(1, 11)); early_mount(); } // Now that tmpfs is mounted on /dev and we have /dev/kmsg, we can actually // talk to the outside world... InitKernelLogging(argv); LOG(INFO) << "init " << (is_first_stage ? "first stage" : "second stage") << " started!"; if (!is_first_stage) { // Indicate that booting is in progress to background fw loaders, etc. close(open("/dev/.booting", O_WRONLY | O_CREAT | O_CLOEXEC, 0000)); property_init(); // If arguments are passed both on the command line and in DT, // properties set in DT always have priority over the command-line ones. process_kernel_dt(); process_kernel_cmdline(); if (is_first_stage) { LOG(INFO) << "init first stage started!"; // Propagate the kernel variables to internal variables // used by init as well as the current required properties. export_kernel_boot_props(); } // Mount devices defined in android.early.* kernel commandline early_mount(); // Set up SELinux, including loading the SELinux policy if we're in the kernel domain. selinux_initialize(is_first_stage); selinux_initialize(true); // If we're in the kernel domain, re-exec init to transition to the init domain now // that the SELinux policy has been loaded. if (is_first_stage) { if (restorecon("/init") == -1) { PLOG(ERROR) << "restorecon failed"; security_failure(); Loading @@ -629,6 +616,26 @@ int main(int argc, char** argv) { PLOG(ERROR) << "execv(\"" << path << "\") failed"; security_failure(); } } else { LOG(INFO) << "init second stage started!"; // Indicate that booting is in progress to background fw loaders, etc. close(open("/dev/.booting", O_WRONLY | O_CREAT | O_CLOEXEC, 0000)); property_init(); // If arguments are passed both on the command line and in DT, // properties set in DT always have priority over the command-line ones. process_kernel_dt(); process_kernel_cmdline(); // Propagate the kernel variables to internal variables // used by init as well as the current required properties. export_kernel_boot_props(); // Now set up SELinux for second stage selinux_initialize(false); } // These directories were necessarily created before initial policy load Loading Loading
init/init.cpp +27 −20 Original line number Diff line number Diff line Loading @@ -588,37 +588,24 @@ int main(int argc, char** argv) { mount("sysfs", "/sys", "sysfs", 0, NULL); mount("selinuxfs", "/sys/fs/selinux", "selinuxfs", 0, NULL); mknod("/dev/kmsg", S_IFCHR | 0600, makedev(1, 11)); early_mount(); } // Now that tmpfs is mounted on /dev and we have /dev/kmsg, we can actually // talk to the outside world... InitKernelLogging(argv); LOG(INFO) << "init " << (is_first_stage ? "first stage" : "second stage") << " started!"; if (!is_first_stage) { // Indicate that booting is in progress to background fw loaders, etc. close(open("/dev/.booting", O_WRONLY | O_CREAT | O_CLOEXEC, 0000)); property_init(); // If arguments are passed both on the command line and in DT, // properties set in DT always have priority over the command-line ones. process_kernel_dt(); process_kernel_cmdline(); if (is_first_stage) { LOG(INFO) << "init first stage started!"; // Propagate the kernel variables to internal variables // used by init as well as the current required properties. export_kernel_boot_props(); } // Mount devices defined in android.early.* kernel commandline early_mount(); // Set up SELinux, including loading the SELinux policy if we're in the kernel domain. selinux_initialize(is_first_stage); selinux_initialize(true); // If we're in the kernel domain, re-exec init to transition to the init domain now // that the SELinux policy has been loaded. if (is_first_stage) { if (restorecon("/init") == -1) { PLOG(ERROR) << "restorecon failed"; security_failure(); Loading @@ -629,6 +616,26 @@ int main(int argc, char** argv) { PLOG(ERROR) << "execv(\"" << path << "\") failed"; security_failure(); } } else { LOG(INFO) << "init second stage started!"; // Indicate that booting is in progress to background fw loaders, etc. close(open("/dev/.booting", O_WRONLY | O_CREAT | O_CLOEXEC, 0000)); property_init(); // If arguments are passed both on the command line and in DT, // properties set in DT always have priority over the command-line ones. process_kernel_dt(); process_kernel_cmdline(); // Propagate the kernel variables to internal variables // used by init as well as the current required properties. export_kernel_boot_props(); // Now set up SELinux for second stage selinux_initialize(false); } // These directories were necessarily created before initial policy load Loading