summaryrefslogtreecommitdiffstats
path: root/tools/fs_config/Android.mk
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-04-01 14:41:29 -0700
committerMark Salyzyn <salyzyn@google.com>2015-04-15 14:17:12 -0700
commit06b91b9bcf4410d7b8c8c5e10a717671dd327c35 (patch)
treec12211036cae095be71a03aa549d0b073184f6d4 /tools/fs_config/Android.mk
parent073a9ebbbf509097bccd0f560cefd84f10879c13 (diff)
downloadbuild-06b91b9bcf4410d7b8c8c5e10a717671dd327c35.zip
build-06b91b9bcf4410d7b8c8c5e10a717671dd327c35.tar.gz
build-06b91b9bcf4410d7b8c8c5e10a717671dd327c35.tar.bz2
fs_config: Add fs_config_generate
fs_config_generate_$(TARGET_DEVICE) is built based off the content of $(TARGET_ANDROID_FILESYSTEM_CONFIG_H). We also add the rules fs_config_dirs and fs_config_file to utilize this command for target contents: fs_config_generate_$(TARGET_DEVICE) -D -o system/etc/fs_config_dir fs_config_generate_$(TARGET_DEVICE) -F -o system/etc/fs_config_file In order to use this feature, one must have the fs_config_dirs and fs_config_files in the $(PRODUCT_PACKAGES) list defined in the device make files in $(TARGET_DEVICE_DIR). And either an android_filesystem_config.h file in that directory, or define a path in TARGET_ANDROID_FILESYSTEM_CONFIG_H to point to one. Bug: 19908228 Change-Id: Iee1543d99169f874e0915ae07962a7750ecb6342
Diffstat (limited to 'tools/fs_config/Android.mk')
-rw-r--r--tools/fs_config/Android.mk61
1 files changed, 61 insertions, 0 deletions
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index 3e16962..34a3522 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -22,3 +22,64 @@ LOCAL_SHARED_LIBRARIES := libcutils libselinux
LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_EXECUTABLE)
+
+# To Build the custom target binary for the host to generate the fs_config
+# override files. The executable is hard coded to include the
+# $(TARGET_ANDROID_FILESYSTEM_CONFIG_H) file if it exists.
+# Expectations:
+# device/<vendor>/<device>/android_filesystem_config.h
+# fills in struct fs_path_config android_device_dirs[] and
+# struct fs_path_config android_device_files[]
+# device/<vendor>/<device>/device.mk
+# PRODUCT_PACKAGES += fs_config_dirs fs_config_files
+
+# If not specified, check if default one to be found
+ANDROID_FS_CONFIG_H := android_filesystem_config.h
+
+ifneq ($(TARGET_ANDROID_FILESYSTEM_CONFIG_H),)
+ifeq ($(filter %/$(ANDROID_FS_CONFIG_H),$(TARGET_ANDROID_FILESYSTEM_CONFIG_H)),)
+$(error TARGET_ANDROID_FILESYSTEM_CONFIG_H file name must be $(ANDROID_FS_CONFIG_H), \
+ see "$(notdir $(TARGET_ANDROID_FILESYSTEM_CONFIG_H))".)
+endif
+
+my_fs_config_h := $(TARGET_ANDROID_FILESYSTEM_CONFIG_H)
+else ifneq ($(wildcard $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H)),)
+my_fs_config_h := $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H)
+else
+my_fs_config_h := $(LOCAL_PATH)/default/$(ANDROID_FS_CONFIG_H)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := fs_config_generate.c
+LOCAL_MODULE := fs_config_generate_$(TARGET_DEVICE)
+LOCAL_SHARED_LIBRARIES := libcutils
+LOCAL_CFLAGS := -Werror -Wno-error=\#warnings
+LOCAL_C_INCLUDES := $(dir $(my_fs_config_h))
+include $(BUILD_HOST_EXECUTABLE)
+fs_config_generate_bin := $(LOCAL_INSTALLED_MODULE)
+
+# Generate the system/etc/fs_config_dirs binary file for the target
+# Add fs_config_dirs to PRODUCT_PACKAGES in the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_dirs
+LOCAL_MODULE_CLASS := ETC
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -D -o $@
+
+# Generate the system/etc/fs_config_files binary file for the target
+# Add fs_config_files to PRODUCT_PACKAGES in the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_files
+LOCAL_MODULE_CLASS := ETC
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -F -o $@
+
+ANDROID_FS_CONFIG_H :=
+my_fs_config_h :=
+fs_config_generate_bin :=