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. Rolling Hash about the Rsync

    今天看文献看到一个有趣的算法—Rolling Hash,这个算法可以更新在不同的machine上的两个“similar”的文件,也叫做rsync algorithm,rsync顾名思义:remote ...

  2. Spring Boot日志集成实战

    Spring Boot日志框架 Spring Boot支持Java Util Logging,Log4j2,Lockback作为日志框架,如果你使用starters启动器,Spring Boot将使用 ...

  3. springboot创建统一异常拦截器全局处理 异常

    1.创建Exception类 public class MyException extends RuntimeException { private ErrorCodeEnum errorCode; ...

  4. 从零开始学 Web 之 ES6(五)ES6基础语法三

    大家好,这里是「 从零开始学 Web 系列教程 」,并在下列地址同步更新...... github:https://github.com/Daotin/Web 微信公众号:Web前端之巅 博客园:ht ...

  5. HDFS-Architecture剖析

    1.概述 从HDFS的应用层面来看,我们可以非常容易的使用其API来操作HDFS,实现目录的创建.删除,文件的上传下载.删除.追加(Hadoop2.x版本以后开始支持)等功能.然而仅仅局限与代码层面是 ...

  6. 如何在线显示php源代码

    通过php提供的函数highlight_file和highlight_string实现

  7. 看图说话,idea 远程调试 tomcat下项目

    tomcat中部署了项目,准备测试远程调试. 1.配置idea 2. 修改catalina.bat,并启动tomcat catalina.bat: ...rem 下面的参数就是从idea配置中复制过来 ...

  8. JavaWeb学习 (六)————Servlet(二)

    一.ServletConfig讲解 1.1.配置Servlet初始化参数 在Servlet的配置文件web.xml中,可以使用一个或多个<init-param>标签为servlet配置一些 ...

  9. springboot aop 自定义注解方式实现完善日志记录(完整源码)

    版权声明:本文为博主原创文章,欢迎转载,转载请注明作者.原文超链接 一:功能简介 本文主要记录如何使用aop切面的方式来实现日志记录功能. 主要记录的信息有: 操作人,方法名,参数,运行时间,操作类型 ...

  10. netty源码解解析(4.0)-11 Channel NIO实现-概览

      结构设计 Channel的NIO实现位于io.netty.channel.nio包和io.netty.channel.socket.nio包中,其中io.netty.channel.nio是抽象实 ...