Checking ro.build.date.utc to detect a downgrade is not enough in the
case where several target files are merged, as timestamps can differ
for each partition.
The solution is to check the build timestamp for each partition and
ro.build.date.utc.
With this change ota generation will be aborted during creation
instead of rejected when installing on device.
This also fixes the --override_timestamp so it is possible to generate
a package where timestamps are reversed, as was added in:
3e6161a3b3.
Issue: 315913966
Test: Manual, confirm that ota generation is aborted when timestamp
on post vendor partitions is newer than on pre.
Ota created successfully with --override_timestamp parameter and
installation successful
Test: atest --host releasetools_test
Change-Id: I275e67a3840f4ef2263381c253231068e72f47d2
Move OTA signing flags to payload_signer.py so that we can re-use these
flags in multiple binaries.
Test: th
Bug: 293313353
Change-Id: I44f9910cee37c449397e174a5784f747ec9fb0d6
brillo_update_payload is thin bash wrapper for delta_generator, and
OTA tools are wrappers around brillo_update_payload. This is
inconveinent, as adding a new flag requires changing 3 places. Since
brillo_update_payload is really thin, skip it and invoke delta_generator
directly.
Test: th
Bug: 293313353
Change-Id: I2fd5af95c571ea45aea62f9eec475f0f4e864953
During build, we will need to generate an OTA for boot partition using a
16K boot image. Typically, OTA is generated from target_files.zip . To
avoid relying on target_files.zip as a dependency for 16K OTA, add a
tool to generate OTA directly from a raw image.
Test: th, ota_from_raw_img --partition_name boot --output ota.zip $OUT/boot_16k.img
Bug: 293313353
Change-Id: I2076332faf2a8dc573450597efd481e285a49545
If a T launch device later changes to LZ4(which is supported since U),
we will fallback to older compression algorithms, because if the full
OTA is applied on an T build, the update_engine on device won't support
lz4.
Bug: 295989519
Test: generate full OTA for T launched devices, make sure lz4 is not
used
Change-Id: I82fdf788e47e2a6daeaa4479bfecf317d8ebb5d5
Partition images are allowed to be in either IMAGES/ or RADIO/ dir of a
target_files zip, so when searching for .map files we should look in
both dirs.
Test: th
Bug: 227848550
Change-Id: I0a9d2c582d8f5d570237434902fac012513c9aad
Supply generator with parameter --apex_info_file=META/apex_info.pb
if the file exists.
This ensures that apex_info is included in payload header.
This is identical to the behaviour of brillo_update_payload
which is not being used since:
Invoke delta_generator directly
fcd731e3d6
Issue: 286253576
Test: Manual, confirm that apex_info is included in payload header
Change-Id: Ic096c5f8966beec8686f918aba462c955290a6c5
We don't actually need write permission, so going with least privilege
principle. We have observed some mysterious permission denied errors on server environments. Without detailed logs or access to the server it's hard to pinpoint what the root cause is. This is an attempt/hypothesis to fix the permission denied error.
Test: th
Bug: 283033491
Change-Id: I52dc360d593aab57c749109994bf3e1e3625d0ce
This allows the build system to potentially paralleize generation of OTA
package and zipping of target files
Bug: 262185376
Bug: 227848550
Change-Id: I90b6c25761683ebe3803b22fc8e23540a5282c66
source_file might be a directory, use the _ReadApexInfo() helper
function to read it instead of go straight to zipfiles.
Test: build incremental OTA for pixel
Bug: 279142680
Bug: 227848550
Bug: 277028723
Change-Id: Ia0041e2c72c1a57123519c970f6e734194a81cd2
When building android, build system will first zip target_file directory
into a .zip file, and then invoke ota_from_target_files. We
ota_from_target_files can work directly on top of directories, we can
parallelize OTA generation and target_file zipping, making builds
faster.
Bug: 227848550
Bug: 277028723
Test: th
Change-Id: Id72bd7cca708af0e1bae2db754f39b27777cd601
Android S update_engine has a smaller minor version, we should use
update_engine version number from source build when generating an
incremental OTA.
Test: th
Bug: 277837157
Change-Id: Ic1ccdccd26c19bf9fb13d146a9151e699e481201
Currently, ota_from_target_files(a python script) calls
brillo_update_payload(a bash script), which then calls delta_generator(a
C++ binary) to do the actual diffing. Having brillo_update_payload in
the middle does not offer any additional flexibility, but it makes
maintaince more difficult. Bash code is less readable and harder to
debug. Further more, everytime we want to add a new flag to
delta_generator, we have to add the flag in three places:
ota_from_target_files, brillo_update_payload, delta_generator.
Historically, brillo_update_payload was there because we inherited from
ChromeOS side. This bash scripts extracts target_files.zip and invoke
delta_generator to generate the actual OTA. Any customizations we want
on OTA must be implemented by modifying the input target_files.zip ,
Manipuating big zip files is slow and inefficient.
To make thing simpler/faster, remove the intermdiary call to
brill_update_payload. ota_from_target_files will now extract target
files and call delta_generator directly.
Test: th
Bug: 227848550
Change-Id: I44b296e43bf7921bcf48ef6a1e4021a12669739c
After aosp/2201756 , caller must explicitly pass signing key as a
parameter to FinalizeMetadata . We forgot to update non_ab.py ,
therefore causing non-AB OTAs to be unsigned.
Test: th
Bug: 265895599
Change-Id: Ia54b1105f37b6574742b9b55d715fc9c61c223eb
In the old days, we hacked values of ZIP64LIMIT to get around size
limitations of non-zip64 supported zip files. Now that we switched to
python3 + zip64, there's no point in keeping those hacks.
Test: th
Bug: 255683436
Change-Id: I913db33dad5503736c68a7a1f1321aa952019f60
ZipClose() was introduced to work with large zip without switching to
ZIP64. It is a hacky patch. Now we have moved to python3 and zip64
completely, no need to keep using it.
Test: th
Bug: 246504616
Change-Id: I1ff15171bb26887b819f655e32817627ecad1132
Move some depency on global OPTIONS to parameters. This makes it easier
for other modules to re-use these functions w/o having to modify OPTIONS
variables before/after calling.
Test: th
Bug: 227536004
Change-Id: I3bab292f65a4222f0c9502bcf04fa7a85f8124c6
There's also a Payload class in system/update_engine/scripts. To avoid
name collision, rename the one in releasetools to PayloadGenerator.
No functional changes in this CL.
Bug: 227848550
Test: th
Change-Id: Ib7d4c7ad9839d99416d965e3a3661b8cee7b7693
This allows other modules to import these classes w/o bring in tons of
depedency. No functional changes.
Test: th
Bug: 227848550
Change-Id: I98139b45c02eddefa8a26d032e759fa11cc4c694
Caller expects output_file to contain the final OTA, so we must copy
data into that location. Modifying loca variables isn't enough.
Test: make ota with --no_signing
Change-Id: Id4aaefbc53b4250b7308701493d151f9408f47f1
Only enable zucchini if configuration file zucchini_config.txt exits
in target files and version in source and target is the same.
Without this patch zucchini would be enabled if configuration file
was missing from both target files.
Bug: 231204699
Test: Run ota package generation with zucchini_config.txt missing from
both source and target zips. Confirm that zucchini is disabled.
Change-Id: Ia34998fd911d5860b38fe49fa5a88056a22d661e
Some OTA files may have additional OTA props; when this is being computed within
ota_utils.py -> ComputeRuntimeBuildInfos, the ramdisk type needs to be passed into
PartitionBuildProps.FromInputFile as not all ramdisk may still use gzip. This check
is already defined in common.py, so this change also exposes the function GetRamdiskFormat.
Bug: 231075507
Signed-off-by: TJ Rhoades <tjr@microsoft.com>
Change-Id: If1b93b887990f0d90df2c6003122821c1e66a1ac
The protobuf addition is present only in S+
while the legacy metadata is always present
Test: tools/gen_update_config.py with ota from R
Change-Id: I482c75b6b3b2b1ade139e59dc9dc57dbf9731d45
When lz4diff is enabled, we inject the host copy of liblz4.so in
target_file to delta_generator. This is to ensure that host tooling can
produce same compressed output as the device.
Test: th
Bug: 206729162
Change-Id: I2d8206f7ec54fadedea16bf3d811b8353bc9414d
- Sort dictionaries before looping over them
- Don't call sorted() on lists with Nones
- Open file in binary format when serializing protobufs
Change-Id: If5dbc908f7125f6184014b3c1c7891f833d1d8bf
Bug: 203436762
Test: Presubmits
When computing the data offset of an entry in zip file, we used length
of extra field from central directory. That is correct most of the time
but wrong if the extra field in central directory has different length
than the one in local file directory. Since python's zipfile doesn't
provide an API to access local file header, we need to parse local file
header ourselves and extract length of extra field.
An incorrect offset will cause magic mismatch error from update_engine,
as update_engine expects to find uncompressed payload at the recorded
offset.
Test: th, partner verification
Bug: 191443484
Change-Id: Id670cd79b0bd65adffaaa5224ae4f8065d66b358
We have already logged the compressed apexes in the target-files.
Because we want to support the apex metrics during OTA update, also
include the uncompressed apexes in the META/apex_info.pb.
For incremental OTA packages, include the source apex version for
each apex package as well.
Bug: 190244686
Test: unit test
Change-Id: I5cf2647c56c4feb5517f9a81aa1e9abc52515bf1
In aosp/1581143 , we banned generation of SPL downgrade OTAs. However,
caller of OTA script can still force an SPL downgrade OTA by passing
--spl_downgrade flag. If this flag is specified, we propagate it to OTA
metadata so that GOTA server can properly honor this flag.
Test: th
Change-Id: Ic8cdc850d2210f4149ad9121fa4ed2e5a4f59bcc
Right now they are the same content. In the future, boot will be added
to PARTITIONS_WITH_BUILD_PROP, but it is not added to
PARTITIONS_WITH_CARE_MAP. Boot partition has a cpio filesystem in the
ramdisk, so it contains a build.prop file, but it doesn't make sense to
create care map from it.
Test: TH
Bug: 162623577
Change-Id: I9b5a20fe2d774b52cf7d5eae9deecbc75122a3dd
When opening an zip file through zipfile.ZipFile(), python2 by default
disables zip64 support. To support update files >4GB, we manually add
allowZip64 to override the setting.
Test: generate && serve an OTA
Change-Id: I9645e963ced830cc2d3a4b72bc63b9369a1cefe8
As part of the ota metadata work to support partial update, we should
add the per-partition device name, fingerprint, and version to the ota
metadata.
Bug: 151088567
Bug: 166154730
Test: unit tests pass, generate a package
Change-Id: I7a71a4860aad651daf9e62df39c60d72727c14ff
Background in http://go/android-partial-updates. For partial update
(e.g. system-only) or devices with mixed build, the current
fingerprint & device name no longer suffice as the precondition to
install the package.
Therefore, we need to additionally include the per-partition build
props into the ota metadata. We also define a protobuf for the metadata
so it can be extended later. The metadata of the legacy format is also
kept for backward compatibility.
Bug: 151088567
Test: unittest pass, generate an OTA and check the result
Change-Id: I716f7da54a393cd340280dbddc3c92b3460f8ef8
Pylint reports lot of error on ota_utils.py, because some members of
OPTIONS object aren't defined. This CL moves some definition from
ota_from_target_files.py to ota_utils.py to fix these lint errors.
Test: Make an OTA package
Change-Id: I1e9f255d5919712b13329046c72650dfac184701