define soong_config_add
|
$(strip \
|
$(if $(1),,$(error Parameter 1 namespace empty))
|
$(if $(2),,$(error Parameter 2 configkey empty))
|
$(eval SOONG_CONFIG_NAMESPACES := $(sort $(1) $(SOONG_CONFIG_NAMESPACES)))
|
$(eval SOONG_CONFIG_$(1) := $(sort $(2) $(SOONG_CONFIG_$(1))))
|
$(eval SOONG_CONFIG_$(1)_$(2) := $(3))
|
)
|
endef
|
|
# For auto load partition size config
|
define get_sys_partition_path
|
$(strip \
|
$(if $(BOARD_ADD_PACK_CONFIG),
|
$(eval __exist := $(filter %/sys_partition.fex,$(BOARD_ADD_PACK_CONFIG)))
|
$(if $(__exist),
|
$(eval __sys_partition_path := $(shell dirname $(__exist)))
|
),
|
$(if $(wildcard $(TOP_DIR)../*/device/config/chips),
|
$(eval __chip_path := $(shell cd $(TOP_DIR)../*/device/config/chips && pwd))
|
$(eval __sys_partition_path := $(__chip_path)/$(TARGET_BOARD_IC)/configs/$(PRODUCT_BOARD)/android),
|
$(eval __chip_path := $(shell cd $(TOP_DIR)../*/tools/pack/chips && pwd))
|
$(eval __sys_partition_path := $(__chip_path)/$(TARGET_BOARD_CHIP)/configs/$(PRODUCT_BOARD))
|
)
|
)
|
$(shell echo $(__sys_partition_path))
|
)
|
endef
|
|
define get_partition_size
|
$(strip \
|
$(eval __def := $(call get_sys_partition_path)/sys_partition.fex)
|
$(if $(strip $(1)),,$(error Parameter 1 partition name empty))
|
$(if $(strip $(2)),$(eval __cfg := $(2)),$(eval __cfg := $(__def)))
|
$(if $(wildcard $(__cfg)),,$(error Config file $(__cfg) not found))
|
$(eval __size := $(shell sed -n '/^\s*name\s*=\s*$(1)\s*$$/,/^\s*user_type\s*=/p' $(__cfg) | awk -F= '/size/{print $$2}'))
|
$(if $(__size),,$(error Cannot find size config for partition $(1)))
|
$(eval __number := $(shell echo $(__size) | sed 's|[a-z,A-Z]*$$||g'))
|
$(eval __dimension :=$(shell echo $(__size) | sed 's|^[0-9,.]\+||g'))
|
$(if $(__dimension),
|
$(if $(filter B b,$(__dimension)),
|
$(eval __m := 1),
|
$(if $(filter K k,$(__dimension)),
|
$(eval __m := 1024),
|
$(if $(filter M m,$(__dimension)),
|
$(eval __m := 1048576),
|
$(if $(filter G g,$(__dimension)),
|
$(eval __m := 1073741824),
|
$(error Error Dimension($(__dimension)))
|
)
|
)
|
)
|
),
|
$(eval __m := 512)
|
)
|
$(shell echo "$(__m) * $(__number)" | bc | awk -F. '{print $$1}')
|
)
|
endef
|
|
define copy-user-file
|
LOCAL_PATH := $$(shell dirname $1)
|
include $$(CLEAR_VARS)
|
LOCAL_MODULE := $$(subst /,-,$2)
|
LOCAL_MODULE_CLASS := ETC
|
LOCAL_MODULE_PATH := $$(shell dirname $2)
|
ifeq ($$(filter $$(PRODUCT_OUT)%,$$(LOCAL_MODULE_PATH)),)
|
LOCAL_MODULE_PATH := $$(PRODUCT_OUT)/$$(LOCAL_MODULE_PATH)
|
endif
|
LOCAL_MODULE_STEM := $$(shell basename $2)
|
LOCAL_SRC_FILES := $$(shell basename $1)
|
include $$(BUILD_PREBUILT)
|
endef
|
|
define get-copy-file-src
|
$(strip $(shell echo $(1) | awk -F':' '{print $$1}'))
|
endef
|
|
define get-copy-file-dst
|
$(strip $(shell echo $(1) | awk -F':' '{print $$2}'))
|
endef
|
|
define get-copy-file-name
|
$(strip $(subst /,-,$(call get-copy-file-dst,$(1))))
|
endef
|
|
define define-copy-target
|
$(foreach f,$(1),\
|
$(eval __internal_current_name := $(call get-copy-file-name,$(f))) \
|
$(if $(filter $(__internal_current_name),$(__internal_total_name)), \
|
$(warning $(__internal_current_name) allready defined, skip.), \
|
$(eval __internal_total_name += $(__internal_current_name)) \
|
$(eval $(call copy-user-file,$(call get-copy-file-src,$(f)),$(call get-copy-file-dst,$(f)))) \
|
) \
|
)
|
endef
|
|
define get-copy-target
|
$(eval __name :=) \
|
$(foreach f,$(1),\
|
$(eval __name += $(call get-copy-file-name,$(f)))) \
|
$(__name)
|
endef
|