Dan Willemsen | c0a0f2d | 2017-09-09 13:37:03 -0700 | [diff] [blame] | 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 | |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 15 | bootstrap_go_package { |
| 16 | name: "soong-fs_config", |
| 17 | pkgPath: "android/soong/fs_config", |
| 18 | deps: [ |
| 19 | "soong-android", |
| 20 | "soong-genrule", |
| 21 | ], |
| 22 | srcs: [ |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 23 | "fs_config.go", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 24 | ], |
| 25 | pluginFor: ["soong_build"], |
| 26 | } |
| 27 | |
Dan Willemsen | c0a0f2d | 2017-09-09 13:37:03 -0700 | [diff] [blame] | 28 | cc_binary_host { |
| 29 | name: "fs_config", |
| 30 | srcs: ["fs_config.c"], |
| 31 | shared_libs: [ |
| 32 | "libcutils", |
| 33 | "libselinux", |
| 34 | ], |
| 35 | cflags: ["-Werror"], |
| 36 | } |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 37 | |
| 38 | target_fs_config_gen_filegroup { |
| 39 | name: "target_fs_config_gen", |
| 40 | } |
| 41 | |
| 42 | genrule { |
| 43 | name: "oemaids_header_gen", |
| 44 | tool_files: ["fs_config_generator.py"], |
Dan Willemsen | 7f25f2a | 2019-04-18 10:10:34 -0700 | [diff] [blame] | 45 | cmd: "$(location fs_config_generator.py) oemaid --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 46 | srcs: [ |
| 47 | ":target_fs_config_gen", |
| 48 | ":android_filesystem_config_header", |
| 49 | ], |
| 50 | out: ["generated_oem_aid.h"], |
| 51 | } |
| 52 | |
| 53 | cc_library_headers { |
| 54 | name: "oemaids_headers", |
P.Adarsh Reddy | 8b2e7c9 | 2020-02-18 14:53:22 +0530 | [diff] [blame^] | 55 | vendor_available: true, |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 56 | generated_headers: ["oemaids_header_gen"], |
| 57 | export_generated_headers: ["oemaids_header_gen"], |
| 58 | } |
| 59 | |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 60 | // Generate the */etc/passwd text files for the target |
| 61 | // These files may be empty if no AIDs are defined in |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 62 | // TARGET_FS_CONFIG_GEN files. |
| 63 | genrule { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 64 | name: "passwd_gen_system", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 65 | tool_files: ["fs_config_generator.py"], |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 66 | cmd: "$(location fs_config_generator.py) passwd --partition=system --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 67 | srcs: [ |
| 68 | ":target_fs_config_gen", |
| 69 | ":android_filesystem_config_header", |
| 70 | ], |
| 71 | out: ["passwd"], |
| 72 | } |
| 73 | |
| 74 | prebuilt_etc { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 75 | name: "passwd_system", |
| 76 | filename: "passwd", |
| 77 | src: ":passwd_gen_system", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 78 | } |
| 79 | |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 80 | genrule { |
| 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 | |
| 91 | prebuilt_etc { |
| 92 | name: "passwd_vendor", |
| 93 | filename: "passwd", |
| 94 | vendor: true, |
| 95 | src: ":passwd_gen_vendor", |
| 96 | } |
| 97 | |
| 98 | genrule { |
| 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 | |
| 109 | prebuilt_etc { |
| 110 | name: "passwd_odm", |
| 111 | filename: "passwd", |
| 112 | device_specific: true, |
| 113 | src: ":passwd_gen_odm", |
| 114 | } |
| 115 | |
| 116 | genrule { |
| 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 | |
| 127 | prebuilt_etc { |
| 128 | name: "passwd_product", |
| 129 | filename: "passwd", |
| 130 | product_specific: true, |
| 131 | src: ":passwd_gen_product", |
| 132 | } |
| 133 | |
| 134 | genrule { |
| 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 | |
| 145 | prebuilt_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 |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 154 | // TARGET_FS_CONFIG_GEN files. |
| 155 | genrule { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 156 | name: "group_gen_system", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 157 | tool_files: ["fs_config_generator.py"], |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 158 | cmd: "$(location fs_config_generator.py) group --partition=system --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 159 | srcs: [ |
| 160 | ":target_fs_config_gen", |
| 161 | ":android_filesystem_config_header", |
| 162 | ], |
| 163 | out: ["group"], |
| 164 | } |
| 165 | |
| 166 | prebuilt_etc { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 167 | name: "group_system", |
| 168 | filename: "group", |
| 169 | src: ":group_gen_system", |
| 170 | } |
| 171 | |
| 172 | genrule { |
| 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 | |
| 183 | prebuilt_etc { |
| 184 | name: "group_vendor", |
| 185 | filename: "group", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 186 | vendor: true, |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 187 | src: ":group_gen_vendor", |
| 188 | } |
| 189 | |
| 190 | genrule { |
| 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 | |
| 201 | prebuilt_etc { |
| 202 | name: "group_odm", |
| 203 | filename: "group", |
| 204 | device_specific: true, |
| 205 | src: ":group_gen_odm", |
| 206 | } |
| 207 | |
| 208 | genrule { |
| 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 | |
| 219 | prebuilt_etc { |
| 220 | name: "group_product", |
| 221 | filename: "group", |
| 222 | product_specific: true, |
| 223 | src: ":group_gen_product", |
| 224 | } |
| 225 | |
| 226 | genrule { |
| 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 | |
| 237 | prebuilt_etc { |
| 238 | name: "group_system_ext", |
| 239 | filename: "group", |
| 240 | system_ext_specific: true, |
| 241 | src: ":group_gen_system_ext", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 242 | } |