Commit graph

3607 commits

Author SHA1 Message Date
Chih-hung Hsieh
bc0ab6d133 Merge "Fix misc-macro-parentheses warnings." 2016-05-11 20:30:47 +00:00
Ian Rogers
adf2141b66 Merge "Add code search links to warnings." 2016-05-11 19:07:36 +00:00
Chih-Hung Hsieh
f536e7ba34 Fix misc-macro-parentheses warnings.
Add parentheses around macro arguments used beside binary operators.

Bug: 28705665
Change-Id: I8594b9463e2389a46d6e0235757b93de065cd007
2016-05-11 11:55:33 -07:00
Tao Bao
7ff7c2d870 Merge "Revert "Include vendor partitions in target zip generation"" 2016-05-11 15:11:57 +00:00
Wei Wang
05e6f679e6 Revert "Include vendor partitions in target zip generation"
This reverts commit 421fe44ae8.

Change-Id: Id45781de73735783bc7dfb6fc2838957578d00d3
2016-05-11 14:49:50 +00:00
Ian Rogers
f382973250 Add code search links to warnings.
Add argument parsing using the argparse library.
Make HTML easier to read by adding a \n after each table row.

Change-Id: I6b745fc60afb96fb51e5f69df7d607b5fb8da0e5
2016-05-10 22:36:38 -07:00
Treehugger Robot
bb05fd768c Merge "Include vendor partitions in target zip generation" 2016-05-11 02:18:58 +00:00
Ian Rogers
32bb9bd03a Add error prone patterns to warn.py
Bug: 28681096

(cherry picked from commit df79adacab)
Change-Id: I06ac0ed4593b03cea0a8163ca85e393ff1358855
2016-05-10 13:54:36 -07:00
Treehugger Robot
afd3d55261 Merge "ApkSignerEngine abstraction for apksigner-core library." 2016-05-10 19:13:41 +00:00
Wei Wang
421fe44ae8 Include vendor partitions in target zip generation
This change will enable the target zip to include partition defined in
BRILLO_VENDOR_PARTITIONS. This is necessary for OTA to support
partitions other than boot and system in ab_partitions.txt.

BUG: 28623063
Change-Id: I6e0969c31c9ad2e8285c6f560825c160aa8c4d55
2016-05-10 11:00:09 -07:00
Ian Rogers
2f4ce82d13 Sort warnings with most frequent first.
Change-Id: Id608c20d065bec83dcb2993658cc743d5e9dcb46
2016-05-10 09:34:29 -07:00
Alex Klyubin
5f987967da ApkSignerEngine abstraction for apksigner-core library.
This adds the ApkSignerEngine abstraction to the apksigner-core
library. This abstraction enables the separation of
parsing/building/writing of an APK from signing the APK.

Users of ApkSignerEngine invoke it during specific I/O events (e.g.,
JAR entry encountered in input APK, all output JAR entries ready).
The engine responds by occasionally providing instructions about what
to do next. For example, it may provide JAR entries to be added to
the output APK, thus making the output APK signed.

The default implementation of ApkSignerEngine will be provided in  a
follow-up commit.

Bug: 26516150
Bug: 27461702
Change-Id: Ia85fd09497a6e2ff3103ba10c53a1848ba731f7b
2016-05-09 13:20:03 -07:00
Alex Klyubin
265db0826e APK Signature Scheme v2 signing logic for apksigner-core.
apksigner-code library will offer a high-level primitive (future
commit) for signing APKs. This is meant to be used by
build/tools/signapk and Android Studio's APK builder/signer.

This commit adds a lower-level APK Signature Scheme v2 (aka v2
signing) code which will be used by the future APK signing abstraction
exposed by this library.

All classes (except DataSource and DataSources) added by this commit
are internal (i.e., implementation details of this library). Clients
of this library should not be using these classes.

Bug: 26516150
Change-Id: I98d4da0666cf122667c67565108ea4fb28ac51e6
2016-05-09 12:16:33 -07:00
Treehugger Robot
b60b340597 Merge "JAR signing logic for the apksigner-core library." 2016-05-05 22:42:43 +00:00
Alex Klyubin
85b8a0146e JAR signing logic for the apksigner-core library.
apksigner-code library will offer a high-level primitive (future
commit) for signing APKs. This is meant to be used by
build/tools/signapk and Android Studio's APK builder/signer.

This commit adds a lower-level JAR signing (aka v1 signing) code which
will be used by the future APK signing abstraction exposed by this
library.

