• 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_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21cc_defaults {
22    name: "libsnapshot_snapuserd_defaults",
23    defaults: [
24        "fs_mgr_defaults",
25    ],
26    cflags: [
27        "-D_FILE_OFFSET_BITS=64",
28    ],
29    export_include_dirs: ["include"],
30    srcs: [
31        "snapuserd_client.cpp",
32    ],
33}
34
35cc_library_static {
36    name: "libsnapshot_snapuserd",
37    defaults: [
38        "fs_mgr_defaults",
39        "libsnapshot_snapuserd_defaults",
40    ],
41    recovery_available: true,
42    static_libs: [
43        "libcutils_sockets",
44        "libfs_mgr",
45    ],
46    shared_libs: [
47        "libbase",
48        "liblog",
49    ],
50    export_include_dirs: ["include"],
51    ramdisk_available: true,
52    vendor_ramdisk_available: true,
53}
54
55cc_library_static {
56    name: "libsnapuserd",
57    defaults: [
58        "fs_mgr_defaults",
59    ],
60    srcs: [
61        "dm-snapshot-merge/snapuserd.cpp",
62        "dm-snapshot-merge/snapuserd_worker.cpp",
63        "dm-snapshot-merge/snapuserd_readahead.cpp",
64        "snapuserd_buffer.cpp",
65        "user-space-merge/snapuserd_core.cpp",
66        "user-space-merge/snapuserd_dm_user.cpp",
67        "user-space-merge/snapuserd_merge.cpp",
68        "user-space-merge/snapuserd_readahead.cpp",
69        "user-space-merge/snapuserd_transitions.cpp",
70        "user-space-merge/snapuserd_verify.cpp",
71    ],
72    static_libs: [
73        "libbase",
74        "libdm",
75        "libext4_utils",
76        "libsnapshot_cow",
77        "liburing",
78    ],
79    include_dirs: ["bionic/libc/kernel"],
80    header_libs: [
81        "libstorage_literals_headers",
82    ],
83    ramdisk_available: true,
84    vendor_ramdisk_available: true,
85    recovery_available: true,
86}
87
88cc_defaults {
89    name: "snapuserd_defaults",
90    defaults: [
91        "fs_mgr_defaults",
92    ],
93    srcs: [
94        "dm-snapshot-merge/snapuserd_server.cpp",
95        "snapuserd_daemon.cpp",
96        "user-space-merge/snapuserd_server.cpp",
97    ],
98
99    cflags: [
100        "-D_FILE_OFFSET_BITS=64",
101    ],
102
103    static_libs: [
104        "libbase",
105        "libbrotli",
106        "libcutils_sockets",
107        "libdm",
108        "libfs_mgr",
109        "libgflags",
110        "liblog",
111        "libsnapshot_cow",
112        "libsnapshot_snapuserd",
113        "libsnapuserd",
114        "libz",
115        "liblz4",
116        "libext4_utils",
117        "liburing",
118    ],
119
120    header_libs: [
121        "libstorage_literals_headers",
122    ],
123
124    include_dirs: ["bionic/libc/kernel"],
125    system_shared_libs: [],
126
127    // snapuserd is started during early boot by first-stage init. At that
128    // point, /system is mounted using the "dm-user" device-mapper kernel
129    // module. dm-user routes all I/O to userspace to be handled by
130    // snapuserd, which would lead to deadlock if we had to handle page
131    // faults for its code pages.
132    static_executable: true,
133
134    // Snapuserd segfaults with ThinLTO
135    // http://b/208565717
136    lto: {
137         never: true,
138    },
139}
140
141cc_binary {
142    name: "snapuserd",
143    defaults: ["snapuserd_defaults"],
144    init_rc: [
145        "snapuserd.rc",
146    ],
147    ramdisk_available: false,
148    vendor_ramdisk_available: true,
149}
150
151// This target will install to /system/bin/snapuserd_ramdisk
152// It will also create a symblink on /system/bin/snapuserd that point to
153// /system/bin/snapuserd_ramdisk .
154// This way, init can check if generic ramdisk copy exists.
155cc_binary {
156    name: "snapuserd_ramdisk",
157    defaults: ["snapuserd_defaults"],
158    init_rc: [
159        "snapuserd.rc",
160    ],
161    // This target is specifically for generic ramdisk, therefore we set
162    // vendor_ramdisk_available to false.
163    ramdisk_available: true,
164    vendor_ramdisk_available: false,
165    ramdisk: true,
166    symlinks: ["snapuserd"],
167}
168
169cc_test {
170    name: "cow_snapuserd_test",
171    defaults: [
172        "fs_mgr_defaults",
173        "libsnapshot_cow_defaults",
174    ],
175    srcs: [
176        "dm-snapshot-merge/cow_snapuserd_test.cpp",
177        "dm-snapshot-merge/snapuserd.cpp",
178        "dm-snapshot-merge/snapuserd_worker.cpp",
179        "snapuserd_buffer.cpp",
180    ],
181    shared_libs: [
182        "libbase",
183        "liblog",
184    ],
185    static_libs: [
186        "libbrotli",
187        "libgtest",
188        "libsnapshot_cow",
189        "libsnapshot_snapuserd",
190        "libcutils_sockets",
191        "libz",
192        "libfs_mgr",
193        "libdm",
194        "libext4_utils",
195    ],
196    header_libs: [
197        "libstorage_literals_headers",
198        "libfiemap_headers",
199    ],
200    test_options: {
201        min_shipping_api_level: 30,
202    },
203    auto_gen_config: true,
204    require_root: false,
205}
206
207cc_test {
208    name: "snapuserd_test",
209    defaults: [
210        "fs_mgr_defaults",
211        "libsnapshot_cow_defaults",
212    ],
213    srcs: [
214        "user-space-merge/snapuserd_test.cpp",
215    ],
216    shared_libs: [
217        "libbase",
218        "liblog",
219    ],
220    static_libs: [
221        "libbrotli",
222        "libgtest",
223        "libsnapshot_cow",
224        "libsnapshot_snapuserd",
225        "libcutils_sockets",
226        "libz",
227        "libfs_mgr",
228        "libdm",
229        "libext4_utils",
230        "liburing",
231        "libgflags",
232    ],
233    include_dirs: ["bionic/libc/kernel"],
234    header_libs: [
235        "libstorage_literals_headers",
236        "libfiemap_headers",
237    ],
238    test_options: {
239        min_shipping_api_level: 30,
240    },
241    auto_gen_config: true,
242    require_root: false,
243}
244