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 | 36ee91d | 2017-07-07 14:59:51 -0700 | [diff] [blame] | 3 | include $(LOCAL_PATH)/definitions.mk |
Jeff Vander Stoep | ecd288f | 2019-02-15 12:18:15 -0800 | [diff] [blame] | 4 | include $(LOCAL_PATH)/policy_version.mk |
Dan Cashman | 36ee91d | 2017-07-07 14:59:51 -0700 | [diff] [blame] | 5 | |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 6 | include $(CLEAR_VARS) |
Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 7 | |
| 8 | MLS_SENS=1 |
| 9 | MLS_CATS=1024 |
| 10 | |
Stephen Smalley | 8e0ca88 | 2015-04-01 10:14:56 -0400 | [diff] [blame] | 11 | ifdef BOARD_SEPOLICY_UNION |
| 12 | $(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.) |
| 13 | endif |
Robert Craig | 6b0ff47 | 2014-01-29 13:10:58 -0500 | [diff] [blame] | 14 | |
William Roberts | d218558 | 2015-07-16 11:28:02 -0700 | [diff] [blame] | 15 | ifdef BOARD_SEPOLICY_M4DEFS |
| 16 | LOCAL_ADDITIONAL_M4DEFS := $(addprefix -D, $(BOARD_SEPOLICY_M4DEFS)) |
Dan Cashman | 36ee91d | 2017-07-07 14:59:51 -0700 | [diff] [blame] | 17 | else |
| 18 | LOCAL_ADDITIONAL_M4DEFS := |
William Roberts | d218558 | 2015-07-16 11:28:02 -0700 | [diff] [blame] | 19 | endif |
| 20 | |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 21 | # sepolicy is now divided into multiple portions: |
| 22 | # public - policy exported on which non-platform policy developers may write |
| 23 | # additional policy. types and attributes are versioned and included in |
| 24 | # delivered non-platform policy, which is to be combined with platform policy. |
| 25 | # private - platform-only policy required for platform functionality but which |
| 26 | # is not exported to vendor policy developers and as such may not be assumed |
| 27 | # to exist. |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 28 | # vendor - vendor-only policy required for vendor functionality. This policy can |
| 29 | # reference the public policy but cannot reference the private policy. This |
| 30 | # policy is for components which are produced from the core/non-vendor tree and |
| 31 | # placed into a vendor partition. |
dcashman | 0779155 | 2016-12-07 11:27:47 -0800 | [diff] [blame] | 32 | # mapping - This contains policy statements which map the attributes |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 33 | # exposed in the public policy of previous versions to the concrete types used |
| 34 | # in this policy to ensure that policy targeting attributes from public |
| 35 | # policy from an older platform version continues to work. |
| 36 | |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 37 | # build process for device: |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 38 | # 1) convert policies to CIL: |
| 39 | # - private + public platform policy to CIL |
| 40 | # - mapping file to CIL (should already be in CIL form) |
| 41 | # - non-platform public policy to CIL |
| 42 | # - non-platform public + private policy to CIL |
| 43 | # 2) attributize policy |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 44 | # - run script which takes non-platform public and non-platform combined |
| 45 | # private + public policy and produces attributized and versioned |
| 46 | # non-platform policy |
| 47 | # 3) combine policy files |
| 48 | # - combine mapping, platform and non-platform policy. |
| 49 | # - compile output binary policy file |
| 50 | |
| 51 | PLAT_PUBLIC_POLICY := $(LOCAL_PATH)/public |
| 52 | PLAT_PRIVATE_POLICY := $(LOCAL_PATH)/private |
Alex Klyubin | 5596172 | 2017-01-30 18:44:59 -0800 | [diff] [blame] | 53 | PLAT_VENDOR_POLICY := $(LOCAL_PATH)/vendor |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 54 | REQD_MASK_POLICY := $(LOCAL_PATH)/reqd_mask |
Felix | 8c53a33 | 2020-07-14 21:28:51 +0200 | [diff] [blame] | 55 | |
| 56 | SYSTEM_EXT_PUBLIC_POLICY := $(SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS) |
| 57 | ifneq (,$(BOARD_PLAT_PUBLIC_SEPOLICY_DIR)) |
Bowgo Tsai | 72b2acb | 2020-10-28 05:01:17 +0000 | [diff] [blame] | 58 | # TODO: Disallow BOARD_PLAT_* |
Felix | 8c53a33 | 2020-07-14 21:28:51 +0200 | [diff] [blame] | 59 | SYSTEM_EXT_PUBLIC_POLICY += $(BOARD_PLAT_PUBLIC_SEPOLICY_DIR) |
| 60 | endif |
| 61 | SYSTEM_EXT_PRIVATE_POLICY := $(SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS) |
| 62 | ifneq (,$(BOARD_PLAT_PRIVATE_SEPOLICY_DIR)) |
Bowgo Tsai | 72b2acb | 2020-10-28 05:01:17 +0000 | [diff] [blame] | 63 | # TODO: Disallow BOARD_PLAT_* |
Felix | 8c53a33 | 2020-07-14 21:28:51 +0200 | [diff] [blame] | 64 | SYSTEM_EXT_PRIVATE_POLICY += $(BOARD_PLAT_PRIVATE_SEPOLICY_DIR) |
| 65 | endif |
| 66 | |
Tri Vo | 9918f28 | 2019-02-01 11:41:08 -0800 | [diff] [blame] | 67 | PRODUCT_PUBLIC_POLICY := $(PRODUCT_PUBLIC_SEPOLICY_DIRS) |
| 68 | PRODUCT_PRIVATE_POLICY := $(PRODUCT_PRIVATE_SEPOLICY_DIRS) |
Tri Vo | 75887dd | 2018-12-14 14:30:56 -0800 | [diff] [blame] | 69 | |
Bowgo Tsai | 948934b | 2019-08-29 17:12:11 +0800 | [diff] [blame] | 70 | ifneq (,$(SYSTEM_EXT_PUBLIC_POLICY)$(SYSTEM_EXT_PRIVATE_POLICY)) |
Bowgo Tsai | ac38125 | 2019-10-04 14:34:18 +0800 | [diff] [blame] | 71 | HAS_SYSTEM_EXT_SEPOLICY_DIR := true |
Bowgo Tsai | 948934b | 2019-08-29 17:12:11 +0800 | [diff] [blame] | 72 | endif |
| 73 | |
Tri Vo | 75887dd | 2018-12-14 14:30:56 -0800 | [diff] [blame] | 74 | # TODO(b/119305624): Currently if the device doesn't have a product partition, |
| 75 | # we install product sepolicy into /system/product. We do that because bits of |
| 76 | # product sepolicy that's still in /system might depend on bits that have moved |
| 77 | # to /product. Once we finish migrating product sepolicy out of system, change |
| 78 | # it so that if no product partition is present, product sepolicy artifacts are |
| 79 | # not built and installed at all. |
| 80 | ifneq (,$(PRODUCT_PUBLIC_POLICY)$(PRODUCT_PRIVATE_POLICY)) |
Bowgo Tsai | 7c4150c | 2019-10-04 15:36:05 +0800 | [diff] [blame] | 81 | HAS_PRODUCT_SEPOLICY_DIR := true |
Tri Vo | 75887dd | 2018-12-14 14:30:56 -0800 | [diff] [blame] | 82 | endif |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 83 | |
Inseob Kim | 8ada8a7 | 2020-11-09 20:58:58 +0900 | [diff] [blame] | 84 | ifneq ($(PLATFORM_SEPOLICY_VERSION),$(BOARD_SEPOLICY_VERS)) |
| 85 | mixed_sepolicy_build := true |
| 86 | else |
| 87 | mixed_sepolicy_build := |
| 88 | endif |
| 89 | |
Joel Galenson | 5988b56 | 2018-01-03 16:53:24 -0800 | [diff] [blame] | 90 | NEVERALLOW_ARG := |
| 91 | ifeq ($(SELINUX_IGNORE_NEVERALLOWS),true) |
| 92 | ifeq ($(TARGET_BUILD_VARIANT),user) |
| 93 | $(error SELINUX_IGNORE_NEVERALLOWS := true cannot be used in user builds) |
| 94 | endif |
| 95 | $(warning Be careful when using the SELINUX_IGNORE_NEVERALLOWS flag. \ |
| 96 | It does not work in user builds and using it will \ |
| 97 | not stop you from failing CTS.) |
| 98 | NEVERALLOW_ARG := -N |
| 99 | endif |
| 100 | |
Bowgo Tsai | 45457e3 | 2017-11-27 11:41:33 +0800 | [diff] [blame] | 101 | # BOARD_SEPOLICY_DIRS was used for vendor/odm sepolicy customization before. |
| 102 | # It has been replaced by BOARD_VENDOR_SEPOLICY_DIRS (mandatory) and |
| 103 | # BOARD_ODM_SEPOLICY_DIRS (optional). BOARD_SEPOLICY_DIRS is still allowed for |
| 104 | # backward compatibility, which will be merged into BOARD_VENDOR_SEPOLICY_DIRS. |
Bowgo Tsai | afbcf21 | 2018-02-05 17:34:52 +0800 | [diff] [blame] | 105 | ifdef BOARD_SEPOLICY_DIRS |
| 106 | BOARD_VENDOR_SEPOLICY_DIRS += $(BOARD_SEPOLICY_DIRS) |
| 107 | endif |
Dan Cashman | 4d24a77 | 2017-04-12 14:28:34 -0700 | [diff] [blame] | 108 | |
Inseob Kim | 8ada8a7 | 2020-11-09 20:58:58 +0900 | [diff] [blame] | 109 | # Set default values for these prebuilt directories |
| 110 | ifeq (,$(BOARD_REQD_MASK_POLICY)) |
| 111 | BOARD_REQD_MASK_POLICY := $(REQD_MASK_POLICY) |
| 112 | endif |
| 113 | |
| 114 | ifeq (,$(BOARD_PLAT_VENDOR_POLICY)) |
| 115 | BOARD_PLAT_VENDOR_POLICY := $(PLAT_VENDOR_POLICY) |
| 116 | endif |
| 117 | |
| 118 | $(foreach p,SYSTEM_EXT PRODUCT,$(foreach q,PUBLIC PRIVATE,$(eval \ |
| 119 | $(if $(BOARD_$(p)_$(q)_PREBUILT_DIRS),,\ |
| 120 | BOARD_$(p)_$(q)_PREBUILT_DIRS := $($(p)_$(q)_POLICY) \ |
| 121 | ) \ |
| 122 | ))) |
| 123 | |
Bowgo Tsai | 45457e3 | 2017-11-27 11:41:33 +0800 | [diff] [blame] | 124 | ifdef BOARD_ODM_SEPOLICY_DIRS |
| 125 | ifneq ($(PRODUCT_SEPOLICY_SPLIT),true) |
| 126 | $(error PRODUCT_SEPOLICY_SPLIT needs to be true when using BOARD_ODM_SEPOLICY_DIRS) |
| 127 | endif |
| 128 | endif |
| 129 | |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 130 | ########################################################### |
| 131 | # Compute policy files to be used in policy build. |
| 132 | # $(1): files to include |
| 133 | # $(2): directories in which to find files |
| 134 | ########################################################### |
| 135 | |
| 136 | define build_policy |
Cole Faust | 087d527 | 2021-09-30 15:48:34 -0700 | [diff] [blame] | 137 | $(strip $(foreach type, $(1), $(foreach file, $(addsuffix /$(type), $(2)), $(sort $(wildcard $(file)))))) |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 138 | endef |
William Roberts | 29d1468 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 139 | |
Bowgo Tsai | afbcf21 | 2018-02-05 17:34:52 +0800 | [diff] [blame] | 140 | # Builds paths for all policy files found in BOARD_VENDOR_SEPOLICY_DIRS. |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 141 | # $(1): the set of policy name paths to build |
Inseob Kim | 7174ffe | 2021-12-08 22:45:58 +0900 | [diff] [blame] | 142 | build_vendor_policy = $(call build_policy, $(1), $(BOARD_PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS)) |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 143 | |
Bowgo Tsai | bae1517 | 2017-11-29 16:14:53 +0800 | [diff] [blame] | 144 | # Builds paths for all policy files found in BOARD_ODM_SEPOLICY_DIRS. |
| 145 | build_odm_policy = $(call build_policy, $(1), $(BOARD_ODM_SEPOLICY_DIRS)) |
| 146 | |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 147 | sepolicy_build_files := security_classes \ |
| 148 | initial_sids \ |
| 149 | access_vectors \ |
| 150 | global_macros \ |
Nick Kralevich | a17a266 | 2014-11-05 15:30:41 -0800 | [diff] [blame] | 151 | neverallow_macros \ |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 152 | mls_macros \ |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 153 | mls_decl \ |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 154 | mls \ |
| 155 | policy_capabilities \ |
| 156 | te_macros \ |
| 157 | attributes \ |
Jeff Vander Stoep | cbaa2b7 | 2015-12-22 10:39:34 -0800 | [diff] [blame] | 158 | ioctl_defines \ |
Jeff Vander Stoep | de9b530 | 2015-06-05 15:28:55 -0700 | [diff] [blame] | 159 | ioctl_macros \ |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 160 | *.te \ |
dcashman | 2e00e63 | 2016-10-12 14:58:09 -0700 | [diff] [blame] | 161 | roles_decl \ |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 162 | roles \ |
| 163 | users \ |
| 164 | initial_sid_contexts \ |
| 165 | fs_use \ |
| 166 | genfs_contexts \ |
| 167 | port_contexts |
| 168 | |
Chris Gross | 12c0b24 | 2020-09-21 15:32:16 -0700 | [diff] [blame] | 169 | sepolicy_compat_files := $(foreach ver, $(PLATFORM_SEPOLICY_COMPAT_VERSIONS), \ |
| 170 | $(addprefix compat/$(ver)/, $(addsuffix .cil, $(ver)))) |
| 171 | |
Tri Vo | 71f1239 | 2019-10-07 16:31:40 -0700 | [diff] [blame] | 172 | # Security classes and permissions defined outside of system/sepolicy. |
| 173 | security_class_extension_files := $(call build_policy, security_classes access_vectors, \ |
| 174 | $(SYSTEM_EXT_PUBLIC_POLICY) $(SYSTEM_EXT_PRIVATE_POLICY) \ |
| 175 | $(PRODUCT_PUBLIC_POLICY) $(PRODUCT_PRIVATE_POLICY) \ |
| 176 | $(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_ODM_SEPOLICY_DIRS)) |
| 177 | |
| 178 | ifneq (,$(strip $(security_class_extension_files))) |
| 179 | $(error Only platform SELinux policy may define classes and permissions: $(strip $(security_class_extension_files))) |
| 180 | endif |
| 181 | |
Bowgo Tsai | ac38125 | 2019-10-04 14:34:18 +0800 | [diff] [blame] | 182 | ifdef HAS_SYSTEM_EXT_SEPOLICY_DIR |
| 183 | # Checks if there are public system_ext policy files. |
| 184 | policy_files := $(call build_policy, $(sepolicy_build_files), $(SYSTEM_EXT_PUBLIC_POLICY)) |
| 185 | ifneq (,$(strip $(policy_files))) |
| 186 | HAS_SYSTEM_EXT_PUBLIC_SEPOLICY := true |
| 187 | endif |
| 188 | # Checks if there are public/private system_ext policy files. |
| 189 | policy_files := $(call build_policy, $(sepolicy_build_files), $(SYSTEM_EXT_PUBLIC_POLICY) $(SYSTEM_EXT_PRIVATE_POLICY)) |
| 190 | ifneq (,$(strip $(policy_files))) |
| 191 | HAS_SYSTEM_EXT_SEPOLICY := true |
| 192 | endif |
| 193 | endif # ifdef HAS_SYSTEM_EXT_SEPOLICY_DIR |
| 194 | |
Bowgo Tsai | 7c4150c | 2019-10-04 15:36:05 +0800 | [diff] [blame] | 195 | ifdef HAS_PRODUCT_SEPOLICY_DIR |
| 196 | # Checks if there are public product policy files. |
| 197 | policy_files := $(call build_policy, $(sepolicy_build_files), $(PRODUCT_PUBLIC_POLICY)) |
| 198 | ifneq (,$(strip $(policy_files))) |
| 199 | HAS_PRODUCT_PUBLIC_SEPOLICY := true |
| 200 | endif |
| 201 | # Checks if there are public/private product policy files. |
| 202 | policy_files := $(call build_policy, $(sepolicy_build_files), $(PRODUCT_PUBLIC_POLICY) $(PRODUCT_PRIVATE_POLICY)) |
| 203 | ifneq (,$(strip $(policy_files))) |
| 204 | HAS_PRODUCT_SEPOLICY := true |
| 205 | endif |
| 206 | endif # ifdef HAS_PRODUCT_SEPOLICY_DIR |
| 207 | |
Alex Klyubin | 7cda44f | 2017-03-21 14:28:53 -0700 | [diff] [blame] | 208 | # CIL files which contain workarounds for current limitation of human-readable |
| 209 | # module policy language. These files are appended to the CIL files produced |
| 210 | # from module language files. |
| 211 | sepolicy_build_cil_workaround_files := technical_debt.cil |
| 212 | |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 213 | my_target_arch := $(TARGET_ARCH) |
| 214 | ifneq (,$(filter mips mips64,$(TARGET_ARCH))) |
| 215 | my_target_arch := mips |
| 216 | endif |
| 217 | |
Jeff Vander Stoep | d2053bd | 2017-03-15 13:37:35 -0700 | [diff] [blame] | 218 | intermediates := $(TARGET_OUT_INTERMEDIATES)/ETC/sepolicy_intermediates |
| 219 | |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 220 | with_asan := false |
| 221 | ifneq (,$(filter address,$(SANITIZE_TARGET))) |
| 222 | with_asan := true |
| 223 | endif |
| 224 | |
Pirama Arumuga Nainar | ce9c0c5 | 2019-06-13 15:05:15 -0700 | [diff] [blame] | 225 | with_native_coverage := false |
| 226 | ifeq ($(NATIVE_COVERAGE),true) |
| 227 | with_native_coverage := true |
| 228 | endif |
Oliver Nguyen | fad5f81 | 2019-12-09 16:37:59 -0800 | [diff] [blame] | 229 | ifeq ($(CLANG_COVERAGE),true) |
| 230 | with_native_coverage := true |
| 231 | endif |
Pirama Arumuga Nainar | ce9c0c5 | 2019-06-13 15:05:15 -0700 | [diff] [blame] | 232 | |
Inseob Kim | ed59c22 | 2019-09-26 15:14:55 +0900 | [diff] [blame] | 233 | treble_sysprop_neverallow := true |
| 234 | ifeq ($(BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW),true) |
| 235 | treble_sysprop_neverallow := false |
| 236 | endif |
| 237 | |
| 238 | ifeq ($(PRODUCT_SHIPPING_API_LEVEL),) |
| 239 | #$(warning no product shipping level defined) |
| 240 | else ifneq ($(call math_lt,29,$(PRODUCT_SHIPPING_API_LEVEL)),) |
| 241 | ifneq ($(BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW),) |
| 242 | $(error BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW cannot be set on a device shipping with R or later, and this is tested by CTS.) |
| 243 | endif |
| 244 | endif |
| 245 | |
Inseob Kim | afc0993 | 2020-09-28 13:32:43 +0900 | [diff] [blame] | 246 | enforce_sysprop_owner := true |
| 247 | ifeq ($(BUILD_BROKEN_ENFORCE_SYSPROP_OWNER),true) |
| 248 | enforce_sysprop_owner := false |
| 249 | endif |
| 250 | |
Hridya Valsaraju | a885dd8 | 2021-04-26 16:32:17 -0700 | [diff] [blame] | 251 | enforce_debugfs_restriction := false |
| 252 | ifeq ($(PRODUCT_SET_DEBUGFS_RESTRICTIONS),true) |
| 253 | enforce_debugfs_restriction := true |
| 254 | endif |
| 255 | |
Inseob Kim | afc0993 | 2020-09-28 13:32:43 +0900 | [diff] [blame] | 256 | ifeq ($(PRODUCT_SHIPPING_API_LEVEL),) |
| 257 | #$(warning no product shipping level defined) |
| 258 | else ifneq ($(call math_lt,30,$(PRODUCT_SHIPPING_API_LEVEL)),) |
| 259 | ifneq ($(BUILD_BROKEN_ENFORCE_SYSPROP_OWNER),) |
| 260 | $(error BUILD_BROKEN_ENFORCE_SYSPROP_OWNER cannot be set on a device shipping with S or later, and this is tested by CTS.) |
| 261 | endif |
| 262 | endif |
| 263 | |
Jeff Vander Stoep | 3ca843a | 2017-10-04 09:42:29 -0700 | [diff] [blame] | 264 | # Library extension for host-side tests |
Jeff Vander Stoep | e06e4c1 | 2017-10-04 18:15:44 -0700 | [diff] [blame] | 265 | ifeq ($(HOST_OS),darwin) |
Jeff Vander Stoep | 3ca843a | 2017-10-04 09:42:29 -0700 | [diff] [blame] | 266 | SHAREDLIB_EXT=dylib |
| 267 | else |
| 268 | SHAREDLIB_EXT=so |
| 269 | endif |
| 270 | |
Jiyong Park | e7fab18 | 2019-01-24 16:41:47 +0900 | [diff] [blame] | 271 | # Convert a file_context file for a non-flattened APEX into a file for |
| 272 | # flattened APEX. /system/apex/<apex_name> path is prepended to the original paths |
| 273 | # $(1): path to the input file_contexts file for non-flattened APEX |
Jooyung Han | a932474 | 2019-11-20 17:54:34 +0900 | [diff] [blame] | 274 | # $(2): path to the flattened APEX |
| 275 | # $(3): path to the generated file_contexts file for flattened APEX |
Jiyong Park | e7fab18 | 2019-01-24 16:41:47 +0900 | [diff] [blame] | 276 | # $(4): variable where $(3) is added to |
| 277 | define build_flattened_apex_file_contexts |
| 278 | $(4) += $(3) |
Jooyung Han | a932474 | 2019-11-20 17:54:34 +0900 | [diff] [blame] | 279 | $(3): PRIVATE_APEX_PATH := $(subst .,\\.,$(2)) |
Jiyong Park | e7fab18 | 2019-01-24 16:41:47 +0900 | [diff] [blame] | 280 | $(3): $(1) |
| 281 | $(hide) awk '/object_r/{printf("$$(PRIVATE_APEX_PATH)%s\n",$$$$0)}' $$< > $$@ |
| 282 | endef |
| 283 | |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 284 | ################################# |
| 285 | |
Dan Cashman | 4f9a648 | 2017-04-10 12:27:18 -0700 | [diff] [blame] | 286 | include $(CLEAR_VARS) |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 287 | |
Dan Cashman | 4f9a648 | 2017-04-10 12:27:18 -0700 | [diff] [blame] | 288 | LOCAL_MODULE := selinux_policy |
Bob Badour | 601ebb4 | 2021-02-03 23:07:40 -0800 | [diff] [blame] | 289 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered |
| 290 | LOCAL_LICENSE_CONDITIONS := notice unencumbered |
| 291 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE |
Dan Cashman | 4f9a648 | 2017-04-10 12:27:18 -0700 | [diff] [blame] | 292 | LOCAL_MODULE_TAGS := optional |
Tri Vo | 1f4a28b | 2018-05-08 18:52:11 -0700 | [diff] [blame] | 293 | LOCAL_REQUIRED_MODULES += \ |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 294 | selinux_policy_nonsystem \ |
| 295 | selinux_policy_system \ |
Tri Vo | 1f4a28b | 2018-05-08 18:52:11 -0700 | [diff] [blame] | 296 | |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 297 | include $(BUILD_PHONY_PACKAGE) |
Tri Vo | 1f4a28b | 2018-05-08 18:52:11 -0700 | [diff] [blame] | 298 | |
Jooyung Han | 749cf93 | 2019-05-30 01:05:43 +0900 | [diff] [blame] | 299 | # selinux_policy is a main goal and triggers lots of tests. |
| 300 | # Most tests are FAKE modules, so aren'triggered on normal builds. (e.g. 'm') |
| 301 | # By setting as droidcore's dependency, tests will run on normal builds. |
| 302 | droidcore: selinux_policy |
Tri Vo | 1f4a28b | 2018-05-08 18:52:11 -0700 | [diff] [blame] | 303 | |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 304 | include $(CLEAR_VARS) |
| 305 | LOCAL_MODULE := selinux_policy_system |
Bob Badour | 601ebb4 | 2021-02-03 23:07:40 -0800 | [diff] [blame] | 306 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered |
| 307 | LOCAL_LICENSE_CONDITIONS := notice unencumbered |
| 308 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE |
Tri Vo | 1f4a28b | 2018-05-08 18:52:11 -0700 | [diff] [blame] | 309 | # These build targets are not used on non-Treble devices. However, we build these to avoid |
| 310 | # divergence between Treble and non-Treble devices. |
Dan Cashman | 4f9a648 | 2017-04-10 12:27:18 -0700 | [diff] [blame] | 311 | LOCAL_REQUIRED_MODULES += \ |
Tri Vo | 937e664 | 2019-01-15 15:16:55 -0800 | [diff] [blame] | 312 | plat_mapping_file \ |
Tri Vo | 6117855 | 2019-10-10 16:29:40 -0700 | [diff] [blame] | 313 | $(addprefix plat_,$(addsuffix .cil,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS))) \ |
Jeff Vander Stoep | 564e292 | 2019-05-02 13:48:44 -0700 | [diff] [blame] | 314 | $(addsuffix .compat.cil,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS)) \ |
Dan Cashman | 4f9a648 | 2017-04-10 12:27:18 -0700 | [diff] [blame] | 315 | plat_sepolicy.cil \ |
Dan Cashman | 4f9a648 | 2017-04-10 12:27:18 -0700 | [diff] [blame] | 316 | secilc \ |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 317 | |
Inseob Kim | 8ada8a7 | 2020-11-09 20:58:58 +0900 | [diff] [blame] | 318 | ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false) |
| 319 | LOCAL_REQUIRED_MODULES += plat_sepolicy_and_mapping.sha256 |
| 320 | endif |
| 321 | |
Jeff Vander Stoep | 7a68c5a | 2017-06-08 13:24:15 -0700 | [diff] [blame] | 322 | LOCAL_REQUIRED_MODULES += \ |
Bowgo Tsai | 741a70a | 2018-02-05 17:41:02 +0800 | [diff] [blame] | 323 | build_sepolicy \ |
Jeff Vander Stoep | 13fb5ed | 2017-08-22 13:29:53 -0700 | [diff] [blame] | 324 | plat_file_contexts \ |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 325 | plat_file_contexts_test \ |
Janis Danisevskis | c40681f | 2020-07-25 13:02:29 -0700 | [diff] [blame] | 326 | plat_keystore2_key_contexts \ |
Jeff Vander Stoep | 13fb5ed | 2017-08-22 13:29:53 -0700 | [diff] [blame] | 327 | plat_mac_permissions.xml \ |
| 328 | plat_property_contexts \ |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 329 | plat_property_contexts_test \ |
Jeff Vander Stoep | 13fb5ed | 2017-08-22 13:29:53 -0700 | [diff] [blame] | 330 | plat_seapp_contexts \ |
| 331 | plat_service_contexts \ |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 332 | plat_service_contexts_test \ |
Jeff Vander Stoep | 13fb5ed | 2017-08-22 13:29:53 -0700 | [diff] [blame] | 333 | plat_hwservice_contexts \ |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 334 | plat_hwservice_contexts_test \ |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 335 | plat_bug_map \ |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 336 | searchpolicy \ |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 337 | |
| 338 | # This conditional inclusion closely mimics the conditional logic |
| 339 | # inside init/init.cpp for loading SELinux policy from files. |
| 340 | ifneq ($(PRODUCT_SEPOLICY_SPLIT),true) |
| 341 | # The following files are only allowed for non-Treble devices. |
| 342 | LOCAL_REQUIRED_MODULES += \ |
| 343 | sepolicy \ |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 344 | |
| 345 | endif # ($(PRODUCT_SEPOLICY_SPLIT),true) |
Jeff Vander Stoep | 7a68c5a | 2017-06-08 13:24:15 -0700 | [diff] [blame] | 346 | |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 347 | ifneq ($(with_asan),true) |
Jeff Vander Stoep | 3d4965b | 2018-02-13 20:29:55 -0800 | [diff] [blame] | 348 | ifneq ($(SELINUX_IGNORE_NEVERALLOWS),true) |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 349 | LOCAL_REQUIRED_MODULES += \ |
| 350 | sepolicy_tests \ |
Inseob Kim | 16d3be3 | 2022-01-07 09:15:27 +0900 | [diff] [blame] | 351 | sepolicy_compat_test \ |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 352 | |
Steven Moreland | 1cb64c4 | 2019-09-20 11:16:29 -0700 | [diff] [blame] | 353 | ifeq ($(PRODUCT_SEPOLICY_SPLIT),true) |
| 354 | LOCAL_REQUIRED_MODULES += \ |
| 355 | $(addprefix treble_sepolicy_tests_,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS)) \ |
| 356 | |
| 357 | endif # PRODUCT_SEPOLICY_SPLIT |
| 358 | endif # SELINUX_IGNORE_NEVERALLOWS |
| 359 | endif # with_asan |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 360 | |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 361 | ifneq ($(PLATFORM_SEPOLICY_VERSION),$(TOT_SEPOLICY_VERSION)) |
| 362 | LOCAL_REQUIRED_MODULES += \ |
Inseob Kim | d581661 | 2021-09-15 03:01:05 +0000 | [diff] [blame] | 363 | sepolicy_freeze_test |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 364 | endif # ($(PLATFORM_SEPOLICY_VERSION),$(TOT_SEPOLICY_VERSION)) |
| 365 | |
| 366 | include $(BUILD_PHONY_PACKAGE) |
| 367 | |
| 368 | ################################# |
| 369 | |
| 370 | include $(CLEAR_VARS) |
| 371 | |
Justin Yun | 0f72269 | 2020-10-07 18:28:47 +0900 | [diff] [blame] | 372 | LOCAL_MODULE := selinux_policy_system_ext |
Bob Badour | 601ebb4 | 2021-02-03 23:07:40 -0800 | [diff] [blame] | 373 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered |
| 374 | LOCAL_LICENSE_CONDITIONS := notice unencumbered |
| 375 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE |
Justin Yun | 0f72269 | 2020-10-07 18:28:47 +0900 | [diff] [blame] | 376 | # Include precompiled policy, unless told otherwise. |
| 377 | ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false) |
Inseob Kim | a76c0c8 | 2021-04-29 19:45:50 +0900 | [diff] [blame] | 378 | ifdef HAS_SYSTEM_EXT_SEPOLICY |
Justin Yun | 0f72269 | 2020-10-07 18:28:47 +0900 | [diff] [blame] | 379 | LOCAL_REQUIRED_MODULES += system_ext_sepolicy_and_mapping.sha256 |
| 380 | endif |
Inseob Kim | a76c0c8 | 2021-04-29 19:45:50 +0900 | [diff] [blame] | 381 | endif |
Justin Yun | 0f72269 | 2020-10-07 18:28:47 +0900 | [diff] [blame] | 382 | |
| 383 | ifdef HAS_SYSTEM_EXT_SEPOLICY |
| 384 | LOCAL_REQUIRED_MODULES += system_ext_sepolicy.cil |
| 385 | endif |
| 386 | |
| 387 | ifdef HAS_SYSTEM_EXT_PUBLIC_SEPOLICY |
| 388 | LOCAL_REQUIRED_MODULES += \ |
| 389 | system_ext_mapping_file |
| 390 | |
| 391 | system_ext_compat_files := $(call build_policy, $(sepolicy_compat_files), $(SYSTEM_EXT_PRIVATE_POLICY)) |
| 392 | |
| 393 | LOCAL_REQUIRED_MODULES += $(addprefix system_ext_, $(notdir $(system_ext_compat_files))) |
| 394 | |
| 395 | endif |
| 396 | |
| 397 | ifdef HAS_SYSTEM_EXT_SEPOLICY_DIR |
| 398 | LOCAL_REQUIRED_MODULES += \ |
| 399 | system_ext_file_contexts \ |
| 400 | system_ext_file_contexts_test \ |
| 401 | system_ext_hwservice_contexts \ |
| 402 | system_ext_hwservice_contexts_test \ |
| 403 | system_ext_property_contexts \ |
| 404 | system_ext_property_contexts_test \ |
| 405 | system_ext_seapp_contexts \ |
| 406 | system_ext_service_contexts \ |
| 407 | system_ext_service_contexts_test \ |
| 408 | system_ext_mac_permissions.xml \ |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 409 | system_ext_bug_map \ |
Yi-Yo Chiang | 8be93c0 | 2021-04-13 02:49:29 +0800 | [diff] [blame] | 410 | $(addprefix system_ext_,$(addsuffix .compat.cil,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS))) \ |
Justin Yun | 0f72269 | 2020-10-07 18:28:47 +0900 | [diff] [blame] | 411 | |
| 412 | endif |
| 413 | |
| 414 | include $(BUILD_PHONY_PACKAGE) |
| 415 | |
| 416 | ################################# |
| 417 | |
| 418 | include $(CLEAR_VARS) |
| 419 | |
| 420 | LOCAL_MODULE := selinux_policy_product |
Bob Badour | 601ebb4 | 2021-02-03 23:07:40 -0800 | [diff] [blame] | 421 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered |
| 422 | LOCAL_LICENSE_CONDITIONS := notice unencumbered |
| 423 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE |
Justin Yun | 0f72269 | 2020-10-07 18:28:47 +0900 | [diff] [blame] | 424 | # Include precompiled policy, unless told otherwise. |
| 425 | ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false) |
Inseob Kim | a76c0c8 | 2021-04-29 19:45:50 +0900 | [diff] [blame] | 426 | ifdef HAS_PRODUCT_SEPOLICY |
Justin Yun | 0f72269 | 2020-10-07 18:28:47 +0900 | [diff] [blame] | 427 | LOCAL_REQUIRED_MODULES += product_sepolicy_and_mapping.sha256 |
| 428 | endif |
Inseob Kim | a76c0c8 | 2021-04-29 19:45:50 +0900 | [diff] [blame] | 429 | endif |
Justin Yun | 0f72269 | 2020-10-07 18:28:47 +0900 | [diff] [blame] | 430 | |
| 431 | ifdef HAS_PRODUCT_SEPOLICY |
| 432 | LOCAL_REQUIRED_MODULES += product_sepolicy.cil |
| 433 | endif |
| 434 | |
| 435 | ifdef HAS_PRODUCT_PUBLIC_SEPOLICY |
| 436 | LOCAL_REQUIRED_MODULES += \ |
| 437 | product_mapping_file |
| 438 | |
| 439 | product_compat_files := $(call build_policy, $(sepolicy_compat_files), $(PRODUCT_PRIVATE_POLICY)) |
| 440 | |
| 441 | LOCAL_REQUIRED_MODULES += $(addprefix product_, $(notdir $(product_compat_files))) |
| 442 | |
| 443 | endif |
| 444 | |
| 445 | ifdef HAS_PRODUCT_SEPOLICY_DIR |
| 446 | LOCAL_REQUIRED_MODULES += \ |
| 447 | product_file_contexts \ |
| 448 | product_file_contexts_test \ |
| 449 | product_hwservice_contexts \ |
| 450 | product_hwservice_contexts_test \ |
| 451 | product_property_contexts \ |
| 452 | product_property_contexts_test \ |
| 453 | product_seapp_contexts \ |
| 454 | product_service_contexts \ |
| 455 | product_service_contexts_test \ |
| 456 | product_mac_permissions.xml \ |
| 457 | |
| 458 | endif |
| 459 | |
| 460 | include $(BUILD_PHONY_PACKAGE) |
| 461 | |
| 462 | ################################# |
| 463 | |
| 464 | include $(CLEAR_VARS) |
| 465 | |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 466 | LOCAL_MODULE := selinux_policy_nonsystem |
Bob Badour | 601ebb4 | 2021-02-03 23:07:40 -0800 | [diff] [blame] | 467 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered |
| 468 | LOCAL_LICENSE_CONDITIONS := notice unencumbered |
| 469 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 470 | # Include precompiled policy, unless told otherwise. |
| 471 | ifneq ($(PRODUCT_PRECOMPILED_SEPOLICY),false) |
| 472 | LOCAL_REQUIRED_MODULES += \ |
| 473 | precompiled_sepolicy \ |
Inseob Kim | a76c0c8 | 2021-04-29 19:45:50 +0900 | [diff] [blame] | 474 | precompiled_sepolicy.plat_sepolicy_and_mapping.sha256 |
| 475 | |
| 476 | ifdef HAS_SYSTEM_EXT_SEPOLICY |
| 477 | LOCAL_REQUIRED_MODULES += precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256 |
| 478 | endif |
| 479 | |
| 480 | ifdef HAS_PRODUCT_SEPOLICY |
| 481 | LOCAL_REQUIRED_MODULES += precompiled_sepolicy.product_sepolicy_and_mapping.sha256 |
| 482 | endif |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 483 | |
| 484 | endif # ($(PRODUCT_PRECOMPILED_SEPOLICY),false) |
| 485 | |
| 486 | |
| 487 | # These build targets are not used on non-Treble devices. However, we build these to avoid |
| 488 | # divergence between Treble and non-Treble devices. |
| 489 | LOCAL_REQUIRED_MODULES += \ |
| 490 | plat_pub_versioned.cil \ |
| 491 | vendor_sepolicy.cil \ |
| 492 | plat_sepolicy_vers.txt \ |
| 493 | |
| 494 | LOCAL_REQUIRED_MODULES += \ |
| 495 | vendor_file_contexts \ |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 496 | vendor_file_contexts_test \ |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 497 | vendor_mac_permissions.xml \ |
| 498 | vendor_property_contexts \ |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 499 | vendor_property_contexts_test \ |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 500 | vendor_seapp_contexts \ |
linpeter | 87c7261 | 2020-06-12 16:25:41 +0800 | [diff] [blame] | 501 | vendor_service_contexts \ |
Inseob Kim | b5e2353 | 2022-02-16 02:26:11 +0000 | [diff] [blame^] | 502 | vendor_service_contexts_test \ |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 503 | vendor_hwservice_contexts \ |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 504 | vendor_hwservice_contexts_test \ |
Yi-Yo Chiang | 2c18965 | 2021-11-08 19:30:04 +0800 | [diff] [blame] | 505 | vendor_bug_map \ |
Anton Hansson | 8cfe1e6 | 2018-07-02 14:31:29 +0100 | [diff] [blame] | 506 | vndservice_contexts \ |
| 507 | |
Bowgo Tsai | 45457e3 | 2017-11-27 11:41:33 +0800 | [diff] [blame] | 508 | ifdef BOARD_ODM_SEPOLICY_DIRS |
Bowgo Tsai | bae1517 | 2017-11-29 16:14:53 +0800 | [diff] [blame] | 509 | LOCAL_REQUIRED_MODULES += \ |
| 510 | odm_sepolicy.cil \ |
Bowgo Tsai | ecf656b | 2017-11-29 16:15:28 +0800 | [diff] [blame] | 511 | odm_file_contexts \ |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 512 | odm_file_contexts_test \ |
Bowgo Tsai | 1f717b1 | 2017-11-29 16:15:55 +0800 | [diff] [blame] | 513 | odm_seapp_contexts \ |
Bowgo Tsai | ad6231f | 2017-11-29 16:16:26 +0800 | [diff] [blame] | 514 | odm_property_contexts \ |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 515 | odm_property_contexts_test \ |
Bowgo Tsai | af7d85f | 2017-11-29 16:06:15 +0800 | [diff] [blame] | 516 | odm_hwservice_contexts \ |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 517 | odm_hwservice_contexts_test \ |
Bowgo Tsai | af7d85f | 2017-11-29 16:06:15 +0800 | [diff] [blame] | 518 | odm_mac_permissions.xml |
Bowgo Tsai | 45457e3 | 2017-11-27 11:41:33 +0800 | [diff] [blame] | 519 | endif |
Tri Vo | 75887dd | 2018-12-14 14:30:56 -0800 | [diff] [blame] | 520 | |
Justin Yun | 0f72269 | 2020-10-07 18:28:47 +0900 | [diff] [blame] | 521 | LOCAL_REQUIRED_MODULES += selinux_policy_system_ext |
| 522 | LOCAL_REQUIRED_MODULES += selinux_policy_product |
Tri Vo | 4eb6815 | 2019-01-23 09:47:05 -0800 | [diff] [blame] | 523 | |
Bowgo Tsai | e763667 | 2019-04-19 22:03:33 +0800 | [diff] [blame] | 524 | # Builds an addtional userdebug sepolicy into the debug ramdisk. |
| 525 | LOCAL_REQUIRED_MODULES += \ |
| 526 | userdebug_plat_sepolicy.cil \ |
| 527 | |
Dan Cashman | 4f9a648 | 2017-04-10 12:27:18 -0700 | [diff] [blame] | 528 | include $(BUILD_PHONY_PACKAGE) |
| 529 | |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 530 | ################################## |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 531 | # Policy files are now built with Android.bp. Grab them from intermediate. |
| 532 | # See Android.bp for details of policy files. |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 533 | # |
| 534 | reqd_policy_mask.cil := $(call intermediates-dir-for,ETC,reqd_policy_mask.cil)/reqd_policy_mask.cil |
Inseob Kim | d869d02 | 2021-03-19 07:04:51 +0000 | [diff] [blame] | 535 | |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 536 | pub_policy.cil := $(call intermediates-dir-for,ETC,pub_policy.cil)/pub_policy.cil |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 537 | system_ext_pub_policy.cil := $(call intermediates-dir-for,ETC,system_ext_pub_policy.cil)/system_ext_pub_policy.cil |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 538 | plat_pub_policy.cil := $(call intermediates-dir-for,ETC,plat_pub_policy.cil)/plat_pub_policy.cil |
Inseob Kim | d869d02 | 2021-03-19 07:04:51 +0000 | [diff] [blame] | 539 | |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 540 | built_plat_cil := $(call intermediates-dir-for,ETC,plat_sepolicy.cil)/plat_sepolicy.cil |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 541 | built_plat_mapping_cil := $(call intermediates-dir-for,ETC,plat_mapping_file)/plat_mapping_file |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 542 | |
| 543 | ifdef HAS_SYSTEM_EXT_SEPOLICY |
| 544 | built_system_ext_cil := $(call intermediates-dir-for,ETC,system_ext_sepolicy.cil)/system_ext_sepolicy.cil |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 545 | built_system_ext_mapping_cil := $(call intermediates-dir-for,ETC,system_ext_mapping_file)/system_ext_mapping_file |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 546 | endif # ifdef HAS_SYSTEM_EXT_SEPOLICY |
| 547 | |
| 548 | ifdef HAS_PRODUCT_SEPOLICY |
| 549 | built_product_cil := $(call intermediates-dir-for,ETC,product_sepolicy.cil)/product_sepolicy.cil |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 550 | built_product_mapping_cil := $(call intermediates-dir-for,ETC,product_mapping_file)/product_mapping_file |
Inseob Kim | a49e724 | 2021-03-22 10:26:13 +0900 | [diff] [blame] | 551 | endif # ifdef HAS_PRODUCT_SEPOLICY |
| 552 | |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 553 | built_pub_vers_cil := $(call intermediates-dir-for,ETC,plat_pub_versioned.cil)/plat_pub_versioned.cil |
Inseob Kim | 039175b | 2021-03-25 15:37:34 +0900 | [diff] [blame] | 554 | |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 555 | built_vendor_cil := $(call intermediates-dir-for,ETC,vendor_sepolicy.cil)/vendor_sepolicy.cil |
Alex Klyubin | 193dccd | 2017-03-07 14:05:57 -0800 | [diff] [blame] | 556 | |
Nick Kralevich | 1b2ea49 | 2018-09-25 11:03:48 -0700 | [diff] [blame] | 557 | ifdef BOARD_ODM_SEPOLICY_DIRS |
Inseob Kim | 3ac62fe | 2021-12-16 19:00:03 +0900 | [diff] [blame] | 558 | built_odm_cil := $(call intermediates-dir-for,ETC,odm_sepolicy.cil)/odm_sepolicy.cil |
Nick Kralevich | 1b2ea49 | 2018-09-25 11:03:48 -0700 | [diff] [blame] | 559 | endif |
Bowgo Tsai | 45457e3 | 2017-11-27 11:41:33 +0800 | [diff] [blame] | 560 | |
Inseob Kim | 3d5f925 | 2021-12-21 20:42:35 +0900 | [diff] [blame] | 561 | built_sepolicy := $(call intermediates-dir-for,ETC,precompiled_sepolicy)/precompiled_sepolicy |
Inseob Kim | 893eef2 | 2021-12-29 13:53:38 +0900 | [diff] [blame] | 562 | built_sepolicy_neverallows := $(call intermediates-dir-for,ETC,sepolicy_neverallows)/sepolicy_neverallows |
| 563 | built_sepolicy_neverallows += $(call intermediates-dir-for,ETC,sepolicy_neverallows_vendor)/sepolicy_neverallows_vendor |
Stephen Smalley | 01a58af | 2012-10-02 12:46:37 -0400 | [diff] [blame] | 564 | |
Alex Klyubin | 84aa742 | 2017-03-10 09:36:07 -0800 | [diff] [blame] | 565 | ################################# |
Inseob Kim | 81cd51a | 2021-12-24 12:56:09 +0900 | [diff] [blame] | 566 | # sepolicy is also built with Android.bp. |
| 567 | # This module is to keep compatibility with monolithic sepolicy devices. |
| 568 | include $(CLEAR_VARS) |
| 569 | |
| 570 | LOCAL_MODULE := sepolicy |
| 571 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered |
| 572 | LOCAL_LICENSE_CONDITIONS := notice unencumbered |
| 573 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE |
| 574 | LOCAL_MODULE_CLASS := ETC |
| 575 | LOCAL_MODULE_TAGS := optional |
| 576 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
| 577 | |
| 578 | include $(BUILD_SYSTEM)/base_rules.mk |
| 579 | |
| 580 | $(LOCAL_BUILT_MODULE): $(built_sepolicy) |
| 581 | $(copy-file-to-target) |
| 582 | |
dcashman | 704741a | 2014-07-25 19:11:52 -0700 | [diff] [blame] | 583 | ################################## |
dcashman | d225b69 | 2016-12-12 09:29:04 -0800 | [diff] [blame] | 584 | # TODO - remove this. Keep around until we get the filesystem creation stuff taken care of. |
| 585 | # |
William Roberts | b876993 | 2015-06-29 16:31:23 -0700 | [diff] [blame] | 586 | include $(CLEAR_VARS) |
| 587 | |
Richard Haines | c2d0191 | 2015-08-06 17:43:52 +0100 | [diff] [blame] | 588 | LOCAL_MODULE := file_contexts.bin |
Bob Badour | 601ebb4 | 2021-02-03 23:07:40 -0800 | [diff] [blame] | 589 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered |
| 590 | LOCAL_LICENSE_CONDITIONS := notice unencumbered |
| 591 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 592 | LOCAL_MODULE_CLASS := ETC |
| 593 | LOCAL_MODULE_TAGS := optional |
| 594 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) |
| 595 | |
Stephen Smalley | 5b340be | 2012-03-06 11:12:41 -0500 | [diff] [blame] | 596 | include $(BUILD_SYSTEM)/base_rules.mk |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 597 | |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 598 | # The file_contexts.bin is built in the following way: |
| 599 | # 1. Collect all file_contexts files in THIS repository and process them with |
| 600 | # m4 into a tmp file called file_contexts.local.tmp. |
Jooyung Han | 0606ce7 | 2020-09-23 19:16:10 +0900 | [diff] [blame] | 601 | # 2. Collect all file_contexts files from LOCAL_FILE_CONTEXTS of installed |
| 602 | # modules with m4 with a tmp file called file_contexts.modules.tmp. |
| 603 | # 3. Collect all device specific file_contexts files and process them with m4 |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 604 | # into a tmp file called file_contexts.device.tmp. |
Jooyung Han | 0606ce7 | 2020-09-23 19:16:10 +0900 | [diff] [blame] | 605 | # 4. Run checkfc -e (allow no device fc entries ie empty) and fc_sort on |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 606 | # file_contexts.device.tmp and output to file_contexts.device.sorted.tmp. |
Jooyung Han | 0606ce7 | 2020-09-23 19:16:10 +0900 | [diff] [blame] | 607 | # 5. Concatenate file_contexts.local.tmp, file_contexts.modules.tmp and |
Inseob Kim | 8ada8a7 | 2020-11-09 20:58:58 +0900 | [diff] [blame] | 608 | # file_contexts.device.sorted.tmp into file_contexts.concat.tmp. |
Jooyung Han | 0606ce7 | 2020-09-23 19:16:10 +0900 | [diff] [blame] | 609 | # 6. Run checkfc and sefcontext_compile on file_contexts.concat.tmp to produce |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 610 | # file_contexts.bin. |
| 611 | # |
| 612 | # Note: That a newline file is placed between each file_context file found to |
| 613 | # 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] | 614 | |
Dan Cashman | 1b0a71f | 2017-05-08 14:26:52 -0700 | [diff] [blame] | 615 | local_fc_files := $(call build_policy, file_contexts, $(PLAT_PRIVATE_POLICY)) |
| 616 | |
Bowgo Tsai | ac38125 | 2019-10-04 14:34:18 +0800 | [diff] [blame] | 617 | ifdef HAS_SYSTEM_EXT_SEPOLICY_DIR |
Bowgo Tsai | 86a048d | 2019-09-09 22:04:06 +0800 | [diff] [blame] | 618 | local_fc_files += $(call build_policy, file_contexts, $(SYSTEM_EXT_PRIVATE_POLICY)) |
| 619 | endif |
| 620 | |
Bowgo Tsai | 7c4150c | 2019-10-04 15:36:05 +0800 | [diff] [blame] | 621 | ifdef HAS_PRODUCT_SEPOLICY_DIR |
Tri Vo | 75887dd | 2018-12-14 14:30:56 -0800 | [diff] [blame] | 622 | local_fc_files += $(call build_policy, file_contexts, $(PRODUCT_PRIVATE_POLICY)) |
| 623 | endif |
| 624 | |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 625 | ifneq ($(filter address,$(SANITIZE_TARGET)),) |
Mark Salyzyn | 9b398f3 | 2018-06-13 08:02:29 -0700 | [diff] [blame] | 626 | local_fc_files += $(wildcard $(addsuffix /file_contexts_asan, $(PLAT_PRIVATE_POLICY))) |
| 627 | endif |
| 628 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
| 629 | local_fc_files += $(wildcard $(addsuffix /file_contexts_overlayfs, $(PLAT_PRIVATE_POLICY))) |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 630 | endif |
Jooyung Han | a932474 | 2019-11-20 17:54:34 +0900 | [diff] [blame] | 631 | |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 632 | file_contexts.local.tmp := $(intermediates)/file_contexts.local.tmp |
Jooyung Han | 0606ce7 | 2020-09-23 19:16:10 +0900 | [diff] [blame] | 633 | $(call merge-fc-files,$(local_fc_files),$(file_contexts.local.tmp)) |
| 634 | |
| 635 | # The rule for file_contexts.modules.tmp is defined in build/make/core/Makefile. |
| 636 | # it gathers LOCAL_FILE_CONTEXTS from product_MODULES |
| 637 | file_contexts.modules.tmp := $(intermediates)/file_contexts.modules.tmp |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 638 | |
Bowgo Tsai | afbcf21 | 2018-02-05 17:34:52 +0800 | [diff] [blame] | 639 | device_fc_files := $(call build_vendor_policy, file_contexts) |
Bowgo Tsai | bae1517 | 2017-11-29 16:14:53 +0800 | [diff] [blame] | 640 | |
| 641 | ifdef BOARD_ODM_SEPOLICY_DIRS |
| 642 | device_fc_files += $(call build_odm_policy, file_contexts) |
| 643 | endif |
| 644 | |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 645 | file_contexts.device.tmp := $(intermediates)/file_contexts.device.tmp |
| 646 | $(file_contexts.device.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
Dan Willemsen | 3c3e59b | 2019-06-19 10:52:50 -0700 | [diff] [blame] | 647 | $(file_contexts.device.tmp): PRIVATE_DEVICE_FC_FILES := $(device_fc_files) |
| 648 | $(file_contexts.device.tmp): $(device_fc_files) $(M4) |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 649 | @mkdir -p $(dir $@) |
Dan Willemsen | 3c3e59b | 2019-06-19 10:52:50 -0700 | [diff] [blame] | 650 | $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_DEVICE_FC_FILES) > $@ |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 651 | |
| 652 | file_contexts.device.sorted.tmp := $(intermediates)/file_contexts.device.sorted.tmp |
| 653 | $(file_contexts.device.sorted.tmp): PRIVATE_SEPOLICY := $(built_sepolicy) |
Bowgo Tsai | afbcf21 | 2018-02-05 17:34:52 +0800 | [diff] [blame] | 654 | $(file_contexts.device.sorted.tmp): $(file_contexts.device.tmp) $(built_sepolicy) \ |
| 655 | $(HOST_OUT_EXECUTABLES)/fc_sort $(HOST_OUT_EXECUTABLES)/checkfc |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 656 | @mkdir -p $(dir $@) |
dcashman | 0779155 | 2016-12-07 11:27:47 -0800 | [diff] [blame] | 657 | $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -e $(PRIVATE_SEPOLICY) $< |
Jeff Vander Stoep | 1ca7a4c | 2019-04-10 16:53:17 -0700 | [diff] [blame] | 658 | $(hide) $(HOST_OUT_EXECUTABLES)/fc_sort -i $< -o $@ |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 659 | |
| 660 | file_contexts.concat.tmp := $(intermediates)/file_contexts.concat.tmp |
Jooyung Han | 0606ce7 | 2020-09-23 19:16:10 +0900 | [diff] [blame] | 661 | $(call merge-fc-files,\ |
| 662 | $(file_contexts.local.tmp) $(file_contexts.modules.tmp) $(file_contexts.device.sorted.tmp),\ |
| 663 | $(file_contexts.concat.tmp)) |
Stephen Smalley | 5b340be | 2012-03-06 11:12:41 -0500 | [diff] [blame] | 664 | |
William Roberts | 3746a0a | 2015-09-25 10:18:44 -0700 | [diff] [blame] | 665 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 666 | $(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] | 667 | @mkdir -p $(dir $@) |
dcashman | 0779155 | 2016-12-07 11:27:47 -0800 | [diff] [blame] | 668 | $(hide) $(HOST_OUT_EXECUTABLES)/checkfc $(PRIVATE_SEPOLICY) $< |
Richard Haines | c2d0191 | 2015-08-06 17:43:52 +0100 | [diff] [blame] | 669 | $(hide) $(HOST_OUT_EXECUTABLES)/sefcontext_compile -o $@ $< |
| 670 | |
Robert Craig | 8b7545b | 2014-03-20 09:35:08 -0400 | [diff] [blame] | 671 | built_fc := $(LOCAL_BUILT_MODULE) |
William Roberts | 49693f1 | 2016-01-04 12:20:57 -0800 | [diff] [blame] | 672 | local_fc_files := |
| 673 | local_fcfiles_with_nl := |
| 674 | device_fc_files := |
| 675 | device_fcfiles_with_nl := |
| 676 | file_contexts.concat.tmp := |
| 677 | file_contexts.device.sorted.tmp := |
| 678 | file_contexts.device.tmp := |
| 679 | file_contexts.local.tmp := |
Jooyung Han | 0606ce7 | 2020-09-23 19:16:10 +0900 | [diff] [blame] | 680 | file_contexts.modules.tmp := |
William Roberts | 171a062 | 2012-08-16 10:55:05 -0700 | [diff] [blame] | 681 | |
Ying Wang | 02fb5f3 | 2012-01-17 17:51:09 -0800 | [diff] [blame] | 682 | ################################## |
Martijn Coenen | 3ea47b9 | 2017-04-07 16:14:43 -0700 | [diff] [blame] | 683 | include $(CLEAR_VARS) |
| 684 | |
Martijn Coenen | 6676c23 | 2017-03-31 17:29:53 -0700 | [diff] [blame] | 685 | LOCAL_MODULE := vndservice_contexts |
Bob Badour | 601ebb4 | 2021-02-03 23:07:40 -0800 | [diff] [blame] | 686 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered |
| 687 | LOCAL_LICENSE_CONDITIONS := notice unencumbered |
| 688 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE |
Martijn Coenen | 6676c23 | 2017-03-31 17:29:53 -0700 | [diff] [blame] | 689 | LOCAL_MODULE_CLASS := ETC |
| 690 | LOCAL_MODULE_TAGS := optional |
Martijn Coenen | 6676c23 | 2017-03-31 17:29:53 -0700 | [diff] [blame] | 691 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux |
Martijn Coenen | 6676c23 | 2017-03-31 17:29:53 -0700 | [diff] [blame] | 692 | |
| 693 | include $(BUILD_SYSTEM)/base_rules.mk |
| 694 | |
Inseob Kim | 7174ffe | 2021-12-08 22:45:58 +0900 | [diff] [blame] | 695 | vnd_svcfiles := $(call build_policy, vndservice_contexts, $(BOARD_PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_REQD_MASK_POLICY)) |
Martijn Coenen | 6676c23 | 2017-03-31 17:29:53 -0700 | [diff] [blame] | 696 | |
| 697 | vndservice_contexts.tmp := $(intermediates)/vndservice_contexts.tmp |
| 698 | $(vndservice_contexts.tmp): PRIVATE_SVC_FILES := $(vnd_svcfiles) |
| 699 | $(vndservice_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS) |
Dan Willemsen | 3c3e59b | 2019-06-19 10:52:50 -0700 | [diff] [blame] | 700 | $(vndservice_contexts.tmp): $(vnd_svcfiles) $(M4) |
Martijn Coenen | 6676c23 | 2017-03-31 17:29:53 -0700 | [diff] [blame] | 701 | @mkdir -p $(dir $@) |
Dan Willemsen | 3c3e59b | 2019-06-19 10:52:50 -0700 | [diff] [blame] | 702 | $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_SVC_FILES) > $@ |
Martijn Coenen | 6676c23 | 2017-03-31 17:29:53 -0700 | [diff] [blame] | 703 | |
| 704 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
| 705 | $(LOCAL_BUILT_MODULE): $(vndservice_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc $(ACP) |
| 706 | @mkdir -p $(dir $@) |
| 707 | sed -e 's/#.*$$//' -e '/^$$/d' $< > $@ |
Martijn Coenen | ee97662 | 2017-04-07 10:08:55 -0700 | [diff] [blame] | 708 | $(hide) $(HOST_OUT_EXECUTABLES)/checkfc -e -v $(PRIVATE_SEPOLICY) $@ |
Martijn Coenen | 6676c23 | 2017-03-31 17:29:53 -0700 | [diff] [blame] | 709 | |
| 710 | vnd_svcfiles := |
| 711 | vndservice_contexts.tmp := |
dcashman | 90b3b94 | 2016-12-14 13:47:55 -0800 | [diff] [blame] | 712 | |
| 713 | ################################## |
Tri Vo | 8b3016b | 2019-01-07 16:43:31 -0800 | [diff] [blame] | 714 | include $(LOCAL_PATH)/mac_permissions.mk |
Bowgo Tsai | af7d85f | 2017-11-29 16:06:15 +0800 | [diff] [blame] | 715 | |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 716 | ################################# |
| 717 | include $(CLEAR_VARS) |
| 718 | LOCAL_MODULE := sepolicy_tests |
Bob Badour | 601ebb4 | 2021-02-03 23:07:40 -0800 | [diff] [blame] | 719 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered |
| 720 | LOCAL_LICENSE_CONDITIONS := notice unencumbered |
| 721 | LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE |
Jooyung Han | 749cf93 | 2019-05-30 01:05:43 +0900 | [diff] [blame] | 722 | LOCAL_MODULE_CLASS := FAKE |
| 723 | LOCAL_MODULE_TAGS := optional |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 724 | |
| 725 | include $(BUILD_SYSTEM)/base_rules.mk |
| 726 | |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 727 | all_fc_files := $(TARGET_OUT)/etc/selinux/plat_file_contexts |
| 728 | all_fc_files += $(TARGET_OUT_VENDOR)/etc/selinux/vendor_file_contexts |
Bowgo Tsai | ac38125 | 2019-10-04 14:34:18 +0800 | [diff] [blame] | 729 | ifdef HAS_SYSTEM_EXT_SEPOLICY_DIR |
Bowgo Tsai | 86a048d | 2019-09-09 22:04:06 +0800 | [diff] [blame] | 730 | all_fc_files += $(TARGET_OUT_SYSTEM_EXT)/etc/selinux/system_ext_file_contexts |
| 731 | endif |
Bowgo Tsai | 7c4150c | 2019-10-04 15:36:05 +0800 | [diff] [blame] | 732 | ifdef HAS_PRODUCT_SEPOLICY_DIR |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 733 | all_fc_files += $(TARGET_OUT_PRODUCT)/etc/selinux/product_file_contexts |
Tri Vo | 3361ec4 | 2018-12-18 19:51:19 -0800 | [diff] [blame] | 734 | endif |
Bowgo Tsai | bae1517 | 2017-11-29 16:14:53 +0800 | [diff] [blame] | 735 | ifdef BOARD_ODM_SEPOLICY_DIRS |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 736 | all_fc_files += $(TARGET_OUT_ODM)/etc/selinux/odm_file_contexts |
Bowgo Tsai | bae1517 | 2017-11-29 16:14:53 +0800 | [diff] [blame] | 737 | endif |
Bowgo Tsai | afbcf21 | 2018-02-05 17:34:52 +0800 | [diff] [blame] | 738 | all_fc_args := $(foreach file, $(all_fc_files), -f $(file)) |
| 739 | |
Jooyung Han | 749cf93 | 2019-05-30 01:05:43 +0900 | [diff] [blame] | 740 | $(LOCAL_BUILT_MODULE): ALL_FC_ARGS := $(all_fc_args) |
| 741 | $(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy) |
| 742 | $(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/sepolicy_tests $(all_fc_files) $(built_sepolicy) |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 743 | @mkdir -p $(dir $@) |
Inseob Kim | 6fa8efd | 2021-12-29 13:56:14 +0900 | [diff] [blame] | 744 | $(hide) $(HOST_OUT_EXECUTABLES)/sepolicy_tests $(ALL_FC_ARGS) -p $(PRIVATE_SEPOLICY) |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 745 | $(hide) touch $@ |
| 746 | |
rpcraig | b19665c | 2012-07-30 09:33:03 -0400 | [diff] [blame] | 747 | ################################## |
Tri Vo | 1406926 | 2018-01-31 16:22:35 -0800 | [diff] [blame] | 748 | # Tests for Treble compatibility of current platform policy and vendor policy of |
| 749 | # given release version. |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 750 | ifeq ($(PRODUCT_SEPOLICY_SPLIT),true) |
| 751 | |
| 752 | built_plat_sepolicy := $(call intermediates-dir-for,ETC,base_plat_sepolicy)/base_plat_sepolicy |
| 753 | built_system_ext_sepolicy := $(call intermediates-dir-for,ETC,base_system_ext_sepolicy)/base_system_ext_sepolicy |
| 754 | built_product_sepolicy := $(call intermediates-dir-for,ETC,base_product_sepolicy)/base_product_sepolicy |
| 755 | |
| 756 | base_plat_pub_policy.cil := $(call intermediates-dir-for,ETC,base_plat_pub_policy.cil)/base_plat_pub_policy.cil |
| 757 | base_system_ext_pub_polcy.cil := $(call intermediates-dir-for,ETC,base_system_ext_pub_polcy.cil)/base_system_ext_pub_polcy.cil |
| 758 | base_product_pub_policy.cil := $(call intermediates-dir-for,ETC,base_product_pub_policy.cil)/base_product_pub_policy.cil |
| 759 | |
Inseob Kim | ed2dc8c | 2021-12-10 18:34:41 +0900 | [diff] [blame] | 760 | $(foreach v,$(PLATFORM_SEPOLICY_COMPAT_VERSIONS), \ |
| 761 | $(eval version_under_treble_tests := $(v)) \ |
| 762 | $(eval include $(LOCAL_PATH)/treble_sepolicy_tests_for_release.mk) \ |
| 763 | ) |
Steven Moreland | 1cb64c4 | 2019-09-20 11:16:29 -0700 | [diff] [blame] | 764 | endif # PRODUCT_SEPOLICY_SPLIT |
Jae Shin | 1fa9634 | 2018-07-11 18:30:44 +0900 | [diff] [blame] | 765 | |
Inseob Kim | 4d90b7e | 2021-09-27 13:43:01 +0000 | [diff] [blame] | 766 | built_plat_sepolicy := |
| 767 | built_system_ext_sepolicy := |
| 768 | built_product_sepolicy := |
| 769 | base_plat_pub_policy.cil := |
| 770 | base_system_ext_pub_polcy.cil := |
| 771 | base_product_pub_policy.cil := |
Inseob Kim | b554e59 | 2019-04-15 20:10:46 +0900 | [diff] [blame] | 772 | all_fc_files := |
| 773 | all_fc_args := |
Dan Cashman | 91d398d | 2017-09-26 12:58:29 -0700 | [diff] [blame] | 774 | |
Jeff Vander Stoep | 1fc0682 | 2017-05-31 15:36:07 -0700 | [diff] [blame] | 775 | ################################# |
Tri Vo | 81198bb | 2018-03-15 11:38:08 -0700 | [diff] [blame] | 776 | |
rpcraig | 47cd396 | 2012-10-17 21:09:52 -0400 | [diff] [blame] | 777 | |
Bowgo Tsai | afbcf21 | 2018-02-05 17:34:52 +0800 | [diff] [blame] | 778 | build_vendor_policy := |
Bowgo Tsai | bae1517 | 2017-11-29 16:14:53 +0800 | [diff] [blame] | 779 | build_odm_policy := |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 780 | build_policy := |
Alex Klyubin | 8f7173b | 2017-02-25 14:47:53 -0800 | [diff] [blame] | 781 | built_plat_cil := |
Bowgo Tsai | 948934b | 2019-08-29 17:12:11 +0800 | [diff] [blame] | 782 | built_system_ext_cil := |
| 783 | built_product_cil := |
Tri Vo | e68ba59 | 2019-01-15 13:31:03 -0800 | [diff] [blame] | 784 | built_pub_vers_cil := |
Tri Vo | 937e664 | 2019-01-15 15:16:55 -0800 | [diff] [blame] | 785 | built_plat_mapping_cil := |
Bowgo Tsai | 948934b | 2019-08-29 17:12:11 +0800 | [diff] [blame] | 786 | built_system_ext_mapping_cil := |
Tri Vo | 937e664 | 2019-01-15 15:16:55 -0800 | [diff] [blame] | 787 | built_product_mapping_cil := |
Bowgo Tsai | afbcf21 | 2018-02-05 17:34:52 +0800 | [diff] [blame] | 788 | built_vendor_cil := |
Bowgo Tsai | 45457e3 | 2017-11-27 11:41:33 +0800 | [diff] [blame] | 789 | built_odm_cil := |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 790 | built_sepolicy := |
Joel Galenson | 5988b56 | 2018-01-03 16:53:24 -0800 | [diff] [blame] | 791 | built_sepolicy_neverallows := |
Sandeep Patil | a058b56 | 2016-12-27 15:10:48 -0800 | [diff] [blame] | 792 | built_plat_svc := |
Bowgo Tsai | afbcf21 | 2018-02-05 17:34:52 +0800 | [diff] [blame] | 793 | built_vendor_svc := |
Inseob Kim | ed59c22 | 2019-09-26 15:14:55 +0900 | [diff] [blame] | 794 | treble_sysprop_neverallow := |
Inseob Kim | afc0993 | 2020-09-28 13:32:43 +0900 | [diff] [blame] | 795 | enforce_sysprop_owner := |
Hridya Valsaraju | a885dd8 | 2021-04-26 16:32:17 -0700 | [diff] [blame] | 796 | enforce_debugfs_restriction := |
Jeff Vander Stoep | b878769 | 2017-04-21 15:57:07 -0700 | [diff] [blame] | 797 | mapping_policy := |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 798 | my_target_arch := |
Tri Vo | e68ba59 | 2019-01-15 13:31:03 -0800 | [diff] [blame] | 799 | pub_policy.cil := |
Bowgo Tsai | 948934b | 2019-08-29 17:12:11 +0800 | [diff] [blame] | 800 | system_ext_pub_policy.cil := |
| 801 | plat_pub_policy.cil := |
dcashman | 1faa644 | 2016-11-28 07:20:28 -0800 | [diff] [blame] | 802 | reqd_policy_mask.cil := |
Dan Cashman | 1c04027 | 2016-12-15 15:28:44 -0800 | [diff] [blame] | 803 | sepolicy_build_files := |
Alex Klyubin | 7cda44f | 2017-03-21 14:28:53 -0700 | [diff] [blame] | 804 | sepolicy_build_cil_workaround_files := |
Jeff Vander Stoep | 7443484 | 2017-03-13 12:22:15 -0700 | [diff] [blame] | 805 | with_asan := |
Alice Chu | cdfb06f | 2012-11-01 11:33:04 -0700 | [diff] [blame] | 806 | |
| 807 | include $(call all-makefiles-under,$(LOCAL_PATH)) |