2009-03-04 04:28:42 +01:00
|
|
|
# Copyright (C) 2008 The Android Open Source Project
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
LOCAL_PATH := $(call my-dir)
|
2015-04-15 21:53:39 +02:00
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_SRC_FILES := fs_config.c
|
|
|
|
LOCAL_MODULE := fs_config
|
2015-04-15 21:53:39 +02:00
|
|
|
LOCAL_SHARED_LIBRARIES := libcutils libselinux
|
2015-04-01 21:54:46 +02:00
|
|
|
LOCAL_CFLAGS := -Werror
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
include $(BUILD_HOST_EXECUTABLE)
|
2015-04-01 23:41:29 +02:00
|
|
|
|
2016-03-05 03:12:29 +01:00
|
|
|
# One can override the default android_filesystem_config.h file in one of two ways:
|
|
|
|
#
|
|
|
|
# 1. The old way:
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
# 2. The new way:
|
|
|
|
# set TARGET_FS_CONFIG_GEN to contain a list of intermediate format files
|
|
|
|
# for generating the android_filesystem_config.h file.
|
|
|
|
#
|
|
|
|
# More information can be found in the README
|
2015-04-01 23:41:29 +02:00
|
|
|
ANDROID_FS_CONFIG_H := android_filesystem_config.h
|
|
|
|
|
|
|
|
ifneq ($(TARGET_ANDROID_FILESYSTEM_CONFIG_H),)
|
2016-03-05 03:12:29 +01:00
|
|
|
ifneq ($(TARGET_FS_CONFIG_GEN),)
|
|
|
|
$(error Cannot set TARGET_ANDROID_FILESYSTEM_CONFIG_H and TARGET_FS_CONFIG_GEN simultaneously)
|
|
|
|
endif
|
2016-02-11 19:35:07 +01:00
|
|
|
|
|
|
|
# One and only one file can be specified.
|
|
|
|
ifneq ($(words $(TARGET_ANDROID_FILESYSTEM_CONFIG_H)),1)
|
|
|
|
$(error Multiple fs_config files specified, \
|
|
|
|
see "$(TARGET_ANDROID_FILESYSTEM_CONFIG_H)".)
|
|
|
|
endif
|
|
|
|
|
2015-04-01 23:41:29 +02:00
|
|
|
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)),)
|
2016-03-05 03:12:29 +01:00
|
|
|
|
|
|
|
ifneq ($(TARGET_FS_CONFIG_GEN),)
|
|
|
|
$(error Cannot provide $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H) and set TARGET_FS_CONFIG_GEN simultaneously)
|
|
|
|
endif
|
2015-04-01 23:41:29 +02:00
|
|
|
my_fs_config_h := $(TARGET_DEVICE_DIR)/$(ANDROID_FS_CONFIG_H)
|
2016-03-05 03:12:29 +01:00
|
|
|
|
2015-04-01 23:41:29 +02:00
|
|
|
else
|
|
|
|
my_fs_config_h := $(LOCAL_PATH)/default/$(ANDROID_FS_CONFIG_H)
|
|
|
|
endif
|
|
|
|
|
2016-03-05 03:12:29 +01:00
|
|
|
##################################
|
2015-04-01 23:41:29 +02:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_SRC_FILES := fs_config_generate.c
|
|
|
|
LOCAL_MODULE := fs_config_generate_$(TARGET_DEVICE)
|
2016-03-05 03:12:29 +01:00
|
|
|
LOCAL_MODULE_CLASS := EXECUTABLES
|
2015-04-01 23:41:29 +02:00
|
|
|
LOCAL_SHARED_LIBRARIES := libcutils
|
|
|
|
LOCAL_CFLAGS := -Werror -Wno-error=\#warnings
|
2016-03-05 03:12:29 +01:00
|
|
|
|
|
|
|
ifneq ($(TARGET_FS_CONFIG_GEN),)
|
2016-04-12 02:12:47 +02:00
|
|
|
system_android_filesystem_config := system/core/include/private/android_filesystem_config.h
|
2016-04-12 17:51:13 +02:00
|
|
|
|
|
|
|
# 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
|
2016-03-05 03:12:29 +01:00
|
|
|
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)
|
2016-04-12 02:12:47 +02:00
|
|
|
$(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
|
2016-03-05 03:12:29 +01:00
|
|
|
$(transform-generated-source)
|
|
|
|
|
2016-04-12 17:51:13 +02:00
|
|
|
LOCAL_GENERATED_SOURCES := $(oem) $(gen)
|
|
|
|
|
2016-03-05 03:12:29 +01:00
|
|
|
my_fs_config_h := $(gen)
|
2016-04-12 17:51:13 +02:00
|
|
|
my_gen_oem_aid := $(oem)
|
2016-04-12 02:12:47 +02:00
|
|
|
system_android_filesystem_config :=
|
2016-03-05 03:12:29 +01:00
|
|
|
gen :=
|
2016-04-12 17:51:13 +02:00
|
|
|
oem :=
|
2016-03-05 03:12:29 +01:00
|
|
|
endif
|
|
|
|
|
2016-04-12 17:51:13 +02:00
|
|
|
LOCAL_C_INCLUDES := $(dir $(my_fs_config_h)) $(dir $(my_gen_oem_aid))
|
2016-03-05 03:12:29 +01:00
|
|
|
|
2015-04-01 23:41:29 +02:00
|
|
|
include $(BUILD_HOST_EXECUTABLE)
|
|
|
|
fs_config_generate_bin := $(LOCAL_INSTALLED_MODULE)
|
|
|
|
|
2016-03-05 03:12:29 +01:00
|
|
|
##################################
|
2015-04-01 23:41:29 +02:00
|
|
|
# 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 $@
|
|
|
|
|
2016-03-05 03:12:29 +01:00
|
|
|
##################################
|
2015-04-01 23:41:29 +02:00
|
|
|
# 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 $@
|
|
|
|
|
2016-04-12 17:51:13 +02:00
|
|
|
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)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2015-04-01 23:41:29 +02:00
|
|
|
ANDROID_FS_CONFIG_H :=
|
|
|
|
my_fs_config_h :=
|
|
|
|
fs_config_generate_bin :=
|
2016-04-12 17:51:13 +02:00
|
|
|
my_gen_oem_aid :=
|