All classes added by this commit are internal (i.e., implementation
details of this library). Clients of this library should not be using
these classes.

Bug: 26516150
Change-Id: I5cecd435e63aab206d63868be5e0d0e289e7c423
2016-05-05 10:53:56 -07:00
Alex Klyubin
b141ded82b SHA-256 with ECDSA supported only on API Level 21 and higher.
Turns out APK signatures using SHA-256 with ECDSA are accepted only by
platforms with API Level 21 and higher, not 18 and higher.

Bug: 28296599

Change-Id: I3fab5be17bf3a9bdbf4d84d90d51448027c7e761
2016-05-03 18:15:39 -07:00
Alex Klyubin
cc3440cc1d Merge "Separate logic for alg selection for OTA and APK signing." 2016-05-03 20:50:54 +00:00
Shinichiro Hamaji
a6da20e2d2 Merge "Initialize an uninitialized field in ijar" 2016-05-02 19:00:43 +00:00
Shinichiro Hamaji
d6c694b302 Initialize an uninitialized field in ijar
The upstream patch was merged:
https://github.com/bazelbuild/bazel/commit/a5004430338bc72817c7

Bug: 28347190
Change-Id: I9b8b9bc830bd16299b94e8c92c22dba8aa36affb
2016-05-03 03:19:23 +09:00
Chih-hung Hsieh
169cb4b68c Merge "Fix google-explicit-constructor warnings." 2016-05-02 18:08:16 +00:00
Chih-Hung Hsieh
1df33b78aa Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I72bdd1df09cea91743aa89dab4cb0b9db2657e2d
2016-04-29 14:10:10 -07:00
Alex Klyubin
01d6b59dcf zipalign supports -p also when checking alignment.
This updates the usage banner of zipalign to state that the -p switch
is supported in check alignment mode.

Change-Id: I119026b0e09e5a2528646e88a9b58dbb79c0c17c
2016-04-29 12:32:17 -07:00
Tao Bao
00dbe29173 target_files_diff: Fix the issue with file type change.
When a file is switched from a regular file to a symlink, we should skip
the comparasion.

Bug: 28373409
Change-Id: I8fef00ab9f2d6f811fde1cadf595e8bd46af2dfd
(cherry picked from commit f31a6deeee)
2016-04-25 11:29:48 -07:00
Alex Klyubin
3f52653abf Separate logic for alg selection for OTA and APK signing.
The rules for which digest algorithms are accepted by the Android
platform for APK signatures and OTA update package signatures are
different. For example, the set of digest algorithms accepted for APK
signatures depends on the signing key algorithm and the platform's
API Level. Whereas the set of digest algorithms accepted for OTA
update package signatures by Recovery depends on the list produced
by the build system, which in turn produces the list based on the
key algorithm and digest used in the signing certificate.

To reflect this reality, this refactoring CL explicitly separates
signapk's logic for choosing the digest algorithm to use for v1
signing from its logic for choosing the digest algorithm to use for
OTA update package signing.

Bug: 28296599
Change-Id: Ic7aa77e89622d727e985f8749071284746be7f45
2016-04-25 11:15:27 -07:00
Treehugger Robot
27e0d48f0b Merge "fs_config: include both oem ranges" 2016-04-18 20:35:27 +00:00
Tao Bao
962dfdcdac 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
(cherry picked from commit f9efe284a4)
2016-04-14 20:23:17 -07:00
David Zeuthen
2528968871 Merge "Add support for Brillo partitioning." 2016-04-14 16:04:30 +00:00
Tao Bao
d4caaae160 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
(cherry picked from commit d522bdc9ed)
2016-04-13 17:00:34 -07:00
Tianjie Xu
323e3d4c18 Merge "Monotonic flag sets incorrectly in rangelib" 2016-04-13 21:48:53 +00:00
Tianjie Xu
cd1e16a761 Monotonic flag sets incorrectly in rangelib
After applying update_target_files_incr_ext4.sh, some files may end up
occupying unsorted block fragments. In one example, an apk file has the
block range [258768-259211,196604]. The monotonic flag in rangelib sets
incorrectly for this example and leads to a bad input file for imgdiff.
After fixing the flag, bsdiff is called instead of imgdiff and the
incremental OTA package generates successfully.

