Commit graph

56 commits

Author SHA1 Message Date
Tao Bao
3e30d97dde Revert "Revert "releasetools: Support OTAs that have OEM properties changes.""
This CL fixes the bug in [1] (copy-paste error) and reenables it.

We need to handle a special case that an OTA goes from a source build
without OEM properties to a target build with those properties (or vice
versa). Add support in OTA scripts to deal the case properly, by a)
using two oem_props variables to handle source and target builds
respectively; b) adjusting the fingerprint/thumbprint assertions to
allow a mix of both.

[1] commit c086370440

Change-Id: I98118d77d5a0ff694fa1ee33602b5ee5e048599b
2016-03-15 13:28:49 -07:00
Tao Bao
3c37889299 Merge "Revert "releasetools: Support OTAs that have OEM properties changes."" 2016-03-15 19:16:33 +00:00
Tao Bao
838c68fa1a Revert "releasetools: Support OTAs that have OEM properties changes."
Broke some builds.

This reverts commit c086370440.

Change-Id: If07006db412fea6c04f8698776a2ab418125a469
2016-03-15 19:16:18 +00:00
Tao Bao
61cebe79f4 Merge "releasetools: Support OTAs that have OEM properties changes." 2016-03-15 18:33:20 +00:00
Tao Bao
4996cf03d2 Use the update-binary in the source build for downgrade OTAs.
We used to use the update-binary from the target build when creating
incremental OTAs. But for downgrade OTAs, we should use the one in the
source build instead, which is actually newer.

Bug: 27556903
Change-Id: Ib6415729b979dbffdebdda24902f7f560942801a
2016-03-08 17:57:40 -08:00
Tao Bao
c086370440 releasetools: Support OTAs that have OEM properties changes.
We need to handle a special case that an OTA goes from a source build
without OEM properties to a target build with those properties (or vice
versa). Add support in OTA scripts to deal the case properly, by a)
using two oem_props variables to handle source and target builds
respectively; b) adjusting the fingerprint/thumbprint assertions to
allow a mix of both.

Change-Id: Ib517c366730b967a974c89528df9d42887c92ec2
2016-03-07 13:14:49 -08:00
Tao Bao
1bb5a18918 releasetools: Fix one missing case for --oem_no_mount.
The CL in [1] added support for --oem_no_mount. It missed one place that
guards the OEM mounting.

[1] commit 8608cde944

Change-Id: I6ecaa94cd0866e0fd4fc88cb0aa3ebf55cde2968
2016-03-04 09:45:39 -08:00
Tao Bao
8608cde944 releasetools: Add --oem_no_mount option.
We may have devices with OEM-specific properties but without an OEM
partition (e.g. the properties might be set by init based on hardware
SKUs). For such devices, we supply --oem_no_mount to skip mounting the
OEM partition in the updater-script. The option is only meaningful when
-o (--oem_settings) is specified.

Bug: 27359929
Change-Id: Ic08396e478a82be4188e980e704b33b4f704a8d7
2016-02-26 16:07:16 -08:00
Tao Bao
5d1825664a releasetools: Support generating downgrade incremental OTAs.
Add --downgrade flag to ota_from_target_files.py script. It allows
generating an incremental OTA that updates from a newer build to an
older one (based on timestamp comparison). "post-timestamp" line in the
metadata file will be replaced by "ota-downgrade=yes". A data wipe will
always be enforced, so "ota-wipe=yes" will also be included in the
metadata file.

Bug: 26883782
Change-Id: Iaa05f662d948b7ab632a9fbb7051cc3f8bf68c21
2016-02-24 11:31:17 -08:00
Tao Bao
d8d14bec0d releasetools: Add two new entries to metadata.
Add "ota-required-cache" into the metadata file in an OTA package,
which shows the minimum free space on /cache to apply the update.

Add "ota-type" into the metadata file, which shows the OTA type for
this package (i.e. one of FILE, BLOCK and AB).

