Switch root to /system in first stage mount
Bug: 79173823
Bug: 79758715
Test: boot hikey and observe that /system is the new root
Change-Id: I22f58f1332150ebae8e7e24eccfe780ff29eba7f
diff --git a/init/Android.mk b/init/Android.mk
index ada87b8..dc400ad 100644
--- a/init/Android.mk
+++ b/init/Android.mk
@@ -47,6 +47,7 @@
init_first_stage.cpp \
reboot_utils.cpp \
selinux.cpp \
+ switch_root.cpp \
uevent_listener.cpp \
util.cpp \
@@ -54,8 +55,15 @@
LOCAL_FORCE_STATIC_EXECUTABLE := true
-LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
-LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
+LOCAL_MODULE_PATH := $(TARGET_RAMDISK_OUT)
+LOCAL_UNSTRIPPED_PATH := $(TARGET_RAMDISK_OUT_UNSTRIPPED)
+
+# Set up the same mount points on the ramdisk that system-as-root contains.
+LOCAL_POST_INSTALL_CMD := \
+ mkdir -p $(TARGET_RAMDISK_OUT)/dev \
+ mkdir -p $(TARGET_RAMDISK_OUT)/mnt \
+ mkdir -p $(TARGET_RAMDISK_OUT)/proc \
+ mkdir -p $(TARGET_RAMDISK_OUT)/sys \
LOCAL_STATIC_LIBRARIES := \
libfs_mgr \