2012-01-04 18:33:27 +01:00
|
|
|
LOCAL_PATH:= $(call my-dir)
|
2012-08-28 00:41:15 +02:00
|
|
|
|
2012-01-04 18:33:27 +01:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
# SELinux policy version.
|
|
|
|
# Must be <= /selinux/policyvers reported by the Android kernel.
|
|
|
|
# Must be within the compatibility range reported by checkpolicy -V.
|
2012-09-18 21:11:49 +02:00
|
|
|
POLICYVERS ?= 24
|
2012-01-04 18:33:27 +01:00
|
|
|
|
|
|
|
MLS_SENS=1
|
|
|
|
MLS_CATS=1024
|
|
|
|
|
2012-10-18 03:09:52 +02:00
|
|
|
# Quick edge case error detection for BOARD_SEPOLICY_REPLACE.
|
|
|
|
# Builds the singular path for each replace file.
|
|
|
|
sepolicy_replace_paths :=
|
|
|
|
$(foreach pf, $(BOARD_SEPOLICY_REPLACE), \
|
|
|
|
$(if $(filter $(pf), $(BOARD_SEPOLICY_UNION)), \
|
|
|
|
$(error Ambiguous request for sepolicy $(pf). Appears in both \
|
|
|
|
BOARD_SEPOLICY_REPLACE and BOARD_SEPOLICY_UNION), \
|
|
|
|
) \
|
2013-02-12 05:30:47 +01:00
|
|
|
$(eval _paths := $(filter-out $(BOARD_SEPOLICY_IGNORE), \
|
|
|
|
$(wildcard $(addsuffix /$(pf), $(BOARD_SEPOLICY_DIRS))))) \
|
2012-10-18 03:09:52 +02:00
|
|
|
$(eval _occurrences := $(words $(_paths))) \
|
|
|
|
$(if $(filter 0,$(_occurrences)), \
|
|
|
|
$(error No sepolicy file found for $(pf) in $(BOARD_SEPOLICY_DIRS)), \
|
|
|
|
) \
|
|
|
|
$(if $(filter 1, $(_occurrences)), \
|
|
|
|
$(eval sepolicy_replace_paths += $(_paths)), \
|
|
|
|
$(error Multiple occurrences of replace file $(pf) in $(_paths)) \
|
|
|
|
) \
|
|
|
|
$(if $(filter 0, $(words $(wildcard $(addsuffix /$(pf), $(LOCAL_PATH))))), \
|
|
|
|
$(error Specified the sepolicy file $(pf) in BOARD_SEPOLICY_REPLACE, \
|
|
|
|
but none found in $(LOCAL_PATH)), \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
|
|
|
|
# Builds paths for all requested policy files w.r.t
|
|
|
|
# both BOARD_SEPOLICY_REPLACE and BOARD_SEPOLICY_UNION
|
|
|
|
# product variables.
|
|
|
|
# $(1): the set of policy name paths to build
|
|
|
|
build_policy = $(foreach type, $(1), \
|
2013-02-12 05:30:47 +01:00
|
|
|
$(filter-out $(BOARD_SEPOLICY_IGNORE), \
|
|
|
|
$(foreach expanded_type, $(notdir $(wildcard $(addsuffix /$(type), $(LOCAL_PATH)))), \
|
|
|
|
$(if $(filter $(expanded_type), $(BOARD_SEPOLICY_REPLACE)), \
|
|
|
|
$(wildcard $(addsuffix $(expanded_type), $(sort $(dir $(sepolicy_replace_paths))))), \
|
|
|
|
$(LOCAL_PATH)/$(expanded_type) \
|
|
|
|
) \
|
2012-10-18 03:09:52 +02:00
|
|
|
) \
|
2013-02-12 05:30:47 +01:00
|
|
|
$(foreach union_policy, $(wildcard $(addsuffix /$(type), $(BOARD_SEPOLICY_DIRS))), \
|
|
|
|
$(if $(filter $(notdir $(union_policy)), $(BOARD_SEPOLICY_UNION)), \
|
|
|
|
$(union_policy), \
|
|
|
|
) \
|
2012-10-18 03:09:52 +02:00
|
|
|
) \
|
|
|
|
) \
|
|
|
|
)
|
2012-03-06 17:12:41 +01:00
|
|
|
|
2012-01-18 02:51:09 +01:00
|
|
|
##################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := sepolicy
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
|
|
|
sepolicy_policy.conf := $(intermediates)/policy.conf
|
|
|
|
$(sepolicy_policy.conf): PRIVATE_MLS_SENS := $(MLS_SENS)
|
|
|
|
$(sepolicy_policy.conf): PRIVATE_MLS_CATS := $(MLS_CATS)
|
2012-11-01 21:17:29 +01:00
|
|
|
$(sepolicy_policy.conf) : $(call build_policy, security_classes initial_sids access_vectors global_macros mls_macros mls policy_capabilities te_macros attributes *.te roles users initial_sid_contexts fs_use genfs_contexts port_contexts)
|
2012-01-18 02:51:09 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2012-11-01 21:17:29 +01:00
|
|
|
$(hide) m4 -D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) -s $^ > $@
|
2013-03-27 11:30:25 +01:00
|
|
|
$(hide) sed '/dontaudit/d' $@ > $@.dontaudit
|
2012-01-18 02:51:09 +01:00
|
|
|
|
2012-01-24 14:46:13 +01:00
|
|
|
$(LOCAL_BUILT_MODULE) : $(sepolicy_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpolicy
|
2012-01-18 02:51:09 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2012-04-10 00:31:03 +02:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -c $(POLICYVERS) -o $@ $<
|
2013-03-27 11:30:25 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -c $(POLICYVERS) -o $(dir $<)/$(notdir $@).dontaudit $<.dontaudit
|
2012-01-18 02:51:09 +01:00
|
|
|
|
2012-10-26 04:01:31 +02:00
|
|
|
built_sepolicy := $(LOCAL_BUILT_MODULE)
|
2012-01-18 02:51:09 +01:00
|
|
|
sepolicy_policy.conf :=
|
2012-10-02 18:46:37 +02:00
|
|
|
|
|
|
|
###################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2012-01-18 02:51:09 +01:00
|
|
|
LOCAL_MODULE := file_contexts
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
|
|
|
|
2012-03-06 17:12:41 +01:00
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
2012-01-18 02:51:09 +01:00
|
|
|
|
2012-10-18 03:09:52 +02:00
|
|
|
ALL_FC_FILES := $(call build_policy, file_contexts)
|
2012-10-02 18:46:37 +02:00
|
|
|
|
2012-10-26 04:01:31 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(ALL_FC_FILES) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc
|
2012-03-06 17:12:41 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2012-10-02 18:46:37 +02:00
|
|
|
$(hide) m4 -s $(ALL_FC_FILES) > $@
|
2012-10-26 04:01:31 +02:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc $(PRIVATE_SEPOLICY) $@
|
2012-01-18 02:51:09 +01:00
|
|
|
|
2012-03-06 17:12:41 +01:00
|
|
|
file_contexts :=
|
2012-08-16 19:55:05 +02:00
|
|
|
|
2012-01-18 02:51:09 +01:00
|
|
|
##################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := seapp_contexts
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
|
|
|
|
2012-08-16 19:55:05 +02:00
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2012-09-05 20:19:07 +02:00
|
|
|
seapp_contexts.tmp := $(intermediates)/seapp_contexts.tmp
|
2012-10-18 03:09:52 +02:00
|
|
|
$(seapp_contexts.tmp): $(call build_policy, seapp_contexts)
|
2012-08-16 19:55:05 +02:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) m4 -s $^ > $@
|
|
|
|
|
2012-10-26 04:01:31 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy)
|
|
|
|
$(LOCAL_BUILT_MODULE) : $(seapp_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkseapp
|
2012-08-28 00:41:15 +02:00
|
|
|
@mkdir -p $(dir $@)
|
2012-10-26 04:01:31 +02:00
|
|
|
$(HOST_OUT_EXECUTABLES)/checkseapp -p $(PRIVATE_SEPOLICY) -o $@ $<
|
2012-01-18 02:51:09 +01:00
|
|
|
|
2012-09-05 20:19:07 +02:00
|
|
|
seapp_contexts.tmp :=
|
2012-04-04 16:11:16 +02:00
|
|
|
##################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := property_contexts
|
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2013-01-23 20:04:50 +01:00
|
|
|
ALL_PC_FILES := $(call build_policy, property_contexts)
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $(built_sepolicy)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(ALL_PC_FILES) $(built_sepolicy) $(HOST_OUT_EXECUTABLES)/checkfc
|
2012-04-04 16:11:16 +02:00
|
|
|
@mkdir -p $(dir $@)
|
2013-01-23 20:04:50 +01:00
|
|
|
$(hide) m4 -s $(ALL_PC_FILES) > $@
|
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/checkfc -p $(PRIVATE_SEPOLICY) $@
|
2012-04-04 16:11:16 +02:00
|
|
|
|
|
|
|
property_contexts :=
|
2013-01-23 20:04:50 +01:00
|
|
|
built_sepolicy :=
|
2012-01-18 02:51:09 +01:00
|
|
|
##################################
|
2012-02-02 19:28:28 +01:00
|
|
|
|
2012-06-20 17:58:01 +02:00
|
|
|
##################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_MODULE := selinux-network.sh
|
|
|
|
LOCAL_SRC_FILES := $(LOCAL_MODULE)
|
|
|
|
LOCAL_MODULE_CLASS := EXECUTABLES
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)
|
|
|
|
|
|
|
|
include $(BUILD_PREBUILT)
|
|
|
|
|
2012-07-30 15:33:03 +02:00
|
|
|
##################################
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2013-03-27 13:35:39 +01:00
|
|
|
LOCAL_MODULE := mac_permissions.xml
|
2012-07-30 15:33:03 +02:00
|
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/security
|
|
|
|
|
2012-11-30 23:59:09 +01:00
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
2012-07-30 15:33:03 +02:00
|
|
|
|
2013-03-26 19:19:12 +01:00
|
|
|
# Build keys.conf
|
|
|
|
mac_perms_keys.tmp := $(intermediates)/keys.tmp
|
|
|
|
$(mac_perms_keys.tmp) : $(call build_policy, keys.conf)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) m4 -s $^ > $@
|
|
|
|
|
2013-03-27 13:35:39 +01:00
|
|
|
ALL_MAC_PERMS_FILES := $(call build_policy, $(LOCAL_MODULE))
|
2012-07-30 15:33:03 +02:00
|
|
|
|
2013-03-27 13:35:39 +01:00
|
|
|
$(LOCAL_BUILT_MODULE) : $(mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py $(ALL_MAC_PERMS_FILES)
|
2013-03-26 19:19:12 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2013-03-27 13:35:39 +01:00
|
|
|
$(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(ALL_MAC_PERMS_FILES)
|
2013-03-26 19:19:12 +01:00
|
|
|
|
2013-03-27 13:35:39 +01:00
|
|
|
mac_perms_keys.tmp :=
|
2012-06-20 17:58:01 +02:00
|
|
|
##################################
|
2012-10-18 03:09:52 +02:00
|
|
|
|
|
|
|
build_policy :=
|
|
|
|
sepolicy_replace_paths :=
|
2012-11-01 19:33:04 +01:00
|
|
|
|
|
|
|
include $(call all-makefiles-under,$(LOCAL_PATH))
|