• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// Copyright (C) 2018 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
17package {
18    default_team: "trendy_team_android_kernel",
19    default_applicable_licenses: ["Android-Apache-2.0"],
20}
21
22cc_defaults {
23    name: "libsnapuserd_client_defaults",
24    defaults: [
25        "fs_mgr_defaults",
26    ],
27    cflags: [
28        "-D_FILE_OFFSET_BITS=64",
29    ],
30    export_include_dirs: ["include"],
31    srcs: [
32        "snapuserd_client.cpp",
33    ],
34}
35
36cc_library_static {
37    name: "libsnapuserd_client",
38    defaults: [
39        "fs_mgr_defaults",
40        "libsnapuserd_client_defaults",
41    ],
42    recovery_available: true,
43    static_libs: [
44        "libcutils_sockets",
45        "libfs_mgr_file_wait",
46        "libdm",
47    ],
48    shared_libs: [
49        "libbase",
50        "liblog",
51    ],
52    export_include_dirs: ["include"],
53    ramdisk_available: true,
54    vendor_ramdisk_available: true,
55}
56
57cc_library_static {
58    name: "libsnapuserd",
59    defaults: [
60        "fs_mgr_defaults",
61    ],
62    local_include_dirs: ["include/"],
63    srcs: [
64        "dm_user_block_server.cpp",
65        "snapuserd_buffer.cpp",
66        "user-space-merge/handler_manager.cpp",
67        "user-space-merge/merge_worker.cpp",
68        "user-space-merge/read_worker.cpp",
69        "user-space-merge/snapuserd_core.cpp",
70        "user-space-merge/snapuserd_readahead.cpp",
71        "user-space-merge/snapuserd_transitions.cpp",
72        "user-space-merge/snapuserd_verify.cpp",
73        "user-space-merge/worker.cpp",
74        "utility.cpp",
75    ],
76    cflags: [
77        "-D_FILE_OFFSET_BITS=64",
78        "-Wall",
79        "-Werror",
80    ],
81    static_libs: [
82        "libbase",
83        "libdm",
84        "libext2_uuid",
85        "libext4_utils",
86        "libsnapshot_cow",
87        "liburing",
88        "libprocessgroup",
89        "libprocessgroup_util",
90        "libjsoncpp",
91        "liburing_cpp",
92    ],
93    export_include_dirs: ["include"],
94    header_libs: [
95        "libcutils_headers",
96        "libstorage_literals_headers",
97    ],
98    ramdisk_available: true,
99    vendor_ramdisk_available: true,
100    recovery_available: true,
101    host_supported: true,
102}
103
104cc_defaults {
105    name: "snapuserd_defaults",
106    defaults: [
107        "fs_mgr_defaults",
108    ],
109    srcs: [
110        "snapuserd_daemon.cpp",
111        "user-space-merge/snapuserd_server.cpp",
112    ],
113
114    cflags: [
115        "-D_FILE_OFFSET_BITS=64",
116        "-Wall",
117        "-Werror",
118    ],
119
120    static_libs: [
121        "libbase",
122        "libbrotli",
123        "libcutils_sockets",
124        "libdm",
125        "libext2_uuid",
126        "libfs_mgr_file_wait",
127        "libgflags",
128        "liblog",
129        "libsnapshot_cow",
130        "libsnapuserd",
131        "libprocessgroup",
132        "libprocessgroup_util",
133        "libjsoncpp",
134        "libsnapuserd_client",
135        "libz",
136        "liblz4",
137        "libext4_utils",
138        "liburing",
139        "libzstd",
140        "liburing_cpp",
141    ],
142
143    header_libs: [
144        "libcutils_headers",
145        "libstorage_literals_headers",
146    ],
147
148    system_shared_libs: [],
149
150    // snapuserd is started during early boot by first-stage init. At that
151    // point, /system is mounted using the "dm-user" device-mapper kernel
152    // module. dm-user routes all I/O to userspace to be handled by
153    // snapuserd, which would lead to deadlock if we had to handle page
154    // faults for its code pages.
155    static_executable: true,
156}
157
158cc_binary {
159    name: "snapuserd",
160    defaults: ["snapuserd_defaults"],
161    init_rc: [
162        "snapuserd.rc",
163    ],
164    static_libs: [
165        "libsnapuserd_client",
166    ],
167    ramdisk_available: false,
168    vendor_ramdisk_available: true,
169    recovery_available: true,
170}
171
172// This target will install to /system/bin/snapuserd_ramdisk
173// It will also create a symblink on /system/bin/snapuserd that point to
174// /system/bin/snapuserd_ramdisk .
175// This way, init can check if generic ramdisk copy exists.
176cc_binary {
177    name: "snapuserd_ramdisk",
178    defaults: ["snapuserd_defaults"],
179    init_rc: [
180        "snapuserd.rc",
181    ],
182    // This target is specifically for generic ramdisk, therefore we set
183    // vendor_ramdisk_available to false.
184    ramdisk_available: true,
185    vendor_ramdisk_available: false,
186    ramdisk: true,
187    symlinks: ["snapuserd"],
188}
189
190cc_defaults {
191    name: "snapuserd_test_defaults",
192    defaults: [
193        "fs_mgr_defaults",
194        "libsnapshot_cow_defaults",
195    ],
196    srcs: [
197        "testing/dm_user_harness.cpp",
198        "testing/harness.cpp",
199        "testing/host_harness.cpp",
200        "user-space-merge/snapuserd_test.cpp",
201    ],
202    cflags: [
203        "-D_FILE_OFFSET_BITS=64",
204        "-Wall",
205        "-Werror",
206    ],
207    shared_libs: [
208        "libbase",
209        "liblog",
210    ],
211    static_libs: [
212        "libbrotli",
213        "libcutils_sockets",
214        "libdm",
215        "libext2_uuid",
216        "libext4_utils",
217        "libfs_mgr_file_wait",
218        "libgflags",
219        "libgtest",
220        "libsnapshot_cow",
221        "libsnapuserd",
222        "libprocessgroup",
223        "libprocessgroup_util",
224        "libjsoncpp",
225        "liburing",
226        "libz",
227        "liburing_cpp",
228    ],
229    include_dirs: [
230        ".",
231    ],
232    header_libs: [
233        "libstorage_literals_headers",
234        "libfiemap_headers",
235        "libcutils_headers",
236    ],
237    test_options: {
238        min_shipping_api_level: 30,
239    },
240
241    compile_multilib: "both",
242    multilib: {
243        lib32: {
244            suffix: "32",
245        },
246        lib64: {
247            suffix: "64",
248        },
249    },
250
251    auto_gen_config: true,
252    require_root: true,
253}
254
255cc_test {
256    name: "snapuserd_test",
257    defaults: ["snapuserd_test_defaults"],
258    host_supported: true,
259    test_suites: [
260        "general-tests",
261    ],
262    test_options: {
263        test_runner_options: [
264            {
265                name: "force-no-test-error",
266                value: "false",
267            },
268            {
269                name: "native-test-timeout",
270                value: "15m",
271            },
272        ],
273    },
274}
275
276// vts tests cannot be host_supported.
277cc_test {
278    name: "vts_snapuserd_test",
279    defaults: ["snapuserd_test_defaults"],
280    test_suites: [
281        "vts",
282    ],
283    test_options: {
284        // VABC mandatory in Android T per VSR.
285        min_shipping_api_level: 32,
286    },
287}
288
289cc_binary_host {
290    name: "snapuserd_extractor",
291    defaults: [
292        "fs_mgr_defaults",
293        "libsnapshot_cow_defaults",
294    ],
295    srcs: [
296        "testing/dm_user_harness.cpp",
297        "testing/harness.cpp",
298        "testing/host_harness.cpp",
299        "user-space-merge/extractor.cpp",
300        "snapuserd_extractor.cpp",
301    ],
302    cflags: [
303        "-D_FILE_OFFSET_BITS=64",
304        "-Wall",
305        "-Werror",
306    ],
307    shared_libs: [
308        "libbase",
309        "liblog",
310    ],
311    static_libs: [
312        "libbrotli",
313        "libcutils_sockets",
314        "libdm",
315        "libext2_uuid",
316        "libext4_utils",
317        "libfs_mgr_file_wait",
318        "libgflags",
319        "libsnapshot_cow",
320        "libsnapuserd",
321        "libprocessgroup",
322        "libjsoncpp",
323        "liburing",
324        "libz",
325        "liburing_cpp",
326    ],
327    include_dirs: [
328        ".",
329    ],
330    header_libs: [
331        "libstorage_literals_headers",
332        "libfiemap_headers",
333        "libcutils_headers",
334    ],
335}
336