Commit Graph

6270 Commits

Author SHA1 Message Date
Bill Peckham 540d91ae3f Fix missing import.
Test: Verify that script runs properly now that import is present.
Change-Id: I255bc6ca2ba1f2cc387001c6f4bf9690a90eb47c
2019-04-25 14:18:16 -07:00
Yifan Hong 51d375610c ota_from_target_files: include metadata when odm / product is changed.
When odm is changed, device manifest/matrices should be included.
When product is changed, framework manifest/matrices should be included.

Bug: 130714844
Bug: 126770403
Test: build with odm and product VINTF metadata

Change-Id: I49c8083e0e7185ae7b96047d68f1f624b1113dfc
2019-04-25 10:22:39 -07:00
Bill Peckham d40f5b6ec0 Merge "Sort content of merged target files package."
am: d540f5a9a5

Change-Id: I9204ac1023b2d4bc8c8c2a383e4991bdd700518f
2019-04-25 09:32:57 -07:00
Bill Peckham d540f5a9a5 Merge "Sort content of merged target files package." 2019-04-25 16:19:47 +00:00
Tao Bao 8bdfb990ea releasetools: GetCareMap supports non-sparse image.
Test: `atest --host releasetools_test`
Test: `m dist` with a target that uses non-sparse images.
Test: Run UpdateVerifierTest on blueline.
Change-Id: I8fdebee42fcaac78c2d1be2a84ddb69f46ec701d
2019-04-25 09:15:07 -07:00
Tao Bao 541468bb9a Merge "releasetools: Accept PRESIGNED keys in apexkeys.txt."
am: b5b055ab50

Change-Id: Ib69611f76e26ad0a78a1468704700ff437dcfe0e
2019-04-25 07:48:52 -07:00
Tao Bao f454c3a0b4 releasetools: Accept PRESIGNED keys in apexkeys.txt.
For an PRESIGNED APEX, it has the following format, which should be
considered as a valid input.

name="foo.apex" public_key="PRESIGNED" private_key="PRESIGNED" container_certificate="PRESIGNED" container_private_key="PRESIGNED"

Bug: 131153746
Test: Run sign_target_files_apks.py on a target_files.zip with PRESIGNED
      APEXes.
Test: python -m unittest sign_target_files_apks
Change-Id: I51076b0c6eddfb75637d37659a08009f0a88e931
2019-04-25 00:10:07 -07:00
Tao Bao ff354bf918 Merge "releasetools: PRESIGNED APEX container entails PRESIGNED payload."
am: a212ab59df

Change-Id: I24e61e46c4b420bc15f074188efbcff71a337b85
2019-04-24 19:13:58 -07:00
Tao Bao a212ab59df Merge "releasetools: PRESIGNED APEX container entails PRESIGNED payload." 2019-04-25 02:03:50 +00:00
Bill Peckham 9662cfb234 Sort content of merged target files package.
By sorting the content of the final output merged target files package, the
merged target files package is more like the target files packages generated by
a build.

Test: Generate merged target files package, verify that content is sorted.
Change-Id: Ic0c198630ebd7692a3f3f9663d85e4b45229175c
2019-04-24 17:59:01 -07:00
Daniel Norman da27680ccb Merge "Adds support to create img from target files directory instead of zip."
am: 74a679d963

Change-Id: I515fd2c3ed0dc71bbc4999a9b3c283cc196af200
2019-04-24 17:11:41 -07:00
Tao Bao f98fa1094e releasetools: PRESIGNED APEX container entails PRESIGNED payload.
We used to require explicitly setting both (e.g. `-e foo.apex=` and
`--extra_apex_payload_key foo.apex=` to skip signing `foo.apex`).

This CL allows specifying `-e` alone to achieve the same result.
However, if a conflicting `--extra_apex_payload_key` is also specified,
that would be considered as a config error.

Bug: 131153746
Test: Run sign_target_files_apks.py with `-e foo.apex=` alone to skip
      signing foo.apex.
Test: Run sign_target_files_apks.py with `-e foo.apex=` and
      `--extra_apex_payload_key foo.apex=key` and expect assertion error.
Change-Id: Ia747f59ee726b60bdb1445024e749320171064c2
2019-04-24 15:17:23 -07:00
Daniel Norman b8a2f9df51 Adds support to create img from target files directory instead of zip.
This is used by merge_target_files to prevent an unnecessary unzip and
copy.

Test: Ran merge_target_files.py and booted using the img.zip.
Change-Id: I6fe0dd025b30b3f4965c9b22fb6943019bf5899b
2019-04-24 20:53:22 +00:00
Tao Bao c233321fd9 Merge "Write ro.build.ab_update to /vendor/build.prop."
am: 2f401655a9

Change-Id: Id6503be1cac99a302cae1df9427e33c00c6f0f90
2019-04-23 15:29:33 -07:00
Tao Bao 2f401655a9 Merge "Write ro.build.ab_update to /vendor/build.prop." 2019-04-23 22:16:48 +00:00
Bowgo Tsai 2b90184d5c Merge "Avoid signing debuggable boot-debug.img"
am: f0151b1514

Change-Id: Id1c3d08c2ace0fb0189c51f2447fb866a71fc7c8
2019-04-23 00:46:29 -07:00
Bowgo Tsai 78369ebbc1 Avoid signing debuggable boot-debug.img
The boot-debug.img should NOT be release signed and can only be used
if the device is unlocked. Adding a check to prevent the tool from
signing this debuggable boot.img.

See the following for more details about boot-debug.img:

  https://android-review.googlesource.com/c/platform/build/+/947857

