diff options
author | Ying Wang <wangying@google.com> | 2011-12-16 11:27:52 -0800 |
---|---|---|
committer | Ying Wang <wangying@google.com> | 2011-12-16 11:33:01 -0800 |
commit | 0a099d904a5f82cba0ce86878d3d3e5e2dbf9e95 (patch) | |
tree | 83d3f7e7f8ef3c849ee34ffdc4d99cc2ec48e744 | |
parent | 92c32ea079eaa130ef0670d17cf493800df25653 (diff) | |
download | build-0a099d904a5f82cba0ce86878d3d3e5e2dbf9e95.zip build-0a099d904a5f82cba0ce86878d3d3e5e2dbf9e95.tar.gz build-0a099d904a5f82cba0ce86878d3d3e5e2dbf9e95.tar.bz2 |
Support to build factory ramdisk image.
Bug: 5769921
With this change, to build factory_ramdisk.img, set
PRODUCT_FACTORY_RAMDISK_MODULES in your product config.
PRODUCT_FACTORY_RAMDISK_MODULES consists of
"<module_name>:<install_path>" pairs.
<install_path> is relative to the root of the factory ramdisk output.
For example:
PRODUCT_FACTORY_RAMDISK_MODULES := \
toolbox:bin/toolbox adbd:sbin/adbd adb:bin/adb
On the other hand you can use PRODUCT_COPY_FILES to copy prebuilt files
to the factory ramdisk.
Or you can define modules that are specific for the factory ramdisk
(with LOCAL_MODULE_PATH pointing to TARGET_FACTORY_RAMDISK_OUT) and add
the module names to PRODUCT_PACKAGES.
Change-Id: I3778e3d091979261cb476628da1365f931e11f49
-rw-r--r-- | core/envsetup.mk | 2 | ||||
-rw-r--r-- | core/main.mk | 4 | ||||
-rw-r--r-- | core/product.mk | 1 | ||||
-rw-r--r-- | core/tasks/factory_ramdisk.mk | 51 |
4 files changed, 58 insertions, 0 deletions
diff --git a/core/envsetup.mk b/core/envsetup.mk index c3ae3b0..6cd42c8 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -239,6 +239,8 @@ TARGET_INSTALLER_DATA_OUT := $(TARGET_INSTALLER_OUT)/data TARGET_INSTALLER_ROOT_OUT := $(TARGET_INSTALLER_OUT)/root TARGET_INSTALLER_SYSTEM_OUT := $(TARGET_INSTALLER_OUT)/root/system +TARGET_FACTORY_RAMDISK_OUT := $(PRODUCT_OUT)/factory_ramdisk + COMMON_MODULE_CLASSES := TARGET-NOTICE_FILES HOST-NOTICE_FILES HOST-JAVA_LIBRARIES ifeq (,$(strip $(DIST_DIR))) diff --git a/core/main.mk b/core/main.mk index 9b05f76..89cbc63 100644 --- a/core/main.mk +++ b/core/main.mk @@ -733,6 +733,9 @@ checkbuild: $(modules_to_check) .PHONY: ramdisk ramdisk: $(INSTALLED_RAMDISK_TARGET) +.PHONY: factory_ramdisk +factory_ramdisk: $(INSTALLED_FACTORY_RAMDISK_TARGET) + .PHONY: systemtarball systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET) @@ -809,6 +812,7 @@ else # TARGET_BUILD_APPS $(BUILT_TARGET_FILES_PACKAGE) \ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ $(INSTALLED_RAMDISK_TARGET) \ + $(INSTALLED_FACTORY_RAMDISK_TARGET) \ ) # Building a full system-- the default is to build droidcore diff --git a/core/product.mk b/core/product.mk index f48d2be..4d4c983 100644 --- a/core/product.mk +++ b/core/product.mk @@ -84,6 +84,7 @@ _product_var_list := \ PRODUCT_SDK_ADDON_DOC_MODULES \ PRODUCT_DEFAULT_WIFI_CHANNELS \ PRODUCT_DEFAULT_DEV_CERTIFICATE \ + PRODUCT_FACTORY_RAMDISK_MODULES \ define dump-product diff --git a/core/tasks/factory_ramdisk.mk b/core/tasks/factory_ramdisk.mk new file mode 100644 index 0000000..c4d792c --- /dev/null +++ b/core/tasks/factory_ramdisk.mk @@ -0,0 +1,51 @@ +# +# Copyright (C) 2011 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. +# + +# PRODUCT_FACTORY_RAMDISK_MODULES consists of "<module_name>:<install_path>" pairs. +# <install_path> is relative to TARGET_FACTORY_RAMDISK_OUT. +# For example: +# PRODUCT_FACTORY_RAMDISK_MODULES := \ +# toolbox:bin/toolbox adbd:sbin/adbd adb:bin/adb +factory_ramdisk_modules := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_FACTORY_RAMDISK_MODULES)) +ifneq (,$(factory_ramdisk_modules)) +INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES := +$(foreach m, $(factory_ramdisk_modules), \ + $(eval _fr_m_name := $(call word-colon,1,$(m))) \ + $(eval _fr_dest := $(call word-colon,2,$(m))) \ + $(eval _fr_m_built := $(filter $(PRODUCT_OUT)/%, $(ALL_MODULES.$(_fr_m_name).BUILT))) \ + $(if $(_fr_m_built), \ + $(eval _fulldest := $(TARGET_FACTORY_RAMDISK_OUT)/$(_fr_dest)) \ + $(eval $(call copy-one-file,$(_fr_m_built),$(_fulldest))) \ + $(eval INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES += $(_fulldest)), \ + $(error Error: module "$(m)" in PRODUCT_FACTORY_RAMDISK_MODULES is not a target module!) \ + )) +endif + +# Files may also be installed via PRODUCT_COPY_FILES, PRODUCT_PACKAGES etc. +INTERNAL_FACTORY_RAMDISK_FILES := $(filter $(TARGET_FACTORY_RAMDISK_OUT)/%, \ + $(ALL_DEFAULT_INSTALLED_MODULES)) + +ifneq (,$(INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES)$(INTERNAL_FACTORY_RAMDISK_FILES)) + +BUILT_FACTORY_RAMDISK_TARGET := $(PRODUCT_OUT)/factory_ramdisk.img + +INSTALLED_FACTORY_RAMDISK_TARGET := $(BUILT_FACTORY_RAMDISK_TARGET) +$(INSTALLED_FACTORY_RAMDISK_TARGET) : $(MKBOOTFS) \ + $(INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES) $(INTERNAL_FACTORY_RAMDISK_FILES) | $(MINIGZIP) + $(call pretty,"Target factory ram disk: $@") + $(hide) $(MKBOOTFS) $(TARGET_FACTORY_RAMDISK_OUT) | $(MINIGZIP) > $@ + +endif |