summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-02-15 01:50:45 +0100
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-02-15 01:50:45 +0100
commitafb08ef40c6a35226a94c5463ad55bb92a7e4ae2 (patch)
tree6295e83d252a12e102da8a18681dac73f1bd799a
parentcc9124177c841ccc1fccfdcfcf6d82fc57b4bb55 (diff)
downloaddevice_samsung_galaxys2-common-replicant-6.0-0001.zip
device_samsung_galaxys2-common-replicant-6.0-0001.tar.gz
device_samsung_galaxys2-common-replicant-6.0-0001.tar.bz2
releasetools: also rebuild the boot imagereplicant-6.0-0001
This ensures that the right release key is also embedded in the recovery that is part of the boot image. Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
-rwxr-xr-xreleasetools/galaxys2_sign_target_files_apks37
1 files changed, 19 insertions, 18 deletions
diff --git a/releasetools/galaxys2_sign_target_files_apks b/releasetools/galaxys2_sign_target_files_apks
index 8fd837b..c4fa719 100755
--- a/releasetools/galaxys2_sign_target_files_apks
+++ b/releasetools/galaxys2_sign_target_files_apks
@@ -36,18 +36,22 @@ __doc__ = sign_target_files_apks.__doc__
from common import File
-def RebuildRecovery(image_name, unpack_dir, fs_config_file):
- """Takes the modified recovery ramdisk and rebuilds the recovery
+def RebuildBootableImage(image_name, prebuilt_name, unpack_dir, tree_subdir):
+ """Takes the modified ramdisk and rebuilds the recovery or the boot
image"""
- recovery_ramdisk_dir = os.path.join(unpack_dir, "RECOVERY", "RAMDISK")
+ ramdisk_dir = os.path.join(unpack_dir, "RECOVERY", "RAMDISK")
ramdisk_cpio = os.path.join(TARGET_DIR, "ramdisk-recovery.cpio")
ramdisk_cpio_tmp = os.path.join(TARGET_DIR, "ramdisk-recovery.cpio.orig")
- recovery_kernel_dir = os.path.join(TARGET_DIR, "obj", "KERNEL_RECOVERY_OBJ")
- recovery_kernel_out = os.path.join(recovery_kernel_dir, "arch", "arm", "boot",
- "zImage")
+ if prebuilt_name == "recovery.img":
+ kernel_dir = os.path.join(TARGET_DIR, "obj", "KERNEL_RECOVERY_OBJ")
+ else:
+ kernel_dir = os.path.join(TARGET_DIR, "obj", "KERNEL_OBJ")
+
+ kernel_out = os.path.join(kernel_dir, "arch", "arm", "boot", "zImage")
+ fs_config_file = os.path.join(unpack_dir, "META", "recovery_filesystem_config.txt")
- print("Rebuilding the recovery image...")
+ print("Rebuilding the bootable image...")
# temporary move the original ramdisk, move it back later
if os.path.exists(ramdisk_cpio):
@@ -57,32 +61,27 @@ def RebuildRecovery(image_name, unpack_dir, fs_config_file):
raise OSError(2, 'No such file or directory', ramdisk_cpio)
ramdisk = open(ramdisk_cpio, "w")
- cmd = ["mkbootfs", "-f", fs_config_file, recovery_ramdisk_dir]
+ cmd = ["mkbootfs", "-f", fs_config_file, ramdisk_dir]
p = subprocess.call(cmd, stdout=ramdisk)
if p:
- raise ValueError("mkbootfs of %s failed" % recovery_ramdisk_dir)
+ raise ValueError("mkbootfs of %s failed" % ramdisk_dir)
cross_compile = os.getenv('ARM_EABI_TOOLCHAIN')
subprocess.call(["make", "-C", "kernel/samsung/smdk4412",
- "O=" + recovery_kernel_dir, "ARCH=arm",
+ "O=" + kernel_dir, "ARCH=arm",
"CROSS_COMPILE=" + cross_compile, "zImage"])
if p:
- raise ValueError("rebuilding recovery failed: " + str(p))
+ raise ValueError("rebuilding bootable image failed: " + str(p))
os.rename(ramdisk_cpio_tmp, ramdisk_cpio)
- return File.FromLocalFile(image_name, recovery_kernel_out)
+ return File.FromLocalFile(image_name, kernel_out)
def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir,
info_dict=None):
- if prebuilt_name == "recovery.img":
- fs_config = "META/" + tree_subdir.lower() + "_filesystem_config.txt"
- return RebuildRecovery(name, unpack_dir, os.path.join(unpack_dir,
- fs_config))
- else:
- return File.FromLocalFile(name, os.path.join(TARGET_DIR, prebuilt_name))
+ return RebuildBootableImage(name, prebuilt_name, unpack_dir, tree_subdir)
common.GetBootableImage = GetBootableImage
@@ -94,3 +93,5 @@ if __name__ == '__main__':
print(" ERROR: %s" % e)
print()
sys.exit(1)
+ finally:
+ common.Cleanup()