resolved conflicts for merge of 2cb8d5eb to master

Change-Id: I3b1aec1aee7c6bfcee2e978b4755b2bae9e480c4
This commit is contained in:
Doug Zongker 2010-09-16 12:38:40 -07:00
commit f127eb709b
4 changed files with 31 additions and 36 deletions

View File

@ -1058,8 +1058,8 @@ endif
ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
$(hide) echo "userdata_size=$(call image-size-from-data-size,$(BOARD_USERDATAIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/misc_info.txt
endif
ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
$(hide) echo "fs_type=ext4" >> $(zip_root)/META/misc_info.txt
ifneq (,$(INTERNAL_USERIMAGES_EXT_VARIANT))
$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(zip_root)/META/misc_info.txt
$(hide) echo "partition_type=EMMC" >> $(zip_root)/META/misc_info.txt
@# TODO: where is the right place to get this path from? BoardConfig.mk?
$(hide) echo "partition_path=/dev/block/platform/sdhci-tegra.3/by-name/" >> $(zip_root)/META/misc_info.txt
@ -1264,7 +1264,6 @@ $(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS)
$(hide) ./build/tools/releasetools/img_from_target_files -v \
-s $(extensions) \
-p $(HOST_OUT) \
$(addprefix --fs_type ,$(INTERNAL_USERIMAGES_EXT_VARIANT)) \
$(BUILT_TARGET_FILES_PACKAGE) $@
.PHONY: updatepackage

View File

@ -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:
@ -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)

View File

@ -23,11 +23,6 @@ Usage: img_from_target_files [flags] input_target_files output_image_zip
-b (--board_config) <file>
Deprecated.
-f (--fs_type) <value>
The file system type of the user image files to be created.
It can be ext fs variants, such as ext2, ext3, ext4, etc.
Default is yaffs.
"""
import sys
@ -52,11 +47,6 @@ import common
OPTIONS = common.OPTIONS
class UserImageOptions(object): pass
USERIMAGE_OPTIONS = UserImageOptions()
USERIMAGE_OPTIONS.fs_type = None
def AddUserdata(output_zip):
"""Create an empty userdata image and store it in output_zip."""
@ -71,9 +61,9 @@ def AddUserdata(output_zip):
img = tempfile.NamedTemporaryFile()
build_command = []
if USERIMAGE_OPTIONS.fs_type is not None and USERIMAGE_OPTIONS.fs_type.startswith("ext"):
if OPTIONS.info_dict.get("fs_type", "").startswith("ext"):
build_command = ["mkuserimg.sh",
user_dir, img.name, USERIMAGE_OPTIONS.fs_type, "userdata"]
user_dir, img.name, OPTIONS.info_dict["fs_type"], "userdata"]
if "userdata.img" in OPTIONS.max_image_size:
build_command.append(str(OPTIONS.max_image_size["userdata.img"]))
else:
@ -87,8 +77,7 @@ def AddUserdata(output_zip):
p.communicate()
assert p.returncode == 0, "build userdata.img image failed"
if USERIMAGE_OPTIONS.fs_type is None or not USERIMAGE_OPTIONS.fs_type.startswith("ext"):
common.CheckSize(img.name, "userdata.img")
common.CheckSize(img.name, "userdata.img")
output_zip.write(img.name, "userdata.img")
img.close()
os.rmdir(user_dir)
@ -118,10 +107,10 @@ def AddSystem(output_zip):
pass
build_command = []
if USERIMAGE_OPTIONS.fs_type is not None and USERIMAGE_OPTIONS.fs_type.startswith("ext"):
if OPTIONS.info_dict.get("fs_type", "").startswith("ext"):
build_command = ["mkuserimg.sh",
os.path.join(OPTIONS.input_tmp, "system"), img.name,
USERIMAGE_OPTIONS.fs_type, "system"]
OPTIONS.info_dict["fs_type"], "system"]
if "system.img" in OPTIONS.max_image_size:
build_command.append(str(OPTIONS.max_image_size["system.img"]))
else:
@ -139,8 +128,7 @@ def AddSystem(output_zip):
data = img.read()
img.close()
if USERIMAGE_OPTIONS.fs_type is None or not USERIMAGE_OPTIONS.fs_type.startswith("ext"):
common.CheckSize(data, "system.img")
common.CheckSize(data, "system.img")
common.ZipWriteStr(output_zip, "system.img", data)
@ -155,15 +143,13 @@ def main(argv):
def option_handler(o, a):
if o in ("-b", "--board_config"):
pass # deprecated
elif o in ("-f", "--fs_type"):
USERIMAGE_OPTIONS.fs_type = a
else:
return False
return True
args = common.ParseOptions(argv, __doc__,
extra_opts="b:f:",
extra_long_opts=["board_config=", "fs_type="],
extra_opts="b:",
extra_long_opts=["board_config="],
extra_option_handler=option_handler)
if len(args) != 2:
@ -172,8 +158,8 @@ def main(argv):
OPTIONS.input_tmp = common.UnzipTemp(args[0])
info = common.LoadInfoDict()
common.LoadMaxSizes(info)
OPTIONS.info_dict = common.LoadInfoDict()
common.LoadMaxSizes(OPTIONS.info_dict)
if not OPTIONS.max_image_size:
print
print " WARNING: Failed to load max image sizes; will not enforce"

View File

@ -350,11 +350,11 @@ fi
return Item.Get("system/etc/install-recovery.sh", dir=False)
def WriteFullOTAPackage(input_zip, output_zip, info):
def WriteFullOTAPackage(input_zip, output_zip):
# TODO: how to determine this? We don't know what version it will
# be installed on top of. For now, we expect the API just won't
# change very often.
script = edify_generator.EdifyGenerator(3, info)
script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict)
metadata = {"post-build": GetBuildProp("ro.build.fingerprint", input_zip),
"pre-device": GetBuildProp("ro.product.device", input_zip),
@ -473,7 +473,7 @@ def GetRecoveryAPIVersion(zip):
return 0
def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip, info):
def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
source_version = GetRecoveryAPIVersion(source_zip)
target_version = GetRecoveryAPIVersion(target_zip)
partition_type = info["partition_type"]
@ -482,7 +482,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip, info):
if source_version == 0:
print ("WARNING: generating edify script for a source that "
"can't install it.")
script = edify_generator.EdifyGenerator(source_version, info)
script = edify_generator.EdifyGenerator(source_version, OPTIONS.info_dict)
metadata = {"pre-device": GetBuildProp("ro.product.device", source_zip),
"post-timestamp": GetBuildProp("ro.build.date.utc", target_zip),
@ -795,8 +795,8 @@ def main(argv):
else:
raise
info = common.LoadInfoDict()
common.LoadMaxSizes(info)
OPTIONS.info_dict = common.LoadInfoDict()
common.LoadMaxSizes(OPTIONS.info_dict)
if not OPTIONS.max_image_size:
print
print " WARNING: Failed to load max image sizes; will not enforce"
@ -814,12 +814,12 @@ def main(argv):
compression=zipfile.ZIP_DEFLATED)
if OPTIONS.incremental_source is None:
WriteFullOTAPackage(input_zip, output_zip, info)
WriteFullOTAPackage(input_zip, output_zip)
else:
print "unzipping source target-files..."
OPTIONS.source_tmp = common.UnzipTemp(OPTIONS.incremental_source)
source_zip = zipfile.ZipFile(OPTIONS.incremental_source, "r")
WriteIncrementalOTAPackage(input_zip, source_zip, output_zip, info)
WriteIncrementalOTAPackage(input_zip, source_zip, output_zip)
output_zip.close()
if OPTIONS.package_key: