blob: 7cb1b98a293676f89f66301a1e540fea0b8bc355 [file] [log] [blame]
Tri Vo8b3016b2019-01-07 16:43:31 -08001include $(CLEAR_VARS)
2
3LOCAL_MODULE := plat_mac_permissions.xml
4LOCAL_MODULE_CLASS := ETC
5LOCAL_MODULE_TAGS := optional
6LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/selinux
7
8include $(BUILD_SYSTEM)/base_rules.mk
9
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070010all_plat_mac_perms_keys := $(call build_policy, keys.conf, $(PLAT_PRIVATE_POLICY) $(PRODUCT_PRIVATE_POLICY))
11all_plat_mac_perms_files := $(call build_policy, mac_permissions.xml, $(PLAT_PRIVATE_POLICY))
12
Tri Vo8b3016b2019-01-07 16:43:31 -080013# Build keys.conf
14plat_mac_perms_keys.tmp := $(intermediates)/plat_keys.tmp
15$(plat_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070016$(plat_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_plat_mac_perms_keys)
17$(plat_mac_perms_keys.tmp): $(all_plat_mac_perms_keys) $(M4)
Tri Vo8b3016b2019-01-07 16:43:31 -080018 @mkdir -p $(dir $@)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070019 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_KEYS) > $@
Tri Vo8b3016b2019-01-07 16:43:31 -080020
21# Should be synced with keys.conf.
Dan Willemsen3afe2352019-06-10 02:08:46 +000022all_plat_keys := platform media networkstack shared testkey
Dan Willemsen9d06a8f2019-05-28 21:20:08 +000023all_plat_keys := $(all_plat_keys:%=$(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))/%.x509.pem)
Tri Vo8b3016b2019-01-07 16:43:31 -080024
25$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_plat_mac_perms_files)
26$(LOCAL_BUILT_MODULE): $(plat_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py \
27$(all_plat_mac_perms_files) $(all_plat_keys)
28 @mkdir -p $(dir $@)
29 $(hide) DEFAULT_SYSTEM_DEV_CERTIFICATE="$(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))" \
30 $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
31
Tri Vo8b3016b2019-01-07 16:43:31 -080032all_plat_keys :=
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070033all_plat_mac_perms_files :=
34all_plat_mac_perms_keys :=
Tri Vo8b3016b2019-01-07 16:43:31 -080035plat_mac_perms_keys.tmp :=
36
37##################################
38include $(CLEAR_VARS)
39
40LOCAL_MODULE := product_mac_permissions.xml
41LOCAL_MODULE_CLASS := ETC
42LOCAL_MODULE_TAGS := optional
43LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/etc/selinux
44
45include $(BUILD_SYSTEM)/base_rules.mk
46
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070047all_product_mac_perms_keys := $(call build_policy, keys.conf, $(PRODUCT_PRIVATE_POLICY) $(REQD_MASK_POLICY))
48all_product_mac_perms_files := $(call build_policy, mac_permissions.xml, $(PRODUCT_PRIVATE_POLICY) $(REQD_MASK_POLICY))
49
Tri Vo8b3016b2019-01-07 16:43:31 -080050# Build keys.conf
51product_mac_perms_keys.tmp := $(intermediates)/product_keys.tmp
52$(product_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070053$(product_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_product_mac_perms_keys)
54$(product_mac_perms_keys.tmp): $(all_product_mac_perms_keys)
Tri Vo8b3016b2019-01-07 16:43:31 -080055 @mkdir -p $(dir $@)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070056 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $^ > $@
Tri Vo8b3016b2019-01-07 16:43:31 -080057
58$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_product_mac_perms_files)
59$(LOCAL_BUILT_MODULE): $(product_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py \
60$(all_product_mac_perms_files)
61 @mkdir -p $(dir $@)
62 $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
63
64product_mac_perms_keys.tmp :=
65all_product_mac_perms_files :=
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070066all_product_mac_perms_keys :=
Tri Vo8b3016b2019-01-07 16:43:31 -080067
68##################################
69include $(CLEAR_VARS)
70
71LOCAL_MODULE := vendor_mac_permissions.xml
72LOCAL_MODULE_CLASS := ETC
73LOCAL_MODULE_TAGS := optional
74LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
75
76include $(BUILD_SYSTEM)/base_rules.mk
77
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070078all_vendor_mac_perms_keys := $(call build_policy, keys.conf, $(PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS) $(REQD_MASK_POLICY))
79all_vendor_mac_perms_files := $(call build_policy, mac_permissions.xml, $(PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS) $(REQD_MASK_POLICY))
80
Tri Vo8b3016b2019-01-07 16:43:31 -080081# Build keys.conf
82vendor_mac_perms_keys.tmp := $(intermediates)/vendor_keys.tmp
83$(vendor_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070084$(vendor_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_vendor_mac_perms_keys)
85$(vendor_mac_perms_keys.tmp): $(all_vendor_mac_perms_keys) $(M4)
Tri Vo8b3016b2019-01-07 16:43:31 -080086 @mkdir -p $(dir $@)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070087 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_KEYS) > $@
Tri Vo8b3016b2019-01-07 16:43:31 -080088
89$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_vendor_mac_perms_files)
90$(LOCAL_BUILT_MODULE): $(vendor_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py \
91$(all_vendor_mac_perms_files)
92 @mkdir -p $(dir $@)
93 $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
94
95vendor_mac_perms_keys.tmp :=
96all_vendor_mac_perms_files :=
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070097all_vendor_mac_perms_keys :=
Tri Vo8b3016b2019-01-07 16:43:31 -080098
99##################################
100include $(CLEAR_VARS)
101
102LOCAL_MODULE := odm_mac_permissions.xml
103LOCAL_MODULE_CLASS := ETC
104LOCAL_MODULE_TAGS := optional
105LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/etc/selinux
106
107include $(BUILD_SYSTEM)/base_rules.mk
108
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700109all_odm_mac_perms_keys := $(call build_policy, keys.conf, $(BOARD_ODM_SEPOLICY_DIRS) $(REQD_MASK_POLICY))
110all_odm_mac_perms_files := $(call build_policy, mac_permissions.xml, $(BOARD_ODM_SEPOLICY_DIRS) $(REQD_MASK_POLICY))
111
Tri Vo8b3016b2019-01-07 16:43:31 -0800112# Build keys.conf
113odm_mac_perms_keys.tmp := $(intermediates)/odm_keys.tmp
114$(odm_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700115$(odm_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_odm_mac_perms_keys)
116$(odm_mac_perms_keys.tmp): $(all_odm_mac_perms_keys) $(M4)
Tri Vo8b3016b2019-01-07 16:43:31 -0800117 @mkdir -p $(dir $@)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700118 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_KEYS) > $@
Tri Vo8b3016b2019-01-07 16:43:31 -0800119
120$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_odm_mac_perms_files)
121$(LOCAL_BUILT_MODULE): $(odm_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py \
122$(all_odm_mac_perms_files)
123 @mkdir -p $(dir $@)
124 $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
125
126odm_mac_perms_keys.tmp :=
127all_odm_mac_perms_files :=