blob: b1f02793f2e95c28c3ed3bd1f3c945d9274f20fd [file] [log] [blame]
Tom Cherry14fc0132017-05-09 17:11:57 -07001//
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17cc_defaults {
18 name: "init_defaults",
19 cpp_std: "experimental",
20 sanitize: {
Tom Cherry2ffd65e2017-07-26 14:17:09 -070021 misc_undefined: ["signed-integer-overflow"],
Tom Cherry14fc0132017-05-09 17:11:57 -070022 },
Tom Cherry14fc0132017-05-09 17:11:57 -070023 cppflags: [
24 "-DLOG_UEVENTS=0",
25 "-Wall",
26 "-Wextra",
27 "-Wno-unused-parameter",
28 "-Werror",
29 "-DALLOW_LOCAL_PROP_OVERRIDE=0",
30 "-DALLOW_PERMISSIVE_SELINUX=0",
31 "-DREBOOT_BOOTLOADER_ON_PANIC=0",
32 "-DWORLD_WRITABLE_KMSG=0",
33 "-DDUMP_ON_UMOUNT_FAILURE=0",
34 "-DSHUTDOWN_ZERO_TIMEOUT=0",
35 ],
36 product_variables: {
37 debuggable: {
38 cppflags: [
39 "-UALLOW_LOCAL_PROP_OVERRIDE",
40 "-DALLOW_LOCAL_PROP_OVERRIDE=1",
41 "-UALLOW_PERMISSIVE_SELINUX",
42 "-DALLOW_PERMISSIVE_SELINUX=1",
43 "-UREBOOT_BOOTLOADER_ON_PANIC",
44 "-DREBOOT_BOOTLOADER_ON_PANIC=1",
45 "-UWORLD_WRITABLE_KMSG",
46 "-DWORLD_WRITABLE_KMSG=1",
47 "-UDUMP_ON_UMOUNT_FAILURE",
48 "-DDUMP_ON_UMOUNT_FAILURE=1",
49 ],
50 },
51 eng: {
52 cppflags: [
53 "-USHUTDOWN_ZERO_TIMEOUT",
54 "-DSHUTDOWN_ZERO_TIMEOUT=1",
55 ],
56 },
57 },
58}
59
60cc_library_static {
61 name: "libinit",
62 defaults: ["init_defaults"],
63 srcs: [
64 "action.cpp",
65 "capabilities.cpp",
66 "descriptors.cpp",
67 "devices.cpp",
Tom Cherryed506f72017-05-25 15:58:59 -070068 "firmware_handler.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -070069 "import_parser.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -070070 "log.cpp",
71 "parser.cpp",
Tom Cherry2a978d32017-08-09 17:13:21 -070072 "property_service.cpp",
Tom Cherryc3692b32017-08-10 12:22:44 -070073 "security.cpp",
74 "selinux.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -070075 "service.cpp",
Tom Cherry67dee622017-07-27 12:54:48 -070076 "tokenizer.cpp",
Tom Cherryed506f72017-05-25 15:58:59 -070077 "uevent_listener.cpp",
78 "ueventd_parser.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -070079 "util.cpp",
80 ],
81 whole_static_libs: ["libcap"],
82 static_libs: [
83 "libbase",
84 "libselinux",
85 "liblog",
86 "libprocessgroup",
Tom Cherry2a978d32017-08-09 17:13:21 -070087 "libfs_mgr",
Tom Cherry14fc0132017-05-09 17:11:57 -070088 ],
Tom Cherry2a978d32017-08-09 17:13:21 -070089 include_dirs: [
90 "system/core/mkbootimg",
91 ],
92
Tom Cherry14fc0132017-05-09 17:11:57 -070093}
94
95/*
96This is not yet ready, see the below TODOs for what is missing
97
98cc_binary {
99 // TODO: Missing,
100 //LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
101 //LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
102
103 name: "init",
104 defaults: ["init_defaults"],
Jin Qian00456972017-07-06 11:43:45 -0700105 required: [
106 "e2fsdroid",
107 "mke2fs",
108 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700109 static_executable: true,
110 srcs: [
111 "bootchart.cpp",
112 "builtins.cpp",
113 "init.cpp",
114 "init_first_stage.cpp",
115 "keychords.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700116 "reboot.cpp",
117 "signal_handler.cpp",
118 "ueventd.cpp",
119 "watchdogd.cpp",
120 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700121 static_libs: [
122 "libinit",
123 "libbootloader_message",
124 "libfs_mgr",
125 "libfec",
126 "libfec_rs",
127 "libsquashfs_utils",
128 "liblogwrap",
129 "libext4_utils",
130 "libcutils",
131 "libbase",
132 "libc",
133 "libselinux",
134 "liblog",
135 "libcrypto_utils",
136 "libcrypto",
137 "libc++_static",
138 "libdl",
139 "libsparse",
140 "libz",
141 "libprocessgroup",
142 "libavb",
143 "libkeyutils",
144 ],
145 symlinks: [
146 "sbin/ueventd",
147 "sbin/watchdogd",
148 ],
149}
150*/
151
152// Tests
153// ------------------------------------------------------------------------------
154
155cc_test {
156 name: "init_tests",
157 defaults: ["init_defaults"],
158 srcs: [
159 "devices_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700160 "init_test.cpp",
161 "property_service_test.cpp",
Tom Cherry62ca6632017-08-03 12:54:07 -0700162 "result_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700163 "service_test.cpp",
Tom Cherryc2e181c2017-07-14 16:29:23 -0700164 "ueventd_test.cpp",
Tom Cherry14fc0132017-05-09 17:11:57 -0700165 "util_test.cpp",
166 ],
167 shared_libs: [
168 "libbase",
169 "libcutils",
Tom Cherry14fc0132017-05-09 17:11:57 -0700170 ],
Tom Cherry45a9d672017-08-09 17:09:04 -0700171 static_libs: [
172 "libinit",
173 "libselinux",
174 "libcrypto",
175 ],
Tom Cherry14fc0132017-05-09 17:11:57 -0700176}
177
178subdirs = ["*"]