| 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: [ | 
|  | 23 | "fs_config.go" | 
|  | 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"], | 
|  | 45 | cmd: "$(location fs_config_generator.py) oemaid --aid-header=$(location :android_filesystem_config_header) $(location :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 |  | 
|  | 53 | cc_library_headers { | 
|  | 54 | name: "oemaids_headers", | 
|  | 55 | generated_headers: ["oemaids_header_gen"], | 
|  | 56 | export_generated_headers: ["oemaids_header_gen"], | 
|  | 57 | } | 
|  | 58 |  | 
|  | 59 | // Generate the vendor/etc/passwd text file for the target | 
|  | 60 | // This file may be empty if no AIDs are defined in | 
|  | 61 | // TARGET_FS_CONFIG_GEN files. | 
|  | 62 | genrule { | 
|  | 63 | name: "passwd_gen", | 
|  | 64 | tool_files: ["fs_config_generator.py"], | 
|  | 65 | cmd: "$(location fs_config_generator.py) passwd --required-prefix=vendor_ --aid-header=$(location :android_filesystem_config_header) $(location :target_fs_config_gen) >$(out)", | 
|  | 66 | srcs: [ | 
|  | 67 | ":target_fs_config_gen", | 
|  | 68 | ":android_filesystem_config_header", | 
|  | 69 | ], | 
|  | 70 | out: ["passwd"], | 
|  | 71 | } | 
|  | 72 |  | 
|  | 73 | prebuilt_etc { | 
|  | 74 | name: "passwd", | 
|  | 75 | vendor: true, | 
|  | 76 | src: ":passwd_gen", | 
|  | 77 | } | 
|  | 78 |  | 
|  | 79 | // Generate the vendor/etc/group text file for the target | 
|  | 80 | // This file may be empty if no AIDs are defined in | 
|  | 81 | // TARGET_FS_CONFIG_GEN files. | 
|  | 82 | genrule { | 
|  | 83 | name: "group_gen", | 
|  | 84 | tool_files: ["fs_config_generator.py"], | 
|  | 85 | cmd: "$(location fs_config_generator.py) group --required-prefix=vendor_ --aid-header=$(location :android_filesystem_config_header) $(location :target_fs_config_gen) >$(out)", | 
|  | 86 | srcs: [ | 
|  | 87 | ":target_fs_config_gen", | 
|  | 88 | ":android_filesystem_config_header", | 
|  | 89 | ], | 
|  | 90 | out: ["group"], | 
|  | 91 | } | 
|  | 92 |  | 
|  | 93 | prebuilt_etc { | 
|  | 94 | name: "group", | 
|  | 95 | vendor: true, | 
|  | 96 | src: ":group_gen", | 
|  | 97 | } |