Commit graph

2339 commits

Author SHA1 Message Date
Jiyong Park
b92b8f48fc verity_utils.py is a standalone binary
verity_utils.py gets an entry point and becomes a host binary. This is
to support signing images from the "bootimg" module type. Previously
this was done by directly invoking "avbtool" from the soong module, but
that required people to know the partition_size priori. The partition
size may not be known before actually building the partition image
especially when the partition is not for a physical partition but for a
partition in a composite image.

verity_utils.py, when the partition_size is not given, is capable of
calculating the mininum required partition size based on the size of the
unsigned input image file.

Bug: 180676957
Test: m microdroid_boot-5.10
Change-Id: I7bef292fb141c90899b7bdc0748895f95f964829
2021-03-17 16:28:16 +09:00
Treehugger Robot
b7ade64e3f Merge "Trigger data wipe on spl-downgrade as well" 2021-03-12 18:50:38 +00:00
David Anderson
45b4230726 Add --disable_vabc to ota_from_target_files help text.
Bug: N/A
Test: N/A
Change-Id: Ib8f9cd5dae746b0f2dac15d4de378116f4b93178
2021-03-11 13:01:31 -08:00
Kelvin Zhang
06400177a3 Trigger data wipe on spl-downgrade as well
Test: make an spl-downgrade pkg
Change-Id: I3220719a1b3fe6b2f07bfb9fd526ec6e94ca16ba
2021-03-10 11:06:10 -05:00
Tianjie
bf0b8a8610 Add a check for missing entries in AVB_FOOTER_ARGS_BY_PARTITION
Fail the signing if the AVB_FOOTER_ARGS_BY_PARTITION isn't in sync
with common.AVB_PARTITIONS.

Bug: 181787095
Test: run sign_target_files_apks on a S image

Change-Id: I6ccf5fb9f39b92c1da2554f5b3826d2cd87d84d7
2021-03-03 17:31:48 -08:00
Tianjie
697c6eecf6 Add missing R partitions in AVB_FOOTER_ARGS
If we miss these entries, the signing script won't correctly update
the avb prop to build the vbmeta. This cl adds the missing partitions
for R build.

In the followup, we need to make the map in sync with AVB_PARTITIONS in
common.py

Bug: 181787095
Test: run sign_target_files_apks
Change-Id: I39a308fb7028b45ce08f0ca3c6ad61a6c13e8082
2021-03-03 15:28:58 -08:00
Andrew Scull
5553b5704c Merge "Add pvmfw partition to target files" 2021-03-01 21:05:56 +00:00
Treehugger Robot
0a4788c3fb Merge "support pre-defined timestamp and uuid when bulid EROFS images" 2021-03-01 06:29:49 +00:00
Treehugger Robot
d33ae8363c Merge "Add spl-downgrade field to ota metadata" 2021-02-25 22:51:26 +00:00
Kelvin Zhang
05ff7055b6 Add spl-downgrade field to ota metadata
In aosp/1581143 , we banned generation of SPL downgrade OTAs. However,
caller of OTA script can still force an SPL downgrade OTA by passing
--spl_downgrade flag. If this flag is specified, we propagate it to OTA
metadata so that GOTA server can properly honor this flag.

Test: th
Change-Id: Ic8cdc850d2210f4149ad9121fa4ed2e5a4f59bcc
2021-02-25 10:15:45 -05:00
Treehugger Robot
90c1763c0c Merge "releasetools: Fix an issue in common.GetSparseImage" 2021-02-25 05:05:42 +00:00
wangshumin
71af07abe8 releasetools: Fix an issue in common.GetSparseImage
Fix incorrect report "Failed to find the ZIP entry" error when
generate OTA package.

This happens when we have a file in ROOT which name contains 'system'
such as init.system_init.rc, and init.system_init.rc will be rename to
init.SYSTEM_init.rc incorrectly, so we failed to find the entry in ZIP.

Test: manual test
Change-Id: I97359e513aaca7521fe9c035f6a4264a2053b86d
Signed-off-by: wangshumin <wangshumin@xiaomi.com>
2021-02-25 09:34:57 +08:00
Devin Moore
fd4f3c4c63 Merge "Support vendor bootconfig creation" 2021-02-24 15:56:48 +00:00
Daniel Norman
48603ff158 Creates a combined split-sepolicy file in merge_target_files.py.
This follows the same steps as OpenSplitPolicy() in
system/core/init/selinux.cpp on the device.

