I was able to build Android image for my Development Board by applying my custom patch to AOSP code. The generated binaries(Say Version 1) was working fine. I have made few changes to my patch, built the latest image(Say Version 2). This also working good.
I have respective target_files for these versions by running dist command
make dist
What worked:
When i try to generate incremental ota package on my Linux machine(say PC-1), the ota.zip file was generated and working fine.
./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.
What not worked:
The same when tried in another Linux PC(other than PC-1), there are dependency error making my script to fail.
./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
Question: What are the minimal packages required to generate incremental ota file on a fresh Linux PC?
I would install all necessary AOSP libs as stated from: https://source.android.com/source/initializing
For 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
Also, sometimes its helps to pass in the host arch (-p arg) and verbose option (-v) to get more debugging information from the command itself:
I.E.
./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