store user-visible image sizes in target-files
Do the yaffs-specific adjustments to image sizes in common.CheckSize, instead of baking it into the image size stored in the target-files package. Remove the special fs_type flag and fold it into the "info_dict" we have for saving key-value pairs from the build system. Change-Id: I6e63f3330f6277d9a946b22e66cadeb51203ba14
This commit is contained in:
@@ -41,6 +41,7 @@ OPTIONS.tempfiles = []
|
||||
OPTIONS.device_specific = None
|
||||
OPTIONS.extras = {}
|
||||
OPTIONS.mkyaffs2_extra_flags = None
|
||||
OPTIONS.info_dict = None
|
||||
|
||||
|
||||
# Values for "certificate" in apkcerts that mean special things.
|
||||
@@ -85,7 +86,7 @@ def LoadInfoDict():
|
||||
def LoadMaxSizes(info):
|
||||
"""Load the maximum allowable images sizes from the input
|
||||
target_files. Uses the imagesizes.txt file if it's available
|
||||
(pre-honeycomb target_files), or the more general info dict (which
|
||||
(pre-gingerbread target_files), or the more general info dict (which
|
||||
must be passed in) if not."""
|
||||
OPTIONS.max_image_size = {}
|
||||
try:
|
||||
@@ -98,7 +99,7 @@ def LoadMaxSizes(info):
|
||||
except IOError, e:
|
||||
if e.errno == errno.ENOENT:
|
||||
def copy(x, y):
|
||||
if x in info: OPTIONS.max_image_size[x+".img"] = int(info[x+y])
|
||||
if x+y in info: OPTIONS.max_image_size[x+".img"] = int(info[x+y])
|
||||
copy("blocksize", "")
|
||||
copy("boot", "_size")
|
||||
copy("recovery", "_size")
|
||||
@@ -297,9 +298,18 @@ def CheckSize(data, target):
|
||||
"""Check the data string passed against the max size limit, if
|
||||
any, for the given target. Raise exception if the data is too big.
|
||||
Print a warning if the data is nearing the maximum size."""
|
||||
|
||||
fs_type = OPTIONS.info_dict.get("fs_type", None)
|
||||
if not fs_type: return
|
||||
|
||||
limit = OPTIONS.max_image_size.get(target, None)
|
||||
if limit is None: return
|
||||
|
||||
if fs_type == "yaffs2":
|
||||
# image size should be increased by 1/64th to account for the
|
||||
# spare area (64 bytes per 2k page)
|
||||
limit = limit / 2048 * (2048+64)
|
||||
|
||||
size = len(data)
|
||||
pct = float(size) * 100.0 / limit
|
||||
msg = "%s size (%d) is %.2f%% of limit (%d)" % (target, size, pct, limit)
|
||||
|
Reference in New Issue
Block a user