diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk index f946303634..a01e702347 100644 --- a/tools/fs_config/Android.mk +++ b/tools/fs_config/Android.mk @@ -254,7 +254,7 @@ LOCAL_EXPORT_C_INCLUDE_DEPS := $(my_gen_oem_aid) include $(BUILD_HEADER_LIBRARY) ################################## -# Generate the system/etc/passwd text file for the target +# Generate the vendor/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) @@ -270,10 +270,10 @@ $(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) > $@ + $(hide) $< passwd --required-prefix=vendor_ --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@ ################################## -# Generate the system/etc/group text file for the target +# Generate the vendor/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) @@ -289,7 +289,7 @@ $(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) > $@ + $(hide) $< group --required-prefix=vendor_ --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@ system_android_filesystem_config := endif diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py index d51d075e0d..ed63c0e112 100755 --- a/tools/fs_config/fs_config_generator.py +++ b/tools/fs_config/fs_config_generator.py @@ -1235,12 +1235,19 @@ class PasswdGen(BaseGenerator): help='An android_filesystem_config.h file' 'to parse AIDs and OEM Ranges from') + opt_group.add_argument( + '--required-prefix', + required=False, + help='A prefix that the names are required to contain.') + def __call__(self, args): hdr_parser = AIDHeaderParser(args['aid_header']) parser = FSConfigFileParser(args['fsconfig'], hdr_parser.oem_ranges) + required_prefix = args['required_prefix'] + aids = parser.aids # nothing to do if no aids defined @@ -1250,7 +1257,11 @@ class PasswdGen(BaseGenerator): print PasswdGen._GENERATED for aid in aids: - self._print_formatted_line(aid) + if required_prefix is None or aid.friendly.startswith(required_prefix): + self._print_formatted_line(aid) + else: + sys.exit("%s: AID '%s' must start with '%s'" % + (args['fsconfig'], aid.friendly, required_prefix)) def _print_formatted_line(self, aid): """Prints the aid to stdout in the passwd format. Internal use only.