blob: ad17b8f9084b4ad8659b77c829504ed3ef638cc9 [file] [log] [blame]
Tri Vo8b3016b2019-01-07 16:43:31 -08001include $(CLEAR_VARS)
2
3LOCAL_MODULE := plat_mac_permissions.xml
Bob Badour601ebb42021-02-03 23:07:40 -08004LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered
5LOCAL_LICENSE_CONDITIONS := notice unencumbered
6LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
Tri Vo8b3016b2019-01-07 16:43:31 -08007LOCAL_MODULE_CLASS := ETC
8LOCAL_MODULE_TAGS := optional
9LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/selinux
10
11include $(BUILD_SYSTEM)/base_rules.mk
12
Bowgo Tsaia3429fc2019-09-09 22:05:49 +080013all_plat_mac_perms_keys := $(call build_policy, keys.conf, $(PLAT_PRIVATE_POLICY) $(SYSTEM_EXT_PRIVATE_POLICY) $(PRODUCT_PRIVATE_POLICY))
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070014all_plat_mac_perms_files := $(call build_policy, mac_permissions.xml, $(PLAT_PRIVATE_POLICY))
15
Tri Vo8b3016b2019-01-07 16:43:31 -080016# Build keys.conf
17plat_mac_perms_keys.tmp := $(intermediates)/plat_keys.tmp
18$(plat_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070019$(plat_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_plat_mac_perms_keys)
20$(plat_mac_perms_keys.tmp): $(all_plat_mac_perms_keys) $(M4)
Tri Vo8b3016b2019-01-07 16:43:31 -080021 @mkdir -p $(dir $@)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070022 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_KEYS) > $@
Tri Vo8b3016b2019-01-07 16:43:31 -080023
24# Should be synced with keys.conf.
Oriol Prieto Gasco57f48ae2022-06-20 19:22:39 +000025all_plat_keys := platform sdk_sandbox media networkstack shared testkey bluetooth
Dan Willemsen9d06a8f2019-05-28 21:20:08 +000026all_plat_keys := $(all_plat_keys:%=$(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))/%.x509.pem)
Tri Vo8b3016b2019-01-07 16:43:31 -080027
28$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_plat_mac_perms_files)
Thiébaud Weksteen98707252021-12-03 13:38:04 +110029$(LOCAL_BUILT_MODULE): $(plat_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys \
Tri Vo8b3016b2019-01-07 16:43:31 -080030$(all_plat_mac_perms_files) $(all_plat_keys)
31 @mkdir -p $(dir $@)
32 $(hide) DEFAULT_SYSTEM_DEV_CERTIFICATE="$(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))" \
Remi NGUYEN VANbd3ab022019-08-07 18:23:47 +090033 MAINLINE_SEPOLICY_DEV_CERTIFICATES="$(MAINLINE_SEPOLICY_DEV_CERTIFICATES)" \
Thiébaud Weksteen98707252021-12-03 13:38:04 +110034 $(HOST_OUT_EXECUTABLES)/insertkeys -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
Tri Vo8b3016b2019-01-07 16:43:31 -080035
Tri Vo8b3016b2019-01-07 16:43:31 -080036all_plat_keys :=
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070037all_plat_mac_perms_files :=
38all_plat_mac_perms_keys :=
Tri Vo8b3016b2019-01-07 16:43:31 -080039plat_mac_perms_keys.tmp :=
40
41##################################
42include $(CLEAR_VARS)
43
Bowgo Tsaia3429fc2019-09-09 22:05:49 +080044LOCAL_MODULE := system_ext_mac_permissions.xml
Bob Badour601ebb42021-02-03 23:07:40 -080045LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered
46LOCAL_LICENSE_CONDITIONS := notice unencumbered
47LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
Bowgo Tsaia3429fc2019-09-09 22:05:49 +080048LOCAL_MODULE_CLASS := ETC
49LOCAL_MODULE_TAGS := optional
50LOCAL_MODULE_PATH := $(TARGET_OUT_SYSTEM_EXT)/etc/selinux
51
52include $(BUILD_SYSTEM)/base_rules.mk
53
54all_system_ext_mac_perms_keys := $(call build_policy, keys.conf, $(SYSTEM_EXT_PRIVATE_POLICY) $(REQD_MASK_POLICY))
55all_system_ext_mac_perms_files := $(call build_policy, mac_permissions.xml, $(SYSTEM_EXT_PRIVATE_POLICY) $(REQD_MASK_POLICY))
56
57# Build keys.conf
58system_ext_mac_perms_keys.tmp := $(intermediates)/system_ext_keys.tmp
59$(system_ext_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
60$(system_ext_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_system_ext_mac_perms_keys)
Dan Willemsen081b1642020-07-23 17:59:38 -070061$(system_ext_mac_perms_keys.tmp): $(all_system_ext_mac_perms_keys) $(M4)
Bowgo Tsaia3429fc2019-09-09 22:05:49 +080062 @mkdir -p $(dir $@)
Dan Willemsen081b1642020-07-23 17:59:38 -070063 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_KEYS) > $@
Bowgo Tsaia3429fc2019-09-09 22:05:49 +080064
65$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_system_ext_mac_perms_files)
Thiébaud Weksteen98707252021-12-03 13:38:04 +110066$(LOCAL_BUILT_MODULE): $(system_ext_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys \
Bowgo Tsaia3429fc2019-09-09 22:05:49 +080067$(all_system_ext_mac_perms_files)
68 @mkdir -p $(dir $@)
Thiébaud Weksteen98707252021-12-03 13:38:04 +110069 $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
Bowgo Tsaia3429fc2019-09-09 22:05:49 +080070
71system_ext_mac_perms_keys.tmp :=
72all_system_ext_mac_perms_files :=
73all_system_ext_mac_perms_keys :=
74
75##################################
76include $(CLEAR_VARS)
77
Tri Vo8b3016b2019-01-07 16:43:31 -080078LOCAL_MODULE := product_mac_permissions.xml
Bob Badour601ebb42021-02-03 23:07:40 -080079LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered
80LOCAL_LICENSE_CONDITIONS := notice unencumbered
81LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
Tri Vo8b3016b2019-01-07 16:43:31 -080082LOCAL_MODULE_CLASS := ETC
83LOCAL_MODULE_TAGS := optional
84LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/etc/selinux
85
86include $(BUILD_SYSTEM)/base_rules.mk
87
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070088all_product_mac_perms_keys := $(call build_policy, keys.conf, $(PRODUCT_PRIVATE_POLICY) $(REQD_MASK_POLICY))
89all_product_mac_perms_files := $(call build_policy, mac_permissions.xml, $(PRODUCT_PRIVATE_POLICY) $(REQD_MASK_POLICY))
90
Tri Vo8b3016b2019-01-07 16:43:31 -080091# Build keys.conf
92product_mac_perms_keys.tmp := $(intermediates)/product_keys.tmp
93$(product_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070094$(product_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_product_mac_perms_keys)
Dan Willemsen081b1642020-07-23 17:59:38 -070095$(product_mac_perms_keys.tmp): $(all_product_mac_perms_keys) $(M4)
Tri Vo8b3016b2019-01-07 16:43:31 -080096 @mkdir -p $(dir $@)
Dan Willemsen081b1642020-07-23 17:59:38 -070097 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_KEYS) > $@
Tri Vo8b3016b2019-01-07 16:43:31 -080098
99$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_product_mac_perms_files)
Thiébaud Weksteen98707252021-12-03 13:38:04 +1100100$(LOCAL_BUILT_MODULE): $(product_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys \
Tri Vo8b3016b2019-01-07 16:43:31 -0800101$(all_product_mac_perms_files)
102 @mkdir -p $(dir $@)
Thiébaud Weksteen98707252021-12-03 13:38:04 +1100103 $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
Tri Vo8b3016b2019-01-07 16:43:31 -0800104
105product_mac_perms_keys.tmp :=
106all_product_mac_perms_files :=
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700107all_product_mac_perms_keys :=
Tri Vo8b3016b2019-01-07 16:43:31 -0800108
109##################################
110include $(CLEAR_VARS)
111
112LOCAL_MODULE := vendor_mac_permissions.xml
Bob Badour601ebb42021-02-03 23:07:40 -0800113LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered
114LOCAL_LICENSE_CONDITIONS := notice unencumbered
115LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
Tri Vo8b3016b2019-01-07 16:43:31 -0800116LOCAL_MODULE_CLASS := ETC
117LOCAL_MODULE_TAGS := optional
118LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
119
120include $(BUILD_SYSTEM)/base_rules.mk
121
Inseob Kim7174ffe2021-12-08 22:45:58 +0900122all_vendor_mac_perms_keys := $(call build_policy, keys.conf, $(BOARD_PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_REQD_MASK_POLICY))
123all_vendor_mac_perms_files := $(call build_policy, mac_permissions.xml, $(BOARD_PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_REQD_MASK_POLICY))
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700124
Tri Vo8b3016b2019-01-07 16:43:31 -0800125# Build keys.conf
126vendor_mac_perms_keys.tmp := $(intermediates)/vendor_keys.tmp
127$(vendor_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700128$(vendor_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_vendor_mac_perms_keys)
129$(vendor_mac_perms_keys.tmp): $(all_vendor_mac_perms_keys) $(M4)
Tri Vo8b3016b2019-01-07 16:43:31 -0800130 @mkdir -p $(dir $@)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700131 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_KEYS) > $@
Tri Vo8b3016b2019-01-07 16:43:31 -0800132
133$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_vendor_mac_perms_files)
Thiébaud Weksteen98707252021-12-03 13:38:04 +1100134$(LOCAL_BUILT_MODULE): $(vendor_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys \
Tri Vo8b3016b2019-01-07 16:43:31 -0800135$(all_vendor_mac_perms_files)
136 @mkdir -p $(dir $@)
Bowgo Tsai3ffd6b32020-06-02 22:16:12 +0800137 $(hide) DEFAULT_SYSTEM_DEV_CERTIFICATE="$(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))" \
Thiébaud Weksteen98707252021-12-03 13:38:04 +1100138 $(HOST_OUT_EXECUTABLES)/insertkeys -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
Tri Vo8b3016b2019-01-07 16:43:31 -0800139
140vendor_mac_perms_keys.tmp :=
141all_vendor_mac_perms_files :=
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700142all_vendor_mac_perms_keys :=
Tri Vo8b3016b2019-01-07 16:43:31 -0800143
144##################################
145include $(CLEAR_VARS)
146
147LOCAL_MODULE := odm_mac_permissions.xml
Bob Badour601ebb42021-02-03 23:07:40 -0800148LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_unencumbered
149LOCAL_LICENSE_CONDITIONS := notice unencumbered
150LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
Tri Vo8b3016b2019-01-07 16:43:31 -0800151LOCAL_MODULE_CLASS := ETC
152LOCAL_MODULE_TAGS := optional
153LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/etc/selinux
154
155include $(BUILD_SYSTEM)/base_rules.mk
156
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700157all_odm_mac_perms_keys := $(call build_policy, keys.conf, $(BOARD_ODM_SEPOLICY_DIRS) $(REQD_MASK_POLICY))
158all_odm_mac_perms_files := $(call build_policy, mac_permissions.xml, $(BOARD_ODM_SEPOLICY_DIRS) $(REQD_MASK_POLICY))
159
Tri Vo8b3016b2019-01-07 16:43:31 -0800160# Build keys.conf
161odm_mac_perms_keys.tmp := $(intermediates)/odm_keys.tmp
162$(odm_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700163$(odm_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_odm_mac_perms_keys)
164$(odm_mac_perms_keys.tmp): $(all_odm_mac_perms_keys) $(M4)
Tri Vo8b3016b2019-01-07 16:43:31 -0800165 @mkdir -p $(dir $@)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700166 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_KEYS) > $@
Tri Vo8b3016b2019-01-07 16:43:31 -0800167
168$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_odm_mac_perms_files)
Thiébaud Weksteen98707252021-12-03 13:38:04 +1100169$(LOCAL_BUILT_MODULE): $(odm_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys \
Tri Vo8b3016b2019-01-07 16:43:31 -0800170$(all_odm_mac_perms_files)
171 @mkdir -p $(dir $@)
Thiébaud Weksteen98707252021-12-03 13:38:04 +1100172 $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
Tri Vo8b3016b2019-01-07 16:43:31 -0800173
174odm_mac_perms_keys.tmp :=
175all_odm_mac_perms_files :=