diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index ceadcb3..9a535cb 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -264,21 +264,20 @@ def BuildBootableImage(sourcedir, fs_config_file, info_dict=None): data, or None if sourcedir does not appear to contains files for building the requested image.""" - if (((not os.access(os.path.join(sourcedir, "RAMDISK"), os.F_OK)) or - not os.access(os.path.join(sourcedir, "ramdisk.img"), os.F_OK)) or + if (not os.access(os.path.join(sourcedir, "RAMDISK"), os.F_OK) or not os.access(os.path.join(sourcedir, "kernel"), os.F_OK)): return None if info_dict is None: info_dict = OPTIONS.info_dict + ramdisk_img = tempfile.NamedTemporaryFile() img = tempfile.NamedTemporaryFile() # prefer the pre-built ramdisk, otherwise build a new from RAMDISK if os.access(os.path.join(sourcedir, "ramdisk.img"), os.F_OK): ramdisk = os.path.join(sourcedir, "ramdisk.img") else: - ramdisk_img = tempfile.NamedTemporaryFile() ramdisk = ramdisk_img.name if os.access(fs_config_file, os.F_OK): @@ -293,7 +292,8 @@ def BuildBootableImage(sourcedir, fs_config_file, info_dict=None): p1.wait() assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (targetname,) assert p2.returncode == 0, "minigzip of %s ramdisk failed" % (targetname,) - ramdisk_img.close() + + print ">> BuildBootableImage::ramdisk == %s" % (ramdisk_img.name,) cmd = ["mkbootimg", "--kernel", os.path.join(sourcedir, "kernel")] @@ -327,6 +327,7 @@ def BuildBootableImage(sourcedir, fs_config_file, info_dict=None): img.seek(os.SEEK_SET, 0) data = img.read() + ramdisk_img.close() img.close() return data diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files index aa23261..c75b5a8 100755 --- a/tools/releasetools/ota_from_target_files +++ b/tools/releasetools/ota_from_target_files @@ -857,8 +857,7 @@ def main(argv): # is in the out/ directory tree, but for repacking from target-files.zip it's # in the root directory of the ramdisk. if "selinux_fc" in OPTIONS.info_dict: - OPTIONS.info_dict["selinux_fc"] = os.path.join(OPTIONS.input_tmp, "BOOT", "RAMDISK", - "file_contexts") + OPTIONS.info_dict["selinux_fc"] = os.path.join(os.getenv('OUT'), "root", "file_contexts") if OPTIONS.verbose: print "--- target info ---"