diff options
author | Elliott Hughes <enh@google.com> | 2016-12-13 23:37:07 +0000 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2016-12-18 10:55:35 -0800 |
commit | 2d7c86dfeaffb67d18eac143c557db74af5c2b05 (patch) | |
tree | 3f761b42bc2001f4a6ff501039f2c5a1a2b3aa79 /tools/fs_config/Android.mk | |
parent | cbdc0bd096fdde4f92f1ec5bf65d6fc07e910a31 (diff) | |
download | platform_build-2d7c86dfeaffb67d18eac143c557db74af5c2b05.tar.gz platform_build-2d7c86dfeaffb67d18eac143c557db74af5c2b05.tar.bz2 platform_build-2d7c86dfeaffb67d18eac143c557db74af5c2b05.zip |
Revert "Revert "Merge changes from topic 'fsconfig-2'""
This reverts commit fad4b4b715be25e874829345a14219716fc8c157.
Incorporating the following fixes:
1.
fsconfig: fix fs_config_* build for discovered headers
When android_file system_config.h is picked up from the device
directory, neither TARGET_FS_CONFIG_GEN or TARGET_ANDROID_FILESYSTEM_CONFIG_H
are specified. Thus, the build is not generating the required fs_config_files
and fs_config_dirs.
Test: Ensure that make fs_config_files works, and produces the same output as before
Build the system image and mount it as a loop back and dump the file system
capabilities with getcap. Verify that output to the supplied
android_file system_config.h
From the loopback of the system.img mount, from CWD system/bin:
$ getcap *
cnss-daemon = cap_net_bind_service+ep
hostapd = cap_net_admin,cap_net_raw+ep
imsdatadaemon = cap_net_bind_service+ep
ims_rtp_daemon = cap_net_bind_service+ep
logd = cap_setgid,cap_audit_control,cap_syslog+ep
mm-qcamera-daemon = cap_sys_nice+ep
pm-service = cap_net_bind_service+ep
run-as = cap_setgid,cap_setuid+ep
surfaceflinger = cap_sys_nice+ep
webview_zygote32 = cap_setgid,cap_setuid,cap_setpcap+ep
webview_zygote64 = cap_setgid,cap_setuid,cap_setpcap+ep
Compared to the android_filesystem_config.h:
{ 00700, AID_CAMERA, AID_SHELL, (1ULL << CAP_SYS_NICE), "system/bin/mm-qcamera-daemon" },
{ 00755, AID_SYSTEM, AID_SYSTEM, (1ULL << CAP_NET_BIND_SERVICE), "system/bin/pm-service" },
{ 00755, AID_SYSTEM, AID_SYSTEM, (1ULL << CAP_NET_BIND_SERVICE), "system/bin/imsdatadaemon" },
{ 00755, AID_SYSTEM, AID_RADIO, (1ULL << CAP_NET_BIND_SERVICE), "system/bin/ims_rtp_daemon" },
{ 00755, AID_SYSTEM, AID_SYSTEM, (1ULL << CAP_NET_BIND_SERVICE), "system/bin/cnss-daemon"},
2.
fsconfig: fix error message for duplicate AID
Fixes:
raise ValueError('Duplicate aid value "%u" for %s' % value,
TypeError: %u format: a number is required, not str
and
raise ValueError('Duplicate aid value "%s" for %s' % value,
TypeError: not enough arguments for format string
3.
fsconfig: add test for duplicate ranges
Add a test for duplicate range detection.
4.
fsconfig: skip AID_APP, AID_USER and all ranges
Do not output AID_APP, AID_USER and ranges. A range
is defined as ending with AID_ and ending in _START or
_END.
5.
fsconfig: test for skip AID_APP, AID_USER and all ranges
Test against AIDs that caused the bionic tests to fail.
Change-Id: I95569a9ccc83bd3231f8a6f395532cc2de316bd2
Signed-off-by: William Roberts <william.c.roberts@intel.com>
Diffstat (limited to 'tools/fs_config/Android.mk')
-rw-r--r-- | tools/fs_config/Android.mk | 78 |
1 files changed, 74 insertions, 4 deletions
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk index fb4a0c4e46..65f8a081a2 100644 --- a/tools/fs_config/Android.mk +++ b/tools/fs_config/Android.mk @@ -81,19 +81,35 @@ LOCAL_SHARED_LIBRARIES := libcutils LOCAL_CFLAGS := -Werror -Wno-error=\#warnings ifneq ($(TARGET_FS_CONFIG_GEN),) +system_android_filesystem_config := system/core/include/private/android_filesystem_config.h + +# Generate the "generated_oem_aid.h" file +oem := $(local-generated-sources-dir)/generated_oem_aid.h +$(oem): PRIVATE_LOCAL_PATH := $(LOCAL_PATH) +$(oem): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN) +$(oem): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config) +$(oem): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/fs_config_generator.py oemaid --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@ +$(oem): $(TARGET_FS_CONFIG_GEN) $(LOCAL_PATH)/fs_config_generator.py + $(transform-generated-source) + +# Generate the fs_config header gen := $(local-generated-sources-dir)/$(ANDROID_FS_CONFIG_H) $(gen): PRIVATE_LOCAL_PATH := $(LOCAL_PATH) $(gen): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN) -$(gen): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/fs_config_generator.py $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@ -$(gen): $(TARGET_FS_CONFIG_GEN) $(LOCAL_PATH)/fs_config_generator.py +$(gen): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config) +$(gen): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/fs_config_generator.py fsconfig --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@ +$(gen): $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config) $(LOCAL_PATH)/fs_config_generator.py $(transform-generated-source) -LOCAL_GENERATED_SOURCES := $(gen) +LOCAL_GENERATED_SOURCES := $(oem) $(gen) + my_fs_config_h := $(gen) +my_gen_oem_aid := $(oem) gen := +oem := endif -LOCAL_C_INCLUDES := $(dir $(my_fs_config_h)) +LOCAL_C_INCLUDES := $(dir $(my_fs_config_h)) $(dir $(my_gen_oem_aid)) include $(BUILD_HOST_EXECUTABLE) fs_config_generate_bin := $(LOCAL_INSTALLED_MODULE) @@ -122,6 +138,60 @@ $(LOCAL_BUILT_MODULE): $(fs_config_generate_bin) @mkdir -p $(dir $@) $< -F -o $@ +# The newer passwd/group targets are only generated if you +# use the new TARGET_FS_CONFIG_GEN method. +ifneq ($(TARGET_FS_CONFIG_GEN),) + +################################## +# Build the oemaid library when fs config files are present. +# Intentionally break build if you require generated AIDS +# header file, but are not using any fs config files. +include $(CLEAR_VARS) +LOCAL_MODULE := liboemaids +LOCAL_EXPORT_C_INCLUDE_DIRS := $(dir $(my_gen_oem_aid)) +LOCAL_EXPORT_C_INCLUDE_DEPS := $(my_gen_oem_aid) +include $(BUILD_STATIC_LIBRARY) + +################################## +# Generate the system/etc/passwd text file for the target +# This file may be empty if no AIDs are defined in +# TARGET_FS_CONFIG_GEN files. +include $(CLEAR_VARS) + +LOCAL_MODULE := passwd +LOCAL_MODULE_CLASS := ETC + +include $(BUILD_SYSTEM)/base_rules.mk + +$(LOCAL_BUILT_MODULE): PRIVATE_LOCAL_PATH := $(LOCAL_PATH) +$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN) +$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config) +$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config) + @mkdir -p $(dir $@) + $(hide) $< passwd --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@ + +################################## +# Generate the system/etc/group text file for the target +# This file may be empty if no AIDs are defined in +# TARGET_FS_CONFIG_GEN files. +include $(CLEAR_VARS) + +LOCAL_MODULE := group +LOCAL_MODULE_CLASS := ETC + +include $(BUILD_SYSTEM)/base_rules.mk + +$(LOCAL_BUILT_MODULE): PRIVATE_LOCAL_PATH := $(LOCAL_PATH) +$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN) +$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config) +$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config) + @mkdir -p $(dir $@) + $(hide) $< group --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@ + +system_android_filesystem_config := +endif + ANDROID_FS_CONFIG_H := my_fs_config_h := fs_config_generate_bin := +my_gen_oem_aid := |