Also add the cache free space check into updater-script when generating
block-based incremental OTAs (we only had such lines for file-based
incrementals before).

Bug: 26731903
Change-Id: Id6ff0fc4cdfb1443636b0b3800b0f8bddb5bb1d0
2016-02-08 11:00:27 -08:00
Alex Deymo
19241c11bd ota_from_target_files: Include the payload properties.
When building an A/B OTA package, include the payload.bin properties as
a key-value pairs text file, so it can easily be passed to
update_engine during payload application.

Bug: 26991255
TEST=`ota_from_target_files out/dist/${BOARD}-target_files.zip full-ota.zip` includes the properties.

Change-Id: I445c8a8e412a8e16b48b6ee626db8e27d48a38a9
2016-02-04 23:29:50 -08:00
Tao Bao
c098e9efd9 Generate OTA packages for A/B update.
It calls brillo_update_payload to generate the payload for A/B update.
And packages the payload according to Android OTA package format.

Note that it only supports generating full/incremental OTAs with this
CL. Signing for release may not work properly at the moment.

Bug: 25715402
Change-Id: I4ac8505bacad28a572a9320dc8b52dd0f1ce47f5
2016-01-19 15:46:34 -08:00
Tianjie Xu
0b109751b8 Merge "Check block0 for remounting partition R/W" 2016-01-08 00:49:49 +00:00
Daniel Rosenberg
40ef35b9e9 Allow building recovery as boot.
With BOARD_USES_RECOVERY_AS_BOOT = true, we skip building the
non-ramdisk boot.img but building the recovery image as boot.img. It
contains recovery's ramdisk (e.g. with /sbin/recovery). It depends on
the bootloader parameter (skip_initramfs) to determine the actual mode
to boot into.

Change-Id: Id6e2d0a2b94383944ca8f35bba688c6401745622
(cherry picked from commit d80bef2b9e)
2015-12-21 11:17:08 -08:00
Tianjie Xu
fc3422ad36 Check block0 for remounting partition R/W
Add a function check_first_block to read block0 and output a message
on screen if the device has been remounted. The function is called
for version >= 4 only; it executes after a failing block verification
and before recovery attempts.

Bug: 21124327
Change-Id: I49dc0b861c702698896a2495ca094215705d4650
(cherry picked from commit 9dac797013)
2015-12-18 11:05:34 -08:00
Tao Bao
269d785ce0 releasetools: Always use recovery mount options.
Change-Id: I6e96c417ffb5ad36405f4a6f5342f80f358f375f
2015-12-02 15:51:47 -08:00
Tao Bao
d62c603573 releasetools: Allow logging the diff for incrementals.
Add an option "--log_diff <filename>" to ota_from_target_files.py
script. When enabled, it logs the differences between the source
and target builds into <filename> when generating incremental OTAs.

Also move target_files_diff.py into releasetools/ so that it can be
packed into otatools.zip.

Bug: 25372309
Change-Id: Ifd4ed0f2f12ef040ee377621ec8c35a873cec34f
2015-11-30 11:26:40 -08:00
Tao Bao
9bc6bb23b5 releasetools: Support generating verify packages.
We can generate a special OTA package that verifies all the partitions
(boot, recovery, system, vendor and etc) on a device. It also calls
device-specific script to verify bootloader and radio images. This
ensures a flashed device contains all the desired images faithfully.

Usage:
ota_from_target_files.py --gen_verify target_files.zip output.zip

Bug: 24679956
Change-Id: Ib3091d98c4b17a6fad305b3edf16d09efbda5c38
2015-11-10 12:49:33 -08:00
Tao Bao
767e3ac246 releasetools: Refactor ota_from_target_files.py.
Factor out some common lines between generating incremental and full
OTAs. Remove the outer while loop for cleaner logic.

Change-Id: I0a4d44a4a59b488748222c2031bd63f67d45e0b5
2015-11-10 12:23:10 -08:00
Tao Bao
e5eb4567d4 Merge "Honor TARGET_NO_RECOVERY flag."
am: c448e91c3d