Bug: 178864050
Test: merge_target_files for R+S and S+S devices
Test: test_merge_target_files
Change-Id: Ia41a436bfda8e2cb65706122f0ff3805b99d16e1
2021-02-23 11:41:29 -08:00
Devin Moore
50509015bf Support vendor bootconfig creation
Gather all BOARD_BOOTCONFIG parameters.
Create vendor-bootconfig.img with parameters seperated by newlines. Pass
that file to mkbootimg as --vendor_bootconfig to add it to the
vendor_boot.img.

Test: Add BOARD_BOOTCONFIG parameters in cuttlefish .mk file
      Check vendor-bootconfig.img for expected output
      Verify expected vendor_boot.img format with:
      unpack_bootimg --boot_image vendor_boot.img
Test: Update Cuttlefish bootloader to handle the new vendor_boot.img and
      check /proc/bootconfig for the expexted parameters.
Bug: 173815685
Change-Id: Iaa9b71b4bc64375777a5353396e83bb2beb25c47
2021-02-23 07:42:05 -08:00
Tianjie Xu
5b1c0a347c Merge "Sign APEXes on all partitions" 2021-02-19 21:41:02 +00:00
Andrew Scull
e077cf764f Add pvmfw partition to target files
The pvmfw is included in an `m` build but not in the distribution files.
Apply the same treatment as the dtbo partition to copy the pvmfw
partition to dist/ since, similar to the dtbo image, the pvmfw image is
generally provided as a prebuilt image.

Test: make dist
Bug: 174457787
Change-Id: I6f42517ba42db92e90048d1236d7255ccbd73f73
2021-02-19 13:07:32 +00:00
Huang Jianan
1ed889befc support pre-defined timestamp and uuid when bulid EROFS images
Bug:180682930
Test: erofs image can be set to input timestamp and UUID
Change-Id: I71e455350db51096e18ab5a03123500d56ebe252
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-02-19 08:51:46 +00:00
Tianjie
5bd0395570 Sign APEXes on all partitions
Bundle APEXes may exist on other partitions than system, e.g. vendor,
system_ext. And leaving them unsigned may cause security problems.

Bug: 180675334
Test: run sign_target_files_apks
Change-Id: Ib912a026f4010d818161a89b11f818180208843f
2021-02-18 23:02:36 -08:00
Daniel Norman
b4b07aba7d Returns empty apex_infos if the apex target dir does not exist.
This is needed for partial builds that do not have the apex directory in
their target files package.

Test: build target files for a partial vendor-only build.
Change-Id: I076bfbd1a81cccddcef795f5edeaf2b51538cdec
2021-02-17 22:24:48 +00:00
Bob Badour
0390580262 [LSC] Add LOCAL_LICENSE_KINDS to build/make
Added SPDX-license-identifier-Apache-2.0 to:
  target/product/sysconfig/Android.bp
  tools/apicheck/Android.bp
  tools/product_config/Android.bp
  tools/releasetools/Android.bp
  tools/signapk/Android.bp
  tools/signtos/Android.bp
  tools/zipalign/Android.bp
  tools/ziptime/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-CC-BY SPDX-license-identifier-GPL
    SPDX-license-identifier-GPL-2.0 SPDX-license-identifier-LGPL
    SPDX-license-identifier-MIT legacy_not_a_contribution
    legacy_restricted
to:
  Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-CC-BY SPDX-license-identifier-GPL
    SPDX-license-identifier-MIT
to:
  tools/Android.bp
  tools/droiddoc/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0
    SPDX-license-identifier-LGPL SPDX-license-identifier-MIT
to:
  core/base_rules.mk
  core/dex_preopt_libart.mk
  core/package_internal.mk

Added SPDX-license-identifier-Apache-2.0 legacy_not_a_contribution
to:
  target/board/Android.mk

Added legacy_restricted
to:
  core/tasks/tools/package-modules.mk
  target/product/gsi/Android.bp
  target/product/gsi/Android.mk
  target/product/security/Android.bp
  target/product/security/Android.mk
  tools/acp/Android.bp
  tools/atree/Android.bp
  tools/fs_config/Android.bp
  tools/fs_config/Android.mk
  tools/fs_get_stats/Android.bp
  tools/libhost/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Id67a4eb1312940f999643b2ae57f45f34f120724
