am b6153173: Merge change 9605 into donut

Merge commit 'b6153173952895441e55d0ff6be332bb7c7605e2'

* commit 'b6153173952895441e55d0ff6be332bb7c7605e2':
  use the max image sizes from the target files zip
This commit is contained in:
Android (Google) Code Review
2009-08-04 14:16:38 -07:00
committed by Android Git Automerger
3 changed files with 29 additions and 30 deletions

View File

@@ -47,18 +47,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):