Commit graph

5050 commits

Author SHA1 Message Date
Colin Cross
6db8597174 Merge "Update references to build/core to build/make/core" 2017-10-20 23:41:12 +00:00
Colin Cross
6cdc5d20f3 Update references to build/core to build/make/core
sed -i -e 's"\([^/]\)build/core"\1build/make/core"g' $(git grep -l build/core)

Test: m checkbuild
Change-Id: Idf3a2fed79aee5d2c07bd8e42f0c0660f253ddc2
2017-10-20 12:49:28 -07:00
Tao Bao
b937ead5d9 releasetools: Work around the issue with mke2fs created images.
When generating block based OTAs, we read files from the sparse image
directly with the help of block map file. However, the block map info
might not be accurate if the image is created with mke2fs. Because
mke2fs may skip allocating actual blocks if they contain all zeros.
ota_from_target_files.py consequently passes incomplete APK files to
imgdiff, which fails to generate patches.

This CL works around the issue by falling back from imgdiff to bsdiff on
failures. We should figure out a better way in b/68016761 to remove the
workaround, which would otherwise hide other issues in imgdiff.

Bug: 67824829
Bug: 68016761
Test: ota_from_target_files.py passes on previously failing TF zips.
Change-Id: Ib24c5b5f89812b97a0c87c6bf0dc147ae39bc92f
2017-10-19 16:56:22 -07:00
Tao Bao
fa863c86b7 releasetools: Remove the workarounds for mkyaffs2image.
Test: `m dist` on Linux and macOS.
Test: Use an existing target_files.zip for bullhead. Remove IMAGES/*
      and rebuild the images with 'add_img_to_target_files.py -a'. It
      generates idential images as in the original TF.zip.
Change-Id: I803656bf2c924dce53f2271dcb967a94fff48440
2017-10-18 10:21:33 -07:00
Treehugger Robot
404af2ca4b Merge "Build repeatable system images with mke2fs." 2017-10-18 17:20:00 +00:00
Treehugger Robot
f4f94ab567 Merge "Follow renames of conscrypt and bouncycastle to remove -host suffix" 2017-10-18 09:41:11 +00:00
Tom Cherry
1d6e8e31d0 Merge "Allow ro. properties to have arbitrary lengths" 2017-10-17 22:33:11 +00:00
Colin Cross
b34d45ad65 Follow renames of conscrypt and bouncycastle to remove -host suffix
Test: m checkbuild
Change-Id: I72bd7249cf6bdc4a2251f6877c776f439649da81
2017-10-17 15:27:52 -07:00
Tao Bao
d86e3114fc Build repeatable system images with mke2fs.
We have added support in mkuserimg_mke2fs.sh that allows specifying
filesystem UUID and hash seed UUID. This CL generates and passes the
UUIDs based on the image name and build fingerprint. This way we can
rebuild and get identical images.

Note that this only applies to images generated with `m dist` and with
signing tools (sign_target_files_apks.py and
add_img_to_target_files.py). Images under $OUT (built with `make`) are
not affected.

Bug: 64994964
Test: lunch marlin-userdebug; run `m dist` twice (after deleting the
      intermediate files under $OUT/obj/PACKAGING), and compare the
      generated images.
Change-Id: I41cf4e5869582bb930af2f35a8e9c79bff43b2a2
(cherry picked from commit 3aa21e6bb9)
2017-10-16 22:48:33 -07:00
Tom Cherry
47c4eb4680 Allow ro. properties to have arbitrary lengths
Bug: 23102347
Bug: 34954705
Test: provide a fingerprint >92 characters long and see that it
      successfully works

Change-Id: Ida9ffd5266acb3b432b208780804a08e8f7391b4
2017-10-12 09:21:48 -07:00
Bowgo Tsai
6ceeb1a8bf Adding Android verified boot 1.0 metadata into ENG builds
Adding verified boot metadata with a "disable magic". The resulting
metadata at the end of each image (e.g., system.img, vendor.img) will
be the same as triggering an "adb disable-verity" on an USERDEBUG image.

This can help simplify the code on fs_mgr, which won't have to check if
current image is an ENG build or not.

Bug: 63056044
Test: boot sailfish eng/userdebug builds
Change-Id: I95d23ac7b76c04d6d4483c9c4dc1de16bf0d9c3a
2017-10-12 10:08:44 +08:00
Treehugger Robot
2d1681c804 Merge "Use -Werror in build/make" 2017-10-03 22:38:24 +00:00
Chih-Hung Hsieh
2a5bc9dfbf Use -Werror in build/make
* Remove unused local variables.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: Iced5bb903902f49d7cd5cf5f572906a512c75e18
2017-10-03 13:53:13 -07:00
Dan Willemsen
093075304b Ignore zip comments in dump-package-stats
Use -q to silence zip comments, which also silences the first line.

Bug: 67345114
Test: find vendor -name '*.apk' | xargs build/tools/dump-package-stats
Change-Id: Icb319c603de7c29644c58520213940179f67b7e4
2017-10-03 12:56:09 -07:00
Tao Bao
2b6dfd6689 Use computed salt for AVB-signed images.
We want the generated images being identical for the same source files.
Currently the generated ext4 image (either from make_ext4fs or mke2fs)
is reproducible, but the AVB footer added by avbtool contain changes
because of the random salt being used.

This CL changes the avbtool invocation to specify "--salt <hexstring>"
(already supported by avbtool) to use reproducible salt that's computed
based on fingerprints (or thumbprints if applicable).

Bug: 67023482
Test: Regenerate images from the same source as follows:
  Use a target_files.zip from an AVB-enabled target.
    $ zip -d target_files.zip IMAGES/\*
    $ ./build/make/tools/releasetools/add_img_to_target_files.py \
          -v target_files.zip
  Repeat the above commands and compare the generated images.
Change-Id: Id9db17ae0132ca3a820b4be5a5ef06ca3fef71ed
(cherry picked from commit 8f05cca1d9)
2017-09-29 10:47:40 -07:00
Dan Willemsen
a3a06feeed Add -lm to the default libs for Linux & Darwin
libm is a default library for device builds, so default it for host
builds as well.

Also removes duplicate additions of -ldl, -lpthread, -lm and -lrt.

Test: m host
Change-Id: I6a07e12053090eb6997b79d4091c28ac9a9022de
2017-09-26 20:26:11 -07:00
Dan Willemsen
6f2284e4fe Remove ijar
It's no longer used.

Test: cs/
Change-Id: Ib24094e494d4caa390f83df28c179b6012691ebc
2017-09-21 16:08:51 -07:00
Tao Bao
b22afea0f0 Consider prebuilt vendor.img as having vendor partition.
vendor.img could be built from the source - in which case we have
unpacked files under VENDOR/ - or dropped in as a prebuilt binary blob.
We should consider either of them as target having a vendor partition.
Because we need to add its AVB hashtree info into vbmeta.img if target
is using AVB. Otherwise libfs_mgr would refuse to mount this
"AVB-enabled" vendor.img.

For targets not using AVB, this change is no-op.

Bug: 65462819
Test: Having vendor.img as prebuilt, `make dist`. Check that the
      generated vbmeta.img contains the info from vendor.img.
Test: Build, flash and boot the above image.zip.
Change-Id: Iaeb30e2059cb33fb39f23e5ffd28f338d00ccbfc
2017-09-13 11:05:15 -07:00
Tianjie Xu
ab61b6b895 Merge "Add a verbose option to RunCommand in build_image.py" 2017-09-11 19:22:38 +00:00
Dan Willemsen
c0a0f2dc1f Convert to Android.bp
Test: m atree fs_config fs_config_generate_test fs_config-unit-tests fs_get_stats zipalign
Test: cd out/host/linux-x86/nativetest64/fs_config-unit-tests ./fs_config-unit-tests
Change-Id: I3c5403a7f1cf221715eb52a41c640af9afcee175
2017-09-09 13:47:34 -07:00
Tianjie Xu
149b7fbf08 Add a verbose option to RunCommand in build_image.py
Make the build log less verbose; also print the result for
AdjustPartitionSizeForVerity().

Bug: 65292710
Test: Run add_img_to_target_files with and without "-v" and check
the logs.

Change-Id: Icdc86197ce69db036658ea9e77cc4ebe1750463b
2017-09-09 03:42:31 +00:00
Chih-Hung Hsieh
2b1efe63cf Accept alternative email addresses.
Some OWNERS files use secondary email addresses, so we only
check existence of _account_id and email attributes.

Test: run against existing OWNERS files
Change-Id: I6f0804a8a90b7a23783c3fe45686d4d973876ed1
2017-09-07 13:07:26 -07:00
Tao Bao
aa599f3916 Merge "Skip checking files that have less blocks in block map." 2017-09-07 17:50:51 +00:00
Tao Bao
b418c30e3a Skip checking files that have less blocks in block map.
When creating ext4 images with mke2fs, it may skip allocating some
blocks if they contain all zeros. As a result, there could be less
blocks listed in the block map than the actual file length.

For example, for a file with a length of 112200-byte (27+ blocks),
the listed blocks in block.map could be '43665-43688' (24 blocks).
Because some all-zero blocks are not taking actual space.

The generated ext4 images are perfectly valid - kernel will figure out
that data block is not allocated and writes all zeros into user buffer.
However, we can't fully reconstruct a file from its block list in our
Python script. Ideally this can be avoided by mounting or parsing an
ext4 image directly, which is yet to be supported in our script.

This CL skips checking for such files to avoid failing
validate_target_files.py.

Bug: 65213616
Test: validate_target_files.py passes on targets with mke2fs generated
      images (e.g. marlin).
Change-Id: Id9cc59e345b9283844044ef94ceb5702f0ca0526
2017-09-05 15:53:24 -07:00
Tao Bao
a198b1e964 releasetools: Validate A/B OTA payload signatures.
$ PYTHONPATH=$PYTHONPATH:system/update_engine/scripts \
    ./build/make/tools/releasetools/check_ota_package_signature.py \
    build/target/product/security/testkey.x509.pem \
    out/dist/aosp_marlin-ota-eng.zip

Package: out/dist/aosp_marlin-ota-eng.zip
Certificate: build/target/product/security/testkey.x509.pem
...
Whole package signature VERIFIED

Verifying A/B OTA payload signatures...
...
Payload signatures VERIFIED

Bug: 65261072
Test: Signed a package and its payload with the right keys; ran the
      command above.
Test: Signed the payload with a different key; ran the command above and
      observed the reported verification failure.
Change-Id: If626ecb327a9826cd0956eef94914c939068a7d1
2017-09-01 14:33:15 -07:00
Tao Bao
bcd1d161e8 Add compatibility metadata for Treble-enabled non-A/B OTA packages.
Commit 21803d3574 only added compatibility
metadata for A/B OTA packages, because by that time we didn't use
'ro.treble.enabled' property to determine if a target was Treble-enabled.

This CL uses 'ro.treble.enabled' to guard the packing of compatibility
metadata for both of A/B and non-A/B OTA packages. It also switches to
checking the system/vendor fingerprints to determine if there's an
update to the partition (previously it was computing the SHA-1 of the
images, which may have unintentionally changed due to issues that give
non-repetitive builds).

Bug: 64339310
Test: Generate OTA packages (full and incremental) on Treble-enabled
      targets (sailfish, as well as a non-A/B angler target with
      Treble-enabled locally); check that the compatibility.zip entry
      exists.
Test: Generate OTA packages on Treble-unenabled non-A/B target (angler);
      check that the compatibility.zip entry doesn't exist.
Test: Generate OTA packages on Treble-unenabled A/B target; check that
      the compatibility.zip entry doesn't exist.

Change-Id: I2a1fcf612439d849ba8ccea217a0faf5d5ba8e14
2017-08-28 15:19:44 -07:00
Tao Bao
ac7b7db12c Remove file_contexts.bin from non-A/B OTA package.
This entry only exists in non-A/B full OTA path. However, this file has
never been loaded by recovery - recovery was only reading the one from
the recovery image (which also has been removed by a recent change in
[1]).

[1]: commit e35926e1aff2e6b9b54656bd59c8178e295a1b7e in
platform/bootable/recovery.

Bug: 63538434
Test: `m dist` on angler. file_contexts.bin is gone from full OTA
      package. Sideloading the generated full OTA on angler.
Change-Id: Iec2e2d36599fa1ed499516a3e74f06cd36ade494
2017-08-25 14:14:53 -07:00
Jeff Gaston
03e7e81837 Merge "Remove the need to find Android.mk files via directory symlinks"
am: 6ab53d7211

Change-Id: I0495d45001821d095531d5be7c049fc2836888f7
2017-08-08 00:14:51 +00:00
Jeff Gaston
5c1f3fd068 Remove the need to find Android.mk files via directory symlinks
Bug: 64397960
Test: m -j
Change-Id: I5b77dd654dfced63900913c447b5448b632158d7
2017-08-07 14:21:20 -07:00
Tao Bao
d91be38c5e Merge "Look for non-existent files listed in avb_vbmeta_args."
am: 5180c3b97b

Change-Id: I6a035f46f09f70f11c271693158392f98927aa0f
2017-07-21 20:52:24 +00:00
Tao Bao
9a5f419ecf Look for non-existent files listed in avb_vbmeta_args.
In BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS, if we have defined
"--include_descriptors_from_image" with an image file whose path points
to source tree, add_img_to_target_files.py or sign_target_files_apks.py
may fail to find the file. Because these scripts may run without a
source tree, by taking target_files.zip as the only input.

This CL scans additional locations in the input target_files.zip to find
those missing files in avb_vbmeta_args. As long as the files are included
in the target_files.zip, they get a second chance to be found.

Bug: 63910867
Test: As follows:
 1. Setup BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS with a local file path;
 2. Remove the local file;
 3. sign_target_files_apks.py fails without this CL;
 4. sign_target_files_apks.py works.
Change-Id: I3c58f80a5535db02b74cfe40d0c0beff72587cf8
(cherry picked from commit 1dc5d47653)
2017-07-21 11:57:00 -07:00
Tianjie Xu
a07a04c737 Merge "Generate brotli compressed {}.new.dat for full OTA"
am: 1b28eca1a1

Change-Id: I3474e8efb634513fbc4876e5c272cf56b3443e12
2017-07-14 23:27:21 +00:00
Tianjie Xu
1b28eca1a1 Merge "Generate brotli compressed {}.new.dat for full OTA" 2017-07-14 23:21:54 +00:00
Tianjie Xu
b0a29ad8c2 Generate brotli compressed {}.new.dat for full OTA
Brotli has a better compression ratio than deflation. So for non-AB
full OTA, we can compress the new.dat with brotli first and store it
in the zip package.
This increase the OTA generation time by ~5 minutes for a full OTA
(measured based on 2.0G system.new.dat)

Bug: 34220646
Test: Generate a full OTA for bullhead
Change-Id: I9c0550af8eafcfa68711f74290c8e2d05a96648f
2017-07-14 10:53:21 -07:00
Tao Bao
fcc2cf6c1e Merge "Track the AVB property name change."
am: c45161536f

Change-Id: If20f1f0880680b8da185d846a9e0f17139389b50
2017-07-07 23:33:41 +00:00
Tao Bao
3f72176da0 Track the AVB property name change.
system_avb_hashtree_enable has been renamed to
avb_system_hashtree_enable in commit
3e599ead66. 'care_map.txt' is missing due
to the change.

Bug: 63142730
Test: `m dist` and check IMAGES/care_map.txt exists in target_files zip.
Change-Id: I60c269b41df844b50353d357bf67c20f15548642
2017-06-29 15:19:09 -07:00
Tao Bao
ce10b6e2f3 Merge "Allow packing custom radio images into target_files zip."
am: 9ea6a8b817

Change-Id: Ifdcdfa2214e4fa75bb0c7a5df1cb1796814fa7bc
2017-06-29 03:16:17 +00:00
Tao Bao
9ea6a8b817 Merge "Allow packing custom radio images into target_files zip." 2017-06-28 22:03:19 +00:00
Tao Bao
b5363b2dbc Merge "Support replacing AVB signing keys."
am: 682849976d

Change-Id: Iedbd4ce27ffdfeb3d88406f75636221739427add
2017-06-28 19:41:25 +00:00
Tao Bao
95a95c3a5e Allow packing custom radio images into target_files zip.
Radio images are added to INSTALLED_RADIOIMAGE_TARGET, which by default
will be packed under RADIO/ in a target_files zip. This CL introduces
BOARD_PACK_RADIOIMAGES that allows additionally copying them into
IMAGES/, which will then be included into <product>-img.zip.

Bug: 62195105
Test: Define BOARD_PACK_RADIOIMAGES and `m dist`. Check the generated
      target_files zip and <product>-img.zip.
Change-Id: I3deafd2dfecd1d4dbfdfc2d002fc40ef22fb60ea
2017-06-27 13:50:12 -07:00
Tao Bao
639118ff4d Support replacing AVB signing keys.
sign_target_files_apks.py now supports signing targets using verified
boot 2.0 (aka AVB). It allows replacing AVB signing keys for both of
chained and non-chained partitions.

An example command line looks as follows.
 $ ./build/tools/releasetools/sign_target_files_apks.py \
     --avb_vbmeta_key external/avb/test/data/testkey_rsa2048.pem \
     --avb_vbmeta_algorithm SHA256_RSA2048 \
     --avb_vbmeta_extra_args \
         "--signing_helper_with_files ./signing-helper.sh" \
     --avb_system_key external/avb/test/data/testkey_rsa4096.pem \
     --avb_system_algorithm SHA256_RSA4096 \
     --avb_system_extra_args \
         "--signing_helper_with_files ./signing-helper.sh" \
     product-target_files.eng.zip signed-product-target_files.zip

To verify the signed images:
 $ unzip signed-product-target_files.zip IMAGES/\*
 $ avbtool verify_image --image IMAGES/vbmeta.img \
     --expected_chain_partition system:1:testkey_rsa4096_pub.pem \
     --key external/avb/test/data/testkey_rsa2048.pem

Bug: 38315721
Test: sign_target_files_apks.py on AVB-enabled target w/ and w/o chained
      partitions respectively. Check the signing command lines; validate
      the signed images with 'avbtool verify_image'.
Change-Id: Ia009555b16ddb6d8ba6a0858d5ca7d983bbab887
2017-06-27 10:50:46 -07:00
Tianjie Xu
35f6f99056 Merge "Remove the obsolete location check for install-recovery.sh" am: 8fb65a5d63
am: ea5dad9010

Change-Id: I26e314431a87732a486566d2702106d28d323d92
2017-06-22 18:27:49 +00:00
Tianjie Xu
e0bda97ea1 Merge "Verify the contents in install-recovery.sh" am: 924c1c0598
am: 01c463e406

Change-Id: Ie8177614c855e3f554184d570b2f98b29aefc8c6
2017-06-22 18:27:39 +00:00
Tianjie Xu
8fb65a5d63 Merge "Remove the obsolete location check for install-recovery.sh" 2017-06-22 18:12:44 +00:00
Tianjie Xu
924c1c0598 Merge "Verify the contents in install-recovery.sh" 2017-06-22 18:12:44 +00:00
Chih-hung Hsieh
877a7a43d2 Merge "Add OWNERS in build/make" am: d79ce64555
am: 9af11fce7a

Change-Id: I44e3689a9280de474055ec4f109278ef2ff7d8cf
2017-06-22 04:34:38 +00:00
Chih-hung Hsieh
d79ce64555 Merge "Add OWNERS in build/make" 2017-06-22 04:27:13 +00:00
Chih-Hung Hsieh
044fc0c4a4 Add OWNERS in build/make
* Owners are selected from top CL approvals or owners.
  They will be suggested to review/approve future CLs.
* OWNERS files are recognized by the new find-owners plugin, see .md files in
  https://gerrit.googlesource.com/plugins/find-owners/+/master/src/main/resources/Documentation/

Test: build/make/tools/checkowners.py -c -v OWNERS
Change-Id: Ibe6765e5448c471ca413413e3d052507ccee4ea6
2017-06-21 16:09:56 -07:00
Tianjie Xu
9c384d2ca5 Verify the contents in install-recovery.sh
Check the SHA1 of recovery.img and boot.img embedded in the
install-recovery.sh.

Bug: 35411009
Test: validation script detects mismatch for both full recovery and
recovery-from-boot.
Change-Id: I5f07a869d9fa17fad26a22ef9ca3ecb06b1b28e3
2017-06-20 17:28:35 -07:00
Tianjie Xu
78de9f173d Remove the obsolete location check for install-recovery.sh
The script has been moved to /system/bin since L.

Bug: 35411009
Test: Generate a exact same OTA for bullhead.
Change-Id: Iaecb86e3dabc5b659605837bb06f16d20fa80334
2017-06-20 16:52:54 -07:00