2021-02-14 10:37:20 -08:00
Kelvin Zhang
9f781ff907 Fix error where otacerts in VENDOR_BOOT isn't replaced
Test: sign a target_file, check otacerts.zip
Bug: 180025432

Change-Id: I918c3772a6de83314d76884dff3b26a85ed66eb2
2021-02-11 20:14:24 -05:00
Kelvin Zhang
119f279455 Fix signing errors where some partitions aren't properly signed
Rewrite build.prop of all partitions

Test: sign an target_file, check build prop of partitions

Bug: 179186447
Bug: 180025432

Change-Id: I01249532dc2df1b6d9ec8d0be58424a76814b53e
2021-02-11 19:51:05 -05:00
Kelvin Zhang
eb586efe6f Check for existence of private key before generating OTA
At the end of OTA generation, we will use some private key to sign the
OTA payload. Since signing happens after the payload is being generated,
if caller passes an incorrect key path, caller won't notice it until 1
hour later when delta_generator finishes. At which point caller has to
staart from scratch, pass in another key path, and wait for an hour.
Let's detect incorrect key path before calling delta_generator, so
caller will get an error message right at beginning.

Test: th
Change-Id: Iefb1e0a9ed86f82664be1675afb84c020ec28fe7
2021-02-11 19:06:09 -05:00
Kelvin Zhang
80ff466780 Prevent SPL downgrade OTAs from generating
Previously we allow all spl downgrade OTA to generate. But applying such
OTA often causes device to hang and rollback, because keymaster refuses
to attach if it detects spl downgrade. When such error happens, it's
really hard to debug. So instead of debugging a mysterious boot failure,
let''s prevent such OTA from generating in the first place.

Test: th
Bug: 178584781

