首页 技术 正文
技术 2022年11月10日
0 收藏 848 点赞 4,887 浏览 2815 个字

android 8.1上面验证,支持所有的android版本,直接放到sdk中执行即可。 img2sdat.py#!/usr/bin/env python#coding=utf-8 import sys if sys.hexversion < 0x02070000:  print >> sys.stderr, “Python 2.7 or newer is required.”  sys.exit(1) from hashlib import sha1 as sha1 import commonimport sparse_img OPTIONS = common.OPTIONS try:    PARTITION_NAME = str(sys.argv[1])    SYSTEM_IMG = str(sys.argv[2])    OUTPUT_DIR = str(sys.argv[3])    OPTIONS.outpath = OUTPUT_DIRexcept IndexError:    print(‘\nUsage: img2sdat.py <partiton_name> <system_img> <system_new_dir>\n’)    print(‘  eg:   img2sdat.py system system.img system_new\n’)    print(‘        <partiton_name>: input partition name’)    print(‘        <img_name>: input image name’)    print(‘        <new_dir>: image new dat dir’)    print(‘        Visit xda thread for more information.\n’)    try:       input = raw_input    except NameError: pass    input(‘Press ENTER to exit…’)    sys.exit()  def main(argv):    system_tgt = sparse_img.SparseImage(SYSTEM_IMG);  system_tgt.ResetFileMap()  system_diff = common.BlockDifference(PARTITION_NAME, system_tgt, src=None, check_first_block=False, version=4)  if __name__ == ‘__main__’:    main(sys.argv[1:])  目前transfer.list已经最新的支持version=4, system.transfer.list版本进化,这里针对不同的android版本,传入不同的version=1/2/3/4即可 对common.py打patchdiff –git a/tools/releasetools/common.py b/tools/releasetools/common.pyindex 22d95a9..4b981e3 100644— a/tools/releasetools/common.py+++ b/tools/releasetools/common.py@@ -1406,6 +1406,12 @@ class BlockDifference(object):     b = blockimgdiff.BlockImageDiff(tgt, src, threads=OPTIONS.worker_threads,                                     version=self.version,                                     disable_imgdiff=self.disable_imgdiff)++    self.path = os.path.join(OPTIONS.outpath, partition)+    print (self.path)+    b.Compute(self.path)+    return+     tmpdir = tempfile.mkdtemp()     OPTIONS.tempfiles.append(tmpdir)     self.path = os.path.join(tmpdir, partition) 然后即可在android的根目录下面执行如下命令:./build/tools/releasetools/img2sdat.py  system out/target/product/xxxx/system.img out/target/product/xxxx/sdat/Total of 475136 4096-byte output blocks in 2302 input chunks.Finding transfers…Generating digraph…Finding vertex sequence…Reversing backward edges…  0/0 dependencies (0.00%) were violated; 0 source blocks stashed.Improving vertex order…Reticulating splines…940847104  940847104 (100.00%)     new __DATA 0-32765 32768-32769 32889-32890 65536-65537 66033-98301 98304-98305 98425-98426 98922-131070 131072-131073 131569-151714 163840-163841 163961-163962 164458-196605 196608-196609 229376-229377 229497-229498 229994-262141 262144-262145 294912-294913 295033-295034 295530-327677 327680-327681 360448-360449 393216-393217 425984-425985 458752-458753 459249-475135max stashed blocks: 0  (0 bytes), limit: <unknown> 即可在目录out/target/product/xxxx/sdat看到有system.new.dat与system.transfer.list文件生成。system.img镜像转换为system.new.dat + system.transfer.list命令格式: img2sdat.py 分区名  img路径   new.dat路径

eg:img2sdat.py  system  system.img  system_out_dir

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,495
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,909
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,741
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,496
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,134
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,298