Completely migrate init first stage to Soong
adb_debug.prop is migrated too. And ramdisk_available is added to all dependencies. Bug: 187196593 Test: boot Change-Id: I59cd149e0021211b8fd59c44b93bbf18dc8637bf
This commit is contained in:
parent
1c998ded12
commit
2e20058069
13 changed files with 62 additions and 164 deletions
|
@ -141,6 +141,7 @@ cc_library {
|
|||
// Do not ever allow this library to be vendor_available as a shared library.
|
||||
// It does not have a stable interface.
|
||||
name: "libfs_mgr",
|
||||
ramdisk_available: true,
|
||||
recovery_available: true,
|
||||
defaults: [
|
||||
"libfs_mgr_defaults",
|
||||
|
@ -165,6 +166,7 @@ cc_library_static {
|
|||
// It does not have a stable interface.
|
||||
name: "libfstab",
|
||||
vendor_available: true,
|
||||
ramdisk_available: true,
|
||||
recovery_available: true,
|
||||
host_supported: true,
|
||||
defaults: ["fs_mgr_defaults"],
|
||||
|
|
|
@ -20,6 +20,7 @@ package {
|
|||
|
||||
cc_library_headers {
|
||||
name: "libfiemap_headers",
|
||||
ramdisk_available: true,
|
||||
recovery_available: true,
|
||||
export_include_dirs: ["include"],
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ package {
|
|||
cc_library_static {
|
||||
name: "libfs_avb",
|
||||
defaults: ["fs_mgr_defaults"],
|
||||
ramdisk_available: true,
|
||||
recovery_available: true,
|
||||
host_supported: true,
|
||||
export_include_dirs: ["include"],
|
||||
|
|
|
@ -30,6 +30,7 @@ liblp_lib_deps = [
|
|||
cc_library {
|
||||
name: "liblp",
|
||||
host_supported: true,
|
||||
ramdisk_available: true,
|
||||
recovery_available: true,
|
||||
defaults: ["fs_mgr_defaults"],
|
||||
cppflags: [
|
||||
|
|
|
@ -118,6 +118,7 @@ cc_library_static {
|
|||
native_coverage : true,
|
||||
defaults: ["libsnapshot_defaults"],
|
||||
srcs: [":libsnapshot_sources"],
|
||||
ramdisk_available: true,
|
||||
recovery_available: true,
|
||||
cflags: [
|
||||
"-DLIBSNAPSHOT_NO_COW_WRITE",
|
||||
|
|
|
@ -6,6 +6,7 @@ package {
|
|||
cc_library_headers {
|
||||
name: "libstorage_literals_headers",
|
||||
host_supported: true,
|
||||
ramdisk_available: true,
|
||||
recovery_available: true,
|
||||
export_include_dirs: ["."],
|
||||
target: {
|
||||
|
|
|
@ -253,11 +253,32 @@ cc_binary {
|
|||
visibility: ["//packages/modules/Virtualization/microdroid"],
|
||||
}
|
||||
|
||||
// This currently is only for the VM usecase.
|
||||
// TODO(jiyong): replace init_first_stage in Android.mk with this
|
||||
soong_config_module_type {
|
||||
name: "init_first_stage_cc_defaults",
|
||||
module_type: "cc_defaults",
|
||||
config_namespace: "ANDROID",
|
||||
bool_variables: ["BOARD_BUILD_SYSTEM_ROOT_IMAGE", "BOARD_USES_RECOVERY_AS_BOOT"],
|
||||
properties: ["installable"],
|
||||
}
|
||||
|
||||
// Do not install init_first_stage even with mma if we're system-as-root.
|
||||
// Otherwise, it will overwrite the symlink.
|
||||
init_first_stage_cc_defaults {
|
||||
name: "init_first_stage_defaults",
|
||||
soong_config_variables: {
|
||||
BOARD_BUILD_SYSTEM_ROOT_IMAGE: {
|
||||
installable: false,
|
||||
},
|
||||
BOARD_USES_RECOVERY_AS_BOOT: {
|
||||
installable: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "init_first_stage_soong",
|
||||
stem: "init_vendor",
|
||||
name: "init_first_stage",
|
||||
stem: "init",
|
||||
defaults: ["init_first_stage_defaults"],
|
||||
|
||||
srcs: [
|
||||
"block_dev_initializer.cpp",
|
||||
|
@ -313,6 +334,7 @@ cc_binary {
|
|||
],
|
||||
|
||||
static_executable: true,
|
||||
system_shared_libs: [],
|
||||
|
||||
cflags: [
|
||||
"-Wall",
|
||||
|
@ -363,8 +385,23 @@ cc_binary {
|
|||
|
||||
sanitize: {
|
||||
misc_undefined: ["signed-integer-overflow"],
|
||||
|
||||
// First stage init is weird: it may start without stdout/stderr, and no /proc.
|
||||
hwaddress: false,
|
||||
},
|
||||
|
||||
// Install adb_debug.prop into debug ramdisk.
|
||||
// This allows adb root on a user build, when debug ramdisk is used.
|
||||
required: ["adb_debug.prop"],
|
||||
|
||||
ramdisk: true,
|
||||
|
||||
install_in_root: true,
|
||||
}
|
||||
|
||||
phony {
|
||||
name: "init_system",
|
||||
required: ["init_second_stage"],
|
||||
}
|
||||
|
||||
// Tests
|
||||
|
|
151
init/Android.mk
151
init/Android.mk
|
@ -2,153 +2,6 @@
|
|||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
-include system/sepolicy/policy_version.mk
|
||||
|
||||
# --
|
||||
|
||||
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
|
||||
init_options += \
|
||||
-DALLOW_FIRST_STAGE_CONSOLE=1 \
|
||||
-DALLOW_LOCAL_PROP_OVERRIDE=1 \
|
||||
-DALLOW_PERMISSIVE_SELINUX=1 \
|
||||
-DREBOOT_BOOTLOADER_ON_PANIC=1 \
|
||||
-DWORLD_WRITABLE_KMSG=1 \
|
||||
-DDUMP_ON_UMOUNT_FAILURE=1
|
||||
else
|
||||
init_options += \
|
||||
-DALLOW_FIRST_STAGE_CONSOLE=0 \
|
||||
-DALLOW_LOCAL_PROP_OVERRIDE=0 \
|
||||
-DALLOW_PERMISSIVE_SELINUX=0 \
|
||||
-DREBOOT_BOOTLOADER_ON_PANIC=0 \
|
||||
-DWORLD_WRITABLE_KMSG=0 \
|
||||
-DDUMP_ON_UMOUNT_FAILURE=0
|
||||
endif
|
||||
|
||||
ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
|
||||
init_options += \
|
||||
-DSHUTDOWN_ZERO_TIMEOUT=1
|
||||
else
|
||||
init_options += \
|
||||
-DSHUTDOWN_ZERO_TIMEOUT=0
|
||||
endif
|
||||
|
||||
init_options += -DLOG_UEVENTS=0 \
|
||||
-DSEPOLICY_VERSION=$(POLICYVERS)
|
||||
|
||||
init_cflags += \
|
||||
$(init_options) \
|
||||
-Wall -Wextra \
|
||||
-Wno-unused-parameter \
|
||||
-Werror \
|
||||
|
||||
# --
|
||||
|
||||
# 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)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_CPPFLAGS := $(init_cflags)
|
||||
LOCAL_SRC_FILES := \
|
||||
block_dev_initializer.cpp \
|
||||
devices.cpp \
|
||||
first_stage_console.cpp \
|
||||
first_stage_init.cpp \
|
||||
first_stage_main.cpp \
|
||||
first_stage_mount.cpp \
|
||||
reboot_utils.cpp \
|
||||
selabel.cpp \
|
||||
selinux.cpp \
|
||||
service_utils.cpp \
|
||||
snapuserd_transition.cpp \
|
||||
switch_root.cpp \
|
||||
uevent_listener.cpp \
|
||||
util.cpp \
|
||||
|
||||
LOCAL_MODULE := init_first_stage
|
||||
LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
|
||||
LOCAL_LICENSE_CONDITIONS := notice
|
||||
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
|
||||
LOCAL_MODULE_STEM := init
|
||||
|
||||
LOCAL_FORCE_STATIC_EXECUTABLE := true
|
||||
|
||||
LOCAL_MODULE_PATH := $(TARGET_RAMDISK_OUT)
|
||||
LOCAL_UNSTRIPPED_PATH := $(TARGET_RAMDISK_OUT_UNSTRIPPED)
|
||||
|
||||
# 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 \
|
||||
|
||||
# Set up the directories that first stage init mounts on.
|
||||
|
||||
my_ramdisk_dirs := \
|
||||
debug_ramdisk \
|
||||
dev \
|
||||
metadata \
|
||||
mnt \
|
||||
proc \
|
||||
second_stage_resources \
|
||||
sys \
|
||||
|
||||
LOCAL_POST_INSTALL_CMD := mkdir -p $(addprefix $(TARGET_RAMDISK_OUT)/,$(my_ramdisk_dirs))
|
||||
ifeq (true,$(BOARD_USES_GENERIC_KERNEL_IMAGE))
|
||||
LOCAL_POST_INSTALL_CMD += $(addprefix $(TARGET_RAMDISK_OUT)/first_stage_ramdisk/,$(my_ramdisk_dirs))
|
||||
endif
|
||||
|
||||
my_ramdisk_dirs :=
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := \
|
||||
libc++fs \
|
||||
libfs_avb \
|
||||
libfs_mgr \
|
||||
libfec \
|
||||
libfec_rs \
|
||||
libsquashfs_utils \
|
||||
liblogwrap \
|
||||
libext4_utils \
|
||||
libcrypto_utils \
|
||||
libsparse \
|
||||
libavb \
|
||||
libkeyutils \
|
||||
liblp \
|
||||
libcutils \
|
||||
libbase \
|
||||
liblog \
|
||||
libcrypto_static \
|
||||
libdl \
|
||||
libz \
|
||||
libselinux \
|
||||
libcap \
|
||||
libgsi \
|
||||
libcom.android.sysprop.apex \
|
||||
liblzma \
|
||||
libunwindstack_no_dex \
|
||||
libbacktrace_no_dex \
|
||||
libmodprobe \
|
||||
libext2_uuid \
|
||||
libprotobuf-cpp-lite \
|
||||
libsnapshot_cow \
|
||||
libsnapshot_init \
|
||||
update_metadata-protos \
|
||||
libprocinfo \
|
||||
|
||||
LOCAL_SANITIZE := signed-integer-overflow
|
||||
# First stage init is weird: it may start without stdout/stderr, and no /proc.
|
||||
LOCAL_NOSANITIZE := hwaddress
|
||||
include $(BUILD_EXECUTABLE)
|
||||
endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := init_system
|
||||
LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
|
||||
LOCAL_LICENSE_CONDITIONS := notice
|
||||
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
|
||||
LOCAL_REQUIRED_MODULES := \
|
||||
init_second_stage \
|
||||
|
||||
include $(BUILD_PHONY_PACKAGE)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := init_vendor
|
||||
|
@ -156,8 +9,10 @@ LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
|
|||
LOCAL_LICENSE_CONDITIONS := notice
|
||||
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
|
||||
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
|
||||
ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
|
||||
LOCAL_REQUIRED_MODULES := \
|
||||
init_first_stage \
|
||||
|
||||
endif
|
||||
endif # BOARD_USES_RECOVERY_AS_BOOT
|
||||
endif # BOARD_BUILD_SYSTEM_ROOT_IMAGE
|
||||
include $(BUILD_PHONY_PACKAGE)
|
||||
|
|
|
@ -21,6 +21,7 @@ package {
|
|||
cc_library {
|
||||
name: "libcrypto_utils",
|
||||
vendor_available: true,
|
||||
ramdisk_available: true,
|
||||
recovery_available: true,
|
||||
vndk: {
|
||||
enabled: true,
|
||||
|
|
|
@ -15,6 +15,7 @@ cc_library {
|
|||
name: "libkeyutils",
|
||||
cflags: ["-Werror"],
|
||||
defaults: ["linux_bionic_supported"],
|
||||
ramdisk_available: true,
|
||||
recovery_available: true,
|
||||
export_include_dirs: ["include/"],
|
||||
local_include_dirs: ["include/"],
|
||||
|
|
|
@ -8,6 +8,7 @@ cc_library_static {
|
|||
"-Werror",
|
||||
],
|
||||
vendor_available: true,
|
||||
ramdisk_available: true,
|
||||
recovery_available: true,
|
||||
srcs: [
|
||||
"libmodprobe.cpp",
|
||||
|
|
|
@ -45,4 +45,11 @@ prebuilt_etc {
|
|||
src: "etc/public.libraries.android.txt",
|
||||
filename: "public.libraries.txt",
|
||||
installable: false,
|
||||
}
|
||||
}
|
||||
|
||||
// adb_debug.prop in debug ramdisk
|
||||
prebuilt_root {
|
||||
name: "adb_debug.prop",
|
||||
src: "adb_debug.prop",
|
||||
debug_ramdisk: true,
|
||||
}
|
||||
|
|
|
@ -210,15 +210,4 @@ $(LOCAL_BUILT_MODULE):
|
|||
$(hide) $(foreach lib,$(PRIVATE_SANITIZER_RUNTIME_LIBRARIES), \
|
||||
echo $(lib) >> $@;)
|
||||
|
||||
#######################################
|
||||
# adb_debug.prop in debug ramdisk
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := adb_debug.prop
|
||||
LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
|
||||
LOCAL_LICENSE_CONDITIONS := notice
|
||||
LOCAL_SRC_FILES := $(LOCAL_MODULE)
|
||||
LOCAL_MODULE_CLASS := ETC
|
||||
LOCAL_MODULE_PATH := $(TARGET_DEBUG_RAMDISK_OUT)
|
||||
include $(BUILD_PREBUILT)
|
||||
|
||||
include $(call all-makefiles-under,$(LOCAL_PATH))
|
||||
|
|
Loading…
Reference in a new issue