生成Android增量OTA包时出错

时间:2017-07-13 10:39:15

标签: android linux android-source ota

通过将自定义补丁应用于AOSP代码,我能够为我的开发板构建Android映像。生成的二进制文件(Say Version 1)工作正常。我对我的补丁做了一些修改,构建了最新的图像(Say Version 2)。这也很好用。

我通过运行dist命令

为这些版本提供了各自的target_files
make dist 

什么有效:

当我尝试在我的Linux机器上生成增量ota包(比如PC-1)时,生成了ota.zip文件并且工作正常。

./build/tools/releasetools/ota_from_target_files -i ./version1_target_file.zip ./version2_target_file.zip oat_file_version_1_to_2.zip 
unzipping target target-files...
unzipping source target-files...
unable to load device-specific module; assuming none
Loading target...
Loading source...
2 diffs to compute
    0.41 sec      316 /   307886 bytes (  0.10%) system/etc/recovery-resource.dat
    1.43 sec     1799 /  2521277 bytes (  0.07%) system/priv-app/Calander.apk
building image from target_files BOOT...
building image from target_files BOOT...
building image from target_files RECOVERY...
building image from target_files RECOVERY...
boot      target: 5414912  source: 5414912  diff: 1086759
boot image changed; including.
recovery image changed; including as patch from boot.
done.

什么行不通:

在另一台Linux PC(PC-1除外)上尝试时,存在依赖性错误,导致我的脚本失败。

./build/tools/releasetools/ota_from_target_files -i ./version1_target_file.zip ./version2_target_file.zip oat_file_version_1_to_2.zip 
unzipping target target-files...
unzipping source target-files...
unable to load device-specific module; assuming none
Loading target...
Loading source...
2 diffs to compute
[Errno 2] No such file or directory
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/ubuntu/otaPackageBuildTest/test/build/tools/releasetools/common.py", line 919, in worker
    d.ComputePatch()
  File "/home/ubuntu/otaPackageBuildTest/test/build/tools/releasetools/common.py", line 879, in ComputePatch
    p = Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/home/ubuntu/otaPackageBuildTest/test/build/tools/releasetools/common.py", line 68, in Run
    return subprocess.Popen(args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
[Errno 2] No such file or directory
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/ubuntu/otaPackageBuildTest/test/build/tools/releasetools/common.py", line 919, in worker
    d.ComputePatch()
  File "/home/ubuntu/otaPackageBuildTest/test/build/tools/releasetools/common.py", line 879, in ComputePatch
    p = Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/home/ubuntu/otaPackageBuildTest/test/build/tools/releasetools/common.py", line 68, in Run
    return subprocess.Popen(args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory


building image from target_files BOOT...
Traceback (most recent call last):
  File "./build/tools/releasetools/ota_from_target_files", line 914, in <module>
    main(sys.argv[1:])
  File "./build/tools/releasetools/ota_from_target_files", line 899, in main
    WriteIncrementalOTAPackage(input_zip, source_zip, output_zip)
  File "./build/tools/releasetools/ota_from_target_files", line 605, in WriteIncrementalOTAPackage
    OPTIONS.source_info_dict)
  File "/home/ubuntu/otaPackageBuildTest/test/build/tools/releasetools/common.py", line 344, in GetBootableImage
    info_dict))
  File "/home/ubuntu/otaPackageBuildTest/test/build/tools/releasetools/common.py", line 281, in BuildBootableImage
    p1 = Run(cmd, stdout=subprocess.PIPE)
  File "/home/ubuntu/otaPackageBuildTest/test/build/tools/releasetools/common.py", line 68, in Run
    return subprocess.Popen(args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

问题: 在新的Linux PC上生成增量ota文件所需的最小包是什么?

1 个答案:

答案 0 :(得分:0)

我会安装所有必要的AOSP库,如下所述:https://source.android.com/source/initializing

对于Ubuntu 14.04 / 16.04:

  

sudo apt-get install git-core gnupg flex bison gperf build-essential   zip curl zlib1g-dev gcc-multilib g ++ - multilib libc6-dev-i386   lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache   libgl1-mesa-dev libxml2-utils xsltproc unzip

此外,有时它有助于传入主机arch(-p arg)和verbose选项(-v)以从命令本身获取更多调试信息:

./build/tools/releasetools/ota_from_target_files -v --block -p out/host/linux-x86 -k build/target/product/security/releasekey -i previous_signed_target_files.zip signed_target_files.zip incremental.zip