1// Copyright (C) 2008 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package { 16 // See: http://go/android-license-faq 17 // A large-scale-change added 'default_applicable_licenses' to import 18 // all of the 'license_kinds' from "build_make_license" 19 // to get the below license kinds: 20 // legacy_restricted 21 default_applicable_licenses: ["build_make_license"], 22} 23 24bootstrap_go_package { 25 name: "soong-fs_config", 26 pkgPath: "android/soong/fs_config", 27 deps: [ 28 "soong-android", 29 "soong-genrule", 30 ], 31 srcs: [ 32 "fs_config.go", 33 ], 34 pluginFor: ["soong_build"], 35} 36 37cc_binary_host { 38 name: "fs_config", 39 srcs: ["fs_config.c"], 40 shared_libs: [ 41 "libcutils", 42 "libselinux", 43 ], 44 cflags: ["-Werror"], 45} 46 47target_fs_config_gen_filegroup { 48 name: "target_fs_config_gen", 49} 50 51genrule { 52 name: "oemaids_header_gen", 53 tool_files: ["fs_config_generator.py"], 54 cmd: "$(location fs_config_generator.py) oemaid --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 55 srcs: [ 56 ":target_fs_config_gen", 57 ":android_filesystem_config_header", 58 ], 59 out: ["generated_oem_aid.h"], 60} 61 62cc_library_headers { 63 name: "oemaids_headers", 64 vendor_available: true, 65 generated_headers: ["oemaids_header_gen"], 66 export_generated_headers: ["oemaids_header_gen"], 67} 68 69// Generate the */etc/passwd text files for the target 70// These files may be empty if no AIDs are defined in 71// TARGET_FS_CONFIG_GEN files. 72genrule { 73 name: "passwd_gen_system", 74 tool_files: ["fs_config_generator.py"], 75 cmd: "$(location fs_config_generator.py) passwd --partition=system --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 76 srcs: [ 77 ":target_fs_config_gen", 78 ":android_filesystem_config_header", 79 ], 80 out: ["passwd"], 81} 82 83prebuilt_etc { 84 name: "passwd_system", 85 filename: "passwd", 86 src: ":passwd_gen_system", 87} 88 89genrule { 90 name: "passwd_gen_vendor", 91 tool_files: ["fs_config_generator.py"], 92 cmd: "$(location fs_config_generator.py) passwd --partition=vendor --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 93 srcs: [ 94 ":target_fs_config_gen", 95 ":android_filesystem_config_header", 96 ], 97 out: ["passwd"], 98} 99 100prebuilt_etc { 101 name: "passwd_vendor", 102 filename: "passwd", 103 vendor: true, 104 src: ":passwd_gen_vendor", 105} 106 107genrule { 108 name: "passwd_gen_odm", 109 tool_files: ["fs_config_generator.py"], 110 cmd: "$(location fs_config_generator.py) passwd --partition=odm --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 111 srcs: [ 112 ":target_fs_config_gen", 113 ":android_filesystem_config_header", 114 ], 115 out: ["passwd"], 116} 117 118prebuilt_etc { 119 name: "passwd_odm", 120 filename: "passwd", 121 device_specific: true, 122 src: ":passwd_gen_odm", 123} 124 125genrule { 126 name: "passwd_gen_product", 127 tool_files: ["fs_config_generator.py"], 128 cmd: "$(location fs_config_generator.py) passwd --partition=product --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 129 srcs: [ 130 ":target_fs_config_gen", 131 ":android_filesystem_config_header", 132 ], 133 out: ["passwd"], 134} 135 136prebuilt_etc { 137 name: "passwd_product", 138 filename: "passwd", 139 product_specific: true, 140 src: ":passwd_gen_product", 141} 142 143genrule { 144 name: "passwd_gen_system_ext", 145 tool_files: ["fs_config_generator.py"], 146 cmd: "$(location fs_config_generator.py) passwd --partition=system_ext --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 147 srcs: [ 148 ":target_fs_config_gen", 149 ":android_filesystem_config_header", 150 ], 151 out: ["passwd"], 152} 153 154prebuilt_etc { 155 name: "passwd_system_ext", 156 filename: "passwd", 157 system_ext_specific: true, 158 src: ":passwd_gen_system_ext", 159} 160 161// Generate the */etc/group text files for the target 162// These files may be empty if no AIDs are defined in 163// TARGET_FS_CONFIG_GEN files. 164genrule { 165 name: "group_gen_system", 166 tool_files: ["fs_config_generator.py"], 167 cmd: "$(location fs_config_generator.py) group --partition=system --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 168 srcs: [ 169 ":target_fs_config_gen", 170 ":android_filesystem_config_header", 171 ], 172 out: ["group"], 173} 174 175prebuilt_etc { 176 name: "group_system", 177 filename: "group", 178 src: ":group_gen_system", 179} 180 181genrule { 182 name: "group_gen_vendor", 183 tool_files: ["fs_config_generator.py"], 184 cmd: "$(location fs_config_generator.py) group --partition=vendor --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 185 srcs: [ 186 ":target_fs_config_gen", 187 ":android_filesystem_config_header", 188 ], 189 out: ["group"], 190} 191 192prebuilt_etc { 193 name: "group_vendor", 194 filename: "group", 195 vendor: true, 196 src: ":group_gen_vendor", 197} 198 199genrule { 200 name: "group_gen_odm", 201 tool_files: ["fs_config_generator.py"], 202 cmd: "$(location fs_config_generator.py) group --partition=odm --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 203 srcs: [ 204 ":target_fs_config_gen", 205 ":android_filesystem_config_header", 206 ], 207 out: ["group"], 208} 209 210prebuilt_etc { 211 name: "group_odm", 212 filename: "group", 213 device_specific: true, 214 src: ":group_gen_odm", 215} 216 217genrule { 218 name: "group_gen_product", 219 tool_files: ["fs_config_generator.py"], 220 cmd: "$(location fs_config_generator.py) group --partition=product --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 221 srcs: [ 222 ":target_fs_config_gen", 223 ":android_filesystem_config_header", 224 ], 225 out: ["group"], 226} 227 228prebuilt_etc { 229 name: "group_product", 230 filename: "group", 231 product_specific: true, 232 src: ":group_gen_product", 233} 234 235genrule { 236 name: "group_gen_system_ext", 237 tool_files: ["fs_config_generator.py"], 238 cmd: "$(location fs_config_generator.py) group --partition=system_ext --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 239 srcs: [ 240 ":target_fs_config_gen", 241 ":android_filesystem_config_header", 242 ], 243 out: ["group"], 244} 245 246prebuilt_etc { 247 name: "group_system_ext", 248 filename: "group", 249 system_ext_specific: true, 250 src: ":group_gen_system_ext", 251} 252