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_SUPPORT_VERITY_FEC, set to "true" if the product supports
40#     verity FEC (forward error correction).
41#   - CUSTOM_IMAGE_VERITY_BLOCK_DEVICE
42#   - CUSTOM_IMAGE_AVB_HASH_ENABLE, set to "true" to add AVB HASH footer.
43#   - CUSTOM_IMAGE_AVB_ADD_HASH_FOOTER_ARGS, additional args of AVB HASH footer.
44#   - CUSTOM_IMAGE_AVB_HASHTREE_ENABLE, set to "true" to add AVB HASHTREE
45#     footer.
46#   - CUSTOM_IMAGE_AVB_ADD_HASHTREE_FOOTER_ARGS, additional args of AVB
47#     HASHTREE footer.
48#   - CUSTOM_IMAGE_AVB_KEY_PATH, custom AVB signing key.
49#   - CUSTOM_IMAGE_AVB_ALGORITHM, custom AVB signing algorithm.
50#
51# To build all those images, run "make custom_images".
52
53ifneq ($(filter $(MAKECMDGOALS),custom_images),)
54
55.PHONY: custom_images
56
57custom_image_parameter_variables := \
58  CUSTOM_IMAGE_MOUNT_POINT \
59  CUSTOM_IMAGE_PARTITION_SIZE \
60  CUSTOM_IMAGE_FILE_SYSTEM_TYPE \
61  CUSTOM_IMAGE_DICT_FILE \
62  CUSTOM_IMAGE_MODULES \
63  CUSTOM_IMAGE_COPY_FILES \
64  CUSTOM_IMAGE_SELINUX \
65  CUSTOM_IMAGE_SUPPORT_VERITY \
66  CUSTOM_IMAGE_SUPPORT_VERITY_FEC \
67  CUSTOM_IMAGE_VERITY_BLOCK_DEVICE \
68  CUSTOM_IMAGE_AVB_HASH_ENABLE \
69  CUSTOM_IMAGE_AVB_ADD_HASH_FOOTER_ARGS \
70  CUSTOM_IMAGE_AVB_HASHTREE_ENABLE \
71  CUSTOM_IMAGE_AVB_ADD_HASHTREE_FOOTER_ARGS \
72  CUSTOM_IMAGE_AVB_KEY_PATH \
73  CUSTOM_IMAGE_AVB_ALGORITHM \
74
75# We don't expect product makefile to inherit/override PRODUCT_CUSTOM_IMAGE_MAKEFILES,
76# so we don't put it in the _product_var_list.
77$(foreach mk, $(PRODUCT_CUSTOM_IMAGE_MAKEFILES),\
78  $(eval my_custom_imag_makefile := $(mk))\
79  $(eval include $(BUILD_SYSTEM)/tasks/tools/build_custom_image.mk))
80
81endif
82