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.
|
|
|
|
//
|
|
|
|
|
|
|
|
cc_defaults {
|
|
|
|
name: "init_defaults",
|
|
|
|
cpp_std: "experimental",
|
|
|
|
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: [
|
2017-05-10 00:11:57 +00:00
|
|
|
"-DLOG_UEVENTS=0",
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
"-Werror",
|
|
|
|
"-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",
|
|
|
|
],
|
|
|
|
product_variables: {
|
|
|
|
debuggable: {
|
|
|
|
cppflags: [
|
|
|
|
"-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
|
|
|
},
|
2018-01-19 22:25:48 +00:00
|
|
|
static_libs: [
|
|
|
|
"libseccomp_policy",
|
|
|
|
"libprocessgroup",
|
|
|
|
"libavb",
|
|
|
|
"libprotobuf-cpp-lite",
|
|
|
|
"libpropertyinfoserializer",
|
|
|
|
"libpropertyinfoparser",
|
2018-06-01 10:26:42 +00:00
|
|
|
],
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
2018-07-26 05:35:45 +00:00
|
|
|
"libbootloader_message",
|
|
|
|
"libcutils",
|
2018-06-01 10:26:42 +00:00
|
|
|
"libdl",
|
2018-07-26 05:35:45 +00:00
|
|
|
"libext4_utils",
|
|
|
|
"libfs_mgr",
|
|
|
|
"libhidl-gen-utils",
|
|
|
|
"libkeyutils",
|
|
|
|
"liblog",
|
|
|
|
"liblogwrap",
|
2018-06-19 07:55:05 +00:00
|
|
|
"libselinux",
|
2018-01-19 22:25:48 +00:00
|
|
|
],
|
2017-05-10 00:11:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_library_static {
|
|
|
|
name: "libinit",
|
2018-07-20 21:57:00 +00:00
|
|
|
recovery_available: true,
|
2017-05-10 00:11:57 +00:00
|
|
|
defaults: ["init_defaults"],
|
|
|
|
srcs: [
|
|
|
|
"action.cpp",
|
2018-02-13 23:36:14 +00:00
|
|
|
"action_manager.cpp",
|
2018-02-13 23:25:29 +00:00
|
|
|
"action_parser.cpp",
|
2018-01-19 22:25:48 +00:00
|
|
|
"bootchart.cpp",
|
|
|
|
"builtins.cpp",
|
2017-05-10 00:11:57 +00:00
|
|
|
"capabilities.cpp",
|
|
|
|
"descriptors.cpp",
|
|
|
|
"devices.cpp",
|
2015-10-24 23:20:18 +00:00
|
|
|
"epoll.cpp",
|
2017-05-25 22:58:59 +00:00
|
|
|
"firmware_handler.cpp",
|
2018-07-20 22:18:04 +00:00
|
|
|
"first_stage_mount.cpp",
|
2017-05-10 00:11:57 +00:00
|
|
|
"import_parser.cpp",
|
2018-01-19 22:25:48 +00:00
|
|
|
"init.cpp",
|
|
|
|
"keychords.cpp",
|
2018-07-09 18:12:00 +00:00
|
|
|
"modalias_handler.cpp",
|
2017-05-10 00:11:57 +00:00
|
|
|
"parser.cpp",
|
2017-08-04 22:59:03 +00:00
|
|
|
"persistent_properties.cpp",
|
2017-09-15 22:44:04 +00:00
|
|
|
"persistent_properties.proto",
|
2017-08-10 00:13:21 +00:00
|
|
|
"property_service.cpp",
|
2017-12-11 09:40:07 +00:00
|
|
|
"property_type.cpp",
|
2018-01-19 22:25:48 +00:00
|
|
|
"reboot.cpp",
|
2018-08-03 20:36:18 +00:00
|
|
|
"reboot_utils.cpp",
|
2017-08-10 19:22:44 +00:00
|
|
|
"security.cpp",
|
|
|
|
"selinux.cpp",
|
2017-05-10 00:11:57 +00:00
|
|
|
"service.cpp",
|
2018-01-19 22:25:48 +00:00
|
|
|
"sigchld_handler.cpp",
|
2017-09-12 22:58:47 +00:00
|
|
|
"subcontext.cpp",
|
|
|
|
"subcontext.proto",
|
2017-08-25 17:39:25 +00:00
|
|
|
"rlimit_parser.cpp",
|
2017-07-27 19:54:48 +00:00
|
|
|
"tokenizer.cpp",
|
2017-05-25 22:58:59 +00:00
|
|
|
"uevent_listener.cpp",
|
2018-01-19 22:25:48 +00:00
|
|
|
"ueventd.cpp",
|
2017-05-25 22:58:59 +00:00
|
|
|
"ueventd_parser.cpp",
|
2017-05-10 00:11:57 +00:00
|
|
|
"util.cpp",
|
|
|
|
],
|
|
|
|
whole_static_libs: ["libcap"],
|
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,
|
|
|
|
},
|
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"],
|
2017-07-06 18:43:45 +00:00
|
|
|
required: [
|
|
|
|
"e2fsdroid",
|
|
|
|
"mke2fs",
|
2017-11-29 03:26:34 +00:00
|
|
|
"sload_f2fs",
|
|
|
|
"make_f2fs",
|
2017-07-06 18:43:45 +00:00
|
|
|
],
|
2018-01-19 22:25:48 +00:00
|
|
|
srcs: ["main.cpp"],
|
2018-07-20 21:57:00 +00:00
|
|
|
symlinks: ["ueventd"],
|
2017-05-10 00:11:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Tests
|
|
|
|
// ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
cc_test {
|
|
|
|
name: "init_tests",
|
|
|
|
defaults: ["init_defaults"],
|
2018-08-24 16:40:04 +00:00
|
|
|
compile_multilib: "first",
|
2017-05-10 00:11:57 +00:00
|
|
|
srcs: [
|
|
|
|
"devices_test.cpp",
|
|
|
|
"init_test.cpp",
|
2018-05-15 18:19:43 +00:00
|
|
|
"keychords_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",
|
2017-08-03 19:54:07 +00:00
|
|
|
"result_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",
|
|
|
|
],
|
2018-01-19 22:25:48 +00:00
|
|
|
static_libs: ["libinit"],
|
2018-04-27 23:12:06 +00:00
|
|
|
test_suites: ["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
|
|
|
}
|
|
|
|
|
2018-02-14 00:50:08 +00:00
|
|
|
// Host Verifier
|
|
|
|
// ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
genrule {
|
|
|
|
name: "generated_stub_builtin_function_map",
|
|
|
|
out: ["generated_stub_builtin_function_map.h"],
|
|
|
|
srcs: ["builtins.cpp"],
|
2018-03-01 05:40:46 +00:00
|
|
|
cmd: "sed -n '/Builtin-function-map start/{:a;n;/Builtin-function-map end/q;p;ba}' $(in) | sed -e 's/do_[^}]*/do_stub/g' > $(out)",
|
2018-02-14 00:50:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_binary {
|
|
|
|
name: "host_init_verifier",
|
|
|
|
host_supported: true,
|
|
|
|
cpp_std: "experimental",
|
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
"-Werror",
|
|
|
|
],
|
|
|
|
static_libs: [
|
|
|
|
"libbase",
|
|
|
|
"libselinux",
|
|
|
|
],
|
|
|
|
whole_static_libs: ["libcap"],
|
|
|
|
shared_libs: [
|
|
|
|
"libprotobuf-cpp-lite",
|
|
|
|
"libhidl-gen-utils",
|
|
|
|
"libprocessgroup",
|
|
|
|
"liblog",
|
|
|
|
"libcutils",
|
|
|
|
],
|
2018-06-20 22:49:48 +00:00
|
|
|
srcs: [
|
|
|
|
"action.cpp",
|
|
|
|
"action_manager.cpp",
|
|
|
|
"action_parser.cpp",
|
|
|
|
"capabilities.cpp",
|
|
|
|
"descriptors.cpp",
|
|
|
|
"epoll.cpp",
|
|
|
|
"keychords.cpp",
|
|
|
|
"import_parser.cpp",
|
|
|
|
"host_import_parser.cpp",
|
|
|
|
"host_init_verifier.cpp",
|
|
|
|
"host_init_stubs.cpp",
|
|
|
|
"parser.cpp",
|
|
|
|
"rlimit_parser.cpp",
|
|
|
|
"tokenizer.cpp",
|
|
|
|
"service.cpp",
|
|
|
|
"subcontext.cpp",
|
|
|
|
"subcontext.proto",
|
|
|
|
"util.cpp",
|
|
|
|
],
|
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",
|
|
|
|
"generated_android_ids"
|
|
|
|
],
|
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
|
|
|
}
|
|
|
|
|
2017-05-10 00:11:57 +00:00
|
|
|
subdirs = ["*"]
|