Change-Id: I8e271862d804e86b16aea70424b4d3e289d43cc9
2021-02-11 19:06:08 -05:00
Treehugger Robot
7b6988c026 Merge "Make common.py python3 compatible" 2021-02-10 18:29:43 +00:00
Treehugger Robot
e51dcceae1 Merge "Updates merge_target_files soong_zip to use -r instead of -l." 2021-02-09 23:11:09 +00:00
Kelvin Zhang
645dcb8264 Make common.py python3 compatible
Test: th
Change-Id: Ibe4db0a367b7b8df5eeb7f2a6d0816e8e18bf342
2021-02-09 17:53:09 -05:00
Daniel Norman
eaf5c1dca2 Updates merge_target_files soong_zip to use -r instead of -l.
This is needed due to output artifacts in the zip that confuse globbing,
such as [.

(Also changes this call to RunAndCheckOutput, which prints the stderror
by default instead of RunAndWait which does not. Removes RunAndWait
which is now unused)

Bug: 179799226
Test: Run merge_target_files to merge two partial builds
Change-Id: Ibf8a5b0c013c9cd8b1e61195d97583f247d97c6f
2021-02-09 11:01:42 -08:00
Treehugger Robot
41f416d326 Merge "Add flag to manually disable vabc" 2021-02-09 01:14:50 +00:00
Kelvin Zhang
bbfa182995 Add flag to manually disable vabc
Test: ota_from_target_files --disable_vabc
Change-Id: I9ae9ce2c3173909c335708329e787ae45dc5da6b
2021-02-07 10:43:15 -05:00
Julien Desprez
0c09471cc3 Clean TEST_MAPPING config based on go/a-unit-tests
unit_tests:true do not need TEST_MAPPING files

Test: presubmit
Bug: 178646865
Change-Id: Id36e98ce661dc2052e333b2644202361127939a5
2021-02-04 09:12:05 -08:00
Kelvin Zhang
00db3859e7 Merge "Fix test failures due to binaries not found in PATH" 2021-02-02 22:21:15 +00:00
Kelvin Zhang
e9d4ddb1e0 Merge "Add releasetools_test to TEST_MAPPING" 2021-02-02 19:25:21 +00:00
Kelvin Zhang
05a3f680f7 Fix test failures due to binaries not found in PATH
Test: rm `where deapexer` && mm otapackage

Change-Id: I0b742f26ae984729b97bf796aa3ed9335b316369
2021-02-02 14:24:54 -05:00
Kelvin Zhang
553efcaae2 Add releasetools_test to TEST_MAPPING
Test: treehugger
Change-Id: I3a0f9e9e5dd8d49c22f466aa0605768fee3f4821
2021-02-02 14:24:54 -05:00
Mohammad Samiul Islam
f4909b4d71 Add deapexer to releasetools_common
Bug: 178726093
Test: m updatepackage
Change-Id: I74650f339ab5399c2474d7cde1d290b55dab721c
2021-02-01 21:03:58 +00:00
Treehugger Robot
472a860bee Merge "Only add apex_info for compressed apexes" 2021-01-29 10:34:21 +00:00
Nikita Ioffe
8e0c592f89 Merge "Add support for signing a compressed apex" 2021-01-27 19:45:33 +00:00
Kelvin Zhang
c72718c7c5 Only add apex_info for compressed apexes
Test: mm -j dist, then make sure apex_info.pb doesn't contain
non-compressed apex

Change-Id: I6262eb97ec53de28953257d8b3b77e32ac0259be
2021-01-27 14:17:14 -05:00
Nikita Ioffe
3608148612 Add support for signing a compressed apex
Test: atest releasetools_test
Bug: 172912232
Change-Id: I4630578694afbab675db770b46898cc32f1861f3
2021-01-27 01:27:11 +00:00
Kelvin Zhang
7bd09911a2 Add apex_info.pb to generated OTA
Test: generate an OTA, make sure apex_info.pb is in

Bug: 172911822

Change-Id: I13a6ef4bc1f6ed2d146922f3031ea24700ba06f4
2021-01-26 12:42:52 -05:00
Kelvin Zhang
22c687c5c3 Fix pylint warnings on ota_from_target_files.py
Test: treehugger
Change-Id: I0a2b9ebe001152f5de7dce6198139719322fd241
2021-01-26 12:42:52 -05:00
Kelvin Zhang
5f0fcee4dd Emit apex_info to target_files META/apex_info.pb
Test: mm -j
Bug: 172911822

Change-Id: I5a70b75dbe1cd546c66beaa8e4e3a63c3987461e
2021-01-25 09:15:30 -05:00
Mohammad Samiul Islam
9fd5886e23 Create a function that can generate ApexInfo using target-files
If an OTA contains compressed APEX inside it, then the device will need
to allocate space on /data partition for their decompression. In order
to calculate how much space the OTA process needs to allocate, the
process needs more information about the APEX contained inside the OTA.

In this CL, we are adding functionality to the OTA generation script
that allows us to gather information about the APEX stored inside the
target-file zip. However, we did not integrate the new functionality
with the ota_from_target_files.py scrip yet. That will be done on follow
up CL.

Bug: 172911822
Test: atest releasetools_py3_test
Change-Id: I2ac42018f628c2c21527b3e086be1f4e7e7247ad
2021-01-22 20:13:32 -05:00
Yifan Hong
7a27574e5f Merge "GetBootImageBuildProp returns None if file does not exist" 2021-01-13 19:40:13 +00:00
Nikita Ioffe
015b689271 Merge "Refactor apex signing logic in preparation for compressed apexes" 2021-01-13 14:54:49 +00:00
Tianjie Xu
2de3459680 Merge "Fix errors from validate_target_files" 2021-01-13 00:02:36 +00:00
Nikita Ioffe
6068e8dd52 Refactor apex signing logic in preparation for compressed apexes
Logic for signing compressed apex will be added in the follow-up cl.

Test: python -m unittest test_sign_apex
Bug: 172912232
Change-Id: I8dc1d334c17e11f9eed8fe0a575b6dfcf337ab5d
2021-01-12 22:29:58 +00:00
Tianjie
2e0b835d28 Fix errors from validate_target_files
We should skip lines that don't contain '=', e.g. empty lines.
Also, pop a warning instead of an error if a prop is defined
multiple times with the same value

Bug: 177240467
Test: unittest, run validate_target_files
Change-Id: Ifc9eadb91e5dda7170a19d875016e5a47e8fc592
2021-01-12 14:04:58 -08:00