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 15bootstrap_go_package { 16 name: "soong-fs_config", 17 pkgPath: "android/soong/fs_config", 18 deps: [ 19 "soong-android", 20 "soong-genrule", 21 ], 22 srcs: [ 23 "fs_config.go", 24 ], 25 pluginFor: ["soong_build"], 26} 27 28cc_binary_host { 29 name: "fs_config", 30 srcs: ["fs_config.c"], 31 shared_libs: [ 32 "libcutils", 33 "libselinux", 34 ], 35 cflags: ["-Werror"], 36} 37 38target_fs_config_gen_filegroup { 39 name: "target_fs_config_gen", 40} 41 42genrule { 43 name: "oemaids_header_gen", 44 tool_files: ["fs_config_generator.py"], 45 cmd: "$(location fs_config_generator.py) oemaid --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 46 srcs: [ 47 ":target_fs_config_gen", 48 ":android_filesystem_config_header", 49 ], 50 out: ["generated_oem_aid.h"], 51} 52 53cc_library_headers { 54 name: "oemaids_headers", 55 vendor_available: true, 56 generated_headers: ["oemaids_header_gen"], 57 export_generated_headers: ["oemaids_header_gen"], 58} 59 60// Generate the */etc/passwd text files for the target 61// These files may be empty if no AIDs are defined in 62// TARGET_FS_CONFIG_GEN files. 63genrule { 64 name: "passwd_gen_system", 65 tool_files: ["fs_config_generator.py"], 66 cmd: "$(location fs_config_generator.py) passwd --partition=system --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 67 srcs: [ 68 ":target_fs_config_gen", 69 ":android_filesystem_config_header", 70 ], 71 out: ["passwd"], 72} 73 74prebuilt_etc { 75 name: "passwd_system", 76 filename: "passwd", 77 src: ":passwd_gen_system", 78} 79 80genrule { 81 name: "passwd_gen_vendor", 82 tool_files: ["fs_config_generator.py"], 83 cmd: "$(location fs_config_generator.py) passwd --partition=vendor --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 84 srcs: [ 85 ":target_fs_config_gen", 86 ":android_filesystem_config_header", 87 ], 88 out: ["passwd"], 89} 90 91prebuilt_etc { 92 name: "passwd_vendor", 93 filename: "passwd", 94 vendor: true, 95 src: ":passwd_gen_vendor", 96} 97 98genrule { 99 name: "passwd_gen_odm", 100 tool_files: ["fs_config_generator.py"], 101 cmd: "$(location fs_config_generator.py) passwd --partition=odm --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 102 srcs: [ 103 ":target_fs_config_gen", 104 ":android_filesystem_config_header", 105 ], 106 out: ["passwd"], 107} 108 109prebuilt_etc { 110 name: "passwd_odm", 111 filename: "passwd", 112 device_specific: true, 113 src: ":passwd_gen_odm", 114} 115 116genrule { 117 name: "passwd_gen_product", 118 tool_files: ["fs_config_generator.py"], 119 cmd: "$(location fs_config_generator.py) passwd --partition=product --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 120 srcs: [ 121 ":target_fs_config_gen", 122 ":android_filesystem_config_header", 123 ], 124 out: ["passwd"], 125} 126 127prebuilt_etc { 128 name: "passwd_product", 129 filename: "passwd", 130 product_specific: true, 131 src: ":passwd_gen_product", 132} 133 134genrule { 135 name: "passwd_gen_system_ext", 136 tool_files: ["fs_config_generator.py"], 137 cmd: "$(location fs_config_generator.py) passwd --partition=system_ext --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 138 srcs: [ 139 ":target_fs_config_gen", 140 ":android_filesystem_config_header", 141 ], 142 out: ["passwd"], 143} 144 145prebuilt_etc { 146 name: "passwd_system_ext", 147 filename: "passwd", 148 system_ext_specific: true, 149 src: ":passwd_gen_system_ext", 150} 151 152// Generate the */etc/group text files for the target 153// These files may be empty if no AIDs are defined in 154// TARGET_FS_CONFIG_GEN files. 155genrule { 156 name: "group_gen_system", 157 tool_files: ["fs_config_generator.py"], 158 cmd: "$(location fs_config_generator.py) group --partition=system --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 159 srcs: [ 160 ":target_fs_config_gen", 161 ":android_filesystem_config_header", 162 ], 163 out: ["group"], 164} 165 166prebuilt_etc { 167 name: "group_system", 168 filename: "group", 169 src: ":group_gen_system", 170} 171 172genrule { 173 name: "group_gen_vendor", 174 tool_files: ["fs_config_generator.py"], 175 cmd: "$(location fs_config_generator.py) group --partition=vendor --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 176 srcs: [ 177 ":target_fs_config_gen", 178 ":android_filesystem_config_header", 179 ], 180 out: ["group"], 181} 182 183prebuilt_etc { 184 name: "group_vendor", 185 filename: "group", 186 vendor: true, 187 src: ":group_gen_vendor", 188} 189 190genrule { 191 name: "group_gen_odm", 192 tool_files: ["fs_config_generator.py"], 193 cmd: "$(location fs_config_generator.py) group --partition=odm --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 194 srcs: [ 195 ":target_fs_config_gen", 196 ":android_filesystem_config_header", 197 ], 198 out: ["group"], 199} 200 201prebuilt_etc { 202 name: "group_odm", 203 filename: "group", 204 device_specific: true, 205 src: ":group_gen_odm", 206} 207 208genrule { 209 name: "group_gen_product", 210 tool_files: ["fs_config_generator.py"], 211 cmd: "$(location fs_config_generator.py) group --partition=product --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 212 srcs: [ 213 ":target_fs_config_gen", 214 ":android_filesystem_config_header", 215 ], 216 out: ["group"], 217} 218 219prebuilt_etc { 220 name: "group_product", 221 filename: "group", 222 product_specific: true, 223 src: ":group_gen_product", 224} 225 226genrule { 227 name: "group_gen_system_ext", 228 tool_files: ["fs_config_generator.py"], 229 cmd: "$(location fs_config_generator.py) group --partition=system_ext --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", 230 srcs: [ 231 ":target_fs_config_gen", 232 ":android_filesystem_config_header", 233 ], 234 out: ["group"], 235} 236 237prebuilt_etc { 238 name: "group_system_ext", 239 filename: "group", 240 system_ext_specific: true, 241 src: ":group_gen_system_ext", 242} 243