summaryrefslogtreecommitdiffstats
path: root/tools/releasetools/common.py
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2010-07-01 15:30:11 -0700
committerDoug Zongker <dougz@android.com>2010-09-16 11:34:31 -0700
commitc19a8d5590a4ffd42b37ceaca2d779b48e481f99 (patch)
treecd97cf63cbb3b518416d610c8b112164aa128dd9 /tools/releasetools/common.py
parent671f5fb09f3510c16f73049cad9d8d6d652eaad8 (diff)
downloadbuild-c19a8d5590a4ffd42b37ceaca2d779b48e481f99.zip
build-c19a8d5590a4ffd42b37ceaca2d779b48e481f99.tar.gz
build-c19a8d5590a4ffd42b37ceaca2d779b48e481f99.tar.bz2
support for ext4/EMMC in target_files and OTA generation
Move the image sizes into a more generic key-value file. Make them optional. Add additional key/value pairs describing what kind of filesystem the device uses. Pass new fs-type-related arguments in edify scripts when mounting and reformatting partitions. Don't include all the init.*.rc files from the regular system in recovery -- they aren't needed, and break recovery on some devices. Change-Id: Ic1c651f754ed00ba1cffe8cf56c43f7f3b0ebfd7
Diffstat (limited to 'tools/releasetools/common.py')
-rw-r--r--tools/releasetools/common.py40
1 files changed, 37 insertions, 3 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 46cef11..2a81133 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -58,9 +58,35 @@ def Run(args, **kwargs):
return subprocess.Popen(args, **kwargs)
-def LoadMaxSizes():
+def LoadInfoDict():
+ """Read and parse the META/misc_info.txt key/value pairs from the
+ input target files and return a dict."""
+
+ d = {}
+ try:
+ for line in open(os.path.join(OPTIONS.input_tmp, "META", "misc_info.txt")):
+ line = line.strip()
+ if not line or line.startswith("#"): continue
+ k, v = line.split("=", 1)
+ d[k] = v
+ except IOError, e:
+ if e.errno == errno.ENOENT:
+ # ok if misc_info.txt file doesn't exist
+ pass
+ else:
+ raise
+
+ if "fs_type" not in d: info["fs_type"] = "yaffs2"
+ if "partition_type" not in d: info["partition_type"] = "MTD"
+
+ return d
+
+
+def LoadMaxSizes(info):
"""Load the maximum allowable images sizes from the input
- target_files size."""
+ target_files. Uses the imagesizes.txt file if it's available
+ (pre-honeycomb target_files), or the more general info dict (which
+ must be passed in) if not."""
OPTIONS.max_image_size = {}
try:
for line in open(os.path.join(OPTIONS.input_tmp, "META", "imagesizes.txt")):
@@ -71,7 +97,15 @@ def LoadMaxSizes():
OPTIONS.max_image_size[image + ".img"] = size
except IOError, e:
if e.errno == errno.ENOENT:
- pass
+ def copy(x, y):
+ if x in info: OPTIONS.max_image_size[x+".img"] = int(info[x+y])
+ copy("blocksize", "")
+ copy("boot", "_size")
+ copy("recovery", "_size")
+ copy("system", "_size")
+ copy("userdata", "_size")
+ else:
+ raise
def LoadMkyaffs2ExtraFlags():