def __init__(self, partition, tgt, src=None, check_first_block=False): self.tgt = tgt self.src = src self.partition = partition self.check_first_block = check_first_block # Due to http://b/20939131, check_first_block is disabled temporarily. # Remove this assert and replace abort() by ui_print() #assert not self.check_first_block version = 1 if OPTIONS.info_dict: version = max( int(i) for i in OPTIONS.info_dict.get("blockimgdiff_versions", "1").split(",")) b = blockimgdiff.BlockImageDiff(tgt, src, threads=OPTIONS.worker_threads, version=version) tmpdir = tempfile.mkdtemp() OPTIONS.tempfiles.append(tmpdir) self.path = os.path.join(tmpdir, partition) b.Compute(self.path) #wschen #_, self.device = GetTypeAndDevice("/" + partition, OPTIONS.info_dict) self.device = partition
def __init__(self, partition, tgt, src=None, check_first_block=False, use_lzma=False): self.tgt = tgt self.src = src self.partition = partition self.check_first_block = check_first_block self.use_lzma = use_lzma version = 1 if OPTIONS.info_dict: version = max( int(i) for i in OPTIONS.info_dict.get("blockimgdiff_versions", "1").split(",")) b = blockimgdiff.BlockImageDiff(tgt, src, threads=OPTIONS.worker_threads, version=version, use_lzma=use_lzma) tmpdir = tempfile.mkdtemp() OPTIONS.tempfiles.append(tmpdir) self.path = os.path.join(tmpdir, partition) b.Compute(self.path) _, self.device = GetTypeAndDevice("/" + partition, OPTIONS.info_dict)
def __init__(self, partition, tgt, src=None, check_first_block=False, version=None): self.tgt = tgt self.src = src self.partition = partition self.check_first_block = check_first_block # Due to http://b/20939131, check_first_block is disabled temporarily. assert not self.check_first_block if version is None: version = 1 if OPTIONS.info_dict: version = max( int(i) for i in OPTIONS.info_dict.get("blockimgdiff_versions", "1").split(",")) self.version = version b = blockimgdiff.BlockImageDiff(tgt, src, threads=OPTIONS.worker_threads, version=self.version) tmpdir = tempfile.mkdtemp() OPTIONS.tempfiles.append(tmpdir) self.path = os.path.join(tmpdir, partition) b.Compute(self.path) if src is None: _, self.device = GetTypeAndDevice("/" + partition, OPTIONS.info_dict) else: _, self.device = GetTypeAndDevice("/" + partition, OPTIONS.source_info_dict)
def main(INPUT_IMAGE, OUTDIR='.', VERSION=None, PREFIX='system'): global input __version__ = '1.7' if sys.hexversion < 0x02070000: print >> sys.stderr, "Python 2.7 or newer is required." try: input = raw_input except NameError: pass input('Press ENTER to exit...') sys.exit(1) else: print('img2sdat binary - version: %s\n' % __version__) if not os.path.isdir(OUTDIR): os.makedirs(OUTDIR) OUTDIR = OUTDIR + '/' + PREFIX if not VERSION: VERSION = 4 while True: print(''' 1. Android Lollipop 5.0 2. Android Lollipop 5.1 3. Android Marshmallow 6.0 4. Android Nougat 7.0/7.1/8.0/8.1 ''') try: input = raw_input except NameError: pass item = input('Choose system version: ') if item == '1': VERSION = 1 break elif item == '2': VERSION = 2 break elif item == '3': VERSION = 3 break elif item == '4': VERSION = 4 break else: return # Get sparse image image = sparse_img.SparseImage(INPUT_IMAGE, tempfile.mkstemp()[1], '0') # Generate output files b = blockimgdiff.BlockImageDiff(image, None, VERSION) b.Compute(OUTDIR) print('Done! Output files: %s' % os.path.dirname(OUTDIR)) return
def main(argv): # Get sparse image input_image = sparse_img.SparseImage(INPUT_IMAGE, tempfile.mkstemp()[1], '0') # Generate output files b = blockimgdiff.BlockImageDiff(input_image, None) b.Compute('system') print('Done! Output files: %s' % os.path.dirname(__file__)) return
def __init__(self, partition, tgt, src=None, check_first_block=False): self.tgt = tgt self.src = src self.partition = partition self.check_first_block = check_first_block b = blockimgdiff.BlockImageDiff(tgt, src, threads=OPTIONS.worker_threads) tmpdir = tempfile.mkdtemp() OPTIONS.tempfiles.append(tmpdir) self.path = os.path.join(tmpdir, partition) b.Compute(self.path) _, self.device = GetTypeAndDevice("/" + partition, OPTIONS.info_dict)
def main(argv): global input if len(sys.argv) < 3: outdir = './system' else: outdir = sys.argv[2] + '/system' if len(sys.argv) < 4: version = 4 item = True while item: print(''' 1. Android Lollipop 5.0 2. Android Lollipop 5.1 3. Android Marshmallow 6.0 4. Android Nougat 7.0/7.1/8.0 ''') try: input = raw_input except NameError: pass item = input('Choose system version: ') if item == '1': version = 1 break elif item == '2': version = 2 break elif item == '3': version = 3 break elif item == '4': version = 4 break else: return else: version = int(sys.argv[3]) # Get sparse image image = sparse_img.SparseImage(INPUT_IMAGE, tempfile.mkstemp()[1], '0') # Generate output files b = blockimgdiff.BlockImageDiff(image, None, version) b.Compute(outdir) print('Done! Output files: %s' % os.path.dirname(outdir)) return
def main(argv): if len(sys.argv) < 3: version = 4 item = True while item: print(''' 1. Android Lollipop 5.0 2. Android Lollipop 5.1 3. Android Marshmallow 6.0 4. Android Nougat 7.0 ''') item = raw_input('Choose system version: ') if item == '1': version = 1 break elif item == '2': version = 2 break elif item == '3': version = 3 break elif item == '4': version = 4 break else: return else: version = int(sys.argv[2]) # Get sparse image image = sparse_img.SparseImage(INPUT_IMAGE, tempfile.mkstemp()[1], '0') # Generate output files b = blockimgdiff.BlockImageDiff(image, None, version) b.Compute('system') print('Done! Output files: %s' % os.path.dirname(__file__)) return
def main(sysimg, outdir): tgt = sparse_img.SparseImage(sysimg) bif = blockimgdiff.BlockImageDiff(tgt, None) bif.Compute(outdir) return