summaryrefslogtreecommitdiffstats
path: root/tools/releasetools/add_img_to_target_files.py
diff options
context:
space:
mode:
authorBrint E. Kriebel <bekit@cyngn.com>2015-08-06 13:21:29 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-11-07 01:20:47 -0800
commit121ca4946a5f3ef1a8da3a5c2bdb2a852dd6a0ce (patch)
tree25e8d6e1a828ba5155d4f51dd941b33f21091cc1 /tools/releasetools/add_img_to_target_files.py
parente964714a06c158b41f90e49c025607fa9455c781 (diff)
downloadbuild-121ca4946a5f3ef1a8da3a5c2bdb2a852dd6a0ce.zip
build-121ca4946a5f3ef1a8da3a5c2bdb2a852dd6a0ce.tar.gz
build-121ca4946a5f3ef1a8da3a5c2bdb2a852dd6a0ce.tar.bz2
build: Fix extra userdata generation
Image generation has been combined into the target file script and requires the prefix parameter to work properly. This also needs to be called properly when creating fastboot packages. Change-Id: I1f716cc375ffe401d5f18487330fc9bb809ff3b4 Ticket: OPO-191 build: Fix extra userdata generation some more Use the prefix variable when placing the file in the target files package. Change-Id: Ia4b795416b58c493c3ea91b964e3b6f4cdf0fef1 Ticket: OPO-191
Diffstat (limited to 'tools/releasetools/add_img_to_target_files.py')
-rwxr-xr-xtools/releasetools/add_img_to_target_files.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index e8d61ad..dc8307c 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -194,18 +194,29 @@ def AddUserdata(output_zip, prefix="IMAGES/"):
os.rmdir(temp_dir)
-def AddUserdataExtra(output_zip):
+def AddUserdataExtra(output_zip, prefix="IMAGES/"):
"""Create extra userdata image and store it in output_zip."""
image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict,
"data_extra")
- # If no userdataextra_size is provided for extfs, skip userdata_extra.img.
- if (image_props.get("fs_type", "").startswith("ext") and
- not image_props.get("partition_size")):
+
+ # The build system has to explicitly request extra userdata.
+ if "fs_type" not in image_props:
return
extra_name = image_props.get("partition_name", "extra")
+ prebuilt_path = os.path.join(OPTIONS.input_tmp, prefix, "userdata_%s.img" % extra_name)
+ if os.path.exists(prebuilt_path):
+ print "userdata_%s.img already exists in %s, no need to rebuild..." % (extra_name, prefix,)
+ return
+
+ # We only allow yaffs to have a 0/missing partition_size.
+ # Extfs, f2fs must have a size. Skip userdata_extra.img if no size.
+ if (not image_props.get("fs_type", "").startswith("yaffs") and
+ not image_props.get("partition_size")):
+ return
+
print "creating userdata_%s.img..." % extra_name
# The name of the directory it is making an image out of matters to
@@ -224,7 +235,7 @@ def AddUserdataExtra(output_zip):
# Disable size check since this fetches original data partition size
#common.CheckSize(img.name, "userdata_extra.img", OPTIONS.info_dict)
- output_zip.write(img.name, "userdata_%s.img" % extra_name)
+ output_zip.write(img.name, prefix + "userdata_%s.img" % extra_name)
img.close()
os.rmdir(user_dir)
os.rmdir(temp_dir)