diff options
author | Ying Wang <wangying@google.com> | 2011-11-04 11:37:01 -0700 |
---|---|---|
committer | Ying Wang <wangying@google.com> | 2011-11-10 14:30:34 -0800 |
commit | 9f8e8db188371cb3787a91a03d193f87ad244ea3 (patch) | |
tree | ee9f126715d9889a03269450960693a1044f2adf /tools/releasetools/build_image.py | |
parent | ba2c734f71202522464db540260b0df696d26c06 (diff) | |
download | build-9f8e8db188371cb3787a91a03d193f87ad244ea3.zip build-9f8e8db188371cb3787a91a03d193f87ad244ea3.tar.gz build-9f8e8db188371cb3787a91a03d193f87ad244ea3.tar.bz2 |
Build cache.img on demand
Bug: 5153694
To build cache.img, set BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE (required,
ext4 only for now), BOARD_CACHEIMAGE_PARTITION_SIZE (optional) in
BoardConfig.mk.
Change-Id: I1d8b91646aa1dba88285e008ad3335768bcbddd2
Diffstat (limited to 'tools/releasetools/build_image.py')
-rwxr-xr-x | tools/releasetools/build_image.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index b5140a9..15acddc 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -67,22 +67,28 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): mount_point: such as "system", "data" etc. """ d = {} + + def copy_prop(src_p, dest_p): + if src_p in glob_dict: + d[dest_p] = str(glob_dict[src_p]) + common_props = ( - "fs_type", "extfs_sparse_flag", "mkyaffs2_extra_flags", ) for p in common_props: - if p in glob_dict: - d[p] = glob_dict[p] + copy_prop(p, p) d["mount_point"] = mount_point if mount_point == "system": - if "system_size" in glob_dict: - d["partition_size"] = str(glob_dict["system_size"]) + copy_prop("fs_type", "fs_type") + copy_prop("system_size", "partition_size") elif mount_point == "data": - if "userdata_size" in glob_dict: - d["partition_size"] = str(glob_dict["userdata_size"]) + copy_prop("fs_type", "fs_type") + copy_prop("userdata_size", "partition_size") + elif mount_point == "cache": + copy_prop("cache_fs_type", "fs_type") + copy_prop("cache_size", "partition_size") return d @@ -117,6 +123,11 @@ def main(argv): mount_point = "system" elif image_filename == "userdata.img": mount_point = "data" + elif image_filename == "cache.img": + mount_point = "cache" + else: + print >> sys.stderr, "error: unknown image file name ", image_filename + exit(1) image_properties = ImagePropFromGlobalDict(glob_dict, mount_point) if not BuildImage(in_dir, image_properties, out_file): |