summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2015-04-25 23:16:49 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-25 23:16:49 +0000
commitb31c3a5a453cd9f472698068af9909e80a96ab2c (patch)
tree9a6f9833881d53c9b19833ad092b1c18fba5d51d
parent6b6df1733711ace006e0f4f9d44c718f85d2f70d (diff)
parent178299fd459b7622e9e3de05a48d6ba050f92bec (diff)
downloadsystem_core-b31c3a5a453cd9f472698068af9909e80a96ab2c.zip
system_core-b31c3a5a453cd9f472698068af9909e80a96ab2c.tar.gz
system_core-b31c3a5a453cd9f472698068af9909e80a96ab2c.tar.bz2
am 178299fd: Merge "init: don\'t double mount /proc and /sys"
* commit '178299fd459b7622e9e3de05a48d6ba050f92bec': init: don't double mount /proc and /sys
-rw-r--r--init/init.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/init/init.cpp b/init/init.cpp
index b79da89..f76b599 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -981,14 +981,20 @@ int main(int argc, char** argv) {
add_environment("PATH", _PATH_DEFPATH);
+ bool is_first_stage = (argc == 1) || (strcmp(argv[1], "--second-stage") != 0);
+
// Get the basic filesystem setup we need put together in the initramdisk
// on / and then we'll let the rc file figure out the rest.
+ // TODO: avoid mounting tmpfs twice, once in the first stage, and once in the
+ // second stage.
mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755");
mkdir("/dev/pts", 0755);
mkdir("/dev/socket", 0755);
mount("devpts", "/dev/pts", "devpts", 0, NULL);
- mount("proc", "/proc", "proc", 0, NULL);
- mount("sysfs", "/sys", "sysfs", 0, NULL);
+ if (is_first_stage) {
+ mount("proc", "/proc", "proc", 0, NULL);
+ mount("sysfs", "/sys", "sysfs", 0, NULL);
+ }
// Indicate that booting is in progress to background fw loaders, etc.
close(open("/dev/.booting", O_WRONLY | O_CREAT | O_CLOEXEC, 0000));
@@ -1001,7 +1007,6 @@ int main(int argc, char** argv) {
klog_init();
klog_set_level(KLOG_NOTICE_LEVEL);
- bool is_first_stage = (argc == 1) || (strcmp(argv[1], "--second-stage") != 0);
NOTICE("init%s started!\n", is_first_stage ? "" : " second stage");
property_init();