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 |
| 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 | |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 24 | bootstrap_go_package { |
| 25 | name: "soong-fs_config", |
| 26 | pkgPath: "android/soong/fs_config", |
| 27 | deps: [ |
| 28 | "soong-android", |
| 29 | "soong-genrule", |
| 30 | ], |
| 31 | srcs: [ |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 32 | "fs_config.go", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 33 | ], |
| 34 | pluginFor: ["soong_build"], |
| 35 | } |
| 36 | |
Dan Willemsen | c0a0f2d | 2017-09-09 13:37:03 -0700 | [diff] [blame] | 37 | cc_binary_host { |
| 38 | name: "fs_config", |
| 39 | srcs: ["fs_config.c"], |
| 40 | shared_libs: [ |
| 41 | "libcutils", |
| 42 | "libselinux", |
| 43 | ], |
| 44 | cflags: ["-Werror"], |
| 45 | } |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 46 | |
| 47 | target_fs_config_gen_filegroup { |
| 48 | name: "target_fs_config_gen", |
| 49 | } |
| 50 | |
| 51 | genrule { |
| 52 | name: "oemaids_header_gen", |
| 53 | tool_files: ["fs_config_generator.py"], |
Dan Willemsen | 7f25f2a | 2019-04-18 10:10:34 -0700 | [diff] [blame] | 54 | 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] | 55 | srcs: [ |
| 56 | ":target_fs_config_gen", |
| 57 | ":android_filesystem_config_header", |
| 58 | ], |
| 59 | out: ["generated_oem_aid.h"], |
| 60 | } |
| 61 | |
| 62 | cc_library_headers { |
| 63 | name: "oemaids_headers", |
P.Adarsh Reddy | 8b2e7c9 | 2020-02-18 14:53:22 +0530 | [diff] [blame] | 64 | vendor_available: true, |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 65 | generated_headers: ["oemaids_header_gen"], |
| 66 | export_generated_headers: ["oemaids_header_gen"], |
| 67 | } |
| 68 | |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 69 | // Generate the */etc/passwd text files for the target |
| 70 | // These files may be empty if no AIDs are defined in |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 71 | // TARGET_FS_CONFIG_GEN files. |
| 72 | genrule { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 73 | name: "passwd_gen_system", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 74 | tool_files: ["fs_config_generator.py"], |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 75 | 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] | 76 | srcs: [ |
| 77 | ":target_fs_config_gen", |
| 78 | ":android_filesystem_config_header", |
| 79 | ], |
| 80 | out: ["passwd"], |
| 81 | } |
| 82 | |
| 83 | prebuilt_etc { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 84 | name: "passwd_system", |
| 85 | filename: "passwd", |
| 86 | src: ":passwd_gen_system", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 87 | } |
| 88 | |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 89 | genrule { |
| 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 | |
| 100 | prebuilt_etc { |
| 101 | name: "passwd_vendor", |
| 102 | filename: "passwd", |
| 103 | vendor: true, |
| 104 | src: ":passwd_gen_vendor", |
| 105 | } |
| 106 | |
| 107 | genrule { |
| 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 | |
| 118 | prebuilt_etc { |
| 119 | name: "passwd_odm", |
| 120 | filename: "passwd", |
| 121 | device_specific: true, |
| 122 | src: ":passwd_gen_odm", |
| 123 | } |
| 124 | |
| 125 | genrule { |
| 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 | |
| 136 | prebuilt_etc { |
| 137 | name: "passwd_product", |
| 138 | filename: "passwd", |
| 139 | product_specific: true, |
| 140 | src: ":passwd_gen_product", |
| 141 | } |
| 142 | |
| 143 | genrule { |
| 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 | |
| 154 | prebuilt_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 |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 163 | // TARGET_FS_CONFIG_GEN files. |
| 164 | genrule { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 165 | name: "group_gen_system", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 166 | tool_files: ["fs_config_generator.py"], |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 167 | 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] | 168 | srcs: [ |
| 169 | ":target_fs_config_gen", |
| 170 | ":android_filesystem_config_header", |
| 171 | ], |
| 172 | out: ["group"], |
| 173 | } |
| 174 | |
| 175 | prebuilt_etc { |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 176 | name: "group_system", |
| 177 | filename: "group", |
| 178 | src: ":group_gen_system", |
| 179 | } |
| 180 | |
| 181 | genrule { |
| 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 | |
| 192 | prebuilt_etc { |
| 193 | name: "group_vendor", |
| 194 | filename: "group", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 195 | vendor: true, |
Tom Cherry | fb303a5 | 2019-07-11 15:31:36 -0700 | [diff] [blame] | 196 | src: ":group_gen_vendor", |
| 197 | } |
| 198 | |
| 199 | genrule { |
| 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 | |
| 210 | prebuilt_etc { |
| 211 | name: "group_odm", |
| 212 | filename: "group", |
| 213 | device_specific: true, |
| 214 | src: ":group_gen_odm", |
| 215 | } |
| 216 | |
| 217 | genrule { |
| 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 | |
| 228 | prebuilt_etc { |
| 229 | name: "group_product", |
| 230 | filename: "group", |
| 231 | product_specific: true, |
| 232 | src: ":group_gen_product", |
| 233 | } |
| 234 | |
| 235 | genrule { |
| 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 | |
| 246 | prebuilt_etc { |
| 247 | name: "group_system_ext", |
| 248 | filename: "group", |
| 249 | system_ext_specific: true, |
| 250 | src: ":group_gen_system_ext", |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 251 | } |