Commit graph

211 commits

Author SHA1 Message Date
Tianjie Xu
209db46be1 Report error codes in the OTA update script
Modify the abort() function in the OTA update generation script to
report an error code. The recoveryimage will parse the code and write it
into last_install for further data analysis.

Bug: 28934032
Change-Id: I2d62f81fd352c3102fb84f054972ac0ecb965a21
2016-05-25 12:22:31 -07:00
Tao Bao
b079b50e2a releasetools: Change the base_fs assertion into warnings.
commit f54216f292 packed the base_fs files
into target_files.zip and added assertion to ensure the existence of the
files. We don't want to fail the OTA generation for the target_files.zip
without the base_fs files. Change the assertion into warnings instead.

Bug: 28547368
Change-Id: I6fd758a0a4fdfff02d1640fa46cf43d971627e26
2016-05-03 08:05:09 -07:00
Tao Bao
f54216f292 Pack base_fs files into target_files.zip.
Pack the base_fs files ({system,vendor}.map) into target_files.zip,
which would be needed when rebuilding the images at signing.

Reset the base_fs paths to point to the files in META/.

Also add blk_alloc_to_base_fs into otatools.zip.

Bug: 27698960
Change-Id: If4eb274b3f3d839c4365624f46f0dc89bd2fa440
2016-04-30 23:56:10 -07:00
Tao Bao
f9efe284a4 Skip verifying the partition with no changed blocks.
For incremental BBOTAs, commit [1] changed to verify only the touched
blocks to reduce the update time. This CL fixes the bug when there's no
changed block between the two builds.

[1]: commit d522bdc9ed

Bug: 27813356
Bug: 28195498
Change-Id: Ia752d3cf034c544517458ed15df509d4596e21fa
2016-04-14 16:12:06 -07:00
Tao Bao
d522bdc9ed releasetools: Only verify the blocks to be touched.
For incremental BBOTAs, we used to verify the integrity of all the
blocks in the source partition. In order to reduce the time cost under
recovery, this CL changes to only verify the blocks that will be touched
in the given OTA package (BBOTA >= 3 only). This is a trade-off between
performance and reliability.

Bug: 27813356
Change-Id: I3975ae6f461f0f7e58d24f1df7df46a449d2988b
2016-04-12 16:41:01 -07:00
Tianjie Xu
b2deb22033 Remove post-install verification
post-install verification calls range_sha1() and checks if the given
partition has expected contents. It takes roughly 20 seconds on
angler with 2.8G system image. Remove it to speed up OTA update. Also
abort the update if block_image_update() fails, as we were relying on
post-install verification to capture block_image_update() failures.

Bug: 27729678
Change-Id: I8123cd8929295ec26df247acf6bb51df813771d9
2016-04-12 11:40:03 -07:00
Sami Tolvanen
a8c37be285 Revert "Revert "build: pass version and patch level to mkbootimg""
This reverts commit 494a9090f9.

Bug: 27498078
Bug: 22914603
Change-Id: Iee6a784271ec32c6bfcc0a6ad3f0395d82016df3
(cherry picked from commit 3303d909a1)
2016-03-15 11:23:56 -07:00
Sami Tolvanen
1bca9fb6d4 Revert "build: pass version and patch level to mkbootimg"
This reverts commit e555f77962.

Bug: 27580174
Change-Id: I0fd1ddb64d2fd4f91b0ecbc1ab8953a1324a10eb
2016-03-14 15:47:11 +00:00
Sami Tolvanen
e555f77962 build: pass version and patch level to mkbootimg
Add --os_version and --os_patch_level arguments to mkbootimg.

Needs matching changes from
  I57682611e0c27fec5ed284da7d9a788383ff98b1

