summaryrefslogtreecommitdiffstats
path: root/tools/releasetools/common.py
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2009-08-03 17:27:48 -0700
committerDoug Zongker <dougz@android.com>2009-08-03 17:27:48 -0700
commitfdd8e69c42e66fb70384bcaca1747f504f2c021c (patch)
treeac9e4689e1657ef6a7791098de3cd2829aa63584 /tools/releasetools/common.py
parent7ebafd5aa03e9d84696be0448f9d248e8f90e16c (diff)
downloadbuild-fdd8e69c42e66fb70384bcaca1747f504f2c021c.zip
build-fdd8e69c42e66fb70384bcaca1747f504f2c021c.tar.gz
build-fdd8e69c42e66fb70384bcaca1747f504f2c021c.tar.bz2
use the max image sizes from the target files zip
For some time now the build system has included all the max image sizes in a file in the META directory. Use these instead of needing to parse the BoardConfig.mk file for the device at the time of building an image or OTA package.
Diffstat (limited to 'tools/releasetools/common.py')
-rw-r--r--tools/releasetools/common.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index a07ff7c..42a7742 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -46,18 +46,18 @@ def Run(args, **kwargs):
return subprocess.Popen(args, **kwargs)
-def LoadBoardConfig(fn):
- """Parse a board_config.mk file looking for lines that specify the
- maximum size of various images, and parse them into the
- OPTIONS.max_image_size dict."""
+def LoadMaxSizes():
+ """Load the maximum allowable images sizes from the input
+ target_files size."""
OPTIONS.max_image_size = {}
- for line in open(fn):
- line = line.strip()
- m = re.match(r"BOARD_(BOOT|RECOVERY|SYSTEM|USERDATA)IMAGE_MAX_SIZE"
- r"\s*:=\s*(\d+)", line)
- if not m: continue
-
- OPTIONS.max_image_size[m.group(1).lower() + ".img"] = int(m.group(2))
+ try:
+ for line in open(os.path.join(OPTIONS.input_tmp, "META", "imagesizes.txt")):
+ image, size = line.split()
+ size = int(size)
+ OPTIONS.max_image_size[image + ".img"] = size
+ except IOError, e:
+ if e.errno == errno.ENOENT:
+ pass
def BuildAndAddBootableImage(sourcedir, targetname, output_zip):