* commit 'c448e91c3d3d095f8f200c9925f7db2ad525132f':
  Honor TARGET_NO_RECOVERY flag.
2015-10-29 16:45:31 +00:00
Tao Bao
db45efa647 Honor TARGET_NO_RECOVERY flag.
Don't generate recovery.img when calling 'make dist' if
TARGET_NO_RECOVERY is set. The build system passes the flag to the
packaging script which then generates recovery.img conditionally.

Bug: 25329471
Change-Id: Ifbc999300d5c31e897878f81e231ae7dd2aca660
2015-10-27 20:00:10 -07:00
Tao Bao
63e63c2a07 am 543b28d4: Merge "Pass source\'s info_dict to vendor\'s releasetools.py."
* commit '543b28d42f8fdebe011a906826251ab8df70a226':
  Pass source's info_dict to vendor's releasetools.py.
2015-10-16 14:49:40 -07:00
Tao Bao
6f0b219ac5 Pass source's info_dict to vendor's releasetools.py.
When building incremental packages, the info_dict from the source build
should be the one in use. We have done that for most of the partitions
(system and etc.), and should pass that to vendor's script as well.

Bug: 24898607
Change-Id: Ie2973d41b905637862616286663baf80df83bd88
2015-10-13 16:38:36 -07:00
Ian Pedowitz
2029791350 resolved conflicts for f4fc29b0 to mnc-dr-dev-plus-aosp
Change-Id: Ieee6621881ace1631ae53d2a5879c271ba45382f
2015-09-15 19:18:15 -07:00
Ian Pedowitz
a0abf49d2b resolved conflicts for a1fcaf86 to mnc-dr-dev
Change-Id: Ie53652faa530a3c9c83f30c8f2b636d90f0f1b7a
2015-09-15 18:39:19 -07:00
leozwang
a1fcaf86c4 Add an option to include a full bootloader in incremental OTA.
Bug: 23999213
Change-Id: I6c715eb01048e187622ba1e90c89a3306a294b8a
2015-09-15 08:44:12 -07:00
Tao Bao
276a4f4512 am 2f44006a: am 8f4b307e: Merge "releasetools: Fix the bug when deleting files."
* commit '2f44006a4bbfe6eb7af4d69a24bd068a0875a304':
  releasetools: Fix the bug when deleting files.
2015-09-04 18:02:30 +00:00
Tao Bao
a77d41e2f7 releasetools: Fix the bug when deleting files.
For file-based OTAs, we used to remove unneeded files in ascending
order, which failed to delete non-empty directories. Reverse the order
to fix the issue.

For example, now we have the following in our generated script:
  delete("/system/app/Calculator/arm/Calculator.odex",
         "/system/app/Calculator/arm/",
         "/system/app/Calculator/Calculator.apk",
         "/system/app/Calculator/");

Bug: 22960996
Change-Id: I0d36d29b7862fb53bf55bf5685a990180f9c0b3b
2015-09-03 21:21:55 -07:00
Tao Bao
a6e6afbce6 am 39c322ce: releasetools: Fix the bug in symlink deletion.
* commit '39c322cefcc0ecba76a2ffb8881694fd010a87fc':
  releasetools: Fix the bug in symlink deletion.
2015-09-03 17:26:12 +00:00
Tao Bao
39c322cefc releasetools: Fix the bug in symlink deletion.
For file-based OTAs, symlinks in the source build but not in the target
build will be deleted. However, if a symlink is replaced by a regular
file in the target build, the file will be accidentally deleted when
applying (resuming) the same package again.

Verify the checksum of a symlink that will be unpacked or renamed to.
Delete the file only if it doesn't have the target checksum.

Bug: 23646151
Change-Id: I77bae035e39f2e0be25f7f6d71c5882464e3d50f
(cherry picked from commit 84006eacd0)
2015-09-02 21:21:17 -07:00
Tao Bao
11a93a4831 am 3fb3ece6: am c6c9c61d: Merge "releasetools: Fix the bug in symlink deletion."
* commit '3fb3ece67e643e7437f222068e61ee254ee90b26':
  releasetools: Fix the bug in symlink deletion.