Bug: 27498078
Bug: 22914603
Change-Id: I04e20b0de40d864aac92ac7bcf466a6cbde3d0e4
(cherry pick from commit 8fb47f191f)
2016-03-08 08:21:52 -08:00
Alex Klyubin
b05b62df2e Sign APKs using SHA-256 instead of SHA-1 when possible.
This changes the build system to provide the signapk tool with the
minSdkVersion of the APK being signed. signapk in turn will then use
SHA-256 instead of SHA-1 if minSdkVersion is 18 (JB MR2) or higher
(see c2c49ed0c1).

To avoid increasing incremental OTA update package sizes for already
released platforms, release build scripts disable the above logic when
signing target files ZIPs for pre-N platforms.

Bug: 25643280

(cherry picked from commit 2cfd1d108c)

Change-Id: I38450d07ddc05c705de40313f843beada8db7d98
2016-02-10 17:19:08 -08:00
Tao Bao
b4cfca530c 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
(cherry picked from commit d8d14bec0d)
2016-02-10 09:37:40 -08:00
Alex Klyubin
061289c432 Revert "Sign APKs using SHA-256 instead of SHA-1 when possible." This is breaking CTS.
This reverts commit c2a36afd67.

Change-Id: I4389bf99aeb213198c1c501ba9462bd4a4540d0a
2016-01-29 23:56:44 +00:00
Alex Klyubin
c2a36afd67 Sign APKs using SHA-256 instead of SHA-1 when possible.
This changes the build system to provide the signapk tool with the
minSdkVersion of the APK being signed. signapk in turn will then use
SHA-256 instead of SHA-1 if minSdkVersion is 18 (JB MR2) or higher
(see c2c49ed0c1).

To avoid increasing incremental OTA update package sizes for already
released platforms, release build scripts disable the above logic when
signing target files ZIPs for pre-N platforms.

Bug: 25643280

(cherry picked from commit de5bc04717)

Change-Id: I4b100750e47788ab6ed897a0a5abfd33542e8676
2016-01-29 10:17:02 -08:00
Alex Klyubin
a80a8085e0 Revert "Sign APKs using SHA-256 instead of SHA-1 when possible."
This reverts commit 74df828cb5. This commit is breaking a build, again...

Change-Id: I2df561d68302ba4c83e90a64a7bf203645033a3b
2016-01-27 17:45:42 +00:00
Alex Klyubin
74df828cb5 Sign APKs using SHA-256 instead of SHA-1 when possible.
This changes the build system to provide the signapk tool with the
minSdkVersion of the APK being signed. signapk in turn will then use
SHA-256 instead of SHA-1 if minSdkVersion is 18 (JB MR2) or higher
(see c2c49ed0c1).

To avoid increasing incremental OTA update package sizes for already
released platforms, release build scripts disable the above logic when
signing target files ZIPs for pre-N platforms.

Bug: 25643280
Change-Id: I058393e0971d0d6559dbd69ea902754c6c7cab14
(cherry picked from commit de5bc04717)
2016-01-26 18:41:57 +00:00
Alex Klyubin
1429d5e14c Revert "Sign APKs using SHA-256 instead of SHA-1 when possible."
This reverts commit de5bc04717 because it's breaking some builds. Turns out some APKs have multiple sdkVersion attributes returned by aapt.

Change-Id: I013d6ef5eac473dd3900e0b9edf4c32cdc838bab
2016-01-25 17:17:09 +00:00
Alex Klyubin
de5bc04717 Sign APKs using SHA-256 instead of SHA-1 when possible.
This changes the build system to provide the signapk tool with the
minSdkVersion of the APK being signed. signapk in turn will then use
SHA-256 instead of SHA-1 if minSdkVersion is 18 (JB MR2) or higher
(see c2c49ed0c1).

To avoid increasing incremental OTA update package sizes for already
released platforms, release build scripts disable the above logic when
signing target files ZIPs for pre-N platforms.

Bug: 25643280
Change-Id: I048393e0971d0d6559dbd69ea902754c6c7cab14
2016-01-21 10:25:12 -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
Alex Klyubin
9667b18f23 Make signapk use Conscrypt.
This makes the signapk tool use Conscrypt (where possible) instead of
the platform-default JCA providers and the Bouncy Castle JCA provider.
This speeds up (by 10-30%) APK and OTA update signing because
Conscrypt's crypto primitives are backed by BoringSSL.

