android 6.0系统 make otapackage 错误

android 6.0 系统:在make otapackage时,出现如下错误:

unable to load device-specific module; assuming none
using prebuilt recovery.img from IMAGES...
using system.img from target-files
Traceback (most recent call last):
  File "./build/tools/releasetools/ota_from_target_files", line 1719, in <module>
    main(sys.argv[1:])
  File "./build/tools/releasetools/ota_from_target_files", line 1674, in main
    WriteFullOTAPackage(input_zip, output_zip)
  File "./build/tools/releasetools/ota_from_target_files", line 610, in WriteFullOTAPackage    
    system_tgt = GetImage("system", OPTIONS.input_tmp, OPTIONS.info_dict)
  File "./build/tools/releasetools/ota_from_target_files", line 496, in GetImage
    return sparse_img.SparseImage(path, mappath, clobbered_blocks)
  File "/home/guofengwan/workspace/rdadroid-6.0/build/tools/releasetools/sparse_img.py", line 50, in __init__
    raise ValueError("Magic should be 0xED26FF3A but is 0x%08X" % (magic,))
ValueError: Magic should be 0xED26FF3A but is 0x23494255

make: *** [out/target/product/etau-Lensun_R635D_8810P/etau-ota-eng.guofengwan.zip] Error 1


经过查看打包脚本的py代码,分析出在build/core/Makefile中

@echo "Package OTA: $@"
        $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
           ./build/tools/releasetools/ota_from_target_files -v \
-          --block \

加了这个block参数导致了对Magic的检查,进而出现了错误,去掉此参数后,编译通过,那么此参数的作用是什么呢?见如下文章,http://blog.csdn.net/huangyabin001/article/details/44871481


Android5.x及其之后的版本都可以使用模块式OTA来保证每个设备使用相同的分区。模块式OTA把整个分区作为一个文件并且生成一个二进制补丁,而不是对比每个文件生成对应的很多个补丁。

模块式OTA升级的开关就是--block参数。