blob: 3a281979e86bdd1c070ce8fef924c5c5f09964df [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))" \
Remi NGUYEN VANbd3ab022019-08-07 18:23:47 +090030 MAINLINE_SEPOLICY_DEV_CERTIFICATES="$(MAINLINE_SEPOLICY_DEV_CERTIFICATES)" \
Tri Vo8b3016b2019-01-07 16:43:31 -080031 $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
32
Tri Vo8b3016b2019-01-07 16:43:31 -080033all_plat_keys :=
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070034all_plat_mac_perms_files :=
35all_plat_mac_perms_keys :=
Tri Vo8b3016b2019-01-07 16:43:31 -080036plat_mac_perms_keys.tmp :=
37
38##################################
39include $(CLEAR_VARS)
40
41LOCAL_MODULE := product_mac_permissions.xml
42LOCAL_MODULE_CLASS := ETC
43LOCAL_MODULE_TAGS := optional
44LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/etc/selinux
45
46include $(BUILD_SYSTEM)/base_rules.mk
47
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070048all_product_mac_perms_keys := $(call build_policy, keys.conf, $(PRODUCT_PRIVATE_POLICY) $(REQD_MASK_POLICY))
49all_product_mac_perms_files := $(call build_policy, mac_permissions.xml, $(PRODUCT_PRIVATE_POLICY) $(REQD_MASK_POLICY))
50
Tri Vo8b3016b2019-01-07 16:43:31 -080051# Build keys.conf
52product_mac_perms_keys.tmp := $(intermediates)/product_keys.tmp
53$(product_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070054$(product_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_product_mac_perms_keys)
55$(product_mac_perms_keys.tmp): $(all_product_mac_perms_keys)
Tri Vo8b3016b2019-01-07 16:43:31 -080056 @mkdir -p $(dir $@)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070057 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $^ > $@
Tri Vo8b3016b2019-01-07 16:43:31 -080058
59$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_product_mac_perms_files)
60$(LOCAL_BUILT_MODULE): $(product_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py \
61$(all_product_mac_perms_files)
62 @mkdir -p $(dir $@)
63 $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
64
65product_mac_perms_keys.tmp :=
66all_product_mac_perms_files :=
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070067all_product_mac_perms_keys :=
Tri Vo8b3016b2019-01-07 16:43:31 -080068
69##################################
70include $(CLEAR_VARS)
71
72LOCAL_MODULE := vendor_mac_permissions.xml
73LOCAL_MODULE_CLASS := ETC
74LOCAL_MODULE_TAGS := optional
75LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/selinux
76
77include $(BUILD_SYSTEM)/base_rules.mk
78
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070079all_vendor_mac_perms_keys := $(call build_policy, keys.conf, $(PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS) $(REQD_MASK_POLICY))
80all_vendor_mac_perms_files := $(call build_policy, mac_permissions.xml, $(PLAT_VENDOR_POLICY) $(BOARD_VENDOR_SEPOLICY_DIRS) $(REQD_MASK_POLICY))
81
Tri Vo8b3016b2019-01-07 16:43:31 -080082# Build keys.conf
83vendor_mac_perms_keys.tmp := $(intermediates)/vendor_keys.tmp
84$(vendor_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070085$(vendor_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_vendor_mac_perms_keys)
86$(vendor_mac_perms_keys.tmp): $(all_vendor_mac_perms_keys) $(M4)
Tri Vo8b3016b2019-01-07 16:43:31 -080087 @mkdir -p $(dir $@)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070088 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_KEYS) > $@
Tri Vo8b3016b2019-01-07 16:43:31 -080089
90$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_vendor_mac_perms_files)
91$(LOCAL_BUILT_MODULE): $(vendor_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py \
92$(all_vendor_mac_perms_files)
93 @mkdir -p $(dir $@)
94 $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
95
96vendor_mac_perms_keys.tmp :=
97all_vendor_mac_perms_files :=
Dan Willemsen3c3e59b2019-06-19 10:52:50 -070098all_vendor_mac_perms_keys :=
Tri Vo8b3016b2019-01-07 16:43:31 -080099
100##################################
101include $(CLEAR_VARS)
102
103LOCAL_MODULE := odm_mac_permissions.xml
104LOCAL_MODULE_CLASS := ETC
105LOCAL_MODULE_TAGS := optional
106LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/etc/selinux
107
108include $(BUILD_SYSTEM)/base_rules.mk
109
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700110all_odm_mac_perms_keys := $(call build_policy, keys.conf, $(BOARD_ODM_SEPOLICY_DIRS) $(REQD_MASK_POLICY))
111all_odm_mac_perms_files := $(call build_policy, mac_permissions.xml, $(BOARD_ODM_SEPOLICY_DIRS) $(REQD_MASK_POLICY))
112
Tri Vo8b3016b2019-01-07 16:43:31 -0800113# Build keys.conf
114odm_mac_perms_keys.tmp := $(intermediates)/odm_keys.tmp
115$(odm_mac_perms_keys.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700116$(odm_mac_perms_keys.tmp): PRIVATE_KEYS := $(all_odm_mac_perms_keys)
117$(odm_mac_perms_keys.tmp): $(all_odm_mac_perms_keys) $(M4)
Tri Vo8b3016b2019-01-07 16:43:31 -0800118 @mkdir -p $(dir $@)
Dan Willemsen3c3e59b2019-06-19 10:52:50 -0700119 $(hide) $(M4) --fatal-warnings -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_KEYS) > $@
Tri Vo8b3016b2019-01-07 16:43:31 -0800120
121$(LOCAL_BUILT_MODULE): PRIVATE_MAC_PERMS_FILES := $(all_odm_mac_perms_files)
122$(LOCAL_BUILT_MODULE): $(odm_mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py \
123$(all_odm_mac_perms_files)
124 @mkdir -p $(dir $@)
125 $(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(PRIVATE_MAC_PERMS_FILES)
126
127odm_mac_perms_keys.tmp :=
128all_odm_mac_perms_files :=