2017-05-10 00:11:57 +00:00
|
|
|
//
|
|
|
|
// Copyright (C) 2017 The Android Open Source Project
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
|
2021-02-17 03:02:14 +00:00
|
|
|
package {
|
|
|
|
default_applicable_licenses: ["system_core_init_license"],
|
|
|
|
}
|
|
|
|
|
|
|
|
// Added automatically by a large-scale-change
|
|
|
|
// See: http://go/android-license-faq
|
|
|
|
license {
|
|
|
|
name: "system_core_init_license",
|
|
|
|
visibility: [":__subpackages__"],
|
|
|
|
license_kinds: [
|
|
|
|
"SPDX-license-identifier-Apache-2.0",
|
|
|
|
],
|
|
|
|
license_text: [
|
|
|
|
"NOTICE",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2020-02-06 19:56:58 +00:00
|
|
|
init_common_sources = [
|
|
|
|
"action.cpp",
|
|
|
|
"action_manager.cpp",
|
|
|
|
"action_parser.cpp",
|
|
|
|
"capabilities.cpp",
|
|
|
|
"epoll.cpp",
|
|
|
|
"import_parser.cpp",
|
|
|
|
"interface_utils.cpp",
|
2022-10-19 23:30:15 +00:00
|
|
|
"interprocess_fifo.cpp",
|
2020-02-06 19:56:58 +00:00
|
|
|
"keychords.cpp",
|
|
|
|
"parser.cpp",
|
|
|
|
"property_type.cpp",
|
|
|
|
"rlimit_parser.cpp",
|
|
|
|
"service.cpp",
|
|
|
|
"service_list.cpp",
|
|
|
|
"service_parser.cpp",
|
|
|
|
"service_utils.cpp",
|
|
|
|
"subcontext.cpp",
|
|
|
|
"subcontext.proto",
|
|
|
|
"tokenizer.cpp",
|
|
|
|
"util.cpp",
|
|
|
|
]
|
|
|
|
init_device_sources = [
|
2022-07-21 23:05:13 +00:00
|
|
|
"apex_init_util.cpp",
|
2020-03-21 02:38:28 +00:00
|
|
|
"block_dev_initializer.cpp",
|
2020-02-06 19:56:58 +00:00
|
|
|
"bootchart.cpp",
|
|
|
|
"builtins.cpp",
|
|
|
|
"devices.cpp",
|
|
|
|
"firmware_handler.cpp",
|
2019-11-01 20:58:02 +00:00
|
|
|
"first_stage_console.cpp",
|
2020-02-06 19:56:58 +00:00
|
|
|
"first_stage_init.cpp",
|
|
|
|
"first_stage_mount.cpp",
|
|
|
|
"fscrypt_init_extensions.cpp",
|
|
|
|
"init.cpp",
|
|
|
|
"lmkd_service.cpp",
|
|
|
|
"modalias_handler.cpp",
|
|
|
|
"mount_handler.cpp",
|
|
|
|
"mount_namespace.cpp",
|
|
|
|
"persistent_properties.cpp",
|
|
|
|
"persistent_properties.proto",
|
|
|
|
"property_service.cpp",
|
|
|
|
"property_service.proto",
|
|
|
|
"reboot.cpp",
|
|
|
|
"reboot_utils.cpp",
|
|
|
|
"security.cpp",
|
|
|
|
"selabel.cpp",
|
|
|
|
"selinux.cpp",
|
|
|
|
"sigchld_handler.cpp",
|
init: Add an selinux transition for snapuserd.
With compressed VAB updates, it is not possible to mount /system without
first running snapuserd, which is the userspace component to the dm-user
kernel module. This poses a problem because as soon as selinux
enforcement is enabled, snapuserd (running in a kernel context) does not
have access to read and decompress the underlying system partition.
To account for this, we split SelinuxInitialize into multiple steps:
First, sepolicy is read into an in-memory string.
Second, the device-mapper tables for all snapshots are rebuilt. This
flushes any pending reads and creates new dm-user devices. The original
kernel-privileged snapuserd is then killed.
Third, sepolicy is loaded from the in-memory string.
Fourth, we re-launch snapuserd and connect it to the newly created
dm-user devices. As part of this step we restorecon device-mapper
devices and /dev/block/by-name/super, since the new snapuserd is in a
limited context.
Finally, we set enforcing mode.
This sequence ensures that snapuserd has appropriate privileges with a
minimal number of permissive audits.
Bug: 173476209
Test: full OTA with VABC applies and boots
Change-Id: Ie4e0f5166b01c31a6f337afc26fc58b96217604e
2020-12-08 08:21:20 +00:00
|
|
|
"snapuserd_transition.cpp",
|
2020-02-06 19:56:58 +00:00
|
|
|
"switch_root.cpp",
|
|
|
|
"uevent_listener.cpp",
|
|
|
|
"ueventd.cpp",
|
|
|
|
"ueventd_parser.cpp",
|
|
|
|
]
|
|
|
|
init_host_sources = [
|
|
|
|
"check_builtins.cpp",
|
|
|
|
"host_import_parser.cpp",
|
|
|
|
"host_init_verifier.cpp",
|
|
|
|
]
|
|
|
|
|
2021-09-23 14:14:16 +00:00
|
|
|
soong_config_module_type {
|
|
|
|
name: "libinit_cc_defaults",
|
|
|
|
module_type: "cc_defaults",
|
|
|
|
config_namespace: "ANDROID",
|
|
|
|
bool_variables: [
|
|
|
|
"PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
|
|
|
|
],
|
|
|
|
properties: [
|
|
|
|
"cflags",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
libinit_cc_defaults {
|
2017-05-10 00:11:57 +00:00
|
|
|
name: "init_defaults",
|
|
|
|
sanitize: {
|
2017-07-26 21:17:09 +00:00
|
|
|
misc_undefined: ["signed-integer-overflow"],
|
2017-05-10 00:11:57 +00:00
|
|
|
},
|
2017-10-02 22:20:07 +00:00
|
|
|
cflags: [
|
2019-05-21 22:50:39 +00:00
|
|
|
"-DALLOW_FIRST_STAGE_CONSOLE=0",
|
2017-05-10 00:11:57 +00:00
|
|
|
"-DALLOW_LOCAL_PROP_OVERRIDE=0",
|
|
|
|
"-DALLOW_PERMISSIVE_SELINUX=0",
|
2022-12-03 02:48:15 +00:00
|
|
|
"-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
|
2017-05-10 00:11:57 +00:00
|
|
|
"-DDUMP_ON_UMOUNT_FAILURE=0",
|
2020-02-20 18:50:00 +00:00
|
|
|
"-DINIT_FULL_SOURCES",
|
2021-09-23 14:14:16 +00:00
|
|
|
"-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=0",
|
2022-12-03 02:48:48 +00:00
|
|
|
"-DLOG_UEVENTS=0",
|
|
|
|
"-DREBOOT_BOOTLOADER_ON_PANIC=0",
|
|
|
|
"-DSHUTDOWN_ZERO_TIMEOUT=0",
|
|
|
|
"-DWORLD_WRITABLE_KMSG=0",
|
|
|
|
"-Wall",
|
|
|
|
"-Werror",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
"-Wthread-safety",
|
2017-05-10 00:11:57 +00:00
|
|
|
],
|
|
|
|
product_variables: {
|
|
|
|
debuggable: {
|
|
|
|
cppflags: [
|
2019-05-21 22:50:39 +00:00
|
|
|
"-UALLOW_FIRST_STAGE_CONSOLE",
|
|
|
|
"-DALLOW_FIRST_STAGE_CONSOLE=1",
|
2017-05-10 00:11:57 +00:00
|
|
|
"-UALLOW_LOCAL_PROP_OVERRIDE",
|
|
|
|
"-DALLOW_LOCAL_PROP_OVERRIDE=1",
|
|
|
|
"-UALLOW_PERMISSIVE_SELINUX",
|
|
|
|
"-DALLOW_PERMISSIVE_SELINUX=1",
|
|
|
|
"-UREBOOT_BOOTLOADER_ON_PANIC",
|
|
|
|
"-DREBOOT_BOOTLOADER_ON_PANIC=1",
|
|
|
|
"-UWORLD_WRITABLE_KMSG",
|
|
|
|
"-DWORLD_WRITABLE_KMSG=1",
|
|
|
|
"-UDUMP_ON_UMOUNT_FAILURE",
|
|
|
|
"-DDUMP_ON_UMOUNT_FAILURE=1",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
eng: {
|
|
|
|
cppflags: [
|
|
|
|
"-USHUTDOWN_ZERO_TIMEOUT",
|
|
|
|
"-DSHUTDOWN_ZERO_TIMEOUT=1",
|
|
|
|
],
|
|
|
|
},
|
2017-08-23 21:57:07 +00:00
|
|
|
uml: {
|
|
|
|
cppflags: ["-DUSER_MODE_LINUX"],
|
2018-02-17 01:58:14 +00:00
|
|
|
},
|
2017-05-10 00:11:57 +00:00
|
|
|
},
|
2021-09-23 14:14:16 +00:00
|
|
|
soong_config_variables: {
|
|
|
|
PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT: {
|
|
|
|
cflags: [
|
|
|
|
"-UINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT",
|
|
|
|
"-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=1",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2018-01-19 22:25:48 +00:00
|
|
|
static_libs: [
|
|
|
|
"libavb",
|
2022-10-04 04:37:12 +00:00
|
|
|
"libbootloader_message",
|
2019-04-11 15:57:24 +00:00
|
|
|
"libc++fs",
|
2019-03-23 00:21:58 +00:00
|
|
|
"libcgrouprc_format",
|
2022-02-08 12:42:33 +00:00
|
|
|
"libfsverity_init",
|
2019-10-23 00:18:42 +00:00
|
|
|
"liblmkd_utils",
|
2022-04-12 00:29:27 +00:00
|
|
|
"liblz4",
|
2022-02-08 12:42:33 +00:00
|
|
|
"libmini_keyctl_static",
|
2019-04-16 00:43:02 +00:00
|
|
|
"libmodprobe",
|
2021-03-05 22:10:55 +00:00
|
|
|
"libprocinfo",
|
2018-01-19 22:25:48 +00:00
|
|
|
"libprotobuf-cpp-lite",
|
|
|
|
"libpropertyinfoserializer",
|
|
|
|
"libpropertyinfoparser",
|
2022-02-08 12:42:33 +00:00
|
|
|
"libsigningutils",
|
2020-09-21 23:34:25 +00:00
|
|
|
"libsnapshot_cow",
|
2019-10-09 23:24:03 +00:00
|
|
|
"libsnapshot_init",
|
2020-07-04 18:33:36 +00:00
|
|
|
"libxml2",
|
2019-12-07 15:25:15 +00:00
|
|
|
"lib_apex_manifest_proto_lite",
|
2020-04-16 18:05:16 +00:00
|
|
|
"update_metadata-protos",
|
2018-06-01 10:26:42 +00:00
|
|
|
],
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
2022-02-08 12:42:33 +00:00
|
|
|
"libcrypto",
|
2018-07-26 05:35:45 +00:00
|
|
|
"libcutils",
|
2018-06-01 10:26:42 +00:00
|
|
|
"libdl",
|
2018-07-26 05:35:45 +00:00
|
|
|
"libext4_utils",
|
|
|
|
"libfs_mgr",
|
2019-01-04 02:16:56 +00:00
|
|
|
"libgsi",
|
2018-07-26 05:35:45 +00:00
|
|
|
"libhidl-gen-utils",
|
|
|
|
"libkeyutils",
|
|
|
|
"liblog",
|
|
|
|
"liblogwrap",
|
2018-11-06 22:12:05 +00:00
|
|
|
"liblp",
|
2018-12-21 19:41:50 +00:00
|
|
|
"libprocessgroup",
|
2019-03-05 23:47:16 +00:00
|
|
|
"libprocessgroup_setup",
|
2018-06-19 07:55:05 +00:00
|
|
|
"libselinux",
|
2022-05-11 21:42:38 +00:00
|
|
|
"libunwindstack",
|
2018-09-04 04:29:14 +00:00
|
|
|
"libutils",
|
2022-02-08 12:42:33 +00:00
|
|
|
"libziparchive",
|
2018-01-19 22:25:48 +00:00
|
|
|
],
|
2022-09-13 01:19:47 +00:00
|
|
|
header_libs: ["bionic_libc_platform_headers"],
|
2018-12-26 08:34:39 +00:00
|
|
|
bootstrap: true,
|
2019-07-23 17:26:15 +00:00
|
|
|
visibility: [":__subpackages__"],
|
2017-05-10 00:11:57 +00:00
|
|
|
}
|
|
|
|
|
2022-02-15 16:22:55 +00:00
|
|
|
cc_library_headers {
|
|
|
|
name: "libinit_headers",
|
|
|
|
export_include_dirs: ["."],
|
|
|
|
visibility: [":__subpackages__"],
|
|
|
|
}
|
|
|
|
|
2017-05-10 00:11:57 +00:00
|
|
|
cc_library_static {
|
|
|
|
name: "libinit",
|
2018-07-20 21:57:00 +00:00
|
|
|
recovery_available: true,
|
2019-07-23 17:26:15 +00:00
|
|
|
defaults: [
|
|
|
|
"init_defaults",
|
|
|
|
"selinux_policy_version",
|
|
|
|
],
|
2020-02-06 19:56:58 +00:00
|
|
|
srcs: init_common_sources + init_device_sources,
|
2022-07-15 22:02:14 +00:00
|
|
|
export_include_dirs: ["."],
|
2020-07-04 18:33:36 +00:00
|
|
|
generated_sources: [
|
|
|
|
"apex-info-list",
|
|
|
|
],
|
2019-07-23 17:26:15 +00:00
|
|
|
whole_static_libs: [
|
|
|
|
"libcap",
|
2022-06-08 14:19:45 +00:00
|
|
|
"libcom.android.sysprop.apex",
|
|
|
|
"libcom.android.sysprop.init",
|
2019-07-23 17:26:15 +00:00
|
|
|
],
|
2018-03-29 01:45:35 +00:00
|
|
|
header_libs: ["bootimg_headers"],
|
2017-09-15 22:44:04 +00:00
|
|
|
proto: {
|
|
|
|
type: "lite",
|
|
|
|
export_proto_headers: true,
|
|
|
|
},
|
2018-09-04 04:29:14 +00:00
|
|
|
|
|
|
|
target: {
|
|
|
|
recovery: {
|
|
|
|
cflags: ["-DRECOVERY"],
|
2020-07-04 18:33:36 +00:00
|
|
|
exclude_static_libs: [
|
|
|
|
"libxml2",
|
|
|
|
],
|
|
|
|
exclude_generated_sources: [
|
|
|
|
"apex-info-list",
|
|
|
|
],
|
2019-07-23 17:26:15 +00:00
|
|
|
exclude_shared_libs: [
|
|
|
|
"libbinder",
|
|
|
|
"libutils",
|
|
|
|
],
|
2018-09-04 04:29:14 +00:00
|
|
|
},
|
|
|
|
},
|
2022-07-15 22:02:14 +00:00
|
|
|
visibility: [
|
|
|
|
"//system/apex/apexd",
|
|
|
|
"//frameworks/native/cmds/installd",
|
|
|
|
],
|
2017-05-10 00:11:57 +00:00
|
|
|
}
|
|
|
|
|
2019-07-15 22:12:56 +00:00
|
|
|
phony {
|
|
|
|
name: "init",
|
|
|
|
required: [
|
|
|
|
"init_second_stage",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2017-05-10 00:11:57 +00:00
|
|
|
cc_binary {
|
2018-07-20 21:57:00 +00:00
|
|
|
name: "init_second_stage",
|
|
|
|
recovery_available: true,
|
|
|
|
stem: "init",
|
2017-05-10 00:11:57 +00:00
|
|
|
defaults: ["init_defaults"],
|
2018-07-20 21:57:00 +00:00
|
|
|
static_libs: ["libinit"],
|
2018-01-19 22:25:48 +00:00
|
|
|
srcs: ["main.cpp"],
|
2018-07-20 21:57:00 +00:00
|
|
|
symlinks: ["ueventd"],
|
2018-09-04 04:29:14 +00:00
|
|
|
target: {
|
2021-07-24 14:50:17 +00:00
|
|
|
platform: {
|
|
|
|
required: [
|
|
|
|
"init.rc",
|
|
|
|
"ueventd.rc",
|
|
|
|
"e2fsdroid",
|
2022-09-06 01:12:42 +00:00
|
|
|
"extra_free_kbytes",
|
2021-07-24 14:50:17 +00:00
|
|
|
"make_f2fs",
|
|
|
|
"mke2fs",
|
|
|
|
"sload_f2fs",
|
|
|
|
],
|
|
|
|
},
|
2018-09-04 04:29:14 +00:00
|
|
|
recovery: {
|
|
|
|
cflags: ["-DRECOVERY"],
|
2020-07-04 18:33:36 +00:00
|
|
|
exclude_static_libs: [
|
|
|
|
"libxml2",
|
|
|
|
],
|
2019-07-23 17:26:15 +00:00
|
|
|
exclude_shared_libs: [
|
|
|
|
"libbinder",
|
|
|
|
"libutils",
|
|
|
|
],
|
2021-07-24 14:50:17 +00:00
|
|
|
required: [
|
|
|
|
"init_recovery.rc",
|
|
|
|
"ueventd.rc.recovery",
|
|
|
|
"e2fsdroid.recovery",
|
|
|
|
"make_f2fs.recovery",
|
|
|
|
"mke2fs.recovery",
|
|
|
|
"sload_f2fs.recovery",
|
|
|
|
],
|
2018-09-04 04:29:14 +00:00
|
|
|
},
|
|
|
|
},
|
2021-01-25 09:41:40 +00:00
|
|
|
visibility: ["//packages/modules/Virtualization/microdroid"],
|
2017-05-10 00:11:57 +00:00
|
|
|
}
|
|
|
|
|
2021-06-11 03:58:53 +00:00
|
|
|
soong_config_module_type {
|
|
|
|
name: "init_first_stage_cc_defaults",
|
|
|
|
module_type: "cc_defaults",
|
|
|
|
config_namespace: "ANDROID",
|
2022-10-07 13:15:03 +00:00
|
|
|
bool_variables: ["BOARD_USES_RECOVERY_AS_BOOT"],
|
2021-06-11 03:58:53 +00:00
|
|
|
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: {
|
2021-07-14 07:39:53 +00:00
|
|
|
BOARD_USES_RECOVERY_AS_BOOT: {
|
|
|
|
installable: false,
|
|
|
|
},
|
2021-06-11 03:58:53 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2021-02-15 05:13:51 +00:00
|
|
|
cc_binary {
|
2021-06-11 03:58:53 +00:00
|
|
|
name: "init_first_stage",
|
|
|
|
stem: "init",
|
|
|
|
defaults: ["init_first_stage_defaults"],
|
2021-02-15 05:13:51 +00:00
|
|
|
|
|
|
|
srcs: [
|
|
|
|
"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",
|
|
|
|
"service_utils.cpp",
|
|
|
|
"snapuserd_transition.cpp",
|
|
|
|
"switch_root.cpp",
|
|
|
|
"uevent_listener.cpp",
|
|
|
|
"util.cpp",
|
|
|
|
],
|
|
|
|
|
|
|
|
static_libs: [
|
|
|
|
"libc++fs",
|
|
|
|
"libfs_avb",
|
|
|
|
"libfs_mgr",
|
|
|
|
"libfec",
|
|
|
|
"libfec_rs",
|
|
|
|
"libsquashfs_utils",
|
|
|
|
"libcrypto_utils",
|
|
|
|
"libavb",
|
|
|
|
"liblp",
|
|
|
|
"libcutils",
|
|
|
|
"libbase",
|
|
|
|
"liblog",
|
|
|
|
"libcrypto_static",
|
|
|
|
"libselinux",
|
|
|
|
"libcap",
|
|
|
|
"libgsi",
|
|
|
|
"liblzma",
|
|
|
|
"libunwindstack_no_dex",
|
|
|
|
"libmodprobe",
|
|
|
|
"libext2_uuid",
|
|
|
|
"libprotobuf-cpp-lite",
|
|
|
|
"libsnapshot_cow",
|
2022-04-12 00:29:27 +00:00
|
|
|
"liblz4",
|
2021-02-15 05:13:51 +00:00
|
|
|
"libsnapshot_init",
|
|
|
|
"update_metadata-protos",
|
2021-03-05 22:10:55 +00:00
|
|
|
"libprocinfo",
|
2021-02-15 05:13:51 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
static_executable: true,
|
2021-06-11 03:58:53 +00:00
|
|
|
system_shared_libs: [],
|
2021-02-15 05:13:51 +00:00
|
|
|
|
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
"-Werror",
|
|
|
|
"-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",
|
|
|
|
"-DSHUTDOWN_ZERO_TIMEOUT=0",
|
|
|
|
"-DLOG_UEVENTS=0",
|
|
|
|
"-DSEPOLICY_VERSION=30", // TODO(jiyong): externalize the version number
|
|
|
|
],
|
|
|
|
|
|
|
|
product_variables: {
|
|
|
|
debuggable: {
|
|
|
|
cflags: [
|
|
|
|
"-UALLOW_FIRST_STAGE_CONSOLE",
|
|
|
|
"-DALLOW_FIRST_STAGE_CONSOLE=1",
|
|
|
|
|
|
|
|
"-UALLOW_LOCAL_PROP_OVERRIDE",
|
|
|
|
"-DALLOW_LOCAL_PROP_OVERRIDE=1",
|
|
|
|
|
|
|
|
"-UALLOW_PERMISSIVE_SELINUX",
|
|
|
|
"-DALLOW_PERMISSIVE_SELINUX=1",
|
|
|
|
|
|
|
|
"-UREBOOT_BOOTLOADER_ON_PANIC",
|
|
|
|
"-DREBOOT_BOOTLOADER_ON_PANIC=1",
|
|
|
|
|
|
|
|
"-UWORLD_WRITABLE_KMSG",
|
|
|
|
"-DWORLD_WRITABLE_KMSG=1",
|
|
|
|
|
|
|
|
"-UDUMP_ON_UMOUNT_FAILURE",
|
|
|
|
"-DDUMP_ON_UMOUNT_FAILURE=1",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
eng: {
|
|
|
|
cflags: [
|
|
|
|
"-USHUTDOWN_ZERO_TIMEOUT",
|
|
|
|
"-DSHUTDOWN_ZERO_TIMEOUT=1",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
sanitize: {
|
|
|
|
misc_undefined: ["signed-integer-overflow"],
|
2021-06-11 03:58:53 +00:00
|
|
|
|
|
|
|
// First stage init is weird: it may start without stdout/stderr, and no /proc.
|
2021-02-15 05:13:51 +00:00
|
|
|
hwaddress: false,
|
|
|
|
},
|
2021-06-11 03:58:53 +00:00
|
|
|
|
|
|
|
// 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"],
|
2021-02-15 05:13:51 +00:00
|
|
|
}
|
|
|
|
|
2017-05-10 00:11:57 +00:00
|
|
|
// Tests
|
|
|
|
// ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
cc_test {
|
2019-08-20 17:43:48 +00:00
|
|
|
name: "CtsInitTestCases",
|
2017-05-10 00:11:57 +00:00
|
|
|
defaults: ["init_defaults"],
|
2019-08-27 23:02:38 +00:00
|
|
|
require_root: true,
|
|
|
|
|
2022-12-07 04:11:40 +00:00
|
|
|
compile_multilib: "first",
|
2019-08-20 17:43:48 +00:00
|
|
|
|
2017-05-10 00:11:57 +00:00
|
|
|
srcs: [
|
|
|
|
"devices_test.cpp",
|
2021-05-14 03:18:14 +00:00
|
|
|
"epoll_test.cpp",
|
2019-08-07 23:02:28 +00:00
|
|
|
"firmware_handler_test.cpp",
|
2017-05-10 00:11:57 +00:00
|
|
|
"init_test.cpp",
|
2022-10-19 23:30:15 +00:00
|
|
|
"interprocess_fifo_test.cpp",
|
2018-05-15 18:19:43 +00:00
|
|
|
"keychords_test.cpp",
|
2020-03-04 18:52:08 +00:00
|
|
|
"oneshot_on_test.cpp",
|
2017-08-04 22:59:03 +00:00
|
|
|
"persistent_properties_test.cpp",
|
2017-05-10 00:11:57 +00:00
|
|
|
"property_service_test.cpp",
|
2017-12-11 09:40:07 +00:00
|
|
|
"property_type_test.cpp",
|
2020-12-10 16:52:35 +00:00
|
|
|
"reboot_test.cpp",
|
2017-08-25 17:39:25 +00:00
|
|
|
"rlimit_parser_test.cpp",
|
2017-05-10 00:11:57 +00:00
|
|
|
"service_test.cpp",
|
2017-09-12 22:58:47 +00:00
|
|
|
"subcontext_test.cpp",
|
2018-06-26 20:56:34 +00:00
|
|
|
"tokenizer_test.cpp",
|
2018-07-17 22:28:16 +00:00
|
|
|
"ueventd_parser_test.cpp",
|
2017-07-14 23:29:23 +00:00
|
|
|
"ueventd_test.cpp",
|
2017-05-10 00:11:57 +00:00
|
|
|
"util_test.cpp",
|
|
|
|
],
|
2022-10-19 23:30:15 +00:00
|
|
|
static_libs: [
|
|
|
|
"libgmock",
|
|
|
|
"libinit",
|
|
|
|
],
|
2019-08-20 17:43:48 +00:00
|
|
|
|
|
|
|
test_suites: [
|
|
|
|
"cts",
|
|
|
|
"device-tests",
|
|
|
|
],
|
2017-05-10 00:11:57 +00:00
|
|
|
}
|
|
|
|
|
2017-09-12 22:58:47 +00:00
|
|
|
cc_benchmark {
|
|
|
|
name: "init_benchmarks",
|
|
|
|
defaults: ["init_defaults"],
|
|
|
|
srcs: [
|
|
|
|
"subcontext_benchmark.cpp",
|
|
|
|
],
|
2018-01-19 22:25:48 +00:00
|
|
|
static_libs: ["libinit"],
|
2017-09-12 22:58:47 +00:00
|
|
|
}
|
|
|
|
|
2020-02-20 18:50:00 +00:00
|
|
|
cc_defaults {
|
|
|
|
name: "libinit_test_utils_libraries_defaults",
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
|
|
|
"libcutils",
|
|
|
|
"libselinux",
|
|
|
|
"liblog",
|
|
|
|
"libprocessgroup",
|
|
|
|
"libprotobuf-cpp-lite",
|
|
|
|
],
|
2023-03-15 19:39:15 +00:00
|
|
|
static_libs: [
|
|
|
|
"libhidl-gen-utils",
|
|
|
|
],
|
2020-02-20 18:50:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_library_static {
|
|
|
|
name: "libinit_test_utils",
|
|
|
|
defaults: ["libinit_test_utils_libraries_defaults"],
|
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
"-Werror",
|
|
|
|
],
|
|
|
|
srcs: init_common_sources + [
|
|
|
|
"test_utils/service_utils.cpp",
|
|
|
|
],
|
|
|
|
whole_static_libs: [
|
|
|
|
"libcap",
|
|
|
|
],
|
|
|
|
export_include_dirs: ["test_utils/include"], // for tests
|
2022-09-13 01:19:47 +00:00
|
|
|
header_libs: ["bionic_libc_platform_headers"],
|
2020-02-20 18:50:00 +00:00
|
|
|
}
|
|
|
|
|
2018-02-14 00:50:08 +00:00
|
|
|
// Host Verifier
|
|
|
|
// ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
genrule {
|
|
|
|
name: "generated_stub_builtin_function_map",
|
2019-07-30 16:34:41 +00:00
|
|
|
tool_files: ["host_builtin_map.py"],
|
2018-02-14 00:50:08 +00:00
|
|
|
out: ["generated_stub_builtin_function_map.h"],
|
2019-08-02 22:13:50 +00:00
|
|
|
srcs: [
|
|
|
|
"builtins.cpp",
|
|
|
|
"check_builtins.cpp",
|
|
|
|
],
|
2019-07-30 16:34:41 +00:00
|
|
|
cmd: "$(location host_builtin_map.py) --builtins $(location builtins.cpp) --check_builtins $(location check_builtins.cpp) > $(out)",
|
2018-02-14 00:50:08 +00:00
|
|
|
}
|
|
|
|
|
2022-03-09 18:49:26 +00:00
|
|
|
cc_defaults {
|
|
|
|
name: "init_host_defaults",
|
2018-02-14 00:50:08 +00:00
|
|
|
host_supported: true,
|
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
"-Werror",
|
|
|
|
],
|
|
|
|
static_libs: [
|
|
|
|
"libbase",
|
|
|
|
"libselinux",
|
2019-11-09 01:54:27 +00:00
|
|
|
"libpropertyinfoserializer",
|
|
|
|
"libpropertyinfoparser",
|
2018-02-14 00:50:08 +00:00
|
|
|
],
|
|
|
|
whole_static_libs: ["libcap"],
|
|
|
|
shared_libs: [
|
2019-07-09 18:00:53 +00:00
|
|
|
"libcutils",
|
2018-02-14 00:50:08 +00:00
|
|
|
"libhidl-gen-utils",
|
2019-10-15 21:53:19 +00:00
|
|
|
"libhidlmetadata",
|
2018-02-14 00:50:08 +00:00
|
|
|
"liblog",
|
2019-07-09 18:00:53 +00:00
|
|
|
"libprocessgroup",
|
|
|
|
"libprotobuf-cpp-lite",
|
2018-02-14 00:50:08 +00:00
|
|
|
],
|
|
|
|
proto: {
|
|
|
|
type: "lite",
|
|
|
|
},
|
2018-06-20 22:49:48 +00:00
|
|
|
generated_headers: [
|
|
|
|
"generated_stub_builtin_function_map",
|
2019-07-23 17:26:15 +00:00
|
|
|
"generated_android_ids",
|
2018-06-20 22:49:48 +00:00
|
|
|
],
|
2018-03-01 01:20:27 +00:00
|
|
|
target: {
|
2018-03-01 05:40:46 +00:00
|
|
|
android: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
2018-03-01 01:20:27 +00:00
|
|
|
darwin: {
|
2018-06-20 22:49:48 +00:00
|
|
|
enabled: false,
|
2018-03-01 01:20:27 +00:00
|
|
|
},
|
|
|
|
},
|
2018-02-14 00:50:08 +00:00
|
|
|
}
|
2021-06-15 19:28:24 +00:00
|
|
|
|
2022-03-09 18:49:26 +00:00
|
|
|
cc_binary {
|
|
|
|
name: "host_init_verifier",
|
|
|
|
defaults: ["init_host_defaults"],
|
|
|
|
srcs: init_common_sources + init_host_sources,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library_host_static {
|
|
|
|
name: "libinit_host",
|
|
|
|
defaults: ["init_host_defaults"],
|
|
|
|
srcs: init_common_sources,
|
|
|
|
export_include_dirs: ["."],
|
|
|
|
proto: {
|
|
|
|
export_proto_headers: true,
|
|
|
|
},
|
|
|
|
visibility: [
|
|
|
|
// host_apex_verifier performs a subset of init.rc validation
|
|
|
|
"//system/apex/tools",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2021-06-15 19:28:24 +00:00
|
|
|
sh_binary {
|
2022-09-06 01:12:42 +00:00
|
|
|
name: "extra_free_kbytes",
|
2021-06-15 19:28:24 +00:00
|
|
|
src: "extra_free_kbytes.sh",
|
2022-09-06 01:12:42 +00:00
|
|
|
filename_from_src: true,
|
2021-06-15 19:28:24 +00:00
|
|
|
}
|