diff options
author | Ying Wang <wangying@google.com> | 2015-03-12 18:30:39 -0700 |
---|---|---|
committer | Ying Wang <wangying@google.com> | 2015-03-13 16:48:02 -0700 |
commit | 5fcf1094f9cf4d57c2598237f99621f254130d71 (patch) | |
tree | 2571d97d184cab2a93e80668b903f84aba506143 /tools | |
parent | 08b32584f42a4a885bcb036e83ce4498932f087f (diff) | |
download | build-5fcf1094f9cf4d57c2598237f99621f254130d71.zip build-5fcf1094f9cf4d57c2598237f99621f254130d71.tar.gz build-5fcf1094f9cf4d57c2598237f99621f254130d71.tar.bz2 |
Support to configure and build multiple custom images.
Build additional images requested by the product makefile.
This script gives the ability to build multiple additional images and
you can configure what modules/files to include in each image.
1. Define PRODUCT_CUSTOM_IMAGE_MAKEFILES in your product makefile.
PRODUCT_CUSTOM_IMAGE_MAKEFILES is a list of makefiles.
Each makefile configures an image.
For image configuration makefile foo/bar/xyz.mk, the built image
file name
will be xyz.img. So make sure they won't conflict.
2. In each image's configuration makefile, you can define variables:
- CUSTOM_IMAGE_MOUNT_POINT, the mount point, such as "oem", "odm"
etc.
- CUSTOM_IMAGE_PARTITION_SIZE
- CUSTOM_IMAGE_FILE_SYSTEM_TYPE
- CUSTOM_IMAGE_DICT_FILE, a text file defining a dictionary
accepted by BuildImage() in tools/releasetools/build_image.py.
- CUSTOM_IMAGE_MODULES, a list of module names you want to include
in the image; Not only the module itself will be installed to proper
path in the image, you can also piggyback additional files/directories
with the module's LOCAL_PICKUP_FILES.
- CUSTOM_IMAGE_COPY_FILES, a list of "<src>:<dest>" to be copied to
the image. <dest> is relativ to the root of the image.
To build all those images, run "make custom_images".
Bug: 19609718
Change-Id: Ic73587e08503a251be27797c7b00329716051927
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/releasetools/build_image.py | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index 55f0058..692ec93 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -379,23 +379,28 @@ def main(argv): out_file = argv[2] glob_dict = LoadGlobalDict(glob_dict_file) - image_filename = os.path.basename(out_file) - mount_point = "" - if image_filename == "system.img": - mount_point = "system" - elif image_filename == "userdata.img": - mount_point = "data" - elif image_filename == "cache.img": - mount_point = "cache" - elif image_filename == "vendor.img": - mount_point = "vendor" - elif image_filename == "oem.img": - mount_point = "oem" + if "mount_point" in glob_dict: + # The caller knows the mount point and provides a dictionay needed by BuildImage(). + image_properties = glob_dict else: - print >> sys.stderr, "error: unknown image file name ", image_filename - exit(1) + image_filename = os.path.basename(out_file) + mount_point = "" + if image_filename == "system.img": + mount_point = "system" + elif image_filename == "userdata.img": + mount_point = "data" + elif image_filename == "cache.img": + mount_point = "cache" + elif image_filename == "vendor.img": + mount_point = "vendor" + elif image_filename == "oem.img": + mount_point = "oem" + else: + print >> sys.stderr, "error: unknown image file name ", image_filename + exit(1) + + image_properties = ImagePropFromGlobalDict(glob_dict, mount_point) - image_properties = ImagePropFromGlobalDict(glob_dict, mount_point) if not BuildImage(in_dir, image_properties, out_file): print >> sys.stderr, "error: failed to build %s from %s" % (out_file, in_dir) exit(1) |