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