zombah

releasetools variants

Oct 22nd, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.88 KB | None | 0 0
  1. ///////////////////////////////////////BN ENCORE//////////////////////////////////////////////////////
  2. def UnpackPackageFile(self, src, dst):
  3.       """Unpack a given file from the OTA package into the given
  4.      destination file."""
  5.       self.script.append('package_extract_file("%s", "%s");' % (src, dst))
  6.  
  7. def CopyBootFiles(input_zip, output_zip):
  8.     output_zip.writestr("MLO", input_zip.read("BOOT/bootloader"))
  9.     output_zip.writestr("u-boot.bin", input_zip.read("BOOT/second"))
  10.     output_zip.writestr("kernel", input_zip.read("BOOT/kernel"))
  11.     output_zip.writestr("ramdisk.img", input_zip.read("BOOT/ramdisk.img"))      
  12.      
  13.      
  14.   CopyBootFiles(input_zip, output_zip)
  15.      
  16. # This mimics how the official B&N updates work and seems pretty elegant to me
  17.   script.Mount("/boot")
  18.   script.UnpackPackageFile("MLO", "/boot/MLO")
  19.   script.UnpackPackageFile("u-boot.bin", "/boot/u-boot.bin")
  20.   script.UnpackPackageFile("kernel", "/boot/uImage")
  21.   script.UnpackPackageFile("ramdisk.img", "/boot/uRamdisk")
  22.    # -- encore build change done
  23.  
  24. ////////////////////////////////////////////HP TENDERLOIN//////////////////////////////////////////  
  25.  
  26. # -- tenderloin build change starting
  27.   #boot_img = common.File("boot.img", common.BuildBootableImage(
  28.   #    os.path.join(OPTIONS.input_tmp, "BOOT")))
  29.   #recovery_img = common.File("recovery.img", common.BuildBootableImage(
  30.   #    os.path.join(OPTIONS.input_tmp, "RECOVERY")))
  31.   #MakeRecoveryPatch(output_zip, recovery_img, boot_img)
  32.   # -- tenderloin build change done
  33.  
  34.   Item.GetMetadata(input_zip)
  35.   Item.Get("system").SetPermissions(script)
  36.  
  37.   # -- tenderloin build change starting
  38.   #common.CheckSize(boot_img.data, "boot.img", OPTIONS.info_dict)
  39.   #common.ZipWriteStr(output_zip, "boot.img", boot_img.data)
  40.   # -- tenderloin build change done
  41.   script.ShowProgress(0.2, 0)
  42.  
  43.   if OPTIONS.backuptool:
  44.     script.ShowProgress(0.2, 10)
  45.     script.RunBackup("restore")
  46.  
  47. #  script.RunVerifyCachePartitionSize()
  48.  
  49.   script.ShowProgress(0.2, 10)
  50.   # -- tenderloin build change starting
  51.   #script.WriteRawImage("/boot", "boot.img")
  52.  
  53.   boot_img = open(OPTIONS.device_out + "/boot.img", "r")
  54.   common.ZipWriteStr(output_zip, "boot.img", boot_img.read())
  55.   boot_img.close()
  56.  
  57.   script.Mount("/boot")
  58.   script.UnpackPackageFile("boot.img", "/boot/uImage.CyanogenMod")
  59.  
  60.   moboot_tga = open(OPTIONS.device_out + "/moboot.splash.CyanogenMod.tga")
  61.   common.ZipWriteStr(output_zip, "moboot.splash.CyanogenMod.tga", moboot_tga.read())
  62.   moboot_tga.close()
  63.  
  64.   script.UnpackPackageFile("moboot.splash.CyanogenMod.tga", "/boot/moboot.splash.CyanogenMod.tga")
  65.  
  66.   # -- tenderloin build change done
  67.  
  68. if __name__ == '__main__':
  69.   try:
  70.     # Ugly hacks are ugly
  71.     OPTIONS.device_out = os.path.dirname(sys.argv[-1])
  72.     main(sys.argv[1:])
  73.   except common.ExternalError, e:
  74.     print
  75.     print " ERROR: %s" % (e,)
  76.     print
  77.     sys.exit(1)
Advertisement
Add Comment
Please, Sign In to add comment