Bug:28053885
Change-Id: Ib841bf449ff6a29314fc4a1b8fba941a6dc532ac
2016-04-13 12:36:14 -07:00
Tianjie Xu
dea8b94f98 Merge "Remove post-install verification" 2016-04-13 19:19:03 +00:00
David Zeuthen
25328627ba Add support for Brillo partitioning.
To generate partition tables in the Android build system, simply add
the path to a .bpt file to the BOARD_BPT_INPUT_FILES variable.

 BOARD_BPT_INPUT_FILES += "hardware/bsp/vendor/soc/board/board-specific.bpt"

The variable BOARD_BPT_DISK_SIZE can be used to specify or override
the disk size, for example:

 BOARD_BPT_DISK_SIZE := "10 GiB"

Additional arguments to 'bpttool make_table' can be specified in the
variable BOARD_BPT_MAKE_TABLE_ARGS.

If BOARD_BPT_INPUT_FILES is set, the build system generates two files

 partition-table.img
 partition-table.bpt

in ${ANDROID_PRODUCT_OUT} using 'bpttool make_table'. The former is
the binary partition tables generated using bptool's --output_gpt
option and the latter is a JSON file generated using the --output_json
option. These files will also be put in the IMAGES/ directory of
target-files.zip when running 'm dist'.

BUG=27831397
TEST=Manually tested.

Change-Id: Iedd15354afb2dd483dcb9bc001360b2a37fd6dc0
2016-04-13 12:45:20 -04:00
Tianjie Xu
618a81e818 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.

cherry-picked from commit b2deb22033
Bug: 27729678
Change-Id: I8123cd8929295ec26df247acf6bb51df813771d9
2016-04-12 15:41:14 -07:00
Tao Bao
83cd79d340 releasetools: Use fixed timestamp in otacerts.zip.
We were using zipfile.write() to write system/etc/security/otacerts.zip
when signing for release. It led to unexpected timestamp change in the
generated otacerts.zip and non-idempotent signed images when signing the
same target_files.zip.

Replace with common.ZipWrite() to always use a fixed timestamp.

Bug: 28122968
Change-Id: Ia6cf4b7d380cbf72ed7050ebb60c932dc8826d87
(cherry picked from commit 7ee3a9678e)
2016-04-12 08:34:43 -07:00
William Roberts
580f2c405d fs_config: include both oem ranges
Support both OEM and OEM2 ranges as defined by
private/android_filesystem_config.h.

Change-Id: I1aef62fa446301bb68b0309b198f3fe8b5eb92c7
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-04-09 08:39:22 -07:00
Ying Wang
d63ec28bcf Merge "Correct usage message for build_image.py" 2016-04-07 21:51:21 +00:00
Alex Klyubin
d71e12028b Merge "Remove support for DSA with SHA-512 from v2 signing." 2016-04-07 19:56:03 +00:00
Alex Klyubin
60817689fa Remove support for DSA with SHA-512 from v2 signing.
Android platform does not support DSA with SHA-512. Thus, it does not
make sense to support this unsupported algorithm in APK Signature
Scheme v2.

Bug: 24331392
Change-Id: Ifba90ad5b11188bb968c28d9e0ed3f9cb13ce2e7
2016-04-07 10:24:56 -07:00
Colin Cross
8f9a53258b makeparallel: reset make's unlimited stack
make 3.81 sets its own stack size to be unlimited, but accidentally
leaves it unlimited for all child processes.  If it is unlimited, reset
it back to a reasonable default (8MB).

See http://savannah.gnu.org/bugs/?22010

Change-Id: Ieb0289823f12a421b59d8ab5292d3df3c6dfc27e
2016-04-06 17:59:14 -07:00
Maria Bornski
885dbb5111 Correct usage message for build_image.py
target_out_dir is now a required argument. Include this in the usage message.

Change-Id: If77d94ec5350b2c737d1dd1df28a51167b173058
2016-04-06 17:26:31 -07:00
Mark Salyzyn
54cb05c01a Merge "fs_config: introduce TARGET_FS_CONFIG_GEN" 2016-04-04 22:37:33 +00:00
Chih-Hung Hsieh
d742e90fe9 Recognize more Clang-Tidy google warning patterns.
* Many AOSP C/C++ code have google-readability warnings.

Bug: http://b/27779618
Change-Id: Ic7d33b957da5c1062410f48ef18bb68a5aa259e9
2016-03-31 16:14:55 -07:00
Chih-Hung Hsieh
90d4619f02 Recognize Clang-Tidy warning messages.
* Put all Clang-Tidy warning messages in a group for now.
  There are too many coding style warnings.
