Merge "Fix log for early_mount"
This commit is contained in:
commit
fff1669341
1 changed files with 27 additions and 20 deletions
|
|
@ -588,16 +588,38 @@ int main(int argc, char** argv) {
|
||||||
mount("sysfs", "/sys", "sysfs", 0, NULL);
|
mount("sysfs", "/sys", "sysfs", 0, NULL);
|
||||||
mount("selinuxfs", "/sys/fs/selinux", "selinuxfs", 0, NULL);
|
mount("selinuxfs", "/sys/fs/selinux", "selinuxfs", 0, NULL);
|
||||||
mknod("/dev/kmsg", S_IFCHR | 0600, makedev(1, 11));
|
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
|
// Now that tmpfs is mounted on /dev and we have /dev/kmsg, we can actually
|
||||||
// talk to the outside world...
|
// talk to the outside world...
|
||||||
InitKernelLogging(argv);
|
InitKernelLogging(argv);
|
||||||
|
|
||||||
LOG(INFO) << "init " << (is_first_stage ? "first stage" : "second stage") << " started!";
|
if (is_first_stage) {
|
||||||
|
LOG(INFO) << "init first stage started!";
|
||||||
|
|
||||||
|
// 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(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 (restorecon("/init") == -1) {
|
||||||
|
PLOG(ERROR) << "restorecon failed";
|
||||||
|
security_failure();
|
||||||
|
}
|
||||||
|
char* path = argv[0];
|
||||||
|
char* args[] = { path, const_cast<char*>("--second-stage"), nullptr };
|
||||||
|
if (execv(path, args) == -1) {
|
||||||
|
PLOG(ERROR) << "execv(\"" << path << "\") failed";
|
||||||
|
security_failure();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
LOG(INFO) << "init second stage started!";
|
||||||
|
|
||||||
if (!is_first_stage) {
|
|
||||||
// Indicate that booting is in progress to background fw loaders, etc.
|
// Indicate that booting is in progress to background fw loaders, etc.
|
||||||
close(open("/dev/.booting", O_WRONLY | O_CREAT | O_CLOEXEC, 0000));
|
close(open("/dev/.booting", O_WRONLY | O_CREAT | O_CLOEXEC, 0000));
|
||||||
|
|
||||||
|
|
@ -611,24 +633,9 @@ int main(int argc, char** argv) {
|
||||||
// Propagate the kernel variables to internal variables
|
// Propagate the kernel variables to internal variables
|
||||||
// used by init as well as the current required properties.
|
// used by init as well as the current required properties.
|
||||||
export_kernel_boot_props();
|
export_kernel_boot_props();
|
||||||
}
|
|
||||||
|
|
||||||
// Set up SELinux, including loading the SELinux policy if we're in the kernel domain.
|
// Now set up SELinux for second stage
|
||||||
selinux_initialize(is_first_stage);
|
selinux_initialize(false);
|
||||||
|
|
||||||
// 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();
|
|
||||||
}
|
|
||||||
char* path = argv[0];
|
|
||||||
char* args[] = { path, const_cast<char*>("--second-stage"), nullptr };
|
|
||||||
if (execv(path, args) == -1) {
|
|
||||||
PLOG(ERROR) << "execv(\"" << path << "\") failed";
|
|
||||||
security_failure();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// These directories were necessarily created before initial policy load
|
// These directories were necessarily created before initial policy load
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue