factory_ramdisk.mk revision 0a099d904a5f82cba0ce86878d3d3e5e2dbf9e95
1# 2# Copyright (C) 2011 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17# PRODUCT_FACTORY_RAMDISK_MODULES consists of "<module_name>:<install_path>" pairs. 18# <install_path> is relative to TARGET_FACTORY_RAMDISK_OUT. 19# For example: 20# PRODUCT_FACTORY_RAMDISK_MODULES := \ 21# toolbox:bin/toolbox adbd:sbin/adbd adb:bin/adb 22factory_ramdisk_modules := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_FACTORY_RAMDISK_MODULES)) 23ifneq (,$(factory_ramdisk_modules)) 24INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES := 25$(foreach m, $(factory_ramdisk_modules), \ 26 $(eval _fr_m_name := $(call word-colon,1,$(m))) \ 27 $(eval _fr_dest := $(call word-colon,2,$(m))) \ 28 $(eval _fr_m_built := $(filter $(PRODUCT_OUT)/%, $(ALL_MODULES.$(_fr_m_name).BUILT))) \ 29 $(if $(_fr_m_built), \ 30 $(eval _fulldest := $(TARGET_FACTORY_RAMDISK_OUT)/$(_fr_dest)) \ 31 $(eval $(call copy-one-file,$(_fr_m_built),$(_fulldest))) \ 32 $(eval INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES += $(_fulldest)), \ 33 $(error Error: module "$(m)" in PRODUCT_FACTORY_RAMDISK_MODULES is not a target module!) \ 34 )) 35endif 36 37# Files may also be installed via PRODUCT_COPY_FILES, PRODUCT_PACKAGES etc. 38INTERNAL_FACTORY_RAMDISK_FILES := $(filter $(TARGET_FACTORY_RAMDISK_OUT)/%, \ 39 $(ALL_DEFAULT_INSTALLED_MODULES)) 40 41ifneq (,$(INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES)$(INTERNAL_FACTORY_RAMDISK_FILES)) 42 43BUILT_FACTORY_RAMDISK_TARGET := $(PRODUCT_OUT)/factory_ramdisk.img 44 45INSTALLED_FACTORY_RAMDISK_TARGET := $(BUILT_FACTORY_RAMDISK_TARGET) 46$(INSTALLED_FACTORY_RAMDISK_TARGET) : $(MKBOOTFS) \ 47 $(INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES) $(INTERNAL_FACTORY_RAMDISK_FILES) | $(MINIGZIP) 48 $(call pretty,"Target factory ram disk: $@") 49 $(hide) $(MKBOOTFS) $(TARGET_FACTORY_RAMDISK_OUT) | $(MINIGZIP) > $@ 50 51endif 52