resolved conflicts for merge of 2cb8d5eb
to master
Change-Id: I3b1aec1aee7c6bfcee2e978b4755b2bae9e480c4
This commit is contained in:
commit
f127eb709b
|
@ -1058,8 +1058,8 @@ endif
|
||||||
ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
|
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
|
$(hide) echo "userdata_size=$(call image-size-from-data-size,$(BOARD_USERDATAIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/misc_info.txt
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
|
ifneq (,$(INTERNAL_USERIMAGES_EXT_VARIANT))
|
||||||
$(hide) echo "fs_type=ext4" >> $(zip_root)/META/misc_info.txt
|
$(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
|
$(hide) echo "partition_type=EMMC" >> $(zip_root)/META/misc_info.txt
|
||||||
@# TODO: where is the right place to get this path from? BoardConfig.mk?
|
@# 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
|
$(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 \
|
$(hide) ./build/tools/releasetools/img_from_target_files -v \
|
||||||
-s $(extensions) \
|
-s $(extensions) \
|
||||||
-p $(HOST_OUT) \
|
-p $(HOST_OUT) \
|
||||||
$(addprefix --fs_type ,$(INTERNAL_USERIMAGES_EXT_VARIANT)) \
|
|
||||||
$(BUILT_TARGET_FILES_PACKAGE) $@
|
$(BUILT_TARGET_FILES_PACKAGE) $@
|
||||||
|
|
||||||
.PHONY: updatepackage
|
.PHONY: updatepackage
|
||||||
|
|
|
@ -41,6 +41,7 @@ OPTIONS.tempfiles = []
|
||||||
OPTIONS.device_specific = None
|
OPTIONS.device_specific = None
|
||||||
OPTIONS.extras = {}
|
OPTIONS.extras = {}
|
||||||
OPTIONS.mkyaffs2_extra_flags = None
|
OPTIONS.mkyaffs2_extra_flags = None
|
||||||
|
OPTIONS.info_dict = None
|
||||||
|
|
||||||
|
|
||||||
# Values for "certificate" in apkcerts that mean special things.
|
# Values for "certificate" in apkcerts that mean special things.
|
||||||
|
@ -85,7 +86,7 @@ def LoadInfoDict():
|
||||||
def LoadMaxSizes(info):
|
def LoadMaxSizes(info):
|
||||||
"""Load the maximum allowable images sizes from the input
|
"""Load the maximum allowable images sizes from the input
|
||||||
target_files. Uses the imagesizes.txt file if it's available
|
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."""
|
must be passed in) if not."""
|
||||||
OPTIONS.max_image_size = {}
|
OPTIONS.max_image_size = {}
|
||||||
try:
|
try:
|
||||||
|
@ -297,9 +298,18 @@ def CheckSize(data, target):
|
||||||
"""Check the data string passed against the max size limit, if
|
"""Check the data string passed against the max size limit, if
|
||||||
any, for the given target. Raise exception if the data is too big.
|
any, for the given target. Raise exception if the data is too big.
|
||||||
Print a warning if the data is nearing the maximum size."""
|
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)
|
limit = OPTIONS.max_image_size.get(target, None)
|
||||||
if limit is None: return
|
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)
|
size = len(data)
|
||||||
pct = float(size) * 100.0 / limit
|
pct = float(size) * 100.0 / limit
|
||||||
msg = "%s size (%d) is %.2f%% of limit (%d)" % (target, size, pct, limit)
|
msg = "%s size (%d) is %.2f%% of limit (%d)" % (target, size, pct, limit)
|
||||||
|
|
|
@ -23,11 +23,6 @@ Usage: img_from_target_files [flags] input_target_files output_image_zip
|
||||||
-b (--board_config) <file>
|
-b (--board_config) <file>
|
||||||
Deprecated.
|
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
|
import sys
|
||||||
|
@ -52,11 +47,6 @@ import common
|
||||||
|
|
||||||
OPTIONS = common.OPTIONS
|
OPTIONS = common.OPTIONS
|
||||||
|
|
||||||
class UserImageOptions(object): pass
|
|
||||||
USERIMAGE_OPTIONS = UserImageOptions()
|
|
||||||
USERIMAGE_OPTIONS.fs_type = None
|
|
||||||
|
|
||||||
|
|
||||||
def AddUserdata(output_zip):
|
def AddUserdata(output_zip):
|
||||||
"""Create an empty userdata image and store it in output_zip."""
|
"""Create an empty userdata image and store it in output_zip."""
|
||||||
|
|
||||||
|
@ -71,9 +61,9 @@ def AddUserdata(output_zip):
|
||||||
img = tempfile.NamedTemporaryFile()
|
img = tempfile.NamedTemporaryFile()
|
||||||
|
|
||||||
build_command = []
|
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",
|
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:
|
if "userdata.img" in OPTIONS.max_image_size:
|
||||||
build_command.append(str(OPTIONS.max_image_size["userdata.img"]))
|
build_command.append(str(OPTIONS.max_image_size["userdata.img"]))
|
||||||
else:
|
else:
|
||||||
|
@ -87,7 +77,6 @@ def AddUserdata(output_zip):
|
||||||
p.communicate()
|
p.communicate()
|
||||||
assert p.returncode == 0, "build userdata.img image failed"
|
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")
|
output_zip.write(img.name, "userdata.img")
|
||||||
img.close()
|
img.close()
|
||||||
|
@ -118,10 +107,10 @@ def AddSystem(output_zip):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
build_command = []
|
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",
|
build_command = ["mkuserimg.sh",
|
||||||
os.path.join(OPTIONS.input_tmp, "system"), img.name,
|
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:
|
if "system.img" in OPTIONS.max_image_size:
|
||||||
build_command.append(str(OPTIONS.max_image_size["system.img"]))
|
build_command.append(str(OPTIONS.max_image_size["system.img"]))
|
||||||
else:
|
else:
|
||||||
|
@ -139,7 +128,6 @@ def AddSystem(output_zip):
|
||||||
data = img.read()
|
data = img.read()
|
||||||
img.close()
|
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)
|
common.ZipWriteStr(output_zip, "system.img", data)
|
||||||
|
|
||||||
|
@ -155,15 +143,13 @@ def main(argv):
|
||||||
def option_handler(o, a):
|
def option_handler(o, a):
|
||||||
if o in ("-b", "--board_config"):
|
if o in ("-b", "--board_config"):
|
||||||
pass # deprecated
|
pass # deprecated
|
||||||
elif o in ("-f", "--fs_type"):
|
|
||||||
USERIMAGE_OPTIONS.fs_type = a
|
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
args = common.ParseOptions(argv, __doc__,
|
args = common.ParseOptions(argv, __doc__,
|
||||||
extra_opts="b:f:",
|
extra_opts="b:",
|
||||||
extra_long_opts=["board_config=", "fs_type="],
|
extra_long_opts=["board_config="],
|
||||||
extra_option_handler=option_handler)
|
extra_option_handler=option_handler)
|
||||||
|
|
||||||
if len(args) != 2:
|
if len(args) != 2:
|
||||||
|
@ -172,8 +158,8 @@ def main(argv):
|
||||||
|
|
||||||
OPTIONS.input_tmp = common.UnzipTemp(args[0])
|
OPTIONS.input_tmp = common.UnzipTemp(args[0])
|
||||||
|
|
||||||
info = common.LoadInfoDict()
|
OPTIONS.info_dict = common.LoadInfoDict()
|
||||||
common.LoadMaxSizes(info)
|
common.LoadMaxSizes(OPTIONS.info_dict)
|
||||||
if not OPTIONS.max_image_size:
|
if not OPTIONS.max_image_size:
|
||||||
print
|
print
|
||||||
print " WARNING: Failed to load max image sizes; will not enforce"
|
print " WARNING: Failed to load max image sizes; will not enforce"
|
||||||
|
|
|
@ -350,11 +350,11 @@ fi
|
||||||
return Item.Get("system/etc/install-recovery.sh", dir=False)
|
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
|
# 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
|
# be installed on top of. For now, we expect the API just won't
|
||||||
# change very often.
|
# 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),
|
metadata = {"post-build": GetBuildProp("ro.build.fingerprint", input_zip),
|
||||||
"pre-device": GetBuildProp("ro.product.device", input_zip),
|
"pre-device": GetBuildProp("ro.product.device", input_zip),
|
||||||
|
@ -473,7 +473,7 @@ def GetRecoveryAPIVersion(zip):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip, info):
|
def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
||||||
source_version = GetRecoveryAPIVersion(source_zip)
|
source_version = GetRecoveryAPIVersion(source_zip)
|
||||||
target_version = GetRecoveryAPIVersion(target_zip)
|
target_version = GetRecoveryAPIVersion(target_zip)
|
||||||
partition_type = info["partition_type"]
|
partition_type = info["partition_type"]
|
||||||
|
@ -482,7 +482,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip, info):
|
||||||
if source_version == 0:
|
if source_version == 0:
|
||||||
print ("WARNING: generating edify script for a source that "
|
print ("WARNING: generating edify script for a source that "
|
||||||
"can't install it.")
|
"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),
|
metadata = {"pre-device": GetBuildProp("ro.product.device", source_zip),
|
||||||
"post-timestamp": GetBuildProp("ro.build.date.utc", target_zip),
|
"post-timestamp": GetBuildProp("ro.build.date.utc", target_zip),
|
||||||
|
@ -795,8 +795,8 @@ def main(argv):
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
info = common.LoadInfoDict()
|
OPTIONS.info_dict = common.LoadInfoDict()
|
||||||
common.LoadMaxSizes(info)
|
common.LoadMaxSizes(OPTIONS.info_dict)
|
||||||
if not OPTIONS.max_image_size:
|
if not OPTIONS.max_image_size:
|
||||||
print
|
print
|
||||||
print " WARNING: Failed to load max image sizes; will not enforce"
|
print " WARNING: Failed to load max image sizes; will not enforce"
|
||||||
|
@ -814,12 +814,12 @@ def main(argv):
|
||||||
compression=zipfile.ZIP_DEFLATED)
|
compression=zipfile.ZIP_DEFLATED)
|
||||||
|
|
||||||
if OPTIONS.incremental_source is None:
|
if OPTIONS.incremental_source is None:
|
||||||
WriteFullOTAPackage(input_zip, output_zip, info)
|
WriteFullOTAPackage(input_zip, output_zip)
|
||||||
else:
|
else:
|
||||||
print "unzipping source target-files..."
|
print "unzipping source target-files..."
|
||||||
OPTIONS.source_tmp = common.UnzipTemp(OPTIONS.incremental_source)
|
OPTIONS.source_tmp = common.UnzipTemp(OPTIONS.incremental_source)
|
||||||
source_zip = zipfile.ZipFile(OPTIONS.incremental_source, "r")
|
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()
|
output_zip.close()
|
||||||
if OPTIONS.package_key:
|
if OPTIONS.package_key:
|
||||||
|
|
Loading…
Reference in New Issue