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 common
import 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_DIR
except 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打patch
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 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)
+    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-475135
max stashed blocks: 0  (0 bytes), limit: <unknown>
 
即可在目录out/target/product/xxxx/sdat看到有system.new.dat与system.transfer.list文件生成。
命令格式: img2sdat.py 分区名  img路径   new.dat路径

eg:img2sdat.py  system  system.img  system_out_dir

system.img镜像转换为system.new.dat + system.transfer.list的更多相关文章

  1. Android镜像文件ramdisk.img,system.img,userdata.img介绍

    Android 源码编译后,在out目录下生成的三个镜像文件:ramdisk.img,system.img,userdata.img以及它们对应的目录树root,system,data. ramdis ...

  2. NotSupportedException-无法将类型“System.DateTime”强制转换为类型“System.Object”

    几张图就可以说明一切 2015-03-29 21:54:09,206 [77] ERROR log - System.NotSupportedException: 无法将类型“System.DateT ...

  3. System.Data.Dbtype转换为System.Data.SqlDbType

    最近在做一些OM Mapping的准备工作,新学了一招. 如果要将System.Data.Dbtype转换为System.Data.SqlDbType,以前以为要写Switch Case语句.其实有很 ...

  4. 将System.Drawing.Bitmap转换为Direct2D.D2DBitmap

    最近在尝试Direct2D编程,挺好玩的. 但是有时候还是会用到GDI+来生成图片,但D2D绘图需要用到自己的D2DBitmap类. 因此需要转换,查阅了下网上的资料,写了这么一个方法: using ...

  5. C# 特性 System.ComponentModel 命名空间属性方法大全,System.ComponentModel 命名空间的特性

    目录: System.ComponentModel 特性命名空间与常用类 System.ComponentModel.DataAnnotations ComponentModel - Classes ...

  6. System.Security.SecurityException The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception

    [15/08/19 00:03:10] [DataManager-7292-ERROR] System.Reflection.TargetInvocationException: Exception ...

  7. BootStrap入门教程 (一) :手脚架Scaffolding(全局样式(Global Style),格网系统(Grid System),流式格网(Fluid grid System),自定义(Customing),布局(Layouts))

    2011年,twitter的“一小撮”工程师为了提高他们内部的分析和管理能力,用业余时间为他们的产品构建了一套易用.优雅.灵活.可扩展的前端工具集--BootStrap.Bootstrap由MARK ...

  8. 基类包括字段“ScriptManager1”,但其类型(System.Web.UI.ScriptManager)与控件(System.Web.UI.ScriptManager)的类型不兼容

    首先说下原先的情况,就是原本老项目的Web解决方案是使用.net framework 2.0的老版本, 所以机器也安装过Microsoft ASP.NET 2.0 AJAX Extensions..A ...

  9. java 标准输出与标准错误 out与 err 区别 用法 联系 java中的out与err区别 System.out和System.err的区别 System.out.println和System.err.println的区别 Java重定向System.out和System.err

    本文关键词: java 标准输出与标准错误    out与 err 区别 用法 联系  java中的out与err区别  System.out和System.err的区别 System.out.pri ...

随机推荐

  1. asp.net mvc 安全测试漏洞 "跨站点请求伪造" 问题解决

    IBM Security Appscan漏洞筛查-跨站请求伪造,该漏洞的产生,有多种情况: 1.WebApi的跨站请求伪造,需要对WebApi的请求头部做限制(此文不做详细介绍): 2.MVC Act ...

  2. LeetCode:145_Binary Tree Postorder Traversal | 二叉树后序遍历 | Hard

    题目:Binary Tree Postorder Traversal 二叉树的后序遍历,题目要求是采用非递归的方式,这个在上数据结构的课时已经很清楚了,二叉树的非递归遍历不管采用何种方式,都需要用到栈 ...

  3. win10 + gluon + GPU

    1. 下载教程 可以用浏览器下载zip格式并解压,在解压目录文件资源管理器的地址栏输入cmd进入命令行模式. 也可以 git pull https://github.com/mli/gluon-tut ...

  4. 【2019北京集训六】路径(path) 二分+DP

    此题niubi! 题目大意:给你一颗n个点的点带权无根树,现在请您进行以下两步操作: 1,选择一个$[0,T]$之间的整数$C$,并令所有的点权$wi$变为$(wi+C)%MOD$ 2,选择若干条点不 ...

  5. 让Java线程池实现任务阻塞执行的一种可行方案

    Java的线程池一般是基于concurrent包下的ThreadPoolExecutor类实现的, 不过当我们基于spring框架开发程序时, 通常会使用其包装类ThreadPoolTaskExecu ...

  6. jsp 假分页的实现

    原本做毕设做了一堆表格需要读出数据.为了以后的数据可能会很多做准备,这里实现一个以基于jsp页面实现的假分页. 假分页:实际上数据库一次过把所有数据读出来,通过对输出展示的控制来实现对数据分页的假象. ...

  7. SpringCloud学习1-服务注册与发现(Eureka)

    由于样式兼容性问题,本文后半部分被截断,可到个人博客找到本文: https://blog.rmiao.top/springcloud-eureka/ 前言 Oracle转让Java,各种动态语言的曝光 ...

  8. 复刻smartbits的国产网络测试工具minismb简介

           复刻smartbits的国产网络性能测试工具minismb,是一款专门用于测试智能路由器,网络交换机的性能和稳定性的软硬件相结合的工具.可以通过此工具测试任何ip网络设备的端口吞吐率,带 ...

  9. 如何做自己的服务监控?spring boot 1.x服务监控揭秘

    1.准备 下载可运行程序:http://www.mkyong.com/spring-boot/spring-boot-hello-world-example-jsp/ 2.添加服务监控依赖 <d ...

  10. [AGC001 E] BBQ Hard

    Description 有\(N(N\leq 200000)\)个数对\((a_i,b_i)(a_i,b_i,\leq 2000)\),求出\(\sum\limits_{i=1}^n\sum\limi ...