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", |
| 55 | generated_headers: ["oemaids_header_gen"], |
| 56 | export_generated_headers: ["oemaids_header_gen"], |
| 57 | } |
| 58 | |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame^] | 59 | // Generate the */etc/passwd text files for the target |
| 60 | // These files may be empty if no AIDs are defined in |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 61 | // TARGET_FS_CONFIG_GEN files. |
| 62 | genrule { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame^] | 63 | name: "passwd_gen_system", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 64 | tool_files: ["fs_config_generator.py"], |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame^] | 65 | 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] | 66 | srcs: [ |
| 67 | ":target_fs_config_gen", |
| 68 | ":android_filesystem_config_header", |
| 69 | ], |
| 70 | out: ["passwd"], |
| 71 | } |
| 72 | |
| 73 | prebuilt_etc { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame^] | 74 | name: "passwd_system", |
| 75 | filename: "passwd", |
| 76 | src: ":passwd_gen_system", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 77 | } |
| 78 | |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame^] | 79 | genrule { |
| 80 | name: "passwd_gen_vendor", |
| 81 | tool_files: ["fs_config_generator.py"], |
| 82 | cmd: "$(location fs_config_generator.py) passwd --partition=vendor --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", |
| 83 | srcs: [ |
| 84 | ":target_fs_config_gen", |
| 85 | ":android_filesystem_config_header", |
| 86 | ], |
| 87 | out: ["passwd"], |
| 88 | } |
| 89 | |
| 90 | prebuilt_etc { |
| 91 | name: "passwd_vendor", |
| 92 | filename: "passwd", |
| 93 | vendor: true, |
| 94 | src: ":passwd_gen_vendor", |
| 95 | } |
| 96 | |
| 97 | genrule { |
| 98 | name: "passwd_gen_odm", |
| 99 | tool_files: ["fs_config_generator.py"], |
| 100 | cmd: "$(location fs_config_generator.py) passwd --partition=odm --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", |
| 101 | srcs: [ |
| 102 | ":target_fs_config_gen", |
| 103 | ":android_filesystem_config_header", |
| 104 | ], |
| 105 | out: ["passwd"], |
| 106 | } |
| 107 | |
| 108 | prebuilt_etc { |
| 109 | name: "passwd_odm", |
| 110 | filename: "passwd", |
| 111 | device_specific: true, |
| 112 | src: ":passwd_gen_odm", |
| 113 | } |
| 114 | |
| 115 | genrule { |
| 116 | name: "passwd_gen_product", |
| 117 | tool_files: ["fs_config_generator.py"], |
| 118 | cmd: "$(location fs_config_generator.py) passwd --partition=product --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", |
| 119 | srcs: [ |
| 120 | ":target_fs_config_gen", |
| 121 | ":android_filesystem_config_header", |
| 122 | ], |
| 123 | out: ["passwd"], |
| 124 | } |
| 125 | |
| 126 | prebuilt_etc { |
| 127 | name: "passwd_product", |
| 128 | filename: "passwd", |
| 129 | product_specific: true, |
| 130 | src: ":passwd_gen_product", |
| 131 | } |
| 132 | |
| 133 | genrule { |
| 134 | name: "passwd_gen_system_ext", |
| 135 | tool_files: ["fs_config_generator.py"], |
| 136 | cmd: "$(location fs_config_generator.py) passwd --partition=system_ext --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", |
| 137 | srcs: [ |
| 138 | ":target_fs_config_gen", |
| 139 | ":android_filesystem_config_header", |
| 140 | ], |
| 141 | out: ["passwd"], |
| 142 | } |
| 143 | |
| 144 | prebuilt_etc { |
| 145 | name: "passwd_system_ext", |
| 146 | filename: "passwd", |
| 147 | system_ext_specific: true, |
| 148 | src: ":passwd_gen_system_ext", |
| 149 | } |
| 150 | |
| 151 | // Generate the */etc/group text files for the target |
| 152 | // These files may be empty if no AIDs are defined in |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 153 | // TARGET_FS_CONFIG_GEN files. |
| 154 | genrule { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame^] | 155 | name: "group_gen_system", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 156 | tool_files: ["fs_config_generator.py"], |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame^] | 157 | 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] | 158 | srcs: [ |
| 159 | ":target_fs_config_gen", |
| 160 | ":android_filesystem_config_header", |
| 161 | ], |
| 162 | out: ["group"], |
| 163 | } |
| 164 | |
| 165 | prebuilt_etc { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame^] | 166 | name: "group_system", |
| 167 | filename: "group", |
| 168 | src: ":group_gen_system", |
| 169 | } |
| 170 | |
| 171 | genrule { |
| 172 | name: "group_gen_vendor", |
| 173 | tool_files: ["fs_config_generator.py"], |
| 174 | cmd: "$(location fs_config_generator.py) group --partition=vendor --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", |
| 175 | srcs: [ |
| 176 | ":target_fs_config_gen", |
| 177 | ":android_filesystem_config_header", |
| 178 | ], |
| 179 | out: ["group"], |
| 180 | } |
| 181 | |
| 182 | prebuilt_etc { |
| 183 | name: "group_vendor", |
| 184 | filename: "group", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 185 | vendor: true, |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame^] | 186 | src: ":group_gen_vendor", |
| 187 | } |
| 188 | |
| 189 | genrule { |
| 190 | name: "group_gen_odm", |
| 191 | tool_files: ["fs_config_generator.py"], |
| 192 | cmd: "$(location fs_config_generator.py) group --partition=odm --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", |
| 193 | srcs: [ |
| 194 | ":target_fs_config_gen", |
| 195 | ":android_filesystem_config_header", |
| 196 | ], |
| 197 | out: ["group"], |
| 198 | } |
| 199 | |
| 200 | prebuilt_etc { |
| 201 | name: "group_odm", |
| 202 | filename: "group", |
| 203 | device_specific: true, |
| 204 | src: ":group_gen_odm", |
| 205 | } |
| 206 | |
| 207 | genrule { |
| 208 | name: "group_gen_product", |
| 209 | tool_files: ["fs_config_generator.py"], |
| 210 | cmd: "$(location fs_config_generator.py) group --partition=product --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", |
| 211 | srcs: [ |
| 212 | ":target_fs_config_gen", |
| 213 | ":android_filesystem_config_header", |
| 214 | ], |
| 215 | out: ["group"], |
| 216 | } |
| 217 | |
| 218 | prebuilt_etc { |
| 219 | name: "group_product", |
| 220 | filename: "group", |
| 221 | product_specific: true, |
| 222 | src: ":group_gen_product", |
| 223 | } |
| 224 | |
| 225 | genrule { |
| 226 | name: "group_gen_system_ext", |
| 227 | tool_files: ["fs_config_generator.py"], |
| 228 | cmd: "$(location fs_config_generator.py) group --partition=system_ext --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)", |
| 229 | srcs: [ |
| 230 | ":target_fs_config_gen", |
| 231 | ":android_filesystem_config_header", |
| 232 | ], |
| 233 | out: ["group"], |
| 234 | } |
| 235 | |
| 236 | prebuilt_etc { |
| 237 | name: "group_system_ext", |
| 238 | filename: "group", |
| 239 | system_ext_specific: true, |
| 240 | src: ":group_gen_system_ext", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 241 | } |