2015-09-03 02:15:37 +00:00
Tao Bao
84006eacd0 releasetools: Fix the bug in symlink deletion.
For file-based OTAs, symlinks in the source build but not in the target
build will be deleted. However, if a symlink is replaced by a regular
file in the target build, the file will be accidentally deleted when
applying (resuming) the same package again.

Verify the checksum of a symlink that will be unpacked or renamed to.
Delete the file only if it doesn't have the target checksum.

Bug: 23646151
Change-Id: Ie322abb6022b6fa812c6b36a3127872d9614fc3b
2015-09-02 17:51:16 -07:00
Tao Bao
418632f517 resolved conflicts for merge of 50827e0d to mnc-dr-dev-plus-aosp
Change-Id: I88f94e520f59a381f441de9d4bad158b6c7045c4
2015-08-31 14:38:31 -07:00
Tao Bao
d47d8e1488 Assert the stash size when generating OTAs.
With block-based OTA v2 and v3, it requires stash space on the /cache
partition to back up blocks during an update. We need to ensure that
it doesn't exceed the partition size. Since there might be other files
on /cache as well, we use cache_size * threshold as the maximum allowed
size. The threshold defaults to 0.8, which can be overridden by command
line option '--stash_threshold'.

Change-Id: Ieee5d373c9bfb2ea401d85ca8a3adb491579de76
(cherry picked from commit 23ac404212)
2015-08-26 15:00:38 -07:00
leozwang
aa6c1a1445 Add an option to include a full bootloader in incremental OTA.
Bug: 23101469
Change-Id: Iac466b83f789f10d26e8d289dce766cf0d05148b
(cherry picked from commit c1324751e79b23a63ea494f4bc784446c8f32435)
2015-08-17 10:34:01 -07:00
Nick Kralevich
5f79bcdd07 Merge changes from topic 'file_contexts.bin'
* changes:
  build: switch over to file_contexts.bin only
  Update embedded.mk to support file_contexts.bin
2015-08-12 23:46:28 +00:00
Tao Bao
575d68a48e Change the cache partition size check into warnings.
For some old builds, we may not define cache partition size. Change the
exception into a warning to make the script backward compatible.

Change-Id: Ie94c7fbb1a9f3a7db3f16e8d845e493a534aac5b
2015-08-07 19:49:45 -07:00
Tao Bao
7a5bf8a645 releasetools: Support packaging for system_root_image.
For system images that contain the root directory, we need to find the
root directory at ROOT/ instead of BOOT/RAMDISK/.

Change-Id: Ica345c8b1b03475f8ac6c44fd576045fcf17c882
2015-08-05 16:28:55 -07:00
Stephen Smalley
d3a803e668 build: switch over to file_contexts.bin only
Change all uses of the file_contexts file to use the
file_contexts.bin file instead.

Depends on
   I75a781100082c23536f70ce3603f7de42408b5ba
   I43806d564b83d57f05f5c36c8eba7b1ff4831b04
   Id560d093440a2aba99cef28c20133b35feebf950
   I15660f4b3e4c5cb8ae0ec1498c74d6fcbb9a0400

Change-Id: Iaf8c4b2e420f610425a07f48db7af32bda3f5b3a
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2015-08-04 14:59:06 -04:00
Tao Bao
cce673b675 Read fstab from the source build.
When creating incremental OTAs, we should always use the fstab from the
source build instead of the target.

Bug: 21948974
Change-Id: I8b6a18f64b412f782184f9d382544ed0ce093fb4
(cherry picked from commit dd24da9ec9)
2015-07-29 14:30:08 -07:00
Tao Bao
dd24da9ec9 Read fstab from the source build.
When creating incremental OTAs, we should always use the fstab from the
source build instead of the target.

