1# 2# Copyright (C) 2015 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# Build additional images requested by the product makefile. 18# This script gives the ability to build multiple additional images and you can 19# configure what modules/files to include in each image. 20# 1. Define PRODUCT_CUSTOM_IMAGE_MAKEFILES in your product makefile. 21# PRODUCT_CUSTOM_IMAGE_MAKEFILES is a list of makefiles. 22# Each makefile configures an image. 23# For image configuration makefile foo/bar/xyz.mk, the built image file name 24# will be xyz.img. So make sure they won't conflict. 25# 2. In each image's configuration makefile, you can define variables: 26# - CUSTOM_IMAGE_MOUNT_POINT, the mount point, such as "oem", "odm" etc. 27# - CUSTOM_IMAGE_PARTITION_SIZE 28# - CUSTOM_IMAGE_FILE_SYSTEM_TYPE 29# - CUSTOM_IMAGE_DICT_FILE, a text file defines a dictionary accepted by 30# BuildImage() in tools/releasetools/build_image.py. 31# - CUSTOM_IMAGE_MODULES, a list of module names you want to include in 32# the image; Not only the module itself will be installed to proper path in 33# the image, you can also piggyback additional files/directories with the 34# module's LOCAL_PICKUP_FILES. 35# - CUSTOM_IMAGE_COPY_FILES, a list of "<src>:<dest>" to be copied to the 36# image. <dest> is relativ to the root of the image. 37# - CUSTOM_IMAGE_SELINUX, set to "true" if the image supports selinux. 38# - CUSTOM_IMAGE_SUPPORT_VERITY, set to "true" if the product supports verity. 39# - CUSTOM_IMAGE_VERITY_BLOCK_DEVICE 40# 41# To build all those images, run "make custom_images". 42 43ifneq ($(filter $(MAKECMDGOALS),custom_images),) 44 45.PHONY: custom_images 46 47custom_image_parameter_variables := \ 48 CUSTOM_IMAGE_MOUNT_POINT \ 49 CUSTOM_IMAGE_PARTITION_SIZE \ 50 CUSTOM_IMAGE_FILE_SYSTEM_TYPE \ 51 CUSTOM_IMAGE_DICT_FILE \ 52 CUSTOM_IMAGE_MODULES \ 53 CUSTOM_IMAGE_COPY_FILES \ 54 CUSTOM_IMAGE_SELINUX \ 55 CUSTOM_IMAGE_SUPPORT_VERITY \ 56 CUSTOM_IMAGE_VERITY_BLOCK_DEVICE \ 57 58# We don't expect product makefile to inherit/override PRODUCT_CUSTOM_IMAGE_MAKEFILES, 59# so we don't put it in the _product_var_list. 60$(foreach mk, $(PRODUCT_CUSTOM_IMAGE_MAKEFILES),\ 61 $(eval my_custom_imag_makefile := $(mk))\ 62 $(eval include $(BUILD_SYSTEM)/tasks/tools/build_custom_image.mk)) 63 64endif 65