Bug: 126493225
Test: put a file /force_debuggable into boot.img, checks the following
      command fails:
        ./build/tools/releasetools/sign_target_files_apks \
        out/dist/*-target_files-*.zip signed-target_files.zip
Change-Id: Ia5232949cb9582d2b4eaa171d9e9f3fe7317d418
2019-04-23 12:55:10 +08:00
Tao Bao 67932ab694 Write ro.build.ab_update to /vendor/build.prop.
It's a vendor-specific property, which was historically included into
/system/build.prop prior to this change.

Whether a target uses A/B OTA shouldn't affect anything on the system
image, including the `ro.build_ab_update` property. Moving it to vendor
partition will also make it consistent with other A/B specific configs,
such as the `slotselect` flag in device fstab
(/vendor/etc/fstab.$(PRODUCT_PLATFORM)).

Bug: 130516531
Test: Build and flash crosshatch-userdebug. Check /system/build.prop,
      /vendor/build.prop and the runtime property.
Change-Id: I927625fbcc02c4a875a1f39850b51576f5ff6c66
2019-04-22 21:08:25 -07:00
Tao Bao 5a5d4e0d63 Merge "releasetools: Update the comment on common.AVB_PARTITIONS."
am: 7b3e97b1ea

Change-Id: I7bdbd2e46c79a4ca5c138dd4681448a4ad032bbe
2019-04-22 20:27:34 -07:00
Tao Bao 7b3e97b1ea Merge "releasetools: Update the comment on common.AVB_PARTITIONS." 2019-04-23 03:09:26 +00:00
Daniel Norman a40cffbea9 Merge "Adds --output-img flag to enable building the IMG package."
am: 235f7d7686

Change-Id: I8b058ea7e53f39fa9a313da0dd04d70a41a2f548
2019-04-18 19:56:40 -07:00
Treehugger Robot 235f7d7686 Merge "Adds --output-img flag to enable building the IMG package." 2019-04-19 02:43:20 +00:00
Daniel Norman 1bd2a1d946 Adds --output-img flag to enable building the IMG package.
This simplifies the use case for mixed build users. Instead of having to
remember to call img_from_target_files.py after this script, they can
use this flag to automatically create the IMG package.

Also includes an update to super_empty.img logic. The super_empty.img is
now always created for dynamic-partition builds. The flag now only
controls copying the super_empty.img to a user-provided location.

Bug: 129976345
Test: Ran merge_target_files.py using --output-img and
--output-super-empty and inspected the resulting img zip and
super_empty.img.

Change-Id: Ida602942bb7a6b4b94f4e225640af9104fc9360c
2019-04-18 16:37:29 -07:00
Dan Willemsen a3f7a5fb6d Merge "TARGET_FS_CONFIG_GEN is a list, not a single path"
am: 0d4ee006db

Change-Id: Ie7733c22baa9a1f401dd5e2244a89e8bdc310a20
2019-04-18 12:48:08 -07:00
Dan Willemsen 7f25f2aed9 TARGET_FS_CONFIG_GEN is a list, not a single path
Bug: 130787336
Test: m oemaids_header_gen oemaids_headers passwd group
Test: Set TARGET_FS_CONFIG_GEN to a list of paths
Change-Id: I5186b378fea8865f46cfd891420ba576f36e2565
2019-04-18 17:16:50 +00:00
Daniel Norman 99a82fcb0d Merge "Runs python formatter and linter over merge_target_files."
am: 8551d21cef

Change-Id: Ifc1de88529faf40df7506a1a5f29dd672ba4eefe
2019-04-17 19:42:36 -07:00
Daniel Norman b6a15bca81 Merge changes from topic "merge_target_files_new_flags"
am: 324d553c7c

Change-Id: I13966ab6a8a263684385eed483712ba2cd61a539
2019-04-17 15:07:52 -07:00
Daniel Norman e5b134aa02 Runs python formatter and linter over merge_target_files.
Test: python -m unittest test_merge_target_files
Change-Id: I95c8611439a019cd21ba16a93327f35e2035a84d
2019-04-17 14:54:06 -07:00
Daniel Norman 3b64ce1437 Adds --output-ota flag to enable building the OTA package.
This simplifies the use case for mixed build users. Instead of having to
remember to call ota_from_target_files.py after this script, they can
use this flag to automatically create the OTA package.

Bug: 129976345
Test: Ran merge_target_files.py using --output-ota and inspected the
resulting zip.

Change-Id: Icc95943c24b8f83b3221e845a7d69a34c1edb4fc
2019-04-17 10:28:57 -07:00
Daniel Norman f031825560 Adds --output-super-empty flag to enable building super_empty.img.
Any mixed build that uses dynamic partitions will require a
super_empty.img image. This image must be created from the merged
misc_info.txt file, so adding this functionality here simplifies
the creation of this image for users (versus having to call
build_super_image.py manually after calling merge_target_files.py).

Bug: 129976345
Test: Ran merge_target_files.py on a dynamic partition enabled build
using the new --output-super-empty flag.

Change-Id: I73901f363d73c9fae1af1579faa2a908369dbbec
2019-04-17 10:22:11 -07:00
Daniel Norman fdb38817ea Adds output-dir and output-item-list for copying only certain files.
This provides the ability to run merge_target_files without the end goal
of a target files zip. This is useful for users that only want the IMAGES
folder, for example.

Bug: 130304869
Test: python -m unittest test_merge_target_files
Change-Id: If0412b8e1eb85fe09d7b689fd7f56ce84067faea
2019-04-17 10:17:50 -07:00
Tao Bao dc0ad08e49 Merge "releasetools: Enable a few tests in OtaFromTargetFilesTest."
am: 56215ba930

Change-Id: Iccce31970307dff8bf61d6495ff3a65bff3429ed
2019-04-16 07:22:17 -07:00
Tao Bao 69909c96ba releasetools: Enable a few tests in OtaFromTargetFilesTest.
They used to be disabled due to the assertion of search_path in setUp()
function, which is not a prerequisite for most of the tests.

Bug: 112080715
Test: `atest releasetools_test`
Test: TreeHugger
Change-Id: I3cbaf42aa09dba0b87a64e11d97de9b3f7af7a47
2019-04-15 07:33:32 -07:00
Tao Bao 4a5539cb99 Merge "relesetools: Enable releasetools_test in presubmit."
am: 2bfc94ebc6

Change-Id: If54e8a9ecd10a4c30fa0c50ec9d3eb1ac03eaa81
2019-04-14 08:21:15 -07:00
Tao Bao 2bfc94ebc6 Merge "relesetools: Enable releasetools_test in presubmit." 2019-04-14 15:09:19 +00:00
Tao Bao 74575ccf97 Merge "relesetools: Support running all the unittests with atest."
am: 2bb1380ee5

Change-Id: I825d3c87468773f8b543dae6b885957684ab0f85
2019-04-12 19:16:41 -07:00
Yifan Hong c9ab0da8d6 Merge "FileImage: make thread-safe"
am: c7b0df0295

Change-Id: I7fc0b214ad3e68192bd952c339e77fb17a2e8376
2019-04-12 19:15:53 -07:00
Tao Bao 2bb1380ee5 Merge "relesetools: Support running all the unittests with atest." 2019-04-13 01:50:09 +00:00
Yifan Hong 55988c4677 FileImage: make thread-safe
FileImage needs to be thread-safe because multiple
threads gets data from it when an incremental OTA
package is created.

Test: apply incremental OTA on cuttlefish
Bug: 113175337
Change-Id: I31637fce0fbd66f3fa6c5c478da09bae65a52229
2019-04-12 15:38:48 -07:00
Tao Bao 82490d3de1 relesetools: Enable releasetools_test in presubmit.
About half of the testcases rely on external tools (i.e. the ones in
`otatools.zip`, which are external to releasetools module, but still
built by Android). It's WAI as releasetools scripts are mostly for
gluing purpose.

However, the current support in Soong doesn't allow packing the helper
modules as part of the built releasetools_test. This CL adds a decorator
that allows declaring external dependencies in testcases, which will be
skipped while running in presubmit. It doesn't affect local invocation
of `atest releasetools_test`.

Fixes: 112080715
Test: `atest releasetools_test`
Test: TreeHugger; check that releasetools_test is invoked (and test
      passes).
Change-Id: I8fdeb6549023cf5ddeb79d610c7c37cf9f13d3cc
2019-04-12 15:26:35 -07:00
Tao Bao 30e31142ce relesetools: Support running all the unittests with atest.
All the unittests will be built into releasetools_test. One can run the
tests with `atest releasetools_test` or the traditional way
`test_utils.py`. The atest way is recommended, which additionally builds
the required tools.

With the current support in Soong, we can't pack the built tools into
releasetools_test yet. So running `releasetools_test` alone in clound
would fail. Follow-up CLs will address the issue in order to deploy the
tests with TEST_MAPPING.

Bug: 112080715
Test: `atest releasetools_test`
Change-Id: Ica95517a5ab326f4e58fc57c6c2c276cfe882f3c
2019-04-12 15:26:32 -07:00
Yifan Hong a5228f33ef Merge "Allow generating OTA package from non-sparse images."
am: fc6948b588

Change-Id: I94350a926540fee777b0471264ae091b0aed34df
2019-04-12 10:34:47 -07:00
Yifan Hong fc6948b588 Merge "Allow generating OTA package from non-sparse images." 2019-04-12 17:21:46 +00:00
Dan Willemsen 079d855245 Merge "Convert oemaids_headers / passwd / group to Soong"
am: 74a2572b99

Change-Id: I1e54ee9d10f6ad0bc1a3e1e07bbcc3b4f5674220
2019-04-11 16:43:27 -07:00
Treehugger Robot 74a2572b99 Merge "Convert oemaids_headers / passwd / group to Soong" 2019-04-11 23:36:09 +00:00
Yifan Hong 8a66a71b06 Allow generating OTA package from non-sparse images.
Test: build OTA package in cuttlefish

Bug: 120041578
Change-Id: I246c38e08376c837b7f126aa19cb8c1d73ed1e26
2019-04-11 14:38:21 -07:00
Pavel Salomatov b26ab68b26 Merge "docker: update sha256sum for repo version 1.25"
am: 2eb9692618

Change-Id: I45584dc394af3216b42e2a564c7ac62094699975
2019-04-11 12:39:33 -07:00
Treehugger Robot 2eb9692618 Merge "docker: update sha256sum for repo version 1.25" 2019-04-11 19:21:12 +00:00
Tao Bao f84391e27c Merge "releasetools: Remove the name restriction in common.GetSparseImage."
am: 33b8923ded

Change-Id: I2ebcc0105a8a9743ce569f34fd68692afd458500
2019-04-11 11:01:18 -07:00
Tao Bao 33b8923ded Merge "releasetools: Remove the name restriction in common.GetSparseImage." 2019-04-11 17:51:43 +00:00
Pavel Salomatov 4a7f6daa85 docker: update sha256sum for repo version 1.25
Change-Id: Iaec4b2429c61aa2d804e56a88cf66ae543a29805
2019-04-11 13:25:33 +03:00
Dan Willemsen d32e6d1314 Convert oemaids_headers / passwd / group to Soong
Bug: 118089258
Test: m oemaids_header_gen oemaids_headers passwd group
Change-Id: Ie3b92a499b44391e0692da5d9ad067089a62aabb
2019-04-10 20:46:33 -07:00
Yifan Hong d70f1c637a Merge "Reland "Only assert-max-image-size for static partitions.""
am: d72873dc41

Change-Id: I3ee60fcbd5c4dd0b7915f9927e4cc3414d5efe49
2019-04-10 13:23:36 -07:00
Dan Willemsen db1e6e9cbc Merge "Stop using build/target -> build/make/target symlink"
am: e3ef041244

Change-Id: Ia2e596189bde8cda5de576a9b279163f80073a4d
2019-04-10 13:15:41 -07:00
Treehugger Robot d72873dc41 Merge "Reland "Only assert-max-image-size for static partitions."" 2019-04-10 20:09:00 +00:00
Treehugger Robot e3ef041244 Merge "Stop using build/target -> build/make/target symlink" 2019-04-10 19:17:25 +00:00
Yifan Hong 43de6ab1ec Merge "Fix DataImage.ReadRangeSet()"
am: 3f8c09f8a5

Change-Id: If01f367cd3c244d01288d0eddb7bb17aec2b6c43
2019-04-10 11:14:12 -07:00
Yifan Hong 3f8c09f8a5 Merge "Fix DataImage.ReadRangeSet()" 2019-04-10 17:20:06 +00:00
Tao Bao b2de7d97de releasetools: Remove the name restriction in common.GetSparseImage.
The function used to be serving system and vendor partitions only (as
they were the only partitions using sparse image at the point). The code
itself doesn't rely on anything specific to system/vendor.

Test: python -m unittest test_common
Change-Id: Ia4ecdeedb262f3d9db082128eaf9bab299983333
2019-04-10 10:11:34 -07:00
Tianjie Xu e74a7b850d Merge "Pass the correct signature size to payload generator"
am: 33edbc98c8

Change-Id: I8e1fca4e043a580f71ddb026365f41deb74bb55d
2019-04-09 23:07:21 -07:00
Dan Willemsen 0ab1be6fe2 Stop using build/target -> build/make/target symlink
Instead, fully specify build/make/target/... everywhere

Test: treehugger
Change-Id: Idf89b2e6a0b777adbfb6370ea34f35faee6d4965
2019-04-09 21:35:37 -07:00
xunchang 376cc7c452 Pass the correct signature size to payload generator
The signature size will be 512 bytes when signing the payload
with 4096 bits key. This cl determines the key size with
"openssl rsa -modulus"

The new key in testdata is generated by
"openssl genrsa -out testkey 4096"

Bug: 129163830
Test: generate and verify an OTA package
Change-Id: I6662b0a0c553dc0fd84711312a1256b887e332fd
2019-04-09 17:41:00 -07:00
Yifan Hong 6f3eaeb84d Fix DataImage.ReadRangeSet()
It returns a list of one generator object, not a list
of strings.

Test: test_blockimgdiff
Change-Id: I8962c539c2ce3fae90d428b38c4b0e52c5a2cdad
2019-04-09 17:01:53 -07:00
Yifan Hong 8c3dce0c56 Reland "Only assert-max-image-size for static partitions."
This reverts commit 6e099095d1.

Reason for revert: reland the CL

Bug: 122377935
Test: build blueline_mainline

Change-Id: Iee594b64e687decff186c0fa60f82b88608febe9
2019-04-09 10:56:34 -07:00
Florian Mayer 3db0c17630 Merge "Revert "Only assert-max-image-size for static partitions.""
am: 1d26ca95c3

Change-Id: I82d0e53f7a817f661b46556b2e59279e132119ad
2019-04-09 06:31:45 -07:00
Florian Mayer 1d26ca95c3 Merge "Revert "Only assert-max-image-size for static partitions."" 2019-04-09 13:21:23 +00:00
Florian Mayer 6e099095d1 Revert "Only assert-max-image-size for static partitions."
This reverts commit 67e4336912.

Reason for revert: Broke master

Change-Id: I8a5054a42f145881437e2cb5b372f276bfdaa3d2
2019-04-09 09:54:59 +00:00
Yifan Hong 27128f4b10 Merge changes from topic "dap_size_check"
am: 3c4889fc79

Change-Id: I58130717a9aaf1a70ecebb85eaf783e1d3d2f504
2019-04-08 21:20:02 -07:00
Treehugger Robot 3c4889fc79 Merge changes from topic "dap_size_check"
* changes:
  Only assert-max-image-size for static partitions.
  sparse_img.py --get_partition_size return size of partition
  Revert "Fix dynamic partition size check for devices with recovery"
2019-04-09 02:17:36 +00:00
Yifan Hong 28c875581c Merge "Build non-sparse super image if necessary."
am: 405d3a4ade

Change-Id: I3b9c5489d9cdd60a57fc9093ff1083cba94075bf
2019-04-04 16:22:37 -07:00
Yifan Hong 67e4336912 Only assert-max-image-size for static partitions.
assert-max-image-size doesn't make sense for
dynamic partitions, as build_image.py always find the
right size for the output image. Hence:

- build_image.py no longer need to write generated_*_info.txt
  (which contains the size of the image).
- assert-max-image-size on the static BOARD_*IMAGE_PARTITION_SIZE. If
  a partition is dynamic, that variable isn't set, and
  assert-max-image-size becomes a no-op. If the partition is static,
  assert-max-image-size checks the static partition size as it used
  to be.
- Fix read-size-of-partitions to use the size of the partition by
  reading the image directly (instead of using generated_*_info.txt).

For devices without AVB, with DAP enabled, and does not have
RESERVED_SIZE for partitions, because of right sizing, the original
code always warns about approaching size limits. Since such checks
doesn't make sense for dynamic partitions, remove them.

Test: builds on device with dynamic partitions
Test: builds on cuttlefish with DAP enabled (without AVB), no
      more size limit warnings:
WARNING: out/target/product/vsoc_x86/vendor.img approaching size limit (X now; limit X)

Fixes: 122377935
Change-Id: I75e1b8322197cb18cf397d02aefd49d777bb6405
2019-04-04 15:09:51 -07:00
Yifan Hong 7ad83b634e sparse_img.py --get_partition_size return size of partition
Also, move code from build_super_image.py to sparse_img.py.

Test: sparse_img.py on sparse and non-sparse images
Bug: 122377935
Change-Id: Ie91fdfdbb54298ea27eb20d1b5363aeb1470356e
2019-04-04 12:59:00 -07:00
Yifan Hong cb35bd9e51 Build non-sparse super image if necessary.
If TARGET_USERIMAGES_SPARSE_EXT_DISABLED is set, don't provide
--sparse to lpmake, so that a non-sparse super image is built.

Test: build with the flag set.
Fixes: 120041578
Change-Id: I5a26e4c793b0e2ddc89e9c38c8828ac21044e78a
2019-04-03 10:58:25 -07:00
Tao Bao a24aecb821 Merge "releasetools: Update the embedded AVB pubkey in an APEX."
am: 289fa3cea3

Change-Id: Iaf4497f41f38fff7bf646f923f61b7a8199e5cfc
2019-04-02 10:22:53 -07:00
Tao Bao 289fa3cea3 Merge "releasetools: Update the embedded AVB pubkey in an APEX." 2019-04-02 16:56:45 +00:00
Bill Peckham a635376ce1 Merge "Add support merging system and other for the non-A/B configuration."
am: 5f4186b000

Change-Id: I347d05f8a60c5f63ba591aed8d16b078bfdfb840
2019-04-02 06:24:25 -07:00
Tao Bao 9c0f443264 releasetools: Update the embedded AVB pubkey in an APEX.
APEX keys are now embedded in the APEX [1].

[1] https://android-review.googlesource.com/c/platform/system/apex/+/936942

Fixes: 128297564
Test: Run sign_target_files_apks.py on a target_files.zip built with the
      CL above.
Change-Id: I219cc3e6ce6f652537fcc37322c8902f295c1447
2019-04-01 21:30:07 -07:00
Bill Peckham 364c1ccaa5 Add support merging system and other for the non-A/B configuration.
For non-A/B, you must supply the --system-item-list, --other-item-list, and
--system-misc-info-keys parameters approrpriate for merging two partial target
files. Additionally, you must supply the --rebuild-recovery option to correctly
generate the filesystem config and file contexts. With all of these parameters,
the script will generate a merged target files containing the correct recovery
files.

Also fix the --keep-tmp option to be consistent with the other options.

Bug: 122813742
Test: verify that merged target image boots and can perform OTA.
Change-Id: I5a942ac0cd9924fec419a686794a2340304594c8
2019-04-01 14:55:33 -07:00
Daniel Norman d8414c71b8 Merge "Adds some tests for merge_target_files."
am: 482e67f4ee

Change-Id: I246a1e6f2afceb42a5aca56b46291fbd37860ac5
2019-03-28 21:30:49 -07:00
Daniel Norman 6d82fa3961 Adds some tests for merge_target_files.
Test: python -m unittest test_merge_target_files
Bug: 129262038
Change-Id: Ibcb3b384b81ceaa1924a6cd402a8880bd3cfbba6
2019-03-28 14:43:30 -07:00
Tao Bao ea673330bd Merge "releasetools: Remove the sanity check on APEX payload key names."
am: c292edc22c

Change-Id: I3ff4de4afde65971f9967db73a6373107517c8fa
2019-03-27 08:51:33 -07:00
Tao Bao c292edc22c Merge "releasetools: Remove the sanity check on APEX payload key names." 2019-03-27 15:44:29 +00:00
Tao Bao 26b2664dce Merge "releasetools: Re-enable verifying AVB-signed images."
am: 5ed75d74e3

Change-Id: I45ff35f4b64967f5dd0c539b5abf535ab648408a
2019-03-26 20:36:22 -07:00
Tao Bao 5ed75d74e3 Merge "releasetools: Re-enable verifying AVB-signed images." 2019-03-27 03:20:13 +00:00
Tao Bao 6d9e3da5f9 releasetools: Remove the sanity check on APEX payload key names.
Unlike container keys/certs, we'll always carry full names for APEX
payload signing keys.

Test: Run sign_target_files_apks.py on a target_files.zip with
      mismatching payload signing keys (e.g. shim apexes).
Test: `python -m unittest test_sign_target_files_apks`
Change-Id: Ifa329478f43b4f5ae665821564dbc14af7841330
2019-03-26 13:05:46 -07:00
Tao Bao a81d429928 releasetools: Re-enable verifying AVB-signed images.
This reverts commit 9788b4ed31. All the
blocking issues have been addressed.

Fixes: 120517892
Test: Run validate_target_files.py on crosshatch signed
      target_files.zip.
Change-Id: I95de241e159998e002dedddafea65953b1a1b263
2019-03-26 12:13:37 -07:00
Daniel Norman 081eedce39 Merge "Merges dynamic partition misc_info.txt keys from both system and other."
am: c21a8448d1

Change-Id: I91afb67ab90b8a6f0c54138b299481403e4b1c2d
2019-03-25 16:26:53 -07:00
Daniel Norman c21a8448d1 Merge "Merges dynamic partition misc_info.txt keys from both system and other." 2019-03-25 23:15:09 +00:00
Anton Hansson fd946975d0 Merge "Put DEVICE/PRODUCT overlays in different partitions"
am: 94fa0e75cb

Change-Id: I490160177bd0084721212d832dff8c0d721e2e14
2019-03-25 02:32:55 -07:00
Anton Hansson 94fa0e75cb Merge "Put DEVICE/PRODUCT overlays in different partitions" 2019-03-25 09:25:47 +00:00
Tao Bao 1ece90be3b Merge changes I91bd3dce,I2e941fd9
am: 9a5093e5f9

Change-Id: Ic708931f9ef0ed9a23c8e7146013a7b8dea9e647
2019-03-24 10:44:21 -07:00
Tao Bao ffc9a30946 releasetools: Fix alignment issue when signing APEXes.
Previously it was following a wrong order by doing `zipalign` after
calling SignApk, which effectively compromised the signature. This CL
corrects the logic, and follows the same flow as in build system:
 - Pack APEX file;
 - `zipalign -f 4096`;
 - Call SignApk to sign the container with `-a 4096` flag.

Bug: 129148142
Test: Run sign_target_files_apks.py on taimen target_files.zip. Boot the
      image after signing.
Change-Id: I91bd3dce4f45c1891c5e122212a699f4808618fa
(cherry picked from commit 0e06cb0a8b)
2019-03-23 10:27:43 -07:00
Daniel Norman 19b9fe9fdf Merges dynamic partition misc_info.txt keys from both system and other.
To build a complete list of the dynamic partitions and partitions
groups, we need to merge the contribution from the system and other
target files.

Bug: 127687287
Test: Running merge_target_files.py and observing partition lists are
merged as expected.
Change-Id: I5bb9bd0e3179d48c9bfacdb3aca8253158f61cf6
2019-03-22 14:46:01 -07:00
Tao Bao 1e4cbfaf5c releasetools: Fix an issue in handling PRESIGNED APEX keys.
For PRESIGNED APEXes, we should keep carrying the matching public keys
at /system/etc/security/apex.

Bug: 129148142
Test: Run sign_target_files_apks.py on a target_files.zip with presigned
      APEXes. Check the output zip.
Change-Id: I2e941fd9b10e99d2db9df1e5308cbbe8c760177b
(cherry picked from commit bf3fb024cd)
2019-03-22 14:11:24 -07:00
Anton Hansson cb8276fa93 Put DEVICE/PRODUCT overlays in different partitions
This change changes auto-generated RROs from DEVICE_PACKAGE_OVERLAYS
to be generated in the vendor partition, as opposed to /product where
they were generated in the past.

Note that PRODUCT_PACKAGE_OVERLAYS continue generating RRO packages
to /product, which means that a single app can be overlayed from
different partitions. These RROs have been given module and package
names based on their location.

Bug: 127758779
Test: verify noop on presubmit targets
Change-Id: I5cee70e28e3969e67b2d83eaf25d9c6e3a11102d
2019-03-22 13:25:20 +00:00
Tao Bao 5cc0abb02f releasetools: Update the comment on common.AVB_PARTITIONS.
Bug: 123611926
Test: TreeHugger
Change-Id: I501e0921ae75adec96bda38af5a538ecf7764a82
2019-03-21 10:32:45 -07:00
Tao Bao d2e70241f3 Merge changes I662aab3d,I5e741c27
am: c62b9a2347

Change-Id: Iae61ac00bce4c9189582c301afd562263311f0f7
2019-03-21 10:02:01 -07:00
Tao Bao c62b9a2347 Merge changes I662aab3d,I5e741c27
* changes:
  Revert^2 "releasetools: check_target_files_signatures.py checks APEXes."
  releasetools: common.UnzipTemp() filters out non-matching patterns.
2019-03-21 16:38:04 +00:00
Logan Chien 5d00745b0a Merge "Update check_elf_file.py for clang-r353983"
am: 81589605fd

Change-Id: I0bdb631d5eeae4fd834efa5255ae472d76763935
2019-03-21 01:19:49 -07:00
Logan Chien 81589605fd Merge "Update check_elf_file.py for clang-r353983" 2019-03-21 08:05:16 +00:00
Vic Yang 38f68f7a2a Merge changes from topic "vndk-no-vendor-variant"
am: 30dda1da5e

Change-Id: I646d55e6195a24530bf22d1e7588b2dd99b27eba
2019-03-20 21:39:57 -07:00
Bowgo Tsai 916e876f7a Merge "Moving system_other key into product.img"
am: 7e87c72fb0

Change-Id: I29ba3d2056fca68a356cb26a8e17b29d415ed08e
2019-03-20 21:36:24 -07:00
Vic Yang 30dda1da5e Merge changes from topic "vndk-no-vendor-variant"
* changes:
  Add support for no-vendor-variant VNDK
  Add module-target-built-files function
2019-03-21 04:30:47 +00:00
Treehugger Robot 7e87c72fb0 Merge "Moving system_other key into product.img" 2019-03-21 04:26:21 +00:00
Tao Bao 359862db12 Revert^2 "releasetools: check_target_files_signatures.py checks APEXes."
This reverts commit 5516d37f41.

The previous issue in unzipping non-matching files has been addressed
with commit a49054ca2f2959f50f3188914ec0faebc90ebcbe. This CL rolls
forward to allow dumping container certifcates for APEXes.

Bug: 128848294
Test: Run check_target_files_signatures.py on target_files.zips w/ and
      w/o APEX files.
Change-Id: I662aab3d96fc40ac8e5e206e32b73ac763220b70
2019-03-20 12:40:34 -07:00
Tao Bao 0ff15de32a releasetools: common.UnzipTemp() filters out non-matching patterns.
common.UnzipTemp() calls `unzip` to do the unzipping, which will
complain if there's non-existent names in the given list. Prior to this
CL, callers had to do the work to remove non-existent entries. This CL
filters out the given patterns in common.UnzipTemp()/common.UnzipToDir()
to make callers' works easier.

Bug: 128848294
Test: `m dist` with aosp_taimen-userdebug (which calls
      ota_from_target_files.py on a target_files.zip that doesn't
      contain RADIO/*).
Test: `python -m unittest test_common.CommonZipTest`
Change-Id: I5e741c27ea8d0b8126c398a7e1b56a8deb4a3d7f
2019-03-20 12:38:09 -07:00
Vic Yang 51512c558c Add support for no-vendor-variant VNDK
When TARGET_VNDK_USE_CORE_VARIANT is set to true, the vendor variant of
VNDK libraries are by default not installed.  Instead, the core variant
will be used by vendor binaries at runtime.

To ensure the core variant of VNDK libraries are installed, we also add
a flag LOCAL_VNDK_DEPEND_ON_CORE_VARIANT to indicate that the vendor
variant module depends on the core variant module.  This flag should be
set by Soong for all VNDK libraries without the vendor variant
installed.  When the flag is set, the vendor variant binary is also
compared against the core variant binary to ensure they are
functionally identical.

As we are merging the two variants for some libraries, we need a new
link type to denote a module is usable as both native:vndk and
native:platform.  We add native:platform_vndk for this.

Bug: 119423884
Test: With the corresponding Soong change, build with
      TARGET_VNDK_USE_CORE_VARIANT set to true.
Test: Add a dummy VNDK library and a dummy vendor binary that depends
      on it.  Build with no-vendor-variant VNDK and check the core
      variant is installed.
Test: Add conditional compilation based on __ANDROID_VNDK__ in the
      dummy VNDK library and check build fails.

Change-Id: I40000f2728e8193212113c1ee950e9d697f2d40d
2019-03-20 10:23:04 -07:00
Anton Hansson f5c74dd470 Merge "Refactor generate_enforce_rro"
am: bec4aa868a

Change-Id: I1f616f8020f85df60b89cdc3d0f489e9111d0454
2019-03-20 09:10:12 -07:00
Anton Hansson bec4aa868a Merge "Refactor generate_enforce_rro" 2019-03-20 15:18:19 +00:00
Anton Hansson a0ea5a17e8 Merge "Rename DEVICE arg in common buildprops script"
am: c371f19e89

Change-Id: I24bd162fcfe728f3972eb4e3ce6d5df74ba8bf50
2019-03-20 03:28:08 -07:00
Anton Hansson c371f19e89 Merge "Rename DEVICE arg in common buildprops script" 2019-03-20 10:25:01 +00:00
Bowgo Tsai e4544b1c02 Moving system_other key into product.img
Currently system_other AVB public key is placed in system.img.
However, this makes it's harder to have a *generic* system.img
across different product configs. Moving the key to /product
partition to allow more product-specific AVB keys.

Device board config can add /product/etc/fstab.postinstall,
to mount system_other with this key in /product. It can specify
different mount options, file systems, verity settings, etc., in
this product-specific fstab as well.

Bug: 123611926
Test: `make productimage` checks the following is generated.
      $OUT/product/etc/security/avb/system_other.avbpubkey
      Also checks it's included in $OUT/installed-files-product.{json, txt}

Test: run the following command and checks that
      PRODUCT/etc/security/avb/system_other.avbpubkey is updated:
      ./build/tools/releasetools/sign_target_files_apks \
        --avb_system_other_algorithm SHA256_RSA2048 \
        --avb_system_other_key external/avb/test/data/testkey_rsa2048.pem \
        out/dist/*-target_files-*.zip signed-target_files.zip

Change-Id: I6804f29941bec54375d80bd68a5aedb5c23b842e
2019-03-20 16:18:11 +08:00
Logan Chien 99cdf5385d Update check_elf_file.py for clang-r353983
This commit updates how `check_elf_file.py` parses the symbol name
because the `llvm-readobj` (from clang-r353983) does not print "@" if
the symbol is not versioned.

See also. https://reviews.llvm.org/D56319

Bug: 128959554
Test: CHECK_ELF_FILES=true make check-elf-files
Change-Id: I0dee5e505225e57750a2c86cf0d25a151c218eb1
2019-03-20 15:24:00 +08:00
Daniel Norman 0e58857364 Merge "Validates the config lists used by the script."
am: a4ab1d8490

Change-Id: I49846ae2cd3e66df79b8230363f916fa5c380f5a
2019-03-19 17:10:46 -07:00
Daniel Norman a4ab1d8490 Merge "Validates the config lists used by the script." 2019-03-19 23:56:25 +00:00
Tao Bao 7898831d95 Merge "releasetools: Allow skipping PRESIGNED APEXes."
am: 2812fd32ac

Change-Id: I2586d1663b0625dee739f964116e8371d90fb813
2019-03-19 16:24:24 -07:00
Tao Bao 2812fd32ac Merge "releasetools: Allow skipping PRESIGNED APEXes." 2019-03-19 23:04:07 +00:00
Daniel Norman 62f2c36d9a Merge "Adds optional --rebuild_recovery flag to merge_target_files."
am: fab3f29e5a

Change-Id: I834d2e7ed672dce20960dd5c97b57fe3dbdc3bb6
2019-03-19 14:52:17 -07:00
Daniel Norman fab3f29e5a Merge "Adds optional --rebuild_recovery flag to merge_target_files." 2019-03-19 21:32:28 +00:00
Tao Bao a08464f59d Merge "Revert "releasetools: check_target_files_signatures.py checks APEXes.""
am: a0debcb62f

Change-Id: Iffe70f3385d53e15e7fee3fdfa56dc5fb33aa4e6
2019-03-19 13:40:35 -07:00
Tao Bao e134399cab releasetools: Allow skipping PRESIGNED APEXes.
This CL adds support that allows treating an APEX as pre-signed. We can
skip signing an APEX with `-e <apex-name>=` and
`--extra_apex_payload_key <apex-name>=`. Note that the payload_key and
container_key must be in consistent state - either they're both
PRESIGNED or none of them is. CheckApkAndApexKeysAvailable() has been
updated to perform the sanity check.

Bug: 123716522
Test: Run sign_target_files_apks.py with the above flags.
Test: python -m unittest test_sign_target_files_apks
Change-Id: Id1e2f3f2facd4a97a385983cc9b78c028f7e7e73
2019-03-19 12:25:02 -07:00
Daniel Norman e596452f03 Validates the config lists used by the script.
This validation is to help ensure that any usage of custom merge config
files does not accidentally exclude any item that has been added to the
default config lists.

Bug: 124197349
Test: Run merge_target_files with custom merge config files.
Change-Id: I34c51cb75212368146a2944d37621f311060d24d
2019-03-19 17:47:49 +00:00
Tao Bao 5516d37f41 Revert "releasetools: check_target_files_signatures.py checks APEXes."
This reverts commit d8469727bc. The script
is broken on target_files.zip that don't contain any APEX.

Bug: 128848294
Test: Run check_target_files_signatures.py on target_files.zip w/o APEX.
2019-03-19 09:30:08 -07:00
Tao Bao 26541cd427 Merge "releasetools: Kill the use of os.getenv('AVBTOOL')."
am: e3f9dc6113

Change-Id: I31c769d45d049a0867aed3db84790fb8b2db1c6d
2019-03-19 09:05:09 -07:00
Tao Bao e3f9dc6113 Merge "releasetools: Kill the use of os.getenv('AVBTOOL')." 2019-03-19 15:53:26 +00:00
Tao Bao f88e0ce01d releasetools: Kill the use of os.getenv('AVBTOOL').
OTA tools should pick up the avbtool, as listed in dict['avb_avbtool'],
from the current PATH (plus bin/ under the dir specified via `--path`),
the same way as handling all other host tools.

Test: `m dist`
Change-Id: I3eb4d2c61979b03d9c23b2403d9a38cf052d87ea
2019-03-18 21:01:43 -07:00
Yifan Hong 5aec484888 Merge "Add supernod build target."
am: 691defc4bd

Change-Id: I5716c6a8028bb6c7beaf2ecbdd6ea28e44ad07ec
2019-03-18 17:06:47 -07:00
Yifan Hong 691defc4bd Merge "Add supernod build target." 2019-03-18 23:46:05 +00:00
Tao Bao f9a68d8167 Merge "releasetools: Fix an issue when using APEX container key mapping."
am: 7cd870ed60

Change-Id: I3124312baf6f3e40a00f8c2bb079fa3155197828
2019-03-18 14:34:51 -07:00
Daniel Norman a4911da57d Adds optional --rebuild_recovery flag to merge_target_files.
Also makes AddSystem check that an output_zip exists before attempting
to add the recovery patch to the output zip.

Bug: 128838154
Test: Running merge_target_files with --rebuild_recovery and verifying
it passes --rebuild_recovery to add_img_to_target_files.
Change-Id: I19347b2c0dabf29b7196045b18551b5d0687df2c
2019-03-18 12:29:31 -07:00
Tao Bao fa9de0aae8 releasetools: Fix an issue when using APEX container key mapping.
The keys_info in the touched code is a tuple, which is immutable.

Bug: 123716522
Test: Run sign_target_files_apks.py with '-e foo.apex=bar' that replaces
      the APEX container key.

Change-Id: I4e57e46c93a56b7f6646764d021ebb42c19bf7f5
2019-03-18 10:26:09 -07:00
Anton Hansson 08231e1786 Refactor generate_enforce_rro
A few tweaks to make it easier to extend to generating RROs in
multiple partitions:
- deduce the module name inside generate_enforce_rro
- dedup rule definition
- tweak framework-res check to use source module name instead

Bug: 127758779
Test: verify noop on presubmit targets
Change-Id: I2f0d6270b21f5427c372c04a5c6e7fb712e72a9a
2019-03-18 14:21:09 +00:00
Baligh Uddin eb5af6fa98 Merge changes I3fa13e3d,I7b7f0017,I2ef318e0
am: 0573298a18

Change-Id: I89a00b65ec6c9c44ccd0d43eda6c9f8049749f04
2019-03-17 11:54:41 -07:00
Tao Bao aa7e993a22 releasetools: Support signing APEXes.
Bug: 123716522
Test: Run sign_target_files_apks.py to sign a target_files with APEXes.
Test: Run check_target_files_signatures.py on signed artifact.
Test: python -m unittest test_sign_target_files_apks
Change-Id: I3fa13e3d9461cf5e0838e0572d436e218164fe41
2019-03-15 22:15:51 -07:00
Tao Bao 1cd59f2a26 releasetools: Add apex_utils.py.
The added `testdata/testkey_with_passwd.key` is generated with:

$ openssl pkcs8 -inform DER -in testdata/testkey_with_passwd.pk8 \
    -out testdata/testkey_with_passwd.key -passin pass:foo

Bug: 123716522
Test: python -m unittest test_apex_utils
Change-Id: I7b7f00178ecab35c3e41ecf4d10295fe9bf480ab
2019-03-15 22:08:42 -07:00
Tao Bao d8469727bc releasetools: check_target_files_signatures.py checks APEXes.
Only the container certs will be checked and reported. For the payload
within an APEX, we can't easily extract the cert info.

It needs to go along a longer path, if ever needed, by:
 - extracting public keys from all the available certs;
 - using each of them to verify against an APEX payload to find a match
   (`avbtool verify_image --image payload --key public_key`).

Bug: 123716522
Test: Run check_target_files_signatures.py on target_files with APEXes.
Change-Id: I2ef318e05433d2d65ab84e2dff9e01fb6ee3373d
2019-03-15 20:56:13 -07:00
Tao Bao 3f759a23ce Merge changes I1f645008,Ic68c019f
am: 015f83137d

Change-Id: I20ae63c891848d0426259b066265e7423a7ed5c8
2019-03-15 20:47:13 -07:00
Tao Bao 2cc0ca1770 releasetools: Add common.ExtractAvbPublicKey().
Bug: 123716522
Test: python -m unittest test_common
Change-Id: I1f645008a14cc882ef280f169c36e4b14a53ef88
2019-03-15 10:47:46 -07:00
Tao Bao badceb2d60 releasetools: Initalize logger when signing.
Other modules have switched to logging module. sign_target_files_apks.py
needs to init the logger to get the logs.

Test: Run `sign_target_files_apks.py -v`. Check outputs.
Test: Run `check_target_files_signatures.py -v`.
Change-Id: Ic68c019f6fb14840561885f1194ad6efdfdb7d82
2019-03-15 09:53:00 -07:00
Chih-hung Hsieh eb617633aa Merge "Accept the "file:(project:)?filePath" directive."
am: cda227eeaf

Change-Id: I977f161f5879573bdcbe415fb25b2e994ba25d7e
2019-03-13 14:02:07 -07:00
Yifan Hong 69e0d61cbe Add supernod build target.
superimage-nodeps and supernod depends
on images from $(ANDROID_PRODUCT_OUT) (not from
target files package). It doesn't rebuild source
images if they are present.

A typical workflow is:

    m -j
    # change code in system
    m snod -j
    m supernod -j

Test: For non retrofit, run:
      `m snod -j; m supernod -j`
Fixes: 128321505
Change-Id: Ib8c011cadb9c0cd334234aef39f19be6a48fee62
2019-03-13 11:15:21 -07:00
Chih-Hung Hsieh cc47729719 Accept the "file:(project:)?filePath" directive.
Test: checkowners.py some_owner_files
Bug: 126777637
Bug: 126761563
Change-Id: Iee03521681bc38fa28970a015058e1eba3c8b87a
2019-03-12 11:56:33 -07:00
Anton Hansson ef0b949be3 Rename DEVICE arg in common buildprops script
A followup change will make it not always equal TARGET_DEVICE,
so that name is unsuitable. Make its name follow the other product
variables.

Bug: 110206836
Test: presubmit
Change-Id: Icb1422ec5e7af658c5cc3070993c472e99805c6b
2019-03-12 18:03:23 +00:00
Daniel Norman f03c76d047 Merge "Adds support for optional config files to configure the merge."
am: cf9509df01

Change-Id: I67c1b99c582027e9993d9fe92acb94b4a66b80cd
2019-03-12 10:07:13 -07:00
Daniel Norman 2c99c5bbd2 Adds support for optional config files to configure the merge.
Bug: 124467065
Test: Running `python merge_target_files.py` using the three new flags
and observing that their contents are passed to the merge_target_files() function.
Change-Id: I4de46f041f5ae8bc8be2730313ce873a952bf78e
2019-03-12 16:51:18 +00:00
Pavel Salomatov 0c470d3b8c Merge "releasetools: Add compatibility for custom out directory."
am: b6f2f8b2d9

Change-Id: I93b394aed846563a54a9c83a3705f91ffbc2cc01
2019-03-11 13:14:37 -07:00
Treehugger Robot b6f2f8b2d9 Merge "releasetools: Add compatibility for custom out directory." 2019-03-11 19:51:14 +00:00
Pavel Salomatov 3267655004 releasetools: Add compatibility for custom out directory.
sign_target_files_apks script looks for the signapk.jar inside the out dir.
If the our dir is set to a different directory via OUT_DIR_COMMON_BASE the script does not work properly.

From now script checks if the OUT_DIR_COMMON_BASE is set, then searches the jar in the proper path.
If OUT_DIR_COMMON_BASE is unset, searches in "out" like it did before.

Test: Build with OUT_DIR_COMMON_BASE set and unset and verify that sign_target_files_apks works in both cases

Change-Id: I9218b98ff79526184f8353705640193405afac9e
2019-03-11 19:22:29 +03:00
Tao Bao dff72247d8 Merge "releasetools: Include retrofit info into package metadata."
am: 28a11ef040

Change-Id: I76c8f757efea6bb2ce8d0dc084083e5c8f6f6bc6
2019-03-07 11:04:35 -08:00
Tao Bao 28a11ef040 Merge "releasetools: Include retrofit info into package metadata." 2019-03-07 18:11:30 +00:00