Bug: 21948974
Change-Id: Iff44130f88a679b253ea1adcfac4ed8566ce9cc7
2015-07-29 14:11:55 -07:00
Tao Bao
f2cffbddb9 Support systems that use a full copy of recovery image.
If BOARD_USES_FULL_RECOVERY_IMAGE == true, a full copy of recovery
image will be carried as /system/etc/recovery.img instead of a patch
at /system/recovery_from_boot.p.

Bug: 22641135
Change-Id: Ie271d3e2d55d7b003f667ac5b44203d69b23c63b
(cherry picked from commit 8beab69bd5)
2015-07-28 12:20:36 -07:00
Tao Bao
8dcf738234 Assert the stash size when generating OTAs.
With block-based OTA v2 and v3, it requires stash space on the /cache
partition to back up blocks during an update. We need to ensure that
it doesn't exceed the partition size. Since there might be other files
on /cache as well, we use cache_size * threshold as the maximum allowed
size. The threshold defaults to 0.8, which can be overridden by command
line option '--stash_threshold'.

Change-Id: I5c2e353ea4716328d6cdc6a7f758520de8d88b8e
(cherry picked from commit 23ac404212)
2015-07-14 13:36:50 -07:00
Tao Bao
2c15d9eefe Pack file_contexts into target_files zip.
file_contexts (specified by SELINUX_FC) is needed both when building
and (re)packaging. We used to use the copy in out/ when building, and
looked for the copy in BOOT/RAMDISK/ when packaging from target_files
zip. With system_root_image enabled, the file_contexts needed for
building and packaging might be different from the one on device. So
we explicitly pack the file as META/file_contexts in target_files zip.

Also refactor out the overriding of selinux_fc property into
common.LoadInfoDict().

Change-Id: I94f9ea6671b3792c12c1c21573840743d63da39a
(cherry picked from commit aa7318c384)
2015-07-10 14:21:16 -07:00
Ying Wang
2ffb3147bc fix up ota_from_target_files symlink detection.
Change-Id: I10b668096d4e61e75473dd805f96387049f29b79
2015-07-06 14:02:01 -07:00
Tao Bao
3806c231a9 Fix OTA scripts to generate incremental BBOTA with OEM property.
Bug: 21803136
Change-Id: I3a45e8aea0b4f4f4f2acb4c9c8a7fad7a014680c
2015-07-05 21:08:33 -07:00
Tao Bao
34b47bf42b Use fstab in the source build
When generating incremental OTAs, we should use the fstab in the source
build instead of the target one. Similarly for recovery_mount_options.

Bug: 22011892
Change-Id: Ia02584c71af7d47835b1f62e7daa46f27940a545
(cherry picked from commit bebd3cfbf9)
2015-06-26 15:53:16 -07:00
Tao Bao
bebd3cfbf9 Use fstab in the source build
When generating incremental OTAs, we should use the fstab in the source
build instead of the target one. Similarly for recovery_mount_options.

Bug: 22011892
Change-Id: Idb5c72d1a792e8bb40376a380e3dc06136b13652
2015-06-22 19:27:59 -07:00
Tao Bao
68658c0f4f Add post-install verification for BBOTAs
Similar to the assertations in file-based OTA, we perform verification
for block-based OTAs (BBOTAs) after updating a partition, for both of
the incremental and full OTAs. It increases the update time (~20s on
Nexus 6), but will capture unnoticed errors right away.

Bug: 21500869
Change-Id: I89ac8fe623b855721b7affd07cf9426a23433ab0
2015-06-01 15:00:30 -07:00
Tao Bao
5ece99d64e Add support for clobbered blocks
In ext4 filesystems, some blocks might be changed even being mounted
R/O, such as the superblock (block 0). We need to exclude such blocks
from integrity verification. Plus such blocks should always be
written to the target by copying instead of patching.

Bug: http://b/20939131
Change-Id: I657025b7b1ad50d4365e7b18dc39308facfe864e
(cherry picked from commit ff7778166b)
2015-05-13 12:26:04 -07:00