Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 1 | LOCAL_PATH:= $(call my-dir) |
William Roberts | f0e0a94 | 2012-08-27 15:41:15 -0700 | [diff] [blame] | 2 | |
Dan Cashman | 6f14f6b | 2017-04-07 16:36:23 -0700 | [diff] [blame^] | 3 | # PLATFORM_SEPOLICY_VERSION is a number of the form "NN.m" with "NN" mapping to |
| 4 | # PLATFORM_SDK_VERSION and "m" as a minor number which allows for SELinux |
| 5 | # changes independent of PLATFORM_SDK_VERSION. This value will be set to |
| 6 | # 10000.0 to represent tip-of-tree development that is inherently unstable and |
| 7 | # thus designed not to work with any shipping vendor policy. This is similar in |
| 8 | # spirit to how DEFAULT_APP_TARGET_SDK is set. |
| 9 | # The minor version ('m' component) must be updated every time a platform release |
| 10 | # is made which breaks compatibility with the previous platform sepolicy version, |
| 11 | # not just on every increase in PLATFORM_SDK_VERSION. The minor version should |
| 12 | # be reset to 0 on every bump of the PLATFORM_SDK_VERSION. |
| 13 | sepolicy_major_vers := 25 |
| 14 | sepolicy_minor_vers := 0 |
| 15 | |
| 16 | ifneq ($(sepolicy_major_vers), $(PLATFORM_SDK_VERSION)) |
| 17 | $(error sepolicy_major_version does not match PLATFORM_SDK_VERSION, please update.) |
| 18 | endif |
| 19 | ifneq (REL,$(PLATFORM_VERSION_CODENAME)) |
| 20 | sepolicy_major_vers := 10000 |
| 21 | sepolicy_minor_vers := 0 |
| 22 | endif |
| 23 | PLATFORM_SEPOLICY_VERSION := $(join $(addsuffix .,$(sepolicy_major_vers)), $(sepolicy_minor_vers)) |
| 24 | sepolicy_major_vers := |
| 25 | sepolicy_minor_vers := |
| 26 | |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 27 | include $(CLEAR_VARS) |
Jeff Vander Stoep | d4a3e9d | 2017-03-22 16:20:24 -0700 | [diff] [blame] | 28 | LOCAL_MODULE := selinux_policy |
| 29 | LOCAL_MODULE_TAGS := optional |
| 30 | # Include SELinux policy. We do this here because different modules |
| 31 | # need to be included based on the value of PRODUCT_FULL_TREBLE. This |
| 32 | # type of conditional inclusion cannot be done in top-level files such |
| 33 | # as build/target/product/embedded.mk. |
| 34 | # This conditional inclusion closely mimics the conditional logic |
| 35 | # inside init/init.cpp for loading SELinux policy from files. |
| 36 | ifeq ($(PRODUCT_FULL_TREBLE),true) |
| 37 | # Use split SELinux policy |
| 38 | LOCAL_REQUIRED_MODULES += \ |
| 39 | mapping_sepolicy.cil \ |
| 40 | nonplat_sepolicy.cil \ |
| 41 | plat_sepolicy.cil \ |
Dan Cashman | 0e9c47c | 2017-04-04 14:27:41 -0700 | [diff] [blame] | 42 | plat_and_mapping_sepolicy.cil.sha256 \ |
Jeff Vander Stoep | d4a3e9d | 2017-03-22 16:20:24 -0700 | [diff] [blame] | 43 | secilc \ |
| 44 | nonplat_file_contexts \ |
| 45 | plat_file_contexts |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 46 | |
Jeff Vander Stoep | d4a3e9d | 2017-03-22 16:20:24 -0700 | [diff] [blame] | 47 | # Include precompiled policy, unless told otherwise |
| 48 | ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false) |
Dan Cashman | 0e9c47c | 2017-04-04 14:27:41 -0700 | [diff] [blame] | 49 | LOCAL_REQUIRED_MODULES += precompiled_sepolicy precompiled_sepolicy.plat_and_mapping.sha256 |
Jeff Vander Stoep | d4a3e9d | 2017-03-22 16:20:24 -0700 | [diff] [blame] | 50 | endif |
| 51 | |
| 52 | else |
| 53 | # Use monolithic SELinux policy |
| 54 | LOCAL_REQUIRED_MODULES += sepolicy \ |
| 55 | file_contexts.bin |
| 56 | endif |
| 57 | include $(BUILD_PHONY_PACKAGE) |
| 58 | |
| 59 | include $(CLEAR_VARS) |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 60 | # SELinux policy version. |
Stephen Smalley | b4f1706 | 2015-03-13 10:03:52 -0400 | [diff] [blame] | 61 | # Must be <= /sys/fs/selinux/policyvers reported by the Android kernel. |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 62 | # Must be within the compatibility range reported by checkpolicy -V. |
Jeff Vander Stoep | 3a0ce49 | 2015-12-07 08:30:43 -0800 | [diff] [blame] | 63 | POLICYVERS ?= 30 |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 64 | |
| 65 | MLS_SENS=1 |
| 66 | MLS_CATS=1024 |
| 67 | |
Stephen Smalley | b4f1706 | 2015-03-13 10:03:52 -0400 | [diff] [blame] | 68 | ifdef BOARD_SEPOLICY_REPLACE |
| 69 | $(error BOARD_SEPOLICY_REPLACE is no longer supported; please remove from your BoardConfig.mk or other .mk file.) |
| 70 | endif |
| 71 | |
| 72 | ifdef BOARD_SEPOLICY_IGNORE |
| 73 | $(error BOARD_SEPOLICY_IGNORE is no longer supported; please remove from your BoardConfig.mk or other .mk file.) |
| 74 | endif |
Stephen Smalley | 5b340be | 2012-03-06 11:12:41 -0500 | [diff] [blame] | 75 | |
Stephen Smalley | 8e0ca88 | 2015-04-01 10:14:56 -0400 | [diff] [blame] | 76 | ifdef BOARD_SEPOLICY_UNION |
| 77 | $(warning BOARD_SEPOLICY_UNION is no longer required - all files found in BOARD_SEPOLICY_DIRS are implicitly unioned; please remove from your BoardConfig.mk or other .mk file.) |
| 78 | endif |
Robert Craig | 6b0ff47 | 2014-01-29 13:10:58 -0500 | [diff] [blame] | 79 | |
William Roberts | d218558 | 2015-07-16 11:28:02 -0700 | [diff] [blame] | 80 | ifdef BOARD_SEPOLICY_M4DEFS |
| 81 | LOCAL_ADDITIONAL_M4DEFS := $(addprefix -D, $(BOARD_SEPOLICY_M4DEFS)) |
| 82 | endif |
| 83 | |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 84 | # sepolicy is now divided into multiple portions: |
| 85 | # public - policy exported on which non-platform policy developers may write |
| 86 | # additional policy. types and attributes are versioned and included in |
| 87 | # delivered non-platform policy, which is to be combined with platform policy. |
| 88 | # private - platform-only policy required for platform functionality but which |
| 89 | # is not exported to vendor policy developers and as such may not be assumed |
| 90 | # to exist. |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 91 | # vendor - vendor-only policy required for vendor functionality. This policy can |
| 92 | # reference the public policy but cannot reference the private policy. This |
| 93 | # policy is for components which are produced from the core/non-vendor tree and |
| 94 | # placed into a vendor partition. |
dcashman | 0779155 | 2016-12-07 11:27:47 -0800 | [diff] [blame] | 95 | # mapping - This contains policy statements which map the attributes |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 96 | # exposed in the public policy of previous versions to the concrete types used |
| 97 | # in this policy to ensure that policy targeting attributes from public |
| 98 | # policy from an older platform version continues to work. |
| 99 | |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 100 | # build process for device: |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 101 | # 1) convert policies to CIL: |
| 102 | # - private + public platform policy to CIL |
| 103 | # - mapping file to CIL (should already be in CIL form) |
| 104 | # - non-platform public policy to CIL |
| 105 | # - non-platform public + private policy to CIL |
| 106 | # 2) attributize policy |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 107 | # - run script which takes non-platform public and non-platform combined |
| 108 | # private + public policy and produces attributized and versioned |
| 109 | # non-platform policy |
| 110 | # 3) combine policy files |
| 111 | # - combine mapping, platform and non-platform policy. |
| 112 | # - compile output binary policy file |
| 113 | |
| 114 | PLAT_PUBLIC_POLICY := $(LOCAL_PATH)/public |
| 115 | PLAT_PRIVATE_POLICY := $(LOCAL_PATH)/private |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 116 | PLAT_VENDOR_POLICY := $(LOCAL_PATH)/vendor |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 117 | REQD_MASK_POLICY := $(LOCAL_PATH)/reqd_mask |
| 118 | |
| 119 | # TODO: move to README when doing the README update and finalizing versioning. |
Sandeep Patil | 42f9598 | 2017-04-07 14:18:48 -0700 | [diff] [blame] | 120 | # BOARD_SEPOLICY_VERS must take the format "NN.m" and contain the sepolicy |
| 121 | # version identifier corresponding to the sepolicy on which the non-platform |
| 122 | # policy is to be based. If unspecified, this will build against the current |
| 123 | # public platform policy in tree |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 124 | # BOARD_SEPOLICY_VERS_DIR should contain the public platform policy which |
| 125 | # is associated with the given BOARD_SEPOLICY_VERS. The policy therein will be |
| 126 | # versioned according to the BOARD_SEPOLICY_VERS identifier and included as |
| 127 | # part of the non-platform policy to ensure removal of access in future |
| 128 | # platform policy does not break non-platform policy. |
| 129 | ifndef BOARD_SEPOLICY_VERS |
| 130 | $(warning BOARD_SEPOLICY_VERS not specified, assuming current platform version) |
Sandeep Patil | 42f9598 | 2017-04-07 14:18:48 -0700 | [diff] [blame] | 131 | # The default platform policy version. |
Dan Cashman | 6f14f6b | 2017-04-07 16:36:23 -0700 | [diff] [blame^] | 132 | BOARD_SEPOLICY_VERS := $(PLATFORM_SEPOLICY_VERSION) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 133 | BOARD_SEPOLICY_VERS_DIR := $(PLAT_PUBLIC_POLICY) |
| 134 | else |
| 135 | ifndef BOARD_SEPOLICY_VERS_DIR |
| 136 | $(error BOARD_SEPOLICY_VERS_DIR not specified for versioned sepolicy.) |
| 137 | endif |
| 138 | endif |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 139 | |
| 140 | ########################################################### |
| 141 | # Compute policy files to be used in policy build. |
| 142 | # $(1): files to include |
| 143 | # $(2): directories in which to find files |
| 144 | ########################################################### |
| 145 | |
| 146 | define build_policy |
| 147 | $(foreach type, $(1), $(foreach file, $(addsuffix /$(type), $(2)), $(sort $(wildcard $(file))))) |
| 148 | endef |
William Roberts | 29d1468 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 149 | |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 150 | # Builds paths for all policy files found in BOARD_SEPOLICY_DIRS. |
| 151 | # $(1): the set of policy name paths to build |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 152 | build_device_policy = $(call build_policy, $(1), $(PLAT_VENDOR_POLICY) $(BOARD_SEPOLICY_DIRS)) |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 153 | |
Richard Haines | c8801fe | 2015-12-11 10:39:19 +0000 | [diff] [blame] | 154 | # Add a file containing only a newline in-between each policy configuration |
| 155 | # 'contexts' file. This will allow OEM policy configuration files without a |
| 156 | # final newline (0x0A) to be built correctly by the m4(1) macro processor. |
| 157 | # $(1): the set of contexts file names. |
| 158 | # $(2): the file containing only 0x0A. |
| 159 | add_nl = $(foreach entry, $(1), $(subst $(entry), $(entry) $(2), $(entry))) |
| 160 | |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 161 | sepolicy_build_files := security_classes \ |
| 162 | initial_sids \ |
| 163 | access_vectors \ |
| 164 | global_macros \ |
Nick Kralevich | a17a266 | 2014-11-05 15:30:41 -0800 | [diff] [blame] | 165 | neverallow_macros \ |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 166 | mls_macros \ |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 167 | mls_decl \ |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 168 | mls \ |
| 169 | policy_capabilities \ |
| 170 | te_macros \ |
| 171 | attributes \ |
Jeff Vander Stoep | cbaa2b7 | 2015-12-22 10:39:34 -0800 | [diff] [blame] | 172 | ioctl_defines \ |
Jeff Vander Stoep | de9b530 | 2015-06-05 15:28:55 -0700 | [diff] [blame] | 173 | ioctl_macros \ |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 174 | *.te \ |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 175 | roles_decl \ |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 176 | roles \ |
| 177 | users \ |
| 178 | initial_sid_contexts \ |
| 179 | fs_use \ |
| 180 | genfs_contexts \ |
| 181 | port_contexts |
| 182 | |
Alex Klyubin | 7cda44f | 2017-03-21 14:28:53 -0700 | [diff] [blame] | 183 | # CIL files which contain workarounds for current limitation of human-readable |
| 184 | # module policy language. These files are appended to the CIL files produced |
| 185 | # from module language files. |
| 186 | sepolicy_build_cil_workaround_files := technical_debt.cil |
| 187 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 188 | my_target_arch := $(TARGET_ARCH) |
| 189 | ifneq (,$(filter mips mips64,$(TARGET_ARCH))) |
| 190 | my_target_arch := mips |
| 191 | endif |
| 192 | |
Jeff Vander Stoep | d2053bd | 2017-03-15 13:37:35 -0700 | [diff] [blame] | 193 | intermediates := $(TARGET_OUT_INTERMEDIATES)/ETC/sepolicy_intermediates |
| 194 | |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 195 | with_asan := false |
| 196 | ifneq (,$(filter address,$(SANITIZE_TARGET))) |
| 197 | with_asan := true |
| 198 | endif |
| 199 | |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 200 | ################################## |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 201 | # reqd_policy_mask - a policy.conf file which contains only the bare minimum |
| 202 | # policy necessary to use checkpolicy. This bare-minimum policy needs to be |
| 203 | # present in all policy.conf files, but should not necessarily be exported as |
| 204 | # part of the public policy. The rules generated by reqd_policy_mask will allow |
| 205 | # the compilation of public policy and subsequent removal of CIL policy that |
| 206 | # should not be exported. |
| 207 | |
| 208 | reqd_policy_mask.conf := $(intermediates)/reqd_policy_mask.conf |
| 209 | $(reqd_policy_mask.conf): PRIVATE_MLS_SENS := $(MLS_SENS) |
| 210 | $(reqd_policy_mask.conf): PRIVATE_MLS_CATS := $(MLS_CATS) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 211 | $(reqd_policy_mask.conf): PRIVATE_TGT_ARCH := $(my_target_arch) |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 212 | $(reqd_policy_mask.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 213 | $(reqd_policy_mask.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 214 | $(reqd_policy_mask.conf): $(call build_policy, $(sepolicy_build_files), $(REQD_MASK_POLICY)) |
| 215 | @mkdir -p $(dir $@) |
| 216 | $(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \ |
| 217 | -D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \ |
| 218 | -D target_build_variant=$(TARGET_BUILD_VARIANT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 219 | -D target_with_dexpreopt=$(WITH_DEXPREOPT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 220 | -D target_arch=$(PRIVATE_TGT_ARCH) \ |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 221 | -D target_with_asan=$(PRIVATE_TGT_WITH_ASAN) \ |
Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 222 | -D target_full_treble=$(PRODUCT_FULL_TREBLE) \ |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 223 | -s $^ > $@ |
| 224 | |
| 225 | reqd_policy_mask.cil := $(intermediates)/reqd_policy_mask.cil |
| 226 | $(reqd_policy_mask.cil): $(reqd_policy_mask.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy |
| 227 | @mkdir -p $(dir $@) |
| 228 | $(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -C -M -c $(POLICYVERS) -o $@ $< |
| 229 | |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 230 | reqd_policy_mask.conf := |
| 231 | |
| 232 | ################################## |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 233 | # plat_pub_policy - policy that will be exported to be a part of non-platform |
| 234 | # policy corresponding to this platform version. This is a limited subset of |
| 235 | # policy that would not compile in checkpolicy on its own. To get around this |
| 236 | # limitation, add only the required files from private policy, which will |
| 237 | # generate CIL policy that will then be filtered out by the reqd_policy_mask. |
| 238 | plat_pub_policy.conf := $(intermediates)/plat_pub_policy.conf |
| 239 | $(plat_pub_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS) |
| 240 | $(plat_pub_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 241 | $(plat_pub_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch) |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 242 | $(plat_pub_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 243 | $(plat_pub_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 244 | $(plat_pub_policy.conf): $(call build_policy, $(sepolicy_build_files), \ |
| 245 | $(BOARD_SEPOLICY_VERS_DIR) $(REQD_MASK_POLICY)) |
| 246 | @mkdir -p $(dir $@) |
| 247 | $(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \ |
| 248 | -D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \ |
| 249 | -D target_build_variant=$(TARGET_BUILD_VARIANT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 250 | -D target_with_dexpreopt=$(WITH_DEXPREOPT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 251 | -D target_arch=$(PRIVATE_TGT_ARCH) \ |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 252 | -D target_with_asan=$(PRIVATE_TGT_WITH_ASAN) \ |
Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 253 | -D target_full_treble=$(PRODUCT_FULL_TREBLE) \ |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 254 | -s $^ > $@ |
| 255 | |
| 256 | plat_pub_policy.cil := $(intermediates)/plat_pub_policy.cil |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 257 | $(plat_pub_policy.cil): PRIVATE_POL_CONF := $(plat_pub_policy.conf) |
| 258 | $(plat_pub_policy.cil): PRIVATE_REQD_MASK := $(reqd_policy_mask.cil) |
| 259 | $(plat_pub_policy.cil): $(HOST_OUT_EXECUTABLES)/checkpolicy $(plat_pub_policy.conf) $(reqd_policy_mask.cil) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 260 | @mkdir -p $(dir $@) |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 261 | $(hide) $< -C -M -c $(POLICYVERS) -o $@.tmp $(PRIVATE_POL_CONF) |
| 262 | $(hide) grep -Fxv -f $(PRIVATE_REQD_MASK) $@.tmp > $@ |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 263 | |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 264 | plat_pub_policy.conf := |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 265 | |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 266 | ################################## |
| 267 | include $(CLEAR_VARS) |
| 268 | |
| 269 | LOCAL_MODULE := sectxfile_nl |
| 270 | LOCAL_MODULE_CLASS := ETC |
| 271 | LOCAL_MODULE_TAGS := optional |
| 272 | |
| 273 | # Create a file containing newline only to add between context config files |
| 274 | include $(BUILD_SYSTEM)/base_rules.mk |
| 275 | $(LOCAL_BUILT_MODULE): |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 276 | @mkdir -p $(dir $@) |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 277 | $(hide) echo > $@ |
| 278 | |
| 279 | built_nl := $(LOCAL_BUILT_MODULE) |
| 280 | |
| 281 | ################################# |
| 282 | include $(CLEAR_VARS) |
| 283 | |
| 284 | LOCAL_MODULE := plat_sepolicy.cil |
| 285 | LOCAL_MODULE_CLASS := ETC |
| 286 | LOCAL_MODULE_TAGS := optional |
Alex Klyubin | 052b0bb | 2017-03-02 12:39:25 -0800 | [diff] [blame] | 287 | LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/selinux |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 288 | |
| 289 | include $(BUILD_SYSTEM)/base_rules.mk |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 290 | |
| 291 | # plat_policy.conf - A combination of the private and public platform policy |
| 292 | # which will ship with the device. The platform will always reflect the most |
| 293 | # recent platform version and is not currently being attributized. |
| 294 | plat_policy.conf := $(intermediates)/plat_policy.conf |
| 295 | $(plat_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS) |
| 296 | $(plat_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 297 | $(plat_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch) |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 298 | $(plat_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 299 | $(plat_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 300 | $(plat_policy.conf): $(call build_policy, $(sepolicy_build_files), \ |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 301 | $(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY)) |
| 302 | @mkdir -p $(dir $@) |
| 303 | $(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \ |
| 304 | -D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \ |
| 305 | -D target_build_variant=$(TARGET_BUILD_VARIANT) \ |
Jorge Lucangeli Obes | 84db84e | 2016-11-18 08:42:35 -0500 | [diff] [blame] | 306 | -D target_with_dexpreopt=$(WITH_DEXPREOPT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 307 | -D target_arch=$(PRIVATE_TGT_ARCH) \ |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 308 | -D target_with_asan=$(PRIVATE_TGT_WITH_ASAN) \ |
Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 309 | -D target_full_treble=$(PRODUCT_FULL_TREBLE) \ |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 310 | -s $^ > $@ |
| 311 | $(hide) sed '/dontaudit/d' $@ > $@.dontaudit |
| 312 | |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 313 | plat_policy_nvr := $(intermediates)/plat_policy_nvr.cil |
Alex Klyubin | 7cda44f | 2017-03-21 14:28:53 -0700 | [diff] [blame] | 314 | $(plat_policy_nvr): PRIVATE_ADDITIONAL_CIL_FILES := \ |
| 315 | $(call build_policy, $(sepolicy_build_cil_workaround_files), $(PLAT_PRIVATE_POLICY)) |
| 316 | $(plat_policy_nvr): $(plat_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy \ |
| 317 | $(call build_policy, $(sepolicy_build_cil_workaround_files), $(PLAT_PRIVATE_POLICY)) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 318 | @mkdir -p $(dir $@) |
dcashman | 0779155 | 2016-12-07 11:27:47 -0800 | [diff] [blame] | 319 | $(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -C -c $(POLICYVERS) -o $@ $< |
Alex Klyubin | 7cda44f | 2017-03-21 14:28:53 -0700 | [diff] [blame] | 320 | $(hide) cat $(PRIVATE_ADDITIONAL_CIL_FILES) >> $@ |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 321 | |
Alex Klyubin | 8f7173b | 2017-02-25 14:47:53 -0800 | [diff] [blame] | 322 | $(LOCAL_BUILT_MODULE): PRIVATE_CIL_FILES := $(plat_policy_nvr) |
| 323 | $(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/secilc $(plat_policy_nvr) |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 324 | @mkdir -p $(dir $@) |
Alex Klyubin | 8f7173b | 2017-02-25 14:47:53 -0800 | [diff] [blame] | 325 | # Strip out neverallow statements. They aren't needed on-device and their presence |
| 326 | # significantly slows down on-device compilation (e.g., from 400 ms to 6,400 ms on |
| 327 | # sailfish-eng). |
| 328 | grep -v '^(neverallow' $(PRIVATE_CIL_FILES) > $@ |
| 329 | # Confirm that the resulting policy compiles |
| 330 | $(hide) $(HOST_OUT_EXECUTABLES)/secilc -M true -c $(POLICYVERS) $@ -o /dev/null -f /dev/null |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 331 | |
Alex Klyubin | 8f7173b | 2017-02-25 14:47:53 -0800 | [diff] [blame] | 332 | built_plat_cil := $(LOCAL_BUILT_MODULE) |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 333 | plat_policy.conf := |
| 334 | |
| 335 | ################################# |
| 336 | include $(CLEAR_VARS) |
| 337 | |
| 338 | LOCAL_MODULE := mapping_sepolicy.cil |
| 339 | LOCAL_MODULE_CLASS := ETC |
| 340 | LOCAL_MODULE_TAGS := optional |
Dan Cashman | 0e9c47c | 2017-04-04 14:27:41 -0700 | [diff] [blame] | 341 | LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/selinux |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 342 | |
| 343 | include $(BUILD_SYSTEM)/base_rules.mk |
| 344 | |
| 345 | # auto-generate the mapping file for current platform policy, since it needs to |
| 346 | # track platform policy development |
Dan Cashman | 6f14f6b | 2017-04-07 16:36:23 -0700 | [diff] [blame^] | 347 | current_mapping.cil := $(intermediates)/mapping/$(PLATFORM_SEPOLICY_VERSION).cil |
| 348 | $(current_mapping.cil) : PRIVATE_VERS := $(PLATFORM_SEPOLICY_VERSION) |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 349 | $(current_mapping.cil) : $(plat_pub_policy.cil) $(HOST_OUT_EXECUTABLES)/version_policy |
| 350 | @mkdir -p $(dir $@) |
| 351 | $(hide) $(HOST_OUT_EXECUTABLES)/version_policy -b $< -m -n $(PRIVATE_VERS) -o $@ |
| 352 | |
Sandeep Patil | 42f9598 | 2017-04-07 14:18:48 -0700 | [diff] [blame] | 353 | |
Dan Cashman | 6f14f6b | 2017-04-07 16:36:23 -0700 | [diff] [blame^] | 354 | ifeq ($(BOARD_SEPOLICY_VERS), $(PLATFORM_SEPOLICY_VERSION)) |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 355 | mapping_policy_nvr := $(current_mapping.cil) |
| 356 | else |
| 357 | mapping_policy_nvr := $(addsuffix /$(BOARD_SEPOLICY_VERS).cil, $(PLAT_PRIVATE_POLICY)/mapping) |
| 358 | endif |
| 359 | |
| 360 | $(LOCAL_BUILT_MODULE): $(mapping_policy_nvr) |
Alex Klyubin | 8f7173b | 2017-02-25 14:47:53 -0800 | [diff] [blame] | 361 | # Strip out neverallow statements. They aren't needed on-device and their presence |
| 362 | # significantly slows down on-device compilation (e.g., from 400 ms to 6,400 ms on |
| 363 | # sailfish-eng). |
| 364 | grep -v '^(neverallow' $< > $@ |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 365 | |
Alex Klyubin | 8f7173b | 2017-02-25 14:47:53 -0800 | [diff] [blame] | 366 | built_mapping_cil := $(LOCAL_BUILT_MODULE) |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 367 | current_mapping.cil := |
| 368 | |
| 369 | ################################# |
| 370 | include $(CLEAR_VARS) |
| 371 | |
Dan Cashman | 0e9c47c | 2017-04-04 14:27:41 -0700 | [diff] [blame] | 372 | LOCAL_MODULE := plat_and_mapping_sepolicy.cil.sha256 |
| 373 | LOCAL_MODULE_CLASS := ETC |
| 374 | LOCAL_MODULE_TAGS := optional |
| 375 | LOCAL_MODULE_PATH = $(TARGET_OUT)/etc/selinux |
| 376 | |
| 377 | include $(BUILD_SYSTEM)/base_rules.mk |
| 378 | |
| 379 | $(LOCAL_BUILT_MODULE): $(built_plat_cil) $(built_mapping_cil) |
| 380 | cat $^ | sha256sum | cut -d' ' -f1 > $@ |
| 381 | |
| 382 | ################################# |
| 383 | include $(CLEAR_VARS) |
| 384 | |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 385 | LOCAL_MODULE := nonplat_sepolicy.cil |
| 386 | LOCAL_MODULE_CLASS := ETC |
| 387 | LOCAL_MODULE_TAGS := optional |
Alex Klyubin | 052b0bb | 2017-03-02 12:39:25 -0800 | [diff] [blame] | 388 | LOCAL_PROPRIETARY_MODULE := true |
| 389 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 390 | |
| 391 | include $(BUILD_SYSTEM)/base_rules.mk |
| 392 | |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 393 | # nonplat_policy.conf - A combination of the non-platform private, vendor and |
| 394 | # the exported platform policy associated with the version the non-platform |
| 395 | # policy targets. This needs attributization and to be combined with the |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 396 | # platform-provided policy. Like plat_pub_policy.conf, this needs to make use |
| 397 | # of the reqd_policy_mask files from private policy in order to use checkpolicy. |
| 398 | nonplat_policy.conf := $(intermediates)/nonplat_policy.conf |
| 399 | $(nonplat_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS) |
| 400 | $(nonplat_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 401 | $(nonplat_policy.conf): PRIVATE_TGT_ARCH := $(my_target_arch) |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 402 | $(nonplat_policy.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 403 | $(nonplat_policy.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 404 | $(nonplat_policy.conf): $(call build_policy, $(sepolicy_build_files), \ |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 405 | $(BOARD_SEPOLICY_VERS_DIR) $(REQD_MASK_POLICY) $(PLAT_VENDOR_POLICY) $(BOARD_SEPOLICY_DIRS)) |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 406 | @mkdir -p $(dir $@) |
William Roberts | d218558 | 2015-07-16 11:28:02 -0700 | [diff] [blame] | 407 | $(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \ |
| 408 | -D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \ |
Nick Kralevich | 623975f | 2014-01-11 01:31:03 -0800 | [diff] [blame] | 409 | -D target_build_variant=$(TARGET_BUILD_VARIANT) \ |
Jorge Lucangeli Obes | 84db84e | 2016-11-18 08:42:35 -0500 | [diff] [blame] | 410 | -D target_with_dexpreopt=$(WITH_DEXPREOPT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 411 | -D target_arch=$(PRIVATE_TGT_ARCH) \ |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 412 | -D target_with_asan=$(PRIVATE_TGT_WITH_ASAN) \ |
Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 413 | -D target_full_treble=$(PRODUCT_FULL_TREBLE) \ |
Nick Kralevich | 623975f | 2014-01-11 01:31:03 -0800 | [diff] [blame] | 414 | -s $^ > $@ |
Robert Craig | 65d4f44 | 2013-03-27 06:30:25 -0400 | [diff] [blame] | 415 | $(hide) sed '/dontaudit/d' $@ > $@.dontaudit |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 416 | |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 417 | nonplat_policy_raw := $(intermediates)/nonplat_policy_raw.cil |
| 418 | $(nonplat_policy_raw): PRIVATE_POL_CONF := $(nonplat_policy.conf) |
| 419 | $(nonplat_policy_raw): PRIVATE_REQD_MASK := $(reqd_policy_mask.cil) |
| 420 | $(nonplat_policy_raw): $(HOST_OUT_EXECUTABLES)/checkpolicy $(nonplat_policy.conf) \ |
| 421 | $(reqd_policy_mask.cil) |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 422 | @mkdir -p $(dir $@) |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 423 | $(hide) $< -C -M -c $(POLICYVERS) -o $@.tmp $(PRIVATE_POL_CONF) |
| 424 | $(hide) grep -Fxv -f $(PRIVATE_REQD_MASK) $@.tmp > $@ |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 425 | |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 426 | nonplat_policy_nvr := $(intermediates)/nonplat_policy_nvr.cil |
| 427 | $(nonplat_policy_nvr) : PRIVATE_VERS := $(BOARD_SEPOLICY_VERS) |
| 428 | $(nonplat_policy_nvr) : PRIVATE_TGT_POL := $(nonplat_policy_raw) |
| 429 | $(nonplat_policy_nvr) : $(plat_pub_policy.cil) $(nonplat_policy_raw) \ |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 430 | $(HOST_OUT_EXECUTABLES)/version_policy |
| 431 | @mkdir -p $(dir $@) |
| 432 | $(HOST_OUT_EXECUTABLES)/version_policy -b $< -t $(PRIVATE_TGT_POL) -n $(PRIVATE_VERS) -o $@ |
| 433 | |
Alex Klyubin | 8f7173b | 2017-02-25 14:47:53 -0800 | [diff] [blame] | 434 | $(LOCAL_BUILT_MODULE): PRIVATE_NONPLAT_CIL_FILES := $(nonplat_policy_nvr) |
| 435 | $(LOCAL_BUILT_MODULE): PRIVATE_DEP_CIL_FILES := $(built_plat_cil) $(built_mapping_cil) |
| 436 | $(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/secilc $(nonplat_policy_nvr) $(built_plat_cil) \ |
| 437 | $(built_mapping_cil) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 438 | @mkdir -p $(dir $@) |
Alex Klyubin | 8f7173b | 2017-02-25 14:47:53 -0800 | [diff] [blame] | 439 | # Strip out neverallow statements. They aren't needed on-device and their presence |
| 440 | # significantly slows down on-device compilation (e.g., from 400 ms to 6,400 ms on |
| 441 | # sailfish-eng). |
| 442 | grep -v '^(neverallow' $(PRIVATE_NONPLAT_CIL_FILES) > $@ |
| 443 | # Confirm that the resulting policy compiles combined with platform and mapping policies |
| 444 | $(hide) $(HOST_OUT_EXECUTABLES)/secilc -M true -c $(POLICYVERS) \ |
| 445 | $(PRIVATE_DEP_CIL_FILES) $@ -o /dev/null -f /dev/null |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 446 | |
Alex Klyubin | 193dccd | 2017-03-07 14:05:57 -0800 | [diff] [blame] | 447 | built_nonplat_cil := $(LOCAL_BUILT_MODULE) |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 448 | nonplat_policy.conf := |
| 449 | nonplat_policy_raw := |
| 450 | |
| 451 | ################################# |
| 452 | include $(CLEAR_VARS) |
Alex Klyubin | 193dccd | 2017-03-07 14:05:57 -0800 | [diff] [blame] | 453 | |
| 454 | LOCAL_MODULE := precompiled_sepolicy |
| 455 | LOCAL_MODULE_CLASS := ETC |
| 456 | LOCAL_MODULE_TAGS := optional |
| 457 | LOCAL_PROPRIETARY_MODULE := true |
| 458 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux |
| 459 | |
| 460 | include $(BUILD_SYSTEM)/base_rules.mk |
| 461 | |
| 462 | $(LOCAL_BUILT_MODULE): PRIVATE_CIL_FILES := \ |
| 463 | $(built_plat_cil) $(built_mapping_cil) $(built_nonplat_cil) |
| 464 | $(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/secilc \ |
| 465 | $(built_plat_cil) $(built_mapping_cil) $(built_nonplat_cil) |
| 466 | $(hide) $(HOST_OUT_EXECUTABLES)/secilc -M true -c $(POLICYVERS) \ |
| 467 | $(PRIVATE_CIL_FILES) -o $@ -f /dev/null |
| 468 | |
| 469 | built_precompiled_sepolicy := $(LOCAL_BUILT_MODULE) |
| 470 | |
| 471 | ################################# |
Dan Cashman | 0e9c47c | 2017-04-04 14:27:41 -0700 | [diff] [blame] | 472 | # SHA-256 digest of the plat_sepolicy.cil and mapping_sepolicy.cil files against |
| 473 | # which precompiled_policy was built. |
Alex Klyubin | 193dccd | 2017-03-07 14:05:57 -0800 | [diff] [blame] | 474 | ################################# |
| 475 | include $(CLEAR_VARS) |
Dan Cashman | 0e9c47c | 2017-04-04 14:27:41 -0700 | [diff] [blame] | 476 | LOCAL_MODULE := precompiled_sepolicy.plat_and_mapping.sha256 |
Alex Klyubin | 193dccd | 2017-03-07 14:05:57 -0800 | [diff] [blame] | 477 | LOCAL_MODULE_CLASS := ETC |
| 478 | LOCAL_MODULE_TAGS := optional |
| 479 | LOCAL_PROPRIETARY_MODULE := true |
| 480 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux |
| 481 | |
| 482 | include $(BUILD_SYSTEM)/base_rules.mk |
| 483 | |
Dan Cashman | 0e9c47c | 2017-04-04 14:27:41 -0700 | [diff] [blame] | 484 | $(LOCAL_BUILT_MODULE): PRIVATE_CIL_FILES := $(built_plat_cil) $(built_mapping_cil) |
| 485 | $(LOCAL_BUILT_MODULE): $(built_precompiled_sepolicy) $(built_plat_cil) $(built_mapping_cil) |
| 486 | cat $(PRIVATE_CIL_FILES) | sha256sum | cut -d' ' -f1 > $@ |
Alex Klyubin | 193dccd | 2017-03-07 14:05:57 -0800 | [diff] [blame] | 487 | |
| 488 | ################################# |
| 489 | include $(CLEAR_VARS) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 490 | # build this target so that we can still perform neverallow checks |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 491 | |
| 492 | LOCAL_MODULE := sepolicy |
| 493 | LOCAL_MODULE_CLASS := ETC |
| 494 | LOCAL_MODULE_TAGS := optional |
Daniel Cashman | 65d0134 | 2016-12-17 00:53:26 +0000 | [diff] [blame] | 495 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 496 | |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 497 | include $(BUILD_SYSTEM)/base_rules.mk |
| 498 | |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 499 | all_cil_files := \ |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 500 | $(plat_policy_nvr) \ |
| 501 | $(mapping_policy_nvr) \ |
| 502 | $(nonplat_policy_nvr) \ |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 503 | |
| 504 | $(LOCAL_BUILT_MODULE): PRIVATE_CIL_FILES := $(all_cil_files) |
| 505 | $(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/secilc $(HOST_OUT_EXECUTABLES)/sepolicy-analyze $(all_cil_files) |
| 506 | @mkdir -p $(dir $@) |
William Roberts | 5d0c2e4 | 2017-03-23 11:26:29 -0700 | [diff] [blame] | 507 | $(hide) $< -M true -c $(POLICYVERS) $(PRIVATE_CIL_FILES) -o $@.tmp -f /dev/null |
Nick Kralevich | bca98ef | 2016-02-26 20:06:52 -0800 | [diff] [blame] | 508 | $(hide) $(HOST_OUT_EXECUTABLES)/sepolicy-analyze $@.tmp permissive > $@.permissivedomains |
| 509 | $(hide) if [ "$(TARGET_BUILD_VARIANT)" = "user" -a -s $@.permissivedomains ]; then \ |
| 510 | echo "==========" 1>&2; \ |
| 511 | echo "ERROR: permissive domains not allowed in user builds" 1>&2; \ |
| 512 | echo "List of invalid domains:" 1>&2; \ |
| 513 | cat $@.permissivedomains 1>&2; \ |
| 514 | exit 1; \ |
| 515 | fi |
| 516 | $(hide) mv $@.tmp $@ |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 517 | |
Ying Wang | d8b122c | 2012-10-25 19:01:31 -0700 | [diff] [blame] | 518 | built_sepolicy := $(LOCAL_BUILT_MODULE) |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 519 | all_cil_files := |
Stephen Smalley | 01a58af | 2012-10-02 12:46:37 -0400 | [diff] [blame] | 520 | |
Alex Klyubin | 84aa742 | 2017-03-10 09:36:07 -0800 | [diff] [blame] | 521 | ################################# |
| 522 | include $(CLEAR_VARS) |
| 523 | |
| 524 | # keep concrete sepolicy for neverallow checks |
| 525 | |
| 526 | LOCAL_MODULE := sepolicy.recovery |
Alex Klyubin | ec78c37 | 2017-03-10 12:44:16 -0800 | [diff] [blame] | 527 | LOCAL_MODULE_STEM := sepolicy |
Alex Klyubin | 84aa742 | 2017-03-10 09:36:07 -0800 | [diff] [blame] | 528 | LOCAL_MODULE_CLASS := ETC |
| 529 | LOCAL_MODULE_TAGS := optional |
Alex Klyubin | ec78c37 | 2017-03-10 12:44:16 -0800 | [diff] [blame] | 530 | LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT) |
Alex Klyubin | 84aa742 | 2017-03-10 09:36:07 -0800 | [diff] [blame] | 531 | |
| 532 | include $(BUILD_SYSTEM)/base_rules.mk |
| 533 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 534 | plat_pub_policy.recovery.conf := $(intermediates)/plat_pub_policy.recovery.conf |
| 535 | $(plat_pub_policy.recovery.conf): PRIVATE_MLS_SENS := $(MLS_SENS) |
| 536 | $(plat_pub_policy.recovery.conf): PRIVATE_MLS_CATS := $(MLS_CATS) |
| 537 | $(plat_pub_policy.recovery.conf): PRIVATE_TGT_ARCH := $(my_target_arch) |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 538 | $(plat_pub_policy.recovery.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 539 | $(plat_pub_policy.recovery.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 540 | $(plat_pub_policy.recovery.conf): $(call build_policy, $(sepolicy_build_files), \ |
| 541 | $(BOARD_SEPOLICY_VERS_DIR) $(REQD_MASK_POLICY)) |
Stephen Smalley | e60723a | 2014-05-29 16:40:15 -0400 | [diff] [blame] | 542 | @mkdir -p $(dir $@) |
William Roberts | d218558 | 2015-07-16 11:28:02 -0700 | [diff] [blame] | 543 | $(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \ |
| 544 | -D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \ |
Stephen Smalley | e60723a | 2014-05-29 16:40:15 -0400 | [diff] [blame] | 545 | -D target_build_variant=$(TARGET_BUILD_VARIANT) \ |
Jorge Lucangeli Obes | 84db84e | 2016-11-18 08:42:35 -0500 | [diff] [blame] | 546 | -D target_with_dexpreopt=$(WITH_DEXPREOPT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 547 | -D target_arch=$(PRIVATE_TGT_ARCH) \ |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 548 | -D target_with_asan=$(PRIVATE_TGT_WITH_ASAN) \ |
Stephen Smalley | e60723a | 2014-05-29 16:40:15 -0400 | [diff] [blame] | 549 | -D target_recovery=true \ |
| 550 | -s $^ > $@ |
| 551 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 552 | plat_pub_policy.recovery.cil := $(intermediates)/plat_pub_policy.recovery.cil |
| 553 | $(plat_pub_policy.recovery.cil): PRIVATE_POL_CONF := $(plat_pub_policy.recovery.conf) |
| 554 | $(plat_pub_policy.recovery.cil): PRIVATE_REQD_MASK := $(reqd_policy_mask.cil) |
| 555 | $(plat_pub_policy.recovery.cil): $(HOST_OUT_EXECUTABLES)/checkpolicy \ |
| 556 | $(plat_pub_policy.recovery.conf) $(reqd_policy_mask.cil) |
Stephen Smalley | e60723a | 2014-05-29 16:40:15 -0400 | [diff] [blame] | 557 | @mkdir -p $(dir $@) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 558 | $(hide) $< -C -M -c $(POLICYVERS) -o $@.tmp $(PRIVATE_POL_CONF) |
| 559 | $(hide) grep -Fxv -f $(PRIVATE_REQD_MASK) $@.tmp > $@ |
| 560 | |
| 561 | plat_pub_policy.recovery.conf := |
| 562 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 563 | plat_policy.recovery.conf := $(intermediates)/plat_policy.recovery.conf |
| 564 | $(plat_policy.recovery.conf): PRIVATE_MLS_SENS := $(MLS_SENS) |
| 565 | $(plat_policy.recovery.conf): PRIVATE_MLS_CATS := $(MLS_CATS) |
| 566 | $(plat_policy.recovery.conf): PRIVATE_TGT_ARCH := $(my_target_arch) |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 567 | $(plat_policy.recovery.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 568 | $(plat_policy.recovery.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 569 | $(plat_policy.recovery.conf): $(call build_policy, $(sepolicy_build_files), \ |
| 570 | $(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY)) |
| 571 | @mkdir -p $(dir $@) |
| 572 | $(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \ |
| 573 | -D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \ |
| 574 | -D target_build_variant=$(TARGET_BUILD_VARIANT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 575 | -D target_with_dexpreopt=$(WITH_DEXPREOPT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 576 | -D target_arch=$(PRIVATE_TGT_ARCH) \ |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 577 | -D target_with_asan=$(PRIVATE_TGT_WITH_ASAN) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 578 | -D target_recovery=true \ |
| 579 | -s $^ > $@ |
| 580 | $(hide) sed '/dontaudit/d' $@ > $@.dontaudit |
| 581 | |
| 582 | plat_policy_nvr.recovery := $(intermediates)/plat_policy_nvr.recovery.cil |
| 583 | $(plat_policy_nvr.recovery): $(plat_policy.recovery.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy |
| 584 | @mkdir -p $(dir $@) |
| 585 | $(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -C -c $(POLICYVERS) -o $@ $< |
| 586 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 587 | plat_policy.recovery.conf := |
| 588 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 589 | # auto-generate the mapping file for current platform policy, since it needs to |
| 590 | # track platform policy development |
Dan Cashman | 6f14f6b | 2017-04-07 16:36:23 -0700 | [diff] [blame^] | 591 | current_mapping.recovery.cil := $(intermediates)/mapping/$(PLATFORM_SEPOLICY_VERSION).recovery.cil |
| 592 | $(current_mapping.recovery.cil) : PRIVATE_VERS := $(PLATFORM_SEPOLICY_VERSION) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 593 | $(current_mapping.recovery.cil) : $(plat_pub_policy.recovery.cil) $(HOST_OUT_EXECUTABLES)/version_policy |
| 594 | @mkdir -p $(dir $@) |
| 595 | $(hide) $(HOST_OUT_EXECUTABLES)/version_policy -b $< -m -n $(PRIVATE_VERS) -o $@ |
| 596 | |
Dan Cashman | 6f14f6b | 2017-04-07 16:36:23 -0700 | [diff] [blame^] | 597 | ifeq ($(BOARD_SEPOLICY_VERS), $(PLATFORM_SEPOLICY_VERSION)) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 598 | mapping_policy_nvr.recovery := $(current_mapping.recovery.cil) |
| 599 | else |
| 600 | mapping_policy_nvr.recovery := $(addsuffix /$(BOARD_SEPOLICY_VERS).recovery.cil, \ |
Sandeep Patil | 42f9598 | 2017-04-07 14:18:48 -0700 | [diff] [blame] | 601 | $(PLAT_PRIVATE_POLICY)/mapping) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 602 | endif |
| 603 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 604 | current_mapping.recovery.cil := |
| 605 | |
Alex Klyubin | 8f7173b | 2017-02-25 14:47:53 -0800 | [diff] [blame] | 606 | # nonplat_policy.recovery.conf - A combination of the non-platform private, |
| 607 | # vendor and the exported platform policy associated with the version the |
| 608 | # non-platform policy targets. This needs attributization and to be combined |
| 609 | # with the platform-provided policy. Like plat_pub_policy.recovery.conf, this |
| 610 | # needs to make use of the reqd_policy_mask files from private policy in order |
| 611 | # to use checkpolicy. |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 612 | nonplat_policy.recovery.conf := $(intermediates)/nonplat_policy.recovery.conf |
| 613 | $(nonplat_policy.recovery.conf): PRIVATE_MLS_SENS := $(MLS_SENS) |
| 614 | $(nonplat_policy.recovery.conf): PRIVATE_MLS_CATS := $(MLS_CATS) |
| 615 | $(nonplat_policy.recovery.conf): PRIVATE_TGT_ARCH := $(my_target_arch) |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 616 | $(nonplat_policy.recovery.conf): PRIVATE_TGT_WITH_ASAN := $(with_asan) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 617 | $(nonplat_policy.recovery.conf): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 618 | $(nonplat_policy.recovery.conf): $(call build_policy, $(sepolicy_build_files), \ |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 619 | $(BOARD_SEPOLICY_VERS_DIR) $(REQD_MASK_POLICY) $(PLAT_VENDOR_POLICY) $(BOARD_SEPOLICY_DIRS)) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 620 | @mkdir -p $(dir $@) |
| 621 | $(hide) m4 $(PRIVATE_ADDITIONAL_M4DEFS) \ |
| 622 | -D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \ |
| 623 | -D target_build_variant=$(TARGET_BUILD_VARIANT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 624 | -D target_with_dexpreopt=$(WITH_DEXPREOPT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 625 | -D target_arch=$(PRIVATE_TGT_ARCH) \ |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 626 | -D target_with_asan=$(PRIVATE_TGT_WITH_ASAN) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 627 | -D target_recovery=true \ |
| 628 | -s $^ > $@ |
| 629 | $(hide) sed '/dontaudit/d' $@ > $@.dontaudit |
| 630 | |
| 631 | nonplat_policy_raw.recovery := $(intermediates)/nonplat_policy_raw.recovery.cil |
| 632 | $(nonplat_policy_raw.recovery): PRIVATE_POL_CONF := $(nonplat_policy.recovery.conf) |
| 633 | $(nonplat_policy_raw.recovery): PRIVATE_REQD_MASK := $(reqd_policy_mask.cil) |
| 634 | $(nonplat_policy_raw.recovery): $(HOST_OUT_EXECUTABLES)/checkpolicy $(nonplat_policy.recovery.conf) \ |
| 635 | $(reqd_policy_mask.cil) |
| 636 | @mkdir -p $(dir $@) |
| 637 | $(hide) $< -C -M -c $(POLICYVERS) -o $@.tmp $(PRIVATE_POL_CONF) |
| 638 | $(hide) grep -Fxv -f $(PRIVATE_REQD_MASK) $@.tmp > $@ |
| 639 | |
| 640 | nonplat_policy_nvr.recovery := $(intermediates)/nonplat_policy_nvr.recovery.cil |
| 641 | $(nonplat_policy_nvr.recovery) : PRIVATE_VERS := $(BOARD_SEPOLICY_VERS) |
| 642 | $(nonplat_policy_nvr.recovery) : PRIVATE_TGT_POL := $(nonplat_policy_raw.recovery) |
| 643 | $(nonplat_policy_nvr.recovery) : $(plat_pub_policy.recovery.cil) $(nonplat_policy_raw.recovery) \ |
| 644 | $(HOST_OUT_EXECUTABLES)/version_policy |
| 645 | @mkdir -p $(dir $@) |
| 646 | $(HOST_OUT_EXECUTABLES)/version_policy -b $< -t $(PRIVATE_TGT_POL) -n $(PRIVATE_VERS) -o $@ |
| 647 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 648 | nonplat_policy.recovery.conf := |
| 649 | nonplat_policy_raw.recovery := |
| 650 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 651 | all_cil_files.recovery := \ |
| 652 | $(plat_policy_nvr.recovery) \ |
| 653 | $(mapping_policy_nvr.recovery) \ |
| 654 | $(nonplat_policy_nvr.recovery) \ |
| 655 | |
| 656 | $(LOCAL_BUILT_MODULE): PRIVATE_CIL_FILES := $(all_cil_files.recovery) |
| 657 | $(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/secilc $(HOST_OUT_EXECUTABLES)/sepolicy-analyze $(all_cil_files.recovery) |
| 658 | @mkdir -p $(dir $@) |
William Roberts | 5d0c2e4 | 2017-03-23 11:26:29 -0700 | [diff] [blame] | 659 | $(hide) $< -M true -c $(POLICYVERS) $(PRIVATE_CIL_FILES) -o $@.tmp -f /dev/null |
Nick Kralevich | bca98ef | 2016-02-26 20:06:52 -0800 | [diff] [blame] | 660 | $(hide) $(HOST_OUT_EXECUTABLES)/sepolicy-analyze $@.tmp permissive > $@.permissivedomains |
| 661 | $(hide) if [ "$(TARGET_BUILD_VARIANT)" = "user" -a -s $@.permissivedomains ]; then \ |
| 662 | echo "==========" 1>&2; \ |
| 663 | echo "ERROR: permissive domains not allowed in user builds" 1>&2; \ |
| 664 | echo "List of invalid domains:" 1>&2; \ |
| 665 | cat $@.permissivedomains 1>&2; \ |
| 666 | exit 1; \ |
| 667 | fi |
| 668 | $(hide) mv $@.tmp $@ |
Stephen Smalley | e60723a | 2014-05-29 16:40:15 -0400 | [diff] [blame] | 669 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 670 | all_cil_files.recovery := |
Alex Klyubin | 84aa742 | 2017-03-10 09:36:07 -0800 | [diff] [blame] | 671 | plat_pub_policy.recovery.cil := |
| 672 | plat_policy_nvr.recovery := |
| 673 | mapping_policy_nvr.recovery := |
| 674 | nonplat_policy_nvr.recovery := |
Stephen Smalley | e60723a | 2014-05-29 16:40:15 -0400 | [diff] [blame] | 675 | |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 676 | ################################## |
Alex Klyubin | 446279a | 2017-04-06 14:45:50 -0700 | [diff] [blame] | 677 | # SELinux policy embedded into CTS. |
| 678 | # CTS checks neverallow rules of this policy against the policy of the device under test. |
| 679 | ################################## |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 680 | include $(CLEAR_VARS) |
| 681 | |
| 682 | LOCAL_MODULE := general_sepolicy.conf |
| 683 | LOCAL_MODULE_CLASS := ETC |
| 684 | LOCAL_MODULE_TAGS := tests |
| 685 | |
| 686 | include $(BUILD_SYSTEM)/base_rules.mk |
| 687 | |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 688 | $(LOCAL_BUILT_MODULE): PRIVATE_MLS_SENS := $(MLS_SENS) |
| 689 | $(LOCAL_BUILT_MODULE): PRIVATE_MLS_CATS := $(MLS_CATS) |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 690 | $(LOCAL_BUILT_MODULE): PRIVATE_TGT_ARCH := $(my_target_arch) |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 691 | $(LOCAL_BUILT_MODULE): $(call build_policy, $(sepolicy_build_files), \ |
| 692 | $(PLAT_PUBLIC_POLICY) $(PLAT_PRIVATE_POLICY)) |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 693 | mkdir -p $(dir $@) |
| 694 | $(hide) m4 -D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \ |
| 695 | -D target_build_variant=user \ |
Jorge Lucangeli Obes | 84db84e | 2016-11-18 08:42:35 -0500 | [diff] [blame] | 696 | -D target_with_dexpreopt=$(WITH_DEXPREOPT) \ |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 697 | -D target_arch=$(PRIVATE_TGT_ARCH) \ |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 698 | -D target_with_asan=false \ |
Alex Klyubin | 446279a | 2017-04-06 14:45:50 -0700 | [diff] [blame] | 699 | -D target_full_treble=cts \ |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 700 | -s $^ > $@ |
| 701 | $(hide) sed '/dontaudit/d' $@ > $@.dontaudit |
| 702 | |
William Roberts | b876993 | 2015-06-29 16:31:23 -0700 | [diff] [blame] | 703 | ################################## |
dcashman | d225b69 | 2016-12-12 09:29:04 -0800 | [diff] [blame] | 704 | # TODO - remove this. Keep around until we get the filesystem creation stuff taken care of. |
| 705 | # |
William Roberts | b876993 | 2015-06-29 16:31:23 -0700 | [diff] [blame] | 706 | include $(CLEAR_VARS) |
| 707 | |
Richard Haines | c2d0191 | 2015-08-06 17:43:52 +0100 | [diff] [blame] | 708 | LOCAL_MODULE := file_contexts.bin |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 709 | LOCAL_MODULE_CLASS := ETC |
| 710 | LOCAL_MODULE_TAGS := optional |
| 711 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
| 712 | |
Stephen Smalley | 5b340be | 2012-03-06 11:12:41 -0500 | [diff] [blame] | 713 | include $(BUILD_SYSTEM)/base_rules.mk |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 714 | |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 715 | # The file_contexts.bin is built in the following way: |
| 716 | # 1. Collect all file_contexts files in THIS repository and process them with |
| 717 | # m4 into a tmp file called file_contexts.local.tmp. |
| 718 | # 2. Collect all device specific file_contexts files and process them with m4 |
| 719 | # into a tmp file called file_contexts.device.tmp. |
| 720 | # 3. Run checkfc -e (allow no device fc entries ie empty) and fc_sort on |
| 721 | # file_contexts.device.tmp and output to file_contexts.device.sorted.tmp. |
| 722 | # 4. Concatenate file_contexts.local.tmp and file_contexts.device.tmp into |
| 723 | # file_contexts.concat.tmp. |
| 724 | # 5. Run checkfc and sefcontext_compile on file_contexts.concat.tmp to produce |
| 725 | # file_contexts.bin. |
| 726 | # |
| 727 | # Note: That a newline file is placed between each file_context file found to |
| 728 | # ensure a proper build when an fc file is missing an ending newline. |
William Roberts | 29d1468 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 729 | |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 730 | local_fc_files := $(PLAT_PRIVATE_POLICY)/file_contexts |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 731 | ifneq ($(filter address,$(SANITIZE_TARGET)),) |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 732 | local_fc_files := $(local_fc_files) $(PLAT_PRIVATE_POLICY)/file_contexts_asan |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 733 | endif |
| 734 | local_fcfiles_with_nl := $(call add_nl, $(local_fc_files), $(built_nl)) |
| 735 | |
| 736 | file_contexts.local.tmp := $(intermediates)/file_contexts.local.tmp |
| 737 | $(file_contexts.local.tmp): $(local_fcfiles_with_nl) |
Stephen Smalley | 5b340be | 2012-03-06 11:12:41 -0500 | [diff] [blame] | 738 | @mkdir -p $(dir $@) |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 739 | $(hide) m4 -s $^ > $@ |
| 740 | |
| 741 | device_fc_files := $(call build_device_policy, file_contexts) |
| 742 | device_fcfiles_with_nl := $(call add_nl, $(device_fc_files), $(built_nl)) |
| 743 | |
| 744 | file_contexts.device.tmp := $(intermediates)/file_contexts.device.tmp |
| 745 | $(file_contexts.device.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 746 | $(file_contexts.device.tmp): $(device_fcfiles_with_nl) |
| 747 | @mkdir -p $(dir $@) |
| 748 | $(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $^ > $@ |
| 749 | |
| 750 | file_contexts.device.sorted.tmp := $(intermediates)/file_contexts.device.sorted.tmp |
| 751 | $(file_contexts.device.sorted.tmp): PRIVATE_SEPOLICY := $(built_sepolicy) |
| 752 | $(file_contexts.device.sorted.tmp): $(file_contexts.device.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/fc_sort $(HOST_OUT_EXECUTABLES)/checkfc |
| 753 | @mkdir -p $(dir $@) |
dcashman | 0779155 | 2016-12-07 11:27:47 -0800 | [diff] [blame] | 754 | $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -e $(PRIVATE_SEPOLICY) $< |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 755 | $(hide) $(HOST_OUT_EXECUTABLES)/fc_sort $< $@ |
| 756 | |
| 757 | file_contexts.concat.tmp := $(intermediates)/file_contexts.concat.tmp |
| 758 | $(file_contexts.concat.tmp): $(file_contexts.local.tmp) $(file_contexts.device.sorted.tmp) |
| 759 | @mkdir -p $(dir $@) |
| 760 | $(hide) m4 -s $^ > $@ |
Stephen Smalley | 5b340be | 2012-03-06 11:12:41 -0500 | [diff] [blame] | 761 | |
William Roberts | 3746a0a | 2015-09-25 10:18:44 -0700 | [diff] [blame] | 762 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 763 | $(LOCAL_BUILT_MODULE): $(file_contexts.concat.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/sefcontext_compile $(HOST_OUT_EXECUTABLES)/checkfc |
Richard Haines | c2d0191 | 2015-08-06 17:43:52 +0100 | [diff] [blame] | 764 | @mkdir -p $(dir $@) |
dcashman | 0779155 | 2016-12-07 11:27:47 -0800 | [diff] [blame] | 765 | $(hide) $(HOST_OUT_EXECUTABLES)/checkfc $(PRIVATE_SEPOLICY) $< |
Richard Haines | c2d0191 | 2015-08-06 17:43:52 +0100 | [diff] [blame] | 766 | $(hide) $(HOST_OUT_EXECUTABLES)/sefcontext_compile -o $@ $< |
| 767 | |
Robert Craig | 8b7545b | 2014-03-20 09:35:08 -0400 | [diff] [blame] | 768 | built_fc := $(LOCAL_BUILT_MODULE) |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 769 | local_fc_files := |
| 770 | local_fcfiles_with_nl := |
| 771 | device_fc_files := |
| 772 | device_fcfiles_with_nl := |
| 773 | file_contexts.concat.tmp := |
| 774 | file_contexts.device.sorted.tmp := |
| 775 | file_contexts.device.tmp := |
| 776 | file_contexts.local.tmp := |
William Roberts | 171a062 | 2012-08-16 10:55:05 -0700 | [diff] [blame] | 777 | |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 778 | ################################## |
| 779 | include $(CLEAR_VARS) |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 780 | |
Alex Klyubin | ec78c37 | 2017-03-10 12:44:16 -0800 | [diff] [blame] | 781 | LOCAL_MODULE := file_contexts.bin.recovery |
| 782 | LOCAL_MODULE_STEM := file_contexts.bin |
| 783 | LOCAL_MODULE_CLASS := ETC |
| 784 | LOCAL_MODULE_TAGS := optional |
| 785 | LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT) |
| 786 | |
| 787 | include $(BUILD_SYSTEM)/base_rules.mk |
| 788 | |
| 789 | $(LOCAL_BUILT_MODULE): $(built_fc) |
| 790 | $(hide) cp -f $< $@ |
| 791 | |
| 792 | ################################## |
| 793 | include $(CLEAR_VARS) |
| 794 | |
dcashman | d225b69 | 2016-12-12 09:29:04 -0800 | [diff] [blame] | 795 | LOCAL_MODULE := plat_file_contexts |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 796 | LOCAL_MODULE_CLASS := ETC |
dcashman | d225b69 | 2016-12-12 09:29:04 -0800 | [diff] [blame] | 797 | LOCAL_MODULE_TAGS := optional |
Jeff Vander Stoep | 0cb417a | 2017-03-08 14:12:54 -0800 | [diff] [blame] | 798 | LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/selinux |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 799 | |
| 800 | include $(BUILD_SYSTEM)/base_rules.mk |
| 801 | |
dcashman | d225b69 | 2016-12-12 09:29:04 -0800 | [diff] [blame] | 802 | local_fc_files := $(PLAT_PRIVATE_POLICY)/file_contexts |
| 803 | ifneq ($(filter address,$(SANITIZE_TARGET)),) |
| 804 | local_fc_files += $(PLAT_PRIVATE_POLICY)/file_contexts_asan |
| 805 | endif |
Alex Klyubin | e4665d7 | 2017-01-19 19:58:34 -0800 | [diff] [blame] | 806 | local_fcfiles_with_nl := $(call add_nl, $(local_fc_files), $(built_nl)) |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 807 | |
Alex Klyubin | e4665d7 | 2017-01-19 19:58:34 -0800 | [diff] [blame] | 808 | $(LOCAL_BUILT_MODULE): PRIVATE_FC_FILES := $(local_fcfiles_with_nl) |
dcashman | d225b69 | 2016-12-12 09:29:04 -0800 | [diff] [blame] | 809 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
Alex Klyubin | e4665d7 | 2017-01-19 19:58:34 -0800 | [diff] [blame] | 810 | $(LOCAL_BUILT_MODULE): PRIVATE_FC_SORT := $(HOST_OUT_EXECUTABLES)/fc_sort |
| 811 | $(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/checkfc $(HOST_OUT_EXECUTABLES)/fc_sort \ |
| 812 | $(local_fcfiles_with_nl) $(built_sepolicy) |
Richard Haines | c2d0191 | 2015-08-06 17:43:52 +0100 | [diff] [blame] | 813 | @mkdir -p $(dir $@) |
Alex Klyubin | e4665d7 | 2017-01-19 19:58:34 -0800 | [diff] [blame] | 814 | $(hide) m4 -s $(PRIVATE_FC_FILES) > $@.tmp |
| 815 | $(hide) $< $(PRIVATE_SEPOLICY) $@.tmp |
| 816 | $(hide) $(PRIVATE_FC_SORT) $@.tmp $@ |
Richard Haines | c2d0191 | 2015-08-06 17:43:52 +0100 | [diff] [blame] | 817 | |
dcashman | d225b69 | 2016-12-12 09:29:04 -0800 | [diff] [blame] | 818 | built_plat_fc := $(LOCAL_BUILT_MODULE) |
| 819 | local_fc_files := |
Alex Klyubin | e4665d7 | 2017-01-19 19:58:34 -0800 | [diff] [blame] | 820 | local_fcfiles_with_nl := |
dcashman | d225b69 | 2016-12-12 09:29:04 -0800 | [diff] [blame] | 821 | |
| 822 | ################################## |
| 823 | include $(CLEAR_VARS) |
| 824 | |
| 825 | LOCAL_MODULE := nonplat_file_contexts |
| 826 | LOCAL_MODULE_CLASS := ETC |
| 827 | LOCAL_MODULE_TAGS := optional |
Jeff Vander Stoep | 0cb417a | 2017-03-08 14:12:54 -0800 | [diff] [blame] | 828 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux |
dcashman | d225b69 | 2016-12-12 09:29:04 -0800 | [diff] [blame] | 829 | |
| 830 | include $(BUILD_SYSTEM)/base_rules.mk |
| 831 | |
| 832 | nonplat_fc_files := $(call build_device_policy, file_contexts) |
| 833 | nonplat_fcfiles_with_nl := $(call add_nl, $(nonplat_fc_files), $(built_nl)) |
| 834 | |
| 835 | $(LOCAL_BUILT_MODULE): PRIVATE_FC_FILES := $(nonplat_fcfiles_with_nl) |
| 836 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
| 837 | $(LOCAL_BUILT_MODULE): PRIVATE_FC_SORT := $(HOST_OUT_EXECUTABLES)/fc_sort |
| 838 | $(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/checkfc $(HOST_OUT_EXECUTABLES)/fc_sort \ |
Alex Klyubin | e4665d7 | 2017-01-19 19:58:34 -0800 | [diff] [blame] | 839 | $(nonplat_fcfiles_with_nl) $(built_sepolicy) |
dcashman | d225b69 | 2016-12-12 09:29:04 -0800 | [diff] [blame] | 840 | @mkdir -p $(dir $@) |
| 841 | $(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_FC_FILES) > $@.tmp |
| 842 | $(hide) $< $(PRIVATE_SEPOLICY) $@.tmp |
| 843 | $(hide) $(PRIVATE_FC_SORT) $@.tmp $@ |
| 844 | |
| 845 | built_nonplat_fc := $(LOCAL_BUILT_MODULE) |
| 846 | nonplat_fc_files := |
| 847 | nonplat_fcfiles_with_nl := |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 848 | |
| 849 | ################################## |
| 850 | include $(CLEAR_VARS) |
Dan Cashman | 9c03807 | 2016-12-22 07:15:18 -0800 | [diff] [blame] | 851 | LOCAL_MODULE := plat_seapp_contexts |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 852 | LOCAL_MODULE_CLASS := ETC |
| 853 | LOCAL_MODULE_TAGS := optional |
Jeff Vander Stoep | 4e3a4c7 | 2017-03-08 22:28:03 -0800 | [diff] [blame] | 854 | ifeq ($(PRODUCT_FULL_TREBLE),true) |
| 855 | LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/selinux |
| 856 | else |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 857 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
Jeff Vander Stoep | 4e3a4c7 | 2017-03-08 22:28:03 -0800 | [diff] [blame] | 858 | endif |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 859 | |
William Roberts | 171a062 | 2012-08-16 10:55:05 -0700 | [diff] [blame] | 860 | include $(BUILD_SYSTEM)/base_rules.mk |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 861 | |
Dan Cashman | 9c03807 | 2016-12-22 07:15:18 -0800 | [diff] [blame] | 862 | plat_sc_files := $(call build_policy, seapp_contexts, $(PLAT_PRIVATE_POLICY)) |
William Roberts | 171a062 | 2012-08-16 10:55:05 -0700 | [diff] [blame] | 863 | |
Ying Wang | d8b122c | 2012-10-25 19:01:31 -0700 | [diff] [blame] | 864 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
Dan Cashman | 9c03807 | 2016-12-22 07:15:18 -0800 | [diff] [blame] | 865 | $(LOCAL_BUILT_MODULE): PRIVATE_SC_FILES := $(plat_sc_files) |
| 866 | $(LOCAL_BUILT_MODULE): $(built_sepolicy) $(plat_sc_files) $(HOST_OUT_EXECUTABLES)/checkseapp |
William Roberts | f0e0a94 | 2012-08-27 15:41:15 -0700 | [diff] [blame] | 867 | @mkdir -p $(dir $@) |
William Roberts | 99fe8df | 2015-06-30 13:53:51 -0700 | [diff] [blame] | 868 | $(hide) $(HOST_OUT_EXECUTABLES)/checkseapp -p $(PRIVATE_SEPOLICY) -o $@ $(PRIVATE_SC_FILES) |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 869 | |
Dan Cashman | 9c03807 | 2016-12-22 07:15:18 -0800 | [diff] [blame] | 870 | built_plat_sc := $(LOCAL_BUILT_MODULE) |
| 871 | plat_sc_files := |
Robert Craig | 8b7545b | 2014-03-20 09:35:08 -0400 | [diff] [blame] | 872 | |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 873 | ################################## |
Stephen Smalley | 124720a | 2012-04-04 10:11:16 -0400 | [diff] [blame] | 874 | include $(CLEAR_VARS) |
Dan Cashman | 9c03807 | 2016-12-22 07:15:18 -0800 | [diff] [blame] | 875 | LOCAL_MODULE := nonplat_seapp_contexts |
Stephen Smalley | 3771287 | 2015-03-12 15:46:36 -0400 | [diff] [blame] | 876 | LOCAL_MODULE_CLASS := ETC |
Dan Cashman | 9c03807 | 2016-12-22 07:15:18 -0800 | [diff] [blame] | 877 | LOCAL_MODULE_TAGS := optional |
Jeff Vander Stoep | 4e3a4c7 | 2017-03-08 22:28:03 -0800 | [diff] [blame] | 878 | ifeq ($(PRODUCT_FULL_TREBLE),true) |
| 879 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux |
| 880 | else |
Dan Cashman | 9c03807 | 2016-12-22 07:15:18 -0800 | [diff] [blame] | 881 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
Jeff Vander Stoep | 4e3a4c7 | 2017-03-08 22:28:03 -0800 | [diff] [blame] | 882 | endif |
Stephen Smalley | 3771287 | 2015-03-12 15:46:36 -0400 | [diff] [blame] | 883 | |
| 884 | include $(BUILD_SYSTEM)/base_rules.mk |
| 885 | |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 886 | nonplat_sc_files := $(call build_policy, seapp_contexts, $(PLAT_VENDOR_POLICY) $(BOARD_SEPOLICY_DIRS) $(REQD_MASK_POLICY)) |
Jeff Vander Stoep | 87ae5f7 | 2017-03-06 22:53:09 -0800 | [diff] [blame] | 887 | plat_sc_neverallow_files := $(addprefix $(PLAT_PRIVATE_POLICY)/, seapp_contexts) |
Stephen Smalley | 3771287 | 2015-03-12 15:46:36 -0400 | [diff] [blame] | 888 | |
Dan Cashman | 9c03807 | 2016-12-22 07:15:18 -0800 | [diff] [blame] | 889 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
| 890 | $(LOCAL_BUILT_MODULE): PRIVATE_SC_FILES := $(nonplat_sc_files) |
Jeff Vander Stoep | 87ae5f7 | 2017-03-06 22:53:09 -0800 | [diff] [blame] | 891 | $(LOCAL_BUILT_MODULE): PRIVATE_SC_NEVERALLOW_FILES := $(plat_sc_neverallow_files) |
| 892 | $(LOCAL_BUILT_MODULE): $(built_sepolicy) $(nonplat_sc_files) $(HOST_OUT_EXECUTABLES)/checkseapp $(plat_sc_neverallow_files) |
Stephen Smalley | 3771287 | 2015-03-12 15:46:36 -0400 | [diff] [blame] | 893 | @mkdir -p $(dir $@) |
Xin Li | ec6f393 | 2017-03-14 16:51:13 -0700 | [diff] [blame] | 894 | $(hide) grep -ie '^neverallow' $(PRIVATE_SC_NEVERALLOW_FILES) > $@.tmp |
| 895 | $(hide) $(HOST_OUT_EXECUTABLES)/checkseapp -p $(PRIVATE_SEPOLICY) -o $@ $(PRIVATE_SC_FILES) $@.tmp |
Stephen Smalley | 3771287 | 2015-03-12 15:46:36 -0400 | [diff] [blame] | 896 | |
Dan Cashman | 9c03807 | 2016-12-22 07:15:18 -0800 | [diff] [blame] | 897 | built_nonplat_sc := $(LOCAL_BUILT_MODULE) |
| 898 | nonplat_sc_files := |
Stephen Smalley | 3771287 | 2015-03-12 15:46:36 -0400 | [diff] [blame] | 899 | |
| 900 | ################################## |
| 901 | include $(CLEAR_VARS) |
Dan Cashman | 9c03807 | 2016-12-22 07:15:18 -0800 | [diff] [blame] | 902 | LOCAL_MODULE := plat_seapp_neverallows |
William Roberts | 4ee7131 | 2015-06-25 11:59:30 -0700 | [diff] [blame] | 903 | LOCAL_MODULE_CLASS := ETC |
| 904 | LOCAL_MODULE_TAGS := tests |
| 905 | |
| 906 | include $(BUILD_SYSTEM)/base_rules.mk |
| 907 | |
Jeff Vander Stoep | 87ae5f7 | 2017-03-06 22:53:09 -0800 | [diff] [blame] | 908 | $(LOCAL_BUILT_MODULE): $(plat_sc_neverallow_files) |
William Roberts | 4ee7131 | 2015-06-25 11:59:30 -0700 | [diff] [blame] | 909 | @mkdir -p $(dir $@) |
| 910 | - $(hide) grep -ie '^neverallow' $< > $@ |
| 911 | |
Jeff Vander Stoep | 87ae5f7 | 2017-03-06 22:53:09 -0800 | [diff] [blame] | 912 | plat_sc_neverallow_files := |
William Roberts | 4ee7131 | 2015-06-25 11:59:30 -0700 | [diff] [blame] | 913 | |
| 914 | ################################## |
| 915 | include $(CLEAR_VARS) |
Stephen Smalley | 124720a | 2012-04-04 10:11:16 -0400 | [diff] [blame] | 916 | |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 917 | LOCAL_MODULE := plat_property_contexts |
Stephen Smalley | 124720a | 2012-04-04 10:11:16 -0400 | [diff] [blame] | 918 | LOCAL_MODULE_CLASS := ETC |
| 919 | LOCAL_MODULE_TAGS := optional |
Alex Klyubin | 9d59041 | 2017-03-08 13:10:05 -0800 | [diff] [blame] | 920 | |
| 921 | ifeq ($(PRODUCT_FULL_TREBLE),true) |
| 922 | LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/selinux |
| 923 | else |
Stephen Smalley | 124720a | 2012-04-04 10:11:16 -0400 | [diff] [blame] | 924 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
Alex Klyubin | 9d59041 | 2017-03-08 13:10:05 -0800 | [diff] [blame] | 925 | endif |
Stephen Smalley | 124720a | 2012-04-04 10:11:16 -0400 | [diff] [blame] | 926 | |
| 927 | include $(BUILD_SYSTEM)/base_rules.mk |
| 928 | |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 929 | plat_pcfiles := $(call build_policy, property_contexts, $(PLAT_PRIVATE_POLICY)) |
William Roberts | 6aabc1c | 2015-07-30 11:44:26 -0700 | [diff] [blame] | 930 | |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 931 | plat_property_contexts.tmp := $(intermediates)/plat_property_contexts.tmp |
| 932 | $(plat_property_contexts.tmp): PRIVATE_PC_FILES := $(plat_pcfiles) |
| 933 | $(plat_property_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 934 | $(plat_property_contexts.tmp): $(plat_pcfiles) |
William Roberts | 7f81b33 | 2015-09-29 13:52:37 -0700 | [diff] [blame] | 935 | @mkdir -p $(dir $@) |
Colin Cross | 9eb6c87 | 2015-10-01 21:25:09 +0000 | [diff] [blame] | 936 | $(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_PC_FILES) > $@ |
William Roberts | dcffd2b | 2015-09-29 13:52:37 -0700 | [diff] [blame] | 937 | |
| 938 | |
| 939 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 940 | $(LOCAL_BUILT_MODULE): $(plat_property_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc |
William Roberts | dcffd2b | 2015-09-29 13:52:37 -0700 | [diff] [blame] | 941 | @mkdir -p $(dir $@) |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 942 | $(hide) sed -e 's/#.*$$//' -e '/^$$/d' $< | sort -u -o $@ |
dcashman | 0779155 | 2016-12-07 11:27:47 -0800 | [diff] [blame] | 943 | $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -p $(PRIVATE_SEPOLICY) $@ |
Stephen Smalley | 124720a | 2012-04-04 10:11:16 -0400 | [diff] [blame] | 944 | |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 945 | built_plat_pc := $(LOCAL_BUILT_MODULE) |
| 946 | plat_pcfiles := |
| 947 | plat_property_contexts.tmp := |
Robert Craig | 8b7545b | 2014-03-20 09:35:08 -0400 | [diff] [blame] | 948 | |
Stephen Smalley | 124720a | 2012-04-04 10:11:16 -0400 | [diff] [blame] | 949 | ################################## |
Riley Spahn | f90c41f | 2014-06-05 15:52:02 -0700 | [diff] [blame] | 950 | include $(CLEAR_VARS) |
| 951 | |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 952 | LOCAL_MODULE := nonplat_property_contexts |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 953 | LOCAL_MODULE_CLASS := ETC |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 954 | LOCAL_MODULE_TAGS := optional |
Alex Klyubin | 9d59041 | 2017-03-08 13:10:05 -0800 | [diff] [blame] | 955 | |
| 956 | ifeq ($(PRODUCT_FULL_TREBLE),true) |
| 957 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux |
| 958 | else |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 959 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
Alex Klyubin | 9d59041 | 2017-03-08 13:10:05 -0800 | [diff] [blame] | 960 | endif |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 961 | |
Stephen Smalley | c936173 | 2015-03-13 09:36:57 -0400 | [diff] [blame] | 962 | include $(BUILD_SYSTEM)/base_rules.mk |
| 963 | |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 964 | nonplat_pcfiles := $(call build_policy, property_contexts, $(PLAT_VENDOR_POLICY) $(BOARD_SEPOLICY_DIRS) $(REQD_MASK_POLICY)) |
Sandeep Patil | 262edc3 | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 965 | |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 966 | nonplat_property_contexts.tmp := $(intermediates)/nonplat_property_contexts.tmp |
| 967 | $(nonplat_property_contexts.tmp): PRIVATE_PC_FILES := $(nonplat_pcfiles) |
| 968 | $(nonplat_property_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 969 | $(nonplat_property_contexts.tmp): $(nonplat_pcfiles) |
William Roberts | dcffd2b | 2015-09-29 13:52:37 -0700 | [diff] [blame] | 970 | @mkdir -p $(dir $@) |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 971 | $(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_PC_FILES) > $@ |
| 972 | |
| 973 | |
| 974 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
| 975 | $(LOCAL_BUILT_MODULE): $(nonplat_property_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc |
| 976 | @mkdir -p $(dir $@) |
| 977 | $(hide) sed -e 's/#.*$$//' -e '/^$$/d' $< | sort -u -o $@ |
dcashman | 0779155 | 2016-12-07 11:27:47 -0800 | [diff] [blame] | 978 | $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -p $(PRIVATE_SEPOLICY) $@ |
William Roberts | dcffd2b | 2015-09-29 13:52:37 -0700 | [diff] [blame] | 979 | |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 980 | built_nonplat_pc := $(LOCAL_BUILT_MODULE) |
| 981 | nonplat_pcfiles := |
| 982 | nonplat_property_contexts.tmp := |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 983 | |
| 984 | ################################## |
| 985 | include $(CLEAR_VARS) |
| 986 | |
Alex Klyubin | ec78c37 | 2017-03-10 12:44:16 -0800 | [diff] [blame] | 987 | LOCAL_MODULE := plat_property_contexts.recovery |
| 988 | LOCAL_MODULE_STEM := plat_property_contexts |
| 989 | LOCAL_MODULE_CLASS := ETC |
| 990 | LOCAL_MODULE_TAGS := optional |
| 991 | LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT) |
| 992 | |
| 993 | include $(BUILD_SYSTEM)/base_rules.mk |
| 994 | |
| 995 | $(LOCAL_BUILT_MODULE): $(built_plat_pc) |
| 996 | $(hide) cp -f $< $@ |
| 997 | |
| 998 | ################################## |
| 999 | include $(CLEAR_VARS) |
| 1000 | |
| 1001 | LOCAL_MODULE := nonplat_property_contexts.recovery |
| 1002 | LOCAL_MODULE_STEM := nonplat_property_contexts |
| 1003 | LOCAL_MODULE_CLASS := ETC |
| 1004 | LOCAL_MODULE_TAGS := optional |
| 1005 | LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT) |
| 1006 | |
| 1007 | include $(BUILD_SYSTEM)/base_rules.mk |
| 1008 | |
| 1009 | $(LOCAL_BUILT_MODULE): $(built_nonplat_pc) |
| 1010 | $(hide) cp -f $< $@ |
| 1011 | |
| 1012 | ################################## |
| 1013 | include $(CLEAR_VARS) |
| 1014 | |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 1015 | LOCAL_MODULE := plat_service_contexts |
Riley Spahn | f90c41f | 2014-06-05 15:52:02 -0700 | [diff] [blame] | 1016 | LOCAL_MODULE_CLASS := ETC |
| 1017 | LOCAL_MODULE_TAGS := optional |
Jeff Vander Stoep | 4e3a4c7 | 2017-03-08 22:28:03 -0800 | [diff] [blame] | 1018 | ifeq ($(PRODUCT_FULL_TREBLE),true) |
| 1019 | LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/selinux |
| 1020 | else |
Riley Spahn | f90c41f | 2014-06-05 15:52:02 -0700 | [diff] [blame] | 1021 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
Jeff Vander Stoep | 4e3a4c7 | 2017-03-08 22:28:03 -0800 | [diff] [blame] | 1022 | endif |
Riley Spahn | f90c41f | 2014-06-05 15:52:02 -0700 | [diff] [blame] | 1023 | |
| 1024 | include $(BUILD_SYSTEM)/base_rules.mk |
| 1025 | |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 1026 | plat_svcfiles := $(call build_policy, service_contexts, $(PLAT_PRIVATE_POLICY)) |
Riley Spahn | f90c41f | 2014-06-05 15:52:02 -0700 | [diff] [blame] | 1027 | |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 1028 | plat_service_contexts.tmp := $(intermediates)/plat_service_contexts.tmp |
| 1029 | $(plat_service_contexts.tmp): PRIVATE_SVC_FILES := $(plat_svcfiles) |
| 1030 | $(plat_service_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 1031 | $(plat_service_contexts.tmp): $(plat_svcfiles) |
Riley Spahn | f90c41f | 2014-06-05 15:52:02 -0700 | [diff] [blame] | 1032 | @mkdir -p $(dir $@) |
William Roberts | 6aabc1c | 2015-07-30 11:44:26 -0700 | [diff] [blame] | 1033 | $(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_SVC_FILES) > $@ |
William Roberts | 7fc865a | 2015-09-29 14:17:38 -0700 | [diff] [blame] | 1034 | |
| 1035 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 1036 | $(LOCAL_BUILT_MODULE): $(plat_service_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc $(ACP) |
William Roberts | 7fc865a | 2015-09-29 14:17:38 -0700 | [diff] [blame] | 1037 | @mkdir -p $(dir $@) |
William Roberts | c9fce3f | 2016-04-06 11:53:04 -0700 | [diff] [blame] | 1038 | sed -e 's/#.*$$//' -e '/^$$/d' $< > $@ |
dcashman | 0779155 | 2016-12-07 11:27:47 -0800 | [diff] [blame] | 1039 | $(HOST_OUT_EXECUTABLES)/checkfc -s $(PRIVATE_SEPOLICY) $@ |
Riley Spahn | f90c41f | 2014-06-05 15:52:02 -0700 | [diff] [blame] | 1040 | |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 1041 | built_plat_svc := $(LOCAL_BUILT_MODULE) |
| 1042 | plat_svcfiles := |
| 1043 | plat_service_contexts.tmp := |
Riley Spahn | f90c41f | 2014-06-05 15:52:02 -0700 | [diff] [blame] | 1044 | |
| 1045 | ################################## |
rpcraig | b19665c | 2012-07-30 09:33:03 -0400 | [diff] [blame] | 1046 | include $(CLEAR_VARS) |
| 1047 | |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 1048 | LOCAL_MODULE := nonplat_service_contexts |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 1049 | LOCAL_MODULE_CLASS := ETC |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 1050 | LOCAL_MODULE_TAGS := optional |
Jeff Vander Stoep | 4e3a4c7 | 2017-03-08 22:28:03 -0800 | [diff] [blame] | 1051 | ifeq ($(PRODUCT_FULL_TREBLE),true) |
| 1052 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux |
| 1053 | else |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 1054 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
Jeff Vander Stoep | 4e3a4c7 | 2017-03-08 22:28:03 -0800 | [diff] [blame] | 1055 | endif |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 1056 | |
| 1057 | include $(BUILD_SYSTEM)/base_rules.mk |
| 1058 | |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 1059 | nonplat_svcfiles := $(call build_policy, service_contexts, $(PLAT_VENDOR_POLICY) $(BOARD_SEPOLICY_DIRS) $(REQD_MASK_POLICY)) |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 1060 | |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 1061 | nonplat_service_contexts.tmp := $(intermediates)/nonplat_service_contexts.tmp |
| 1062 | $(nonplat_service_contexts.tmp): PRIVATE_SVC_FILES := $(nonplat_svcfiles) |
| 1063 | $(nonplat_service_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 1064 | $(nonplat_service_contexts.tmp): $(nonplat_svcfiles) |
| 1065 | @mkdir -p $(dir $@) |
| 1066 | $(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_SVC_FILES) > $@ |
| 1067 | |
| 1068 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
| 1069 | $(LOCAL_BUILT_MODULE): $(nonplat_service_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc $(ACP) |
William Roberts | 7fc865a | 2015-09-29 14:17:38 -0700 | [diff] [blame] | 1070 | @mkdir -p $(dir $@) |
William Roberts | c9fce3f | 2016-04-06 11:53:04 -0700 | [diff] [blame] | 1071 | sed -e 's/#.*$$//' -e '/^$$/d' $< > $@ |
dcashman | 0779155 | 2016-12-07 11:27:47 -0800 | [diff] [blame] | 1072 | $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -s $(PRIVATE_SEPOLICY) $@ |
William Roberts | 7fc865a | 2015-09-29 14:17:38 -0700 | [diff] [blame] | 1073 | |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 1074 | built_nonplat_svc := $(LOCAL_BUILT_MODULE) |
| 1075 | nonplat_svcfiles := |
| 1076 | nonplat_service_contexts.tmp := |
Stephen Smalley | 2e0cd5a | 2015-03-12 17:45:03 -0400 | [diff] [blame] | 1077 | |
| 1078 | ################################## |
| 1079 | include $(CLEAR_VARS) |
| 1080 | |
Martijn Coenen | 6676c23 | 2017-03-31 17:29:53 -0700 | [diff] [blame] | 1081 | LOCAL_MODULE := vndservice_contexts |
| 1082 | LOCAL_MODULE_CLASS := ETC |
| 1083 | LOCAL_MODULE_TAGS := optional |
| 1084 | ifeq ($(PRODUCT_FULL_TREBLE),true) |
| 1085 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux |
| 1086 | else |
| 1087 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
| 1088 | endif |
| 1089 | |
| 1090 | include $(BUILD_SYSTEM)/base_rules.mk |
| 1091 | |
| 1092 | vnd_svcfiles := $(call build_policy, vndservice_contexts, $(PLAT_VENDOR_POLICY) $(BOARD_SEPOLICY_DIRS) $(REQD_MASK_POLICY)) |
| 1093 | |
| 1094 | vndservice_contexts.tmp := $(intermediates)/vndservice_contexts.tmp |
| 1095 | $(vndservice_contexts.tmp): PRIVATE_SVC_FILES := $(vnd_svcfiles) |
| 1096 | $(vndservice_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 1097 | $(vndservice_contexts.tmp): $(vnd_svcfiles) |
| 1098 | @mkdir -p $(dir $@) |
| 1099 | $(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_SVC_FILES) > $@ |
| 1100 | |
| 1101 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
| 1102 | $(LOCAL_BUILT_MODULE): $(vndservice_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc $(ACP) |
| 1103 | @mkdir -p $(dir $@) |
| 1104 | sed -e 's/#.*$$//' -e '/^$$/d' $< > $@ |
Martijn Coenen | ee97662 | 2017-04-07 10:08:55 -0700 | [diff] [blame] | 1105 | $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -e -v $(PRIVATE_SEPOLICY) $@ |
Martijn Coenen | 6676c23 | 2017-03-31 17:29:53 -0700 | [diff] [blame] | 1106 | |
| 1107 | vnd_svcfiles := |
| 1108 | vndservice_contexts.tmp := |
| 1109 | ################################## |
| 1110 | include $(CLEAR_VARS) |
| 1111 | |
dcashman | 90b3b94 | 2016-12-14 13:47:55 -0800 | [diff] [blame] | 1112 | LOCAL_MODULE := plat_mac_permissions.xml |
rpcraig | b19665c | 2012-07-30 09:33:03 -0400 | [diff] [blame] | 1113 | LOCAL_MODULE_CLASS := ETC |
| 1114 | LOCAL_MODULE_TAGS := optional |
Jeff Vander Stoep | bba9e7b | 2017-03-10 15:51:23 -0800 | [diff] [blame] | 1115 | LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/selinux |
rpcraig | b19665c | 2012-07-30 09:33:03 -0400 | [diff] [blame] | 1116 | |
William Roberts | 2c8a55d | 2012-11-30 14:59:09 -0800 | [diff] [blame] | 1117 | include $(BUILD_SYSTEM)/base_rules.mk |
rpcraig | b19665c | 2012-07-30 09:33:03 -0400 | [diff] [blame] | 1118 | |
Geremy Condra | cd4104e | 2013-03-26 18:19:12 +0000 | [diff] [blame] | 1119 | # Build keys.conf |
dcashman | 90b3b94 | 2016-12-14 13:47:55 -0800 | [diff] [blame] | 1120 | plat_mac_perms_keys.tmp := $(intermediates)/plat_keys.tmp |
| 1121 | $(plat_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
| 1122 | $(plat_mac_perms_keys.tmp): $(call build_policy, keys.conf, $(PLAT_PRIVATE_POLICY)) |
Geremy Condra | cd4104e | 2013-03-26 18:19:12 +0000 | [diff] [blame] | 1123 | @mkdir -p $(dir $@) |
William Roberts | d218558 | 2015-07-16 11:28:02 -0700 | [diff] [blame] | 1124 | $(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $^ > $@ |
Geremy Condra | cd4104e | 2013-03-26 18:19:12 +0000 | [diff] [blame] | 1125 | |
dcashman | 90b3b94 | 2016-12-14 13:47:55 -0800 | [diff] [blame] | 1126 | all_plat_mac_perms_files := $(call build_policy, mac_permissions.xml, $(PLAT_PRIVATE_POLICY)) |
rpcraig | b19665c | 2012-07-30 09:33:03 -0400 | [diff] [blame] | 1127 | |
Shinichiro Hamaji | ef0c14d | 2016-05-13 16:04:58 +0900 | [diff] [blame] | 1128 | # Should be synced with keys.conf. |
dcashman | 90b3b94 | 2016-12-14 13:47:55 -0800 | [diff] [blame] | 1129 | all_plat_keys := platform media shared testkey |
| 1130 | all_plat_keys := $(all_keys:%=$(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))/%.x509.pem) |
Shinichiro Hamaji | ef0c14d | 2016-05-13 16:04:58 +0900 | [diff] [blame] | 1131 | |
dcashman | 90b3b94 | 2016-12-14 13:47:55 -0800 | [diff] [blame] | 1132 | $(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_plat_mac_perms_files) |
| 1133 | $(LOCAL_BUILT_MODULE): $(plat_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py \ |
| 1134 | $(all_plat_mac_perms_files) $(all_plat_keys) |
Geremy Condra | cd4104e | 2013-03-26 18:19:12 +0000 | [diff] [blame] | 1135 | @mkdir -p $(dir $@) |
Nick Kralevich | c3c9052 | 2013-10-25 12:25:36 -0700 | [diff] [blame] | 1136 | $(hide) DEFAULT_SYSTEM_DEV_CERTIFICATE="$(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))" \ |
William Roberts | 6aabc1c | 2015-07-30 11:44:26 -0700 | [diff] [blame] | 1137 | $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES) |
Geremy Condra | cd4104e | 2013-03-26 18:19:12 +0000 | [diff] [blame] | 1138 | |
William Roberts | 6aabc1c | 2015-07-30 11:44:26 -0700 | [diff] [blame] | 1139 | all_mac_perms_files := |
dcashman | 90b3b94 | 2016-12-14 13:47:55 -0800 | [diff] [blame] | 1140 | all_plat_keys := |
| 1141 | plat_mac_perms_keys.tmp := |
| 1142 | |
| 1143 | ################################## |
| 1144 | include $(CLEAR_VARS) |
| 1145 | |
| 1146 | LOCAL_MODULE := nonplat_mac_permissions.xml |
| 1147 | LOCAL_MODULE_CLASS := ETC |
| 1148 | LOCAL_MODULE_TAGS := optional |
Jeff Vander Stoep | bba9e7b | 2017-03-10 15:51:23 -0800 | [diff] [blame] | 1149 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux |
dcashman | 90b3b94 | 2016-12-14 13:47:55 -0800 | [diff] [blame] | 1150 | |
| 1151 | include $(BUILD_SYSTEM)/base_rules.mk |
| 1152 | |
| 1153 | # Build keys.conf |
| 1154 | nonplat_mac_perms_keys.tmp := $(intermediates)/nonplat_keys.tmp |
| 1155 | $(nonplat_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 1156 | $(nonplat_mac_perms_keys.tmp): $(call build_policy, keys.conf, $(PLAT_VENDOR_POLICY) $(BOARD_SEPOLICY_DIRS) $(REQD_MASK_POLICY)) |
dcashman | 90b3b94 | 2016-12-14 13:47:55 -0800 | [diff] [blame] | 1157 | @mkdir -p $(dir $@) |
| 1158 | $(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $^ > $@ |
| 1159 | |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 1160 | all_nonplat_mac_perms_files := $(call build_policy, mac_permissions.xml, $(PLAT_VENDOR_POLICY) $(BOARD_SEPOLICY_DIRS) $(REQD_MASK_POLICY)) |
dcashman | 90b3b94 | 2016-12-14 13:47:55 -0800 | [diff] [blame] | 1161 | |
| 1162 | $(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_nonplat_mac_perms_files) |
| 1163 | $(LOCAL_BUILT_MODULE): $(nonplat_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py \ |
| 1164 | $(all_nonplat_mac_perms_files) |
| 1165 | @mkdir -p $(dir $@) |
| 1166 | $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES) |
| 1167 | |
| 1168 | nonplat_mac_perms_keys.tmp := |
| 1169 | all_nonplat_mac_perms_files := |
William Roberts | 6aabc1c | 2015-07-30 11:44:26 -0700 | [diff] [blame] | 1170 | |
rpcraig | b19665c | 2012-07-30 09:33:03 -0400 | [diff] [blame] | 1171 | ################################## |
rpcraig | 47cd396 | 2012-10-17 21:09:52 -0400 | [diff] [blame] | 1172 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 1173 | add_nl := |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 1174 | build_device_policy := |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 1175 | build_policy := |
dcashman | d225b69 | 2016-12-12 09:29:04 -0800 | [diff] [blame] | 1176 | built_plat_fc := |
| 1177 | built_nonplat_fc := |
Richard Haines | c8801fe | 2015-12-11 10:39:19 +0000 | [diff] [blame] | 1178 | built_nl := |
Alex Klyubin | 8f7173b | 2017-02-25 14:47:53 -0800 | [diff] [blame] | 1179 | built_plat_cil := |
Alex Klyubin | 8f7173b | 2017-02-25 14:47:53 -0800 | [diff] [blame] | 1180 | built_mapping_cil := |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 1181 | built_plat_pc := |
Alex Klyubin | 193dccd | 2017-03-07 14:05:57 -0800 | [diff] [blame] | 1182 | built_nonplat_cil := |
Sandeep Patil | a86316e | 2016-12-27 16:08:44 -0800 | [diff] [blame] | 1183 | built_nonplat_pc := |
Dan Cashman | 9c03807 | 2016-12-22 07:15:18 -0800 | [diff] [blame] | 1184 | built_nonplat_sc := |
| 1185 | built_plat_sc := |
Alex Klyubin | 193dccd | 2017-03-07 14:05:57 -0800 | [diff] [blame] | 1186 | built_precompiled_sepolicy := |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 1187 | built_sepolicy := |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 1188 | built_plat_svc := |
| 1189 | built_nonplat_svc := |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 1190 | mapping_policy_nvr := |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 1191 | my_target_arch := |
| 1192 | nonplat_policy_nvr := |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 1193 | plat_policy_nvr := |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 1194 | plat_pub_policy.cil := |
| 1195 | reqd_policy_mask.cil := |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 1196 | sepolicy_build_files := |
Alex Klyubin | 7cda44f | 2017-03-21 14:28:53 -0700 | [diff] [blame] | 1197 | sepolicy_build_cil_workaround_files := |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 1198 | with_asan := |
Alice Chu | cdfb06f | 2012-11-01 11:33:04 -0700 | [diff] [blame] | 1199 | |
| 1200 | include $(call all-makefiles-under,$(LOCAL_PATH)) |