2017-05-10 02:11:57 +02: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 04:02:14 +01: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 20:56:58 +01:00
|
|
|
init_common_sources = [
|
|
|
|
"action.cpp",
|
|
|
|
"action_manager.cpp",
|
|
|
|
"action_parser.cpp",
|
|
|
|
"capabilities.cpp",
|
|
|
|
"epoll.cpp",
|
|
|
|
"import_parser.cpp",
|
|
|
|
"interface_utils.cpp",
|
2022-10-20 01:30:15 +02:00
|
|
|
"interprocess_fifo.cpp",
|
2020-02-06 20:56:58 +01: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-22 01:05:13 +02:00
|
|
|
"apex_init_util.cpp",
|
2020-03-21 03:38:28 +01:00
|
|
|
"block_dev_initializer.cpp",
|
2020-02-06 20:56:58 +01:00
|
|
|
"bootchart.cpp",
|
|
|
|
"builtins.cpp",
|
|
|
|
"devices.cpp",
|
|
|
|
"firmware_handler.cpp",
|
2019-11-01 21:58:02 +01:00
|
|
|
"first_stage_console.cpp",
|
2020-02-06 20:56:58 +01: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 09:21:20 +01:00
|
|
|
"snapuserd_transition.cpp",
|
2020-02-06 20:56:58 +01: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 16:14:16 +02: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 02:11:57 +02:00
|
|
|
name: "init_defaults",
|
|
|
|
sanitize: {
|
2017-07-26 23:17:09 +02:00
|
|
|
misc_undefined: ["signed-integer-overflow"],
|
2017-05-10 02:11:57 +02:00
|
|
|
},
|
2017-10-03 00:20:07 +02:00
|
|
|
cflags: [
|
2019-05-22 00:50:39 +02:00
|
|
|
"-DALLOW_FIRST_STAGE_CONSOLE=0",
|
2017-05-10 02:11:57 +02:00
|
|
|
"-DALLOW_LOCAL_PROP_OVERRIDE=0",
|
|
|
|
"-DALLOW_PERMISSIVE_SELINUX=0",
|
2022-12-03 03:48:15 +01:00
|
|
|
"-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
|
2017-05-10 02:11:57 +02:00
|
|
|
"-DDUMP_ON_UMOUNT_FAILURE=0",
|
2020-02-20 19:50:00 +01:00
|
|
|
"-DINIT_FULL_SOURCES",
|
2021-09-23 16:14:16 +02:00
|
|
|
"-DINSTALL_DEBUG_POLICY_TO_SYSTEM_EXT=0",
|
2022-12-03 03:48:48 +01: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 02:11:57 +02:00
|
|
|
],
|
|
|
|
product_variables: {
|
|
|
|
debuggable: {
|
|
|
|
cppflags: [
|
2019-05-22 00:50:39 +02:00
|
|
|
"-UALLOW_FIRST_STAGE_CONSOLE",
|
|
|
|
"-DALLOW_FIRST_STAGE_CONSOLE=1",
|
2017-05-10 02:11:57 +02: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 23:57:07 +02:00
|
|
|
uml: {
|
|
|
|
cppflags: ["-DUSER_MODE_LINUX"],
|
2018-02-17 02:58:14 +01:00
|
|
|
},
|
2017-05-10 02:11:57 +02:00
|
|
|
},
|
2021-09-23 16:14:16 +02: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 23:25:48 +01:00
|
|
|
static_libs: [
|
|
|
|
"libavb",
|
2022-10-04 06:37:12 +02:00
|
|
|
"libbootloader_message",
|
2019-04-11 17:57:24 +02:00
|
|
|
"libc++fs",
|
2019-03-23 01:21:58 +01:00
|
|
|
"libcgrouprc_format",
|
2019-10-23 02:18:42 +02:00
|
|
|
"liblmkd_utils",
|
2022-04-12 02:29:27 +02:00
|
|
|
"liblz4",
|
2023-02-16 01:23:46 +01:00
|
|
|
"libzstd",
|
2019-04-16 02:43:02 +02:00
|
|
|
"libmodprobe",
|
2021-03-05 23:10:55 +01:00
|
|
|
"libprocinfo",
|
2018-01-19 23:25:48 +01:00
|
|
|
"libprotobuf-cpp-lite",
|
|
|
|
"libpropertyinfoserializer",
|
|
|
|
"libpropertyinfoparser",
|
2020-09-22 01:34:25 +02:00
|
|
|
"libsnapshot_cow",
|
2019-10-10 01:24:03 +02:00
|
|
|
"libsnapshot_init",
|
2020-07-04 20:33:36 +02:00
|
|
|
"libxml2",
|
2019-12-07 16:25:15 +01:00
|
|
|
"lib_apex_manifest_proto_lite",
|
2020-04-16 20:05:16 +02:00
|
|
|
"update_metadata-protos",
|
2018-06-01 12:26:42 +02:00
|
|
|
],
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
2018-07-26 07:35:45 +02:00
|
|
|
"libcutils",
|
2018-06-01 12:26:42 +02:00
|
|
|
"libdl",
|
2018-07-26 07:35:45 +02:00
|
|
|
"libext4_utils",
|
|
|
|
"libfs_mgr",
|
2019-01-04 03:16:56 +01:00
|
|
|
"libgsi",
|
2018-07-26 07:35:45 +02:00
|
|
|
"libhidl-gen-utils",
|
|
|
|
"liblog",
|
|
|
|
"liblogwrap",
|
2018-11-06 23:12:05 +01:00
|
|
|
"liblp",
|
2018-12-21 20:41:50 +01:00
|
|
|
"libprocessgroup",
|
2019-03-06 00:47:16 +01:00
|
|
|
"libprocessgroup_setup",
|
2018-06-19 09:55:05 +02:00
|
|
|
"libselinux",
|
2022-05-11 23:42:38 +02:00
|
|
|
"libunwindstack",
|
2018-09-04 06:29:14 +02:00
|
|
|
"libutils",
|
2024-01-10 05:47:02 +01:00
|
|
|
"libvendorsupport",
|
2018-01-19 23:25:48 +01:00
|
|
|
],
|
2022-09-13 03:19:47 +02:00
|
|
|
header_libs: ["bionic_libc_platform_headers"],
|
2018-12-26 09:34:39 +01:00
|
|
|
bootstrap: true,
|
2019-07-23 19:26:15 +02:00
|
|
|
visibility: [":__subpackages__"],
|
2017-05-10 02:11:57 +02:00
|
|
|
}
|
|
|
|
|
2022-02-15 17:22:55 +01:00
|
|
|
cc_library_headers {
|
|
|
|
name: "libinit_headers",
|
|
|
|
export_include_dirs: ["."],
|
|
|
|
visibility: [":__subpackages__"],
|
|
|
|
}
|
|
|
|
|
2023-06-26 15:55:31 +02:00
|
|
|
cc_defaults {
|
|
|
|
name: "libinit_defaults",
|
2018-07-20 23:57:00 +02:00
|
|
|
recovery_available: true,
|
2019-07-23 19:26:15 +02:00
|
|
|
defaults: [
|
|
|
|
"init_defaults",
|
|
|
|
"selinux_policy_version",
|
|
|
|
],
|
2020-02-06 20:56:58 +01:00
|
|
|
srcs: init_common_sources + init_device_sources,
|
2022-07-16 00:02:14 +02:00
|
|
|
export_include_dirs: ["."],
|
2020-07-04 20:33:36 +02:00
|
|
|
generated_sources: [
|
|
|
|
"apex-info-list",
|
|
|
|
],
|
2019-07-23 19:26:15 +02:00
|
|
|
whole_static_libs: [
|
|
|
|
"libcap",
|
2022-06-08 16:19:45 +02:00
|
|
|
"libcom.android.sysprop.init",
|
2019-07-23 19:26:15 +02:00
|
|
|
],
|
2018-03-29 03:45:35 +02:00
|
|
|
header_libs: ["bootimg_headers"],
|
2017-09-16 00:44:04 +02:00
|
|
|
proto: {
|
|
|
|
type: "lite",
|
|
|
|
export_proto_headers: true,
|
|
|
|
},
|
2018-09-04 06:29:14 +02:00
|
|
|
|
|
|
|
target: {
|
|
|
|
recovery: {
|
|
|
|
cflags: ["-DRECOVERY"],
|
2020-07-04 20:33:36 +02:00
|
|
|
exclude_static_libs: [
|
|
|
|
"libxml2",
|
|
|
|
],
|
|
|
|
exclude_generated_sources: [
|
|
|
|
"apex-info-list",
|
|
|
|
],
|
2019-07-23 19:26:15 +02:00
|
|
|
exclude_shared_libs: [
|
|
|
|
"libbinder",
|
|
|
|
"libutils",
|
|
|
|
],
|
2018-09-04 06:29:14 +02:00
|
|
|
},
|
|
|
|
},
|
2023-06-26 15:55:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_library_static {
|
|
|
|
name: "libinit",
|
|
|
|
defaults: ["libinit_defaults"],
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library_static {
|
|
|
|
name: "libinit.microdroid",
|
|
|
|
defaults: ["libinit_defaults"],
|
|
|
|
cflags: ["-DMICRODROID=1"],
|
2017-05-10 02:11:57 +02:00
|
|
|
}
|
|
|
|
|
2019-07-16 00:12:56 +02:00
|
|
|
phony {
|
|
|
|
name: "init",
|
|
|
|
required: [
|
|
|
|
"init_second_stage",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2023-06-21 17:44:40 +02:00
|
|
|
cc_defaults {
|
|
|
|
name: "init_second_stage_defaults",
|
2018-07-20 23:57:00 +02:00
|
|
|
recovery_available: true,
|
|
|
|
stem: "init",
|
2017-05-10 02:11:57 +02:00
|
|
|
defaults: ["init_defaults"],
|
2018-01-19 23:25:48 +01:00
|
|
|
srcs: ["main.cpp"],
|
2018-07-20 23:57:00 +02:00
|
|
|
symlinks: ["ueventd"],
|
2018-09-04 06:29:14 +02:00
|
|
|
target: {
|
2021-07-24 16:50:17 +02:00
|
|
|
platform: {
|
|
|
|
required: [
|
|
|
|
"init.rc",
|
|
|
|
"ueventd.rc",
|
|
|
|
"e2fsdroid",
|
2022-09-06 03:12:42 +02:00
|
|
|
"extra_free_kbytes",
|
2021-07-24 16:50:17 +02:00
|
|
|
"make_f2fs",
|
|
|
|
"mke2fs",
|
|
|
|
"sload_f2fs",
|
|
|
|
],
|
|
|
|
},
|
2018-09-04 06:29:14 +02:00
|
|
|
recovery: {
|
|
|
|
cflags: ["-DRECOVERY"],
|
2020-07-04 20:33:36 +02:00
|
|
|
exclude_static_libs: [
|
|
|
|
"libxml2",
|
|
|
|
],
|
2019-07-23 19:26:15 +02:00
|
|
|
exclude_shared_libs: [
|
|
|
|
"libbinder",
|
|
|
|
"libutils",
|
|
|
|
],
|
2021-07-24 16:50:17 +02:00
|
|
|
required: [
|
|
|
|
"init_recovery.rc",
|
|
|
|
"ueventd.rc.recovery",
|
|
|
|
"e2fsdroid.recovery",
|
|
|
|
"make_f2fs.recovery",
|
|
|
|
"mke2fs.recovery",
|
|
|
|
"sload_f2fs.recovery",
|
|
|
|
],
|
2018-09-04 06:29:14 +02:00
|
|
|
},
|
|
|
|
},
|
2023-06-21 17:44:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_binary {
|
|
|
|
name: "init_second_stage",
|
|
|
|
defaults: ["init_second_stage_defaults"],
|
2023-06-26 15:55:31 +02:00
|
|
|
static_libs: ["libinit"],
|
2023-06-21 17:44:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_binary {
|
|
|
|
name: "init_second_stage.microdroid",
|
|
|
|
defaults: ["init_second_stage_defaults"],
|
2023-06-26 15:55:31 +02:00
|
|
|
static_libs: ["libinit.microdroid"],
|
|
|
|
cflags: ["-DMICRODROID=1"],
|
2023-06-21 17:44:40 +02:00
|
|
|
installable: false,
|
2021-01-25 10:41:40 +01:00
|
|
|
visibility: ["//packages/modules/Virtualization/microdroid"],
|
2017-05-10 02:11:57 +02:00
|
|
|
}
|
|
|
|
|
2023-06-21 17:44:40 +02:00
|
|
|
|
2021-06-11 05:58:53 +02:00
|
|
|
soong_config_module_type {
|
|
|
|
name: "init_first_stage_cc_defaults",
|
|
|
|
module_type: "cc_defaults",
|
|
|
|
config_namespace: "ANDROID",
|
2022-10-07 15:15:03 +02:00
|
|
|
bool_variables: ["BOARD_USES_RECOVERY_AS_BOOT"],
|
2021-06-11 05:58:53 +02: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 09:39:53 +02:00
|
|
|
BOARD_USES_RECOVERY_AS_BOOT: {
|
|
|
|
installable: false,
|
|
|
|
},
|
2021-06-11 05:58:53 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
stem: "init",
|
2021-02-15 06:13:51 +01: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 02:29:27 +02:00
|
|
|
"liblz4",
|
2023-02-16 01:23:46 +01:00
|
|
|
"libzstd",
|
2021-02-15 06:13:51 +01:00
|
|
|
"libsnapshot_init",
|
|
|
|
"update_metadata-protos",
|
2021-03-05 23:10:55 +01:00
|
|
|
"libprocinfo",
|
2021-02-15 06:13:51 +01:00
|
|
|
],
|
|
|
|
|
|
|
|
static_executable: true,
|
2021-06-11 05:58:53 +02:00
|
|
|
system_shared_libs: [],
|
2021-02-15 06:13:51 +01: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 05:58:53 +02:00
|
|
|
|
|
|
|
// First stage init is weird: it may start without stdout/stderr, and no /proc.
|
2021-02-15 06:13:51 +01:00
|
|
|
hwaddress: false,
|
|
|
|
},
|
2021-06-11 05:58:53 +02: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,
|
|
|
|
}
|
|
|
|
|
2023-06-21 17:44:40 +02:00
|
|
|
cc_binary {
|
|
|
|
name: "init_first_stage",
|
|
|
|
defaults: ["init_first_stage_defaults"],
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_binary {
|
|
|
|
name: "init_first_stage.microdroid",
|
|
|
|
defaults: ["init_first_stage_defaults"],
|
2023-06-26 15:55:31 +02:00
|
|
|
cflags: ["-DMICRODROID=1"],
|
2023-06-21 17:44:40 +02:00
|
|
|
installable: false,
|
|
|
|
}
|
|
|
|
|
2021-06-11 05:58:53 +02:00
|
|
|
phony {
|
|
|
|
name: "init_system",
|
|
|
|
required: ["init_second_stage"],
|
2021-02-15 06:13:51 +01:00
|
|
|
}
|
|
|
|
|
2017-05-10 02:11:57 +02:00
|
|
|
// Tests
|
|
|
|
// ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
cc_test {
|
2019-08-20 19:43:48 +02:00
|
|
|
name: "CtsInitTestCases",
|
2017-05-10 02:11:57 +02:00
|
|
|
defaults: ["init_defaults"],
|
2019-08-28 01:02:38 +02:00
|
|
|
require_root: true,
|
|
|
|
|
2022-12-07 05:11:40 +01:00
|
|
|
compile_multilib: "first",
|
2019-08-20 19:43:48 +02:00
|
|
|
|
2017-05-10 02:11:57 +02:00
|
|
|
srcs: [
|
|
|
|
"devices_test.cpp",
|
2021-05-14 05:18:14 +02:00
|
|
|
"epoll_test.cpp",
|
2019-08-08 01:02:28 +02:00
|
|
|
"firmware_handler_test.cpp",
|
2017-05-10 02:11:57 +02:00
|
|
|
"init_test.cpp",
|
2022-10-20 01:30:15 +02:00
|
|
|
"interprocess_fifo_test.cpp",
|
2018-05-15 20:19:43 +02:00
|
|
|
"keychords_test.cpp",
|
2020-03-04 19:52:08 +01:00
|
|
|
"oneshot_on_test.cpp",
|
2017-08-05 00:59:03 +02:00
|
|
|
"persistent_properties_test.cpp",
|
2017-05-10 02:11:57 +02:00
|
|
|
"property_service_test.cpp",
|
2017-12-11 10:40:07 +01:00
|
|
|
"property_type_test.cpp",
|
2020-12-10 17:52:35 +01:00
|
|
|
"reboot_test.cpp",
|
2017-08-25 19:39:25 +02:00
|
|
|
"rlimit_parser_test.cpp",
|
2017-05-10 02:11:57 +02:00
|
|
|
"service_test.cpp",
|
2017-09-13 00:58:47 +02:00
|
|
|
"subcontext_test.cpp",
|
2018-06-26 22:56:34 +02:00
|
|
|
"tokenizer_test.cpp",
|
2018-07-18 00:28:16 +02:00
|
|
|
"ueventd_parser_test.cpp",
|
2017-07-15 01:29:23 +02:00
|
|
|
"ueventd_test.cpp",
|
2017-05-10 02:11:57 +02:00
|
|
|
"util_test.cpp",
|
|
|
|
],
|
2022-10-20 01:30:15 +02:00
|
|
|
static_libs: [
|
|
|
|
"libgmock",
|
|
|
|
"libinit",
|
|
|
|
],
|
2019-08-20 19:43:48 +02:00
|
|
|
|
|
|
|
test_suites: [
|
|
|
|
"cts",
|
|
|
|
"device-tests",
|
|
|
|
],
|
2017-05-10 02:11:57 +02:00
|
|
|
}
|
|
|
|
|
2017-09-13 00:58:47 +02:00
|
|
|
cc_benchmark {
|
|
|
|
name: "init_benchmarks",
|
|
|
|
defaults: ["init_defaults"],
|
|
|
|
srcs: [
|
|
|
|
"subcontext_benchmark.cpp",
|
|
|
|
],
|
2018-01-19 23:25:48 +01:00
|
|
|
static_libs: ["libinit"],
|
2017-09-13 00:58:47 +02:00
|
|
|
}
|
|
|
|
|
2020-02-20 19:50:00 +01:00
|
|
|
cc_defaults {
|
|
|
|
name: "libinit_test_utils_libraries_defaults",
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
|
|
|
"libcutils",
|
|
|
|
"libselinux",
|
|
|
|
"liblog",
|
|
|
|
"libprocessgroup",
|
|
|
|
"libprotobuf-cpp-lite",
|
|
|
|
],
|
2023-03-15 20:39:15 +01:00
|
|
|
static_libs: [
|
2023-07-25 16:08:55 +02:00
|
|
|
"libfs_mgr",
|
2023-03-15 20:39:15 +01:00
|
|
|
"libhidl-gen-utils",
|
|
|
|
],
|
2020-02-20 19:50:00 +01: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 03:19:47 +02:00
|
|
|
header_libs: ["bionic_libc_platform_headers"],
|
2020-02-20 19:50:00 +01:00
|
|
|
}
|
|
|
|
|
2018-02-14 01:50:08 +01:00
|
|
|
// Host Verifier
|
|
|
|
// ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
genrule {
|
|
|
|
name: "generated_stub_builtin_function_map",
|
2019-07-30 18:34:41 +02:00
|
|
|
tool_files: ["host_builtin_map.py"],
|
2018-02-14 01:50:08 +01:00
|
|
|
out: ["generated_stub_builtin_function_map.h"],
|
2019-08-03 00:13:50 +02:00
|
|
|
srcs: [
|
|
|
|
"builtins.cpp",
|
|
|
|
"check_builtins.cpp",
|
|
|
|
],
|
2019-07-30 18:34:41 +02:00
|
|
|
cmd: "$(location host_builtin_map.py) --builtins $(location builtins.cpp) --check_builtins $(location check_builtins.cpp) > $(out)",
|
2018-02-14 01:50:08 +01:00
|
|
|
}
|
|
|
|
|
2022-03-09 19:49:26 +01:00
|
|
|
cc_defaults {
|
|
|
|
name: "init_host_defaults",
|
2018-02-14 01:50:08 +01:00
|
|
|
host_supported: true,
|
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
"-Werror",
|
|
|
|
],
|
|
|
|
static_libs: [
|
|
|
|
"libbase",
|
|
|
|
"libselinux",
|
2019-11-09 02:54:27 +01:00
|
|
|
"libpropertyinfoserializer",
|
|
|
|
"libpropertyinfoparser",
|
2018-02-14 01:50:08 +01:00
|
|
|
],
|
|
|
|
whole_static_libs: ["libcap"],
|
|
|
|
shared_libs: [
|
2019-07-09 20:00:53 +02:00
|
|
|
"libcutils",
|
2018-02-14 01:50:08 +01:00
|
|
|
"libhidl-gen-utils",
|
2019-10-15 23:53:19 +02:00
|
|
|
"libhidlmetadata",
|
2018-02-14 01:50:08 +01:00
|
|
|
"liblog",
|
2019-07-09 20:00:53 +02:00
|
|
|
"libprocessgroup",
|
|
|
|
"libprotobuf-cpp-lite",
|
2018-02-14 01:50:08 +01:00
|
|
|
],
|
|
|
|
proto: {
|
|
|
|
type: "lite",
|
|
|
|
},
|
2018-06-21 00:49:48 +02:00
|
|
|
generated_headers: [
|
|
|
|
"generated_stub_builtin_function_map",
|
2019-07-23 19:26:15 +02:00
|
|
|
"generated_android_ids",
|
2018-06-21 00:49:48 +02:00
|
|
|
],
|
2018-03-01 02:20:27 +01:00
|
|
|
target: {
|
2018-03-01 06:40:46 +01:00
|
|
|
android: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
2018-03-01 02:20:27 +01:00
|
|
|
darwin: {
|
2018-06-21 00:49:48 +02:00
|
|
|
enabled: false,
|
2018-03-01 02:20:27 +01:00
|
|
|
},
|
|
|
|
},
|
2018-02-14 01:50:08 +01:00
|
|
|
}
|
2021-06-15 21:28:24 +02:00
|
|
|
|
2022-03-09 19:49:26 +01: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 21:28:24 +02:00
|
|
|
sh_binary {
|
2022-09-06 03:12:42 +02:00
|
|
|
name: "extra_free_kbytes",
|
2021-06-15 21:28:24 +02:00
|
|
|
src: "extra_free_kbytes.sh",
|
2022-09-06 03:12:42 +02:00
|
|
|
filename_from_src: true,
|
2021-06-15 21:28:24 +02:00
|
|
|
}
|