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 "-Wall", 29 "-Werror", 30 ], 31 export_include_dirs: ["include"], 32 srcs: [ 33 "snapuserd_client.cpp", 34 ], 35} 36 37cc_library_static { 38 name: "libsnapshot_snapuserd", 39 defaults: [ 40 "libsnapshot_snapuserd_defaults", 41 ], 42 recovery_available: true, 43 static_libs: [ 44 "libcutils_sockets", 45 ], 46 shared_libs: [ 47 "libbase", 48 "liblog", 49 ], 50 export_include_dirs: ["include"], 51 ramdisk_available: true, 52} 53 54cc_defaults { 55 name: "snapuserd_defaults", 56 defaults: [ 57 "fs_mgr_defaults", 58 ], 59 srcs: [ 60 "dm-snapshot-merge/snapuserd_server.cpp", 61 "dm-snapshot-merge/snapuserd.cpp", 62 "dm-snapshot-merge/snapuserd_worker.cpp", 63 "dm-snapshot-merge/snapuserd_readahead.cpp", 64 "snapuserd_daemon.cpp", 65 "snapuserd_buffer.cpp", 66 "user-space-merge/snapuserd_core.cpp", 67 "user-space-merge/snapuserd_dm_user.cpp", 68 "user-space-merge/snapuserd_merge.cpp", 69 "user-space-merge/snapuserd_readahead.cpp", 70 "user-space-merge/snapuserd_transitions.cpp", 71 "user-space-merge/snapuserd_server.cpp", 72 "user-space-merge/snapuserd_verify.cpp", 73 ], 74 75 cflags: [ 76 "-Wall", 77 "-Werror" 78 ], 79 80 static_libs: [ 81 "libbase", 82 "libbrotli", 83 "libcutils_sockets", 84 "libdm", 85 "libfs_mgr", 86 "libgflags", 87 "liblog", 88 "libsnapshot_cow", 89 "libz", 90 "libext4_utils", 91 "liburing", 92 ], 93 94 header_libs: [ 95 "libstorage_literals_headers", 96 ], 97 98 include_dirs: ["bionic/libc/kernel"], 99} 100 101cc_binary { 102 name: "snapuserd", 103 defaults: ["snapuserd_defaults"], 104 init_rc: [ 105 "snapuserd.rc", 106 ], 107 108 // snapuserd is started during early boot by first-stage init. At that 109 // point, /system is mounted using the "dm-user" device-mapper kernel 110 // module. dm-user routes all I/O to userspace to be handled by 111 // snapuserd, which would lead to deadlock if we had to handle page 112 // faults for its code pages. 113 static_executable: true, 114 115 system_shared_libs: [], 116 ramdisk_available: true, 117 vendor_ramdisk_available: true, 118 recovery_available: true, 119 120 // Snapuserd segfaults with ThinLTO 121 // http://b/208565717 122 lto: { 123 never: true, 124 } 125} 126 127cc_test { 128 name: "cow_snapuserd_test", 129 defaults: [ 130 "fs_mgr_defaults", 131 ], 132 srcs: [ 133 "dm-snapshot-merge/cow_snapuserd_test.cpp", 134 "dm-snapshot-merge/snapuserd.cpp", 135 "dm-snapshot-merge/snapuserd_worker.cpp", 136 "snapuserd_buffer.cpp", 137 ], 138 cflags: [ 139 "-Wall", 140 "-Werror", 141 ], 142 shared_libs: [ 143 "libbase", 144 "liblog", 145 ], 146 static_libs: [ 147 "libbrotli", 148 "libgtest", 149 "libsnapshot_cow", 150 "libsnapshot_snapuserd", 151 "libcutils_sockets", 152 "libz", 153 "libfs_mgr", 154 "libdm", 155 "libext4_utils", 156 ], 157 header_libs: [ 158 "libstorage_literals_headers", 159 "libfiemap_headers", 160 ], 161 test_options: { 162 min_shipping_api_level: 30, 163 }, 164 auto_gen_config: true, 165 require_root: false, 166} 167 168cc_test { 169 name: "snapuserd_test", 170 defaults: [ 171 "fs_mgr_defaults", 172 ], 173 srcs: [ 174 "user-space-merge/snapuserd_test.cpp", 175 ], 176 cflags: [ 177 "-Wall", 178 "-Werror", 179 ], 180 shared_libs: [ 181 "libbase", 182 "liblog", 183 ], 184 static_libs: [ 185 "libbrotli", 186 "libgtest", 187 "libsnapshot_cow", 188 "libsnapshot_snapuserd", 189 "libcutils_sockets", 190 "libz", 191 "libfs_mgr", 192 "libdm", 193 "libext4_utils", 194 "liburing", 195 "libgflags", 196 ], 197 include_dirs: ["bionic/libc/kernel"], 198 header_libs: [ 199 "libstorage_literals_headers", 200 "libfiemap_headers", 201 ], 202 test_options: { 203 min_shipping_api_level: 30, 204 }, 205 auto_gen_config: true, 206 require_root: false, 207} 208