* Change the 'top' link to the top of the page.
* Add a few more new clang compiler warnings.

Bug: http://b/27779618
Change-Id: I385b9db927a397704b56f53440301352da8694cf
2016-03-29 15:33:11 -07:00
Tao Bao
8179d68458 rangelib.py: Add parse_raw() method.
parse_raw() parses a string generated by RangeSet.to_string_raw().

>>> RangeSet.parse_raw(RangeSet("0-9").to_string_raw())
<RangeSet("0-9")>

Change-Id: Ia74daa30476d5e9ad73c368f4ecc64c755b734a5
2016-03-24 11:08:51 -07:00
Alex Klyubin
37a0ecd329 Fix bug in APK entry alignment.
APK entry alignment logic assumes that input entries have zero-length
comment and extra fields. When the assumption is broken, the logic
silently breaks alignment of output entries. This happens, for
example, when the APK to be signed is already aligned and thus may
contain entries with non-empty extra fields.

Given that APKs are not supposed to use comment and extra fields for
anything useful and given that this signer already discards comment
and extra fields of compressed entries, this change makes the signer
discard comment and extra fields of STORED input entries as well.
This unbreaks the existing alignment logic.

Bug: 27814973
Change-Id: I8242b037e21ba7bcf45d0fe2afc8bfc47f1ec314
2016-03-23 13:09:42 -07:00
Chih-Hung Hsieh
a9be47e782 Dump table of warning counts before all warnings.
* The table of warning counts has links to each warning pattern section,
  which has a new anchor.
* Each warning pattern section has a new link to the 'top' of the table
  of warning counts.
* Background color of unknown warnings is changed to more visible light blue.

BUG: 27698849
Change-Id: Ia3d4a8511bd42f44f6a47afcb9c3889f6d62b9f2
2016-03-22 10:44:11 -07:00
Chih-Hung Hsieh
ba0ddcd099 Add more patterns, dump sorted unique warnings.
* Sort and remove duplicated warning messages.
* Recognize more warning message patterns from new clang compiler.

BUG: http://b/27698849

Change-Id: Iebbe8600353269d8c2d49ef9d97a72be1d978a24
2016-03-22 16:31:18 +00:00
David Zeuthen
d995f4b04d Add support for Brillo Verified Boot.
The following variables are introduced

 BOARD_BVB_ENABLE: can be set to true to build boot.img and system.img
 files compatible with Brillo Verfied Boot.

 BOARD_BVB_ROLLBACK_INDEX: can be set to an integer to use for the
 rollback index.

 BOARD_BVB_KEY_PATH, BOARD_BVB_ALGORITHM: If set, the former must be a
 path to the private key used to sign the boot image and the latter must
 be the algorithm to use. If unset, a test-key stored in the tree will
 be used.

 BOARD_BVB_MAKE_BOOT_IMAGE_ARGS: Extra options to pass to 'bvbtool
 make_boot_image'.

 BOARD_BVB_SIGN_BOOT_IMAGE_ARGS: Extra options to pass to 'bvbtool
 sign_boot_image'.

 BOARD_BVB_ADD_IMAGE_HASHES_ARGS: Extra options to pass to 'bvbtool
 add_image_hashes'.

 BOARD_CUSTOM_BVBTOOL: Can be set to specify what bvbtool program to
 use.

The existing BOARD_KERNEL_CMDLINE variable is also used, as are existing
kernel and initrd-related variables. Therefore, simply adding

 BOARD_BVB_ENABLE := true

to an existing Makefile should do the trick.

Bug: 26185038
TEST=Added 'BOARD_BVB_ENABLE := true' to hardware/bsp/intel/soc/edison/soc.mk
  and built an image and then ran bvbtool's info_boot_image and
  info_image_hashes commands on the resulting boot.img and system.img
  files and verified that the information was correct. Also ran 'm dist'
  and verified that the boot.img and system.img files in the resulting
  target_files.zip file had similar information.

Change-Id: I08045ed8b0cbddc7c3acdd3a6f2c4bb75cb44bbc
2016-03-18 15:25:43 -04:00
Ying Wang
2c6fbca557 Enable -Werror on zipalign
And fix the last warning to enable this flag.

Bug: 27695718
Change-Id: I70eb9c87530a9b982fbe83abea706908f0ce0356
2016-03-18 10:04:07 -07:00
Ying Wang
5af0991bfc Merge "Fix compilation warning." 2016-03-17 22:44:29 +00:00