2009-03-04 04:32:55 +01:00
|
|
|
# Copyright 2005 The Android Open Source Project
|
|
|
|
|
|
|
|
LOCAL_PATH:= $(call my-dir)
|
|
|
|
|
2019-03-20 01:01:09 +01:00
|
|
|
-include system/sepolicy/policy_version.mk
|
2019-02-15 21:13:38 +01:00
|
|
|
|
2015-02-04 23:46:36 +01:00
|
|
|
# --
|
|
|
|
|
|
|
|
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
|
2017-03-10 23:46:38 +01:00
|
|
|
init_options += \
|
|
|
|
-DALLOW_LOCAL_PROP_OVERRIDE=1 \
|
|
|
|
-DALLOW_PERMISSIVE_SELINUX=1 \
|
2017-03-28 22:07:15 +02:00
|
|
|
-DREBOOT_BOOTLOADER_ON_PANIC=1 \
|
2017-03-29 21:54:40 +02:00
|
|
|
-DWORLD_WRITABLE_KMSG=1 \
|
|
|
|
-DDUMP_ON_UMOUNT_FAILURE=1
|
2015-02-04 23:46:36 +01:00
|
|
|
else
|
2017-03-10 23:46:38 +01:00
|
|
|
init_options += \
|
|
|
|
-DALLOW_LOCAL_PROP_OVERRIDE=0 \
|
|
|
|
-DALLOW_PERMISSIVE_SELINUX=0 \
|
2017-03-28 22:07:15 +02:00
|
|
|
-DREBOOT_BOOTLOADER_ON_PANIC=0 \
|
2017-03-29 21:54:40 +02:00
|
|
|
-DWORLD_WRITABLE_KMSG=0 \
|
|
|
|
-DDUMP_ON_UMOUNT_FAILURE=0
|
2015-02-04 23:46:36 +01:00
|
|
|
endif
|
|
|
|
|
2017-03-28 18:41:36 +02:00
|
|
|
ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
|
|
|
|
init_options += \
|
|
|
|
-DSHUTDOWN_ZERO_TIMEOUT=1
|
|
|
|
else
|
|
|
|
init_options += \
|
|
|
|
-DSHUTDOWN_ZERO_TIMEOUT=0
|
|
|
|
endif
|
|
|
|
|
2019-02-15 21:13:38 +01:00
|
|
|
init_options += -DLOG_UEVENTS=0 \
|
|
|
|
-DSEPOLICY_VERSION=$(POLICYVERS)
|
2015-02-06 21:19:48 +01:00
|
|
|
|
|
|
|
init_cflags += \
|
|
|
|
$(init_options) \
|
|
|
|
-Wall -Wextra \
|
|
|
|
-Wno-unused-parameter \
|
|
|
|
-Werror \
|
2015-02-04 23:46:36 +01:00
|
|
|
|
|
|
|
# --
|
|
|
|
|
2018-11-06 23:12:05 +01:00
|
|
|
# Do not build this even with mmma if we're system-as-root, otherwise it will overwrite the symlink.
|
|
|
|
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
|
2015-02-06 21:19:48 +01:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_CPPFLAGS := $(init_cflags)
|
2018-07-20 23:57:00 +02:00
|
|
|
LOCAL_SRC_FILES := \
|
|
|
|
devices.cpp \
|
2018-11-06 23:12:05 +01:00
|
|
|
first_stage_init.cpp \
|
|
|
|
first_stage_main.cpp \
|
2018-07-20 23:57:00 +02:00
|
|
|
first_stage_mount.cpp \
|
Proper mount namespace configuration for bionic
This CL fixes the design problem of the previous mechanism for providing
the bootstrap bionic and the runtime bionic to the same path.
Previously, bootstrap bionic was self-bind-mounted; i.e.
/system/bin/libc.so is bind-mounted to itself. And the runtime bionic
was bind-mounted on top of the bootstrap bionic. This has not only caused
problems like `adb sync` not working(b/122737045), but also is quite
difficult to understand due to the double-and-self mounting.
This is the new design:
Most importantly, these four are all distinct:
1) bootstrap bionic (/system/lib/bootstrap/libc.so)
2) runtime bionic (/apex/com.android.runtime/lib/bionic/libc.so)
3) mount point for 1) and 2) (/bionic/lib/libc.so)
4) symlink for 3) (/system/lib/libc.so -> /bionic/lib/libc.so)
Inside the mount namespace of the pre-apexd processes, 1) is
bind-mounted to 3). Likewise, inside the mount namespace of the
post-apexd processes, 2) is bind-mounted to 3). In other words, there is
no self-mount, and no double-mount.
Another change is that mount points are under /bionic and the legacy
paths become symlinks to the mount points. This is to make sure that
there is no bind mounts under /system, which is breaking some apps.
Finally, code for creating mount namespaces, mounting bionic, etc are
refactored to mount_namespace.cpp
Bug: 120266448
Bug: 123275379
Test: m, device boots, adb sync/push/pull works,
especially with following paths:
/bionic/lib64/libc.so
/bionic/bin/linker64
/system/lib64/bootstrap/libc.so
/system/bin/bootstrap/linker64
Change-Id: Icdfbdcc1efca540ac854d4df79e07ee61fca559f
2019-01-16 15:00:59 +01:00
|
|
|
mount_namespace.cpp \
|
2018-07-20 23:57:00 +02:00
|
|
|
reboot_utils.cpp \
|
|
|
|
selinux.cpp \
|
2018-08-07 19:22:01 +02:00
|
|
|
switch_root.cpp \
|
2018-07-20 23:57:00 +02:00
|
|
|
uevent_listener.cpp \
|
|
|
|
util.cpp \
|
2015-02-04 02:12:07 +01:00
|
|
|
|
2018-10-16 02:47:16 +02:00
|
|
|
LOCAL_MODULE := init_first_stage
|
|
|
|
LOCAL_MODULE_STEM := init
|
2018-07-20 23:57:00 +02:00
|
|
|
|
|
|
|
LOCAL_FORCE_STATIC_EXECUTABLE := true
|
2015-05-08 17:30:33 +02:00
|
|
|
|
2018-08-07 19:22:01 +02:00
|
|
|
LOCAL_MODULE_PATH := $(TARGET_RAMDISK_OUT)
|
|
|
|
LOCAL_UNSTRIPPED_PATH := $(TARGET_RAMDISK_OUT_UNSTRIPPED)
|
|
|
|
|
2019-04-19 16:08:56 +02:00
|
|
|
# Install adb_debug.prop into debug ramdisk.
|
|
|
|
# This allows adb root on a user build, when debug ramdisk is used.
|
|
|
|
LOCAL_REQUIRED_MODULES := \
|
|
|
|
adb_debug.prop \
|
|
|
|
|
2018-08-07 19:22:01 +02:00
|
|
|
# Set up the same mount points on the ramdisk that system-as-root contains.
|
2019-03-07 02:53:23 +01:00
|
|
|
LOCAL_POST_INSTALL_CMD := mkdir -p \
|
|
|
|
$(TARGET_RAMDISK_OUT)/apex \
|
2019-04-11 17:57:24 +02:00
|
|
|
$(TARGET_RAMDISK_OUT)/debug_ramdisk \
|
2019-03-07 02:53:23 +01:00
|
|
|
$(TARGET_RAMDISK_OUT)/dev \
|
2018-09-17 23:20:16 +02:00
|
|
|
$(TARGET_RAMDISK_OUT)/mnt \
|
|
|
|
$(TARGET_RAMDISK_OUT)/proc \
|
|
|
|
$(TARGET_RAMDISK_OUT)/sys \
|
2009-03-04 04:32:55 +01:00
|
|
|
|
2012-10-17 08:07:05 +02:00
|
|
|
LOCAL_STATIC_LIBRARIES := \
|
2019-04-11 17:57:24 +02:00
|
|
|
libc++fs \
|
2018-11-26 10:49:23 +01:00
|
|
|
libfs_avb \
|
2015-02-06 21:19:48 +01:00
|
|
|
libfs_mgr \
|
2015-05-22 16:43:50 +02:00
|
|
|
libfec \
|
|
|
|
libfec_rs \
|
2015-04-09 02:59:19 +02:00
|
|
|
libsquashfs_utils \
|
2015-02-06 21:19:48 +01:00
|
|
|
liblogwrap \
|
2017-01-11 23:03:11 +01:00
|
|
|
libext4_utils \
|
2018-10-23 22:10:33 +02:00
|
|
|
libfscrypt \
|
2017-07-18 00:14:02 +02:00
|
|
|
libseccomp_policy \
|
2016-08-06 00:47:57 +02:00
|
|
|
libcrypto_utils \
|
2017-01-11 23:37:50 +01:00
|
|
|
libsparse \
|
2017-05-10 02:09:06 +02:00
|
|
|
libavb \
|
|
|
|
libkeyutils \
|
2018-07-28 01:05:31 +02:00
|
|
|
liblp \
|
2018-06-01 12:26:42 +02:00
|
|
|
libcutils \
|
|
|
|
libbase \
|
|
|
|
liblog \
|
|
|
|
libcrypto \
|
|
|
|
libdl \
|
|
|
|
libz \
|
2018-06-19 09:55:05 +02:00
|
|
|
libselinux \
|
2018-07-20 23:57:00 +02:00
|
|
|
libcap \
|
2019-01-04 03:16:56 +01:00
|
|
|
libgsi \
|
2019-02-25 14:18:37 +01:00
|
|
|
libcom.android.sysprop.apex \
|
2018-06-01 12:26:42 +02:00
|
|
|
|
2017-07-26 23:17:09 +02:00
|
|
|
LOCAL_SANITIZE := signed-integer-overflow
|
2018-11-01 21:38:38 +01:00
|
|
|
# First stage init is weird: it may start without stdout/stderr, and no /proc.
|
|
|
|
LOCAL_NOSANITIZE := hwaddress
|
2009-03-04 04:32:55 +01:00
|
|
|
include $(BUILD_EXECUTABLE)
|
2018-11-06 23:12:05 +01:00
|
|
|
endif
|
2018-10-16 02:47:16 +02:00
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := init_system
|
|
|
|
LOCAL_REQUIRED_MODULES := \
|
|
|
|
init_second_stage \
|
|
|
|
|
|
|
|
include $(BUILD_PHONY_PACKAGE)
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := init_vendor
|
|
|
|
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
|
|
|
|
LOCAL_REQUIRED_MODULES := \
|
|
|
|
init_first_stage \
|
|
|
|
|
|
|
|
endif
|
|
|
|
include $(BUILD_PHONY_PACKAGE)
|