Previously, the signapk tool consisted only of the signapk.jar.
Because Conscrypt is backed by native code, signapk now consists of
signapk.jar and crypto_openjdk_jni shared library. This requires that
users of the tool be updated to provide a suitable -Djava.library.path
argument to the Java runtime. This change updates all known users of
the tool inside the Android source tree to do so.

Bug: 26097626
Change-Id: I8411b37d7f771ed99269751a3007dff103083552
2015-12-11 08:36:42 -08:00
Alex Klyubin
eb756d7b7b Do not run zipalign when re-signing APKs.
Running zipalign is no longer needed because signapk takes care of
alignment.

Bug: 25794543
Change-Id: I1080240a67ea6f1b41585fff83d18d57fdcf44e2
2015-12-08 11:05:13 -08:00
Tao Bao
48550cceb0 releasetools: Fix the bug with TARGET_NO_RECOVERY.
The packaging script is broken when we set TARGET_NO_RECOVERY and
SYSTEM_ROOT_IMAGE both. With TARGET_NO_RECOVERY set, we don't have
RECOVERY/RAMDISK/etc/recovery.fstab. It thus fails the assertion in
common.LoadRecoveryFSTab() that "/" must exist in fstab when enabling
SYSTEM_ROOT_IMAGE.

Change-Id: Id509d724f18be7cf7389dd786924ead894ac0cc1
2015-11-19 17:14:21 -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
Sami Tolvanen
a25cced65f Merge "Error correction: Use block_image_recover in block OTAs"
am: fe4e86c7fd

* commit 'fe4e86c7fd1b9c8903fda194b8515451c477ced9':
  Error correction: Use block_image_recover in block OTAs
2015-10-29 16:45:14 +00:00
Sami Tolvanen
f0a7c76b45 Error correction: Use block_image_recover in block OTAs
If block_image_verify fails, attempt to recover using FEC before giving up.

Bug: 21893453
Change-Id: Ibc1fe5d28b2a8099d2b5094277b572ec08229c3a
2015-10-29 11:39:31 +00:00
Tao Bao
6ce8ae761b am ac39bef4: Merge "common.py: Fix the build."
* commit 'ac39bef43fb032bff75b8558f54107e733355265':
  common.py: Fix the build.
2015-10-16 15:46:31 -07:00
Tao Bao
aac4ad56b6 common.py: Fix the build.
Should only use source_info_dict when creating incremental OTAs.

Change-Id: I6a4e5f8fa3613a1b36563ec915e433247965a2b8
2015-10-16 15:28:00 -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
Tao Bao
8c85549a3c am c9ff5102: am 35da9685: Merge "Use the basename of file_contexts from the info dict."
* commit 'c9ff5102ad9258f9189afd3bd15eb58cab186215':
  Use the basename of file_contexts from the info dict.
2015-08-28 18:56:36 +00:00
Tao Bao
c9ff5102ad am 35da9685: Merge "Use the basename of file_contexts from the info dict."
* commit '35da9685f0d3bb367b50aaa4c476b12907099f77':
  Use the basename of file_contexts from the info dict.
2015-08-28 18:46:31 +00:00
Tao Bao
79735a6a82 Use the basename of file_contexts from the info dict.
Changes in [1] break the backward compatibility of the OTA scripts. Fix
the issue by extracting the file basename from the info dict in
META/misc_info.txt.

[1] commit d3a803e668

Bug: 23620049
Change-Id: I40a5625bbe0beb295f34b2328906a4a4283fe59b
2015-08-28 11:17:38 -07:00
Nick Kralevich
cd8f838d07 am c85364c9: am 5f79bcdd: Merge changes from topic \'file_contexts.bin\'
* commit 'c85364c9c91961461a6d81a37c8b30b34b02383b':
  build: switch over to file_contexts.bin only
  Update embedded.mk to support file_contexts.bin
2015-08-13 00:01:09 +00:00
Nick Kralevich
420662b9cd am c85364c9: am 5f79bcdd: Merge changes from topic \'file_contexts.bin\'
* commit 'c85364c9c91961461a6d81a37c8b30b34b02383b':
  build: switch over to file_contexts.bin only
  Update embedded.mk to support file_contexts.bin
2015-08-13 00:00:36 +00: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
Furquan Shaikh
d7ebf9acfc am 7bb7a5f9: am f8a714ba: am 9f5c487e: Merge "releasetools: Fix parameters for vboot_signer" into mnc-dr-dev
* commit '7bb7a5f94e8a2f1f61156773fc259cf112261803':
  releasetools: Fix parameters for vboot_signer
2015-08-10 20:26:27 +00:00
Furquan Shaikh
f8a714ba6f am 9f5c487e: Merge "releasetools: Fix parameters for vboot_signer" into mnc-dr-dev
* commit '9f5c487ef586d20c273cafba6ce663287ef6a37a':
  releasetools: Fix parameters for vboot_signer
2015-08-10 19:34:16 +00:00
Furquan Shaikh
852b8de43f releasetools: Fix parameters for vboot_signer
With the change in vboot_signer (CL:744257), an additional parameter
is required to vboot_signer script. This change adds the required
parameter to releasetools as well.

BUG=23076037

Change-Id: Ice5329578b3a9bc459e278a9d404a1981b35ca88
Signed-off-by: Furquan Shaikh <furquan@google.com>
2015-08-10 11:43:45 -07:00
Tao Bao
f022de397b am 0fed6730: am 8af98164: Merge "Change the cache partition size check into warnings."
* commit '0fed67301d698a30d3f593f6e6ad738f5b28d41e':
  Change the cache partition size check into warnings.
2015-08-08 04:40:35 +00:00
Tao Bao
e3f3a3a941 am 0fed6730: am 8af98164: Merge "Change the cache partition size check into warnings."
* commit '0fed67301d698a30d3f593f6e6ad738f5b28d41e':
  Change the cache partition size check into warnings.
2015-08-08 04:40:29 +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
44ca42a515 am 44c8e4db: am 420f95ff: Merge "releasetools: Support packaging for system_root_image."
* commit '44c8e4db55707bb67e06ccc0db3f42a8c7a9bb1e':
  releasetools: Support packaging for system_root_image.
2015-08-07 20:21:04 +00:00
Tao Bao
f08f5e37f9 am 44c8e4db: am 420f95ff: Merge "releasetools: Support packaging for system_root_image."
* commit '44c8e4db55707bb67e06ccc0db3f42a8c7a9bb1e':
  releasetools: Support packaging for system_root_image.
2015-08-07 20:08:08 +00: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
Daniel Rosenberg
7d3ad6040a am b139ae07: am 22354d3c: Merge "Add support for system images that contain the root directory"
* commit 'b139ae078c8b2598889c2fde1a39a9d64f27dc62':
  Add support for system images that contain the root directory
2015-08-03 17:57:23 +00:00
Daniel Rosenberg
93d8ea20b8 am b139ae07: am 22354d3c: Merge "Add support for system images that contain the root directory"
* commit 'b139ae078c8b2598889c2fde1a39a9d64f27dc62':
  Add support for system images that contain the root directory
2015-08-01 00:23:58 +00:00
Daniel Rosenberg
e6853b0d63 Add support for system images that contain the root directory
When the root directory is included in system, the assumption that
system is mounted at /system breaks down. Redirect /system to /
in that case.

Change-Id: I8031b32d7cb9ca699c1cc22939e28afce9d1c847
2015-07-31 16:52:21 -07:00
Tao Bao
0d511afcb8 resolved conflicts for merge of 910d3822 to mnc-dev-plus-aosp
Change-Id: Ied44516c7c2e46b93965dbdb8fb4bc98d6ed3310
2015-07-28 17:03:09 -07:00