Commit Graph

7256 Commits

Author SHA1 Message Date
Kelvin Zhang 45b44d96e6 Make apex util detect if hashtree is present
Test: sign_target_fiels_apks oriole_target_files.zip
Bug: 195194430

Change-Id: I919d169ce4d66e6a1cdbfd15babde25005971a30
2021-08-06 19:38:14 -04:00
Tianjie e7d0377f4a Write the vbmeta digest to the output zipfile also
During signing, we write the entry directly to the output zip, intead
of a temp directory. Add the logic to write vbmeta_digest.txt to output
zipfile too. So the digest file will show up in the signed target files.

Bug: 189926233
Test: add_img_to_target_files -a <target-files.zip>
Change-Id: Ibf28a8f97512bda8c8c695e06190e1fb6573c53e
(cherry picked from commit c3bf3d00a3077b66aa178f00fb789d34a042c9e8)
2021-07-14 16:07:33 -07:00
Kelvin Zhang 9b55885314 Add ro.vendor.build.dont_use_vabc to disable VABC OTA
This prop is owned by OEM, OEM can set this if they want to disable
VABC.

Test: m dist, make sure generated OTA has VABC disabled
Bug: 185400304

Change-Id: Iceb2fb1f399d38a51722352a86ddf68af05fa24e
Merged-In: Iceb2fb1f399d38a51722352a86ddf68af05fa24e
2021-06-14 15:38:37 -07:00
Baligh Uddin 91b8435347 Merge "Handles capex in signing script" into sc-dev 2021-06-14 21:49:00 +00:00
Tianjie 579c347923 Handles capex in signing script
Today, the signing script simply ignores capex files, because it
looks for hardcoded '.apex' suffix. Add support to handle capex
as well.

Bug: 190574334
Test: Sign a target file locally
Change-Id: I3085ca7b0396a4fbf1b220f7de44d4eafb60c3d8
(cherry picked from commit 4d48d50036e71ccb31cf05326417ee084fd7583a)
2021-06-12 18:13:59 +00:00
Jaegeuk Kim 01da65f93a Missing required packages for f2fs when building ota package
Bug: 171942852
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ib2ecc0cf88d71f358bd04e6c4ac129607fe4054c
Merged-In: Ib2ecc0cf88d71f358bd04e6c4ac129607fe4054c
2021-06-09 02:11:23 +00:00
Tianjie Xu b195f48ce9 Merge "Check super size for factory OTA at build time" into sc-dev 2021-06-02 21:53:36 +00:00
Jaegeuk Kim bce364b9ce Merge changes from topic "f2fs-system" into sc-dev
* changes:
  Enable f2fs compression for other partitions
  Enable --readonly for system compression
2021-06-01 18:09:07 +00:00
Tianjie 16bcac122f Check super size for factory OTA at build time
For VAB launched device, factory OTA will write system_other
partition to the super image. So we want to check that
sum(dynamic partitions) + system_other + overhead <= super at
build time.

Since we don't know the overhead at build time, we might instead
check sum(all partitions) < super.

Bug: 185809374
Test: m check-all-partition-sizes, unittests
Change-Id: Ia7ba5999d23924a1927e9a9463856a4d0ea90c20
Merged-In: Ia7ba5999d23924a1927e9a9463856a4d0ea90c20
(cherry-picked from commit 294ec7d9e5298d91768e0f2e9abe4cc7de180fe1)

Change-Id: I479d1b399a1639b595ae5d7f1481c771a3439e51
2021-05-26 14:43:35 -07:00
Jaegeuk Kim 91869cafe6 Enable f2fs compression for other partitions
Bug: 171942852
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I231f7a2b808cc792fd582cd444825e4a47722984
2021-05-26 13:11:28 -07:00
Jaegeuk Kim 028f6719f3 Enable --readonly for system compression
This option is to reduce system partition size.

Bug: 171942852
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Idc849cfce33ac0badb2b9b7953bb821c46a24472
2021-05-26 13:11:28 -07:00
Bowgo Tsai b23656df31 Support AVB signing for BOARD_PREBUILT_BOOTIMAGE
Devices using GKI architecture will use a prebuilt boot.img.
However, we should still sign this prebuilt boot.img with
device-specific AVB keys.

Steps to test the CL.
1. In a device BoardConfig.mk:

   # Uses a prebuilt boot.img
   TARGET_NO_KERNEL := true
   BOARD_PREBUILT_BOOTIMAGE := device/google/redbull/boot.img

   # Enable chained vbmeta for the boot image.
   # The following can be absent, where the hash descriptor of the
   # 'boot' partition will be stored then signed in vbmeta.img instead.
   BOARD_AVB_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
   BOARD_AVB_BOOT_ALGORITHM := SHA256_RSA4096
   BOARD_AVB_BOOT_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
   BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION := 2

2. `make bootimage`, then `avbtool info_image --image $OUT/boot.img`,
    checks the image is re-signed with a device-specific key

3. `make dist` to generate out/dist/TF.zip

4. `unzip out/dist/TF.zip IMAGES/boot.img`

5. `avbtool info_image --image out/dist/IMAGES/boot.img`,
    checks the image is re-signed with a device-specific key

6. `sign_target_files_apks \
      --avb_boot_key=external/avb/test/data/testkey_rsa8192.pem \
      --avb_boot_algorithm=SHA256_RSA8192 \
      --avb_boot_extra_args="--prop test:sign" \
      ./out/dist/*-target_files-eng.*.zip signed.zip`, resign the TF.zip

7. `unzip signed.zip IMAGES/boot.img`, then use `avbtool info_image` to
   check the boot.img is re-signed with the --avb_boot_key in step 6.

Bug: 188485657
Test: above steps
Change-Id: I7ee8b3ffe6a86aaca34bbb7a8898a97b3f8bd801
Merged-In: I7ee8b3ffe6a86aaca34bbb7a8898a97b3f8bd801
(cherry picked from commit cf9ead8972dd2b7c90772b6a1fd26bd4311a7c74)
2021-05-26 09:11:00 +08:00
Kelvin Zhang 2067dff87c Merge "Expose ota_metadata_proto for consumption" am: 51c8f9f34c am: 9dbff33bd9 am: 580a36f814 am: ee491d95eb
Original change: https://android-review.googlesource.com/c/platform/build/+/1708627

Bug: 186581246
Bug: 188575410

Change-Id: I996092bd29f8f6231c8055b44d59ae87d5809127
(cherry picked from commit 7780289064062d5529f88af0909fb6b02c521ac5)
2021-05-19 23:55:25 +00:00
Kelvin Zhang 4de9bb23f2 Reland: Enable verity computation on VABC devices
Test: th
Test: Manual OTA test on bramble, pause/resume multiple times
Test: verity enabled, VABC enabled OTA
Test: verity enabled, VABC disabled OTA
Test: verity disabled, VABC enabled OTA
Test: verity disabled, VABC disabled OTA

Change-Id: Ia236984b158761f84f54ab7a6d3d49491c249546
2021-05-14 12:38:28 -04:00
Tianjie Xu fc15d50d6d Merge "Calculate the runtime ro.build.id in ota scripts" 2021-05-11 19:19:09 +00:00
Treehugger Robot dcadb68011 Merge "sign_target_files_apks: replacing GKI signing args completely" 2021-05-11 07:30:16 +00:00
Tianjie fdda51d2ae Calculate the runtime ro.build.id in ota scripts
If the build prop ro.build.id isn't set at build time, init will
set it at runtime. The logic is appending the vbmeta digest to
the ro.build.legacy.id.

Make the same change in ota scripts, so the correct build fingerprint
will be saved in the ota metadata.

Bug: 186786987
Test: generate an OTA, check the metadata
Change-Id: I278f59c41c1f98d4cbea749e5d9e4eaf7a6b9565
2021-05-10 11:35:48 -07:00
Bowgo Tsai bcae74def7 sign_target_files_apks: replacing GKI signing args completely
Commit I8bd8ad3acf324931b47d45fd30bc590206b1927e adds a default
value of "gki_signing_signature_args" in the misc_info.txt for
release signing to work. However, it's better to replace the default
value entirely (e.g., --prop foo:bar) as there is no need to include
them in the final release-signed image.

Bug: 178559811
Bug: 177862434
Test: atest releasetools_test
Test: atest releasetools_py3_test
Change-Id: I060b5a7076ff3e5d883abeb7d72f3db887c9fd69
2021-05-10 17:43:52 +08:00
Tianjie Xu a530481db1 Merge "Don't set the build id if we need to append the digest" 2021-05-08 22:56:56 +00:00
Treehugger Robot e86abec252 Merge "Add ota_metadata_proto_java" 2021-05-08 21:44:57 +00:00
Tianjie Xu efc00ca7b2 Merge "Calculate the vbmeta digest when building images" 2021-05-07 19:06:32 +00:00
Tianjie 9797623c2a Don't set the build id if we need to append the digest
Background in http://go/compatible-build-fingerprint. If we want
to append unique vbmeta digest to build id, we cannot setup the
prop value at build time. Instead, set the old value as
ro.build.legacy.id; and let init set ro.build.id at runtime.

Bug: 186786987
Test: build a target file with the flag on
Change-Id: Ie139725bb7e5c65bd3f28f43b9975ba48ee10354
2021-05-06 00:32:56 +00:00
Tianjie bbde59f9eb Calculate the vbmeta digest when building images
Calculate the vbmeta digest if the device builds vbmeta image. The
digest will used later to determine the build fingerprint in new
format.

One sample usage is the ota package generation, where we put the
build fingerprint in the ota metadata. But we don't have the runtime
vbmeta digest provided the bootloader.

Bug: 186786987
Test: unit tests
Change-Id: If572e2b973e295a6c95a9e23a65bb20b3afbf1b0
2021-05-05 18:04:51 +00:00
Kelvin Zhang 2b6a9c3133 Add ota_metadata_proto_java
Test: th
Change-Id: Iac9b679299db6a23cdf85d7c46f20d0538ba6015
2021-05-05 09:08:12 -04:00
Kelvin Zhang 2a3e5b1cf5 Disable downgrade VABC OTAs
Downgrade VABC OTA causes users to wait in recovery for merge to
complete, disable by default.

Test: th
Test: generate downgrade OTA, make sure VABC disabled
Test: generate upgrade OTA with --wipe_user_data, make sure VABC
disabled
Test: generate upgrade OTA, make sure VABC is used
Test: generate downgrade OTA with --vabc_downgrade, make sure VABC is
enabled
Bug: 187215486

Change-Id: Ib7e6165252d47f1ecaac4fc2329b580274c8d70e
2021-05-05 09:08:12 -04:00
Chih-hung Hsieh 73524b6bdd Merge "Fix more pylint warnings." 2021-05-03 17:37:58 +00:00
Treehugger Robot 34949e63da Merge "Avoid to print undefined image_size and partition_size" 2021-05-01 03:45:13 +00:00
Chih-Hung Hsieh a606822f35 Fix more pylint warnings.
* add .pylintrc to use 2 space indentation
* rename single-letter local variables

Test: ./warn.py build.log > warnings.html
Change-Id: I2ca56a6cb130a9d6c73328c5592ad7cde8a974ab
2021-04-30 14:32:25 -07:00
Treehugger Robot d19ec52207 Merge "Disable VABC if either source/target doesn't support it" 2021-04-30 18:10:49 +00:00
Kelvin Zhang 563750f483 Disable VABC if either source/target doesn't support it
If source supports VABC, delta_generator/update_engine will attempt to
use VABC. This dangerous, as the target build won't have snapuserd to
serve I/O request when device boots. Therefore, disable VABC if source
build doesn't supports it.

Test: downgrade from VABC enabled build to a build w/o VABC

Change-Id: Ie8353e00f65354c2242ee5255b6652c6b62483a4
2021-04-30 10:06:26 -04:00
Huang Jianan f63abb1cae Avoid to print undefined image_size and partition_size
If dynamic partitioning is enabled and the partition size is not set,
we will get a KeyError before image_size or partition_size is calculated
when we try to catch exception in BuildImageMkfs.

Bug: 186704243
Test: build_image.py can correctly throw exception
Change-Id: I3d8c143ad5603d07fe94afb8bb911ead244f0bf7
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-04-29 07:40:46 +00:00
Chih-Hung Hsieh 98b285dafb Fix/suppress most pylint and gpylint warnings
* Add missing function doc strings.
  Suppress this warning on trivial functions in *_warn_patterns.py.
* Remove unused g-importing-memeber, g-complex-comprehension.
* Suppress pylint warning on unrecognized g-* options.
* Suppress too-few-public-methods warnings on simple classes.
* Suppress too-many-arguments and missing-function-docstring in
  html_writer.py, which will be refactored later.
* Fix bad naming, long lines and line breaks, and bad quotes.

Test: compare output for build.log
Change-Id: Icdb34f014a10ec1e642c2cfe8003fc3ae245b507
2021-04-28 14:57:56 -07:00
Chih-Hung Hsieh 7cc0e15e4a Use python3
Test: warn.py build.log > warnings.html
Change-Id: I781ea7bfe023ec5af829757c417bc70aba80af0d
2021-04-26 17:09:36 -07:00
Treehugger Robot 243f9ea65f Merge "sign_target_files_apks: Relax ro.build.description requirements" 2021-04-24 05:13:01 +00:00
Treehugger Robot 87cfdce392 Merge "Revert "Enable support for verity writes for VABC targets"" 2021-04-24 03:36:26 +00:00
Kelvin Zhang c777570825 Revert "Enable support for verity writes for VABC targets"
This reverts commit 6bb647fb85.

Reason for revert: b/186213024

Change-Id: I35054cf263c9118933fb885d5740546af3d4deec
2021-04-23 22:44:01 +00:00
jiajia tang 92b6078314 Simplify codes for BuildSuperImage func
Use common function LoadDictionaryFromFile(), instead
of LoadDictionaryFromLines(). Makes these codes conciser.

Change-Id: Ibb6f19744246b3415bcd639bc59dbb2aede725d9
Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
2021-04-23 19:58:40 +08:00
Treehugger Robot 8d437e4168 Merge "Enable support for verity writes for VABC targets" 2021-04-22 18:09:11 +00:00
Kelvin Zhang 6bb647fb85 Enable support for verity writes for VABC targets
We already added support on device to write verity. Flipping a flag in
ota generation tools to enable verity.

Test: th && running OTA repeatedly on bramble
Change-Id: Id1639f644eb8c23f97e171264702a7872f41411a
2021-04-21 15:19:23 -04:00
jiajia tang 92be6ee9d7 More accurate error if input_file is not exists
This patch is intended to make build log is more
accurate if input_file is not exists, then check if
it is a zipfile.

Change-Id: I30da0141ea44fc3ce0947f868a86a15a054a4346
Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
2021-04-21 16:41:58 +08:00
Daniel Norman e9af70ad68 Performs basic APEX validation in the merged target files package.
Uses apex_utils.GetApexInfoFromTargetFiles to find and parse APEX files
in the target files partition dirs. Raises an error on failure to parse
or duplicate package names.

Bug: 177225446
Test: releasetools_test
Test: Create a merged build that provides the VNDK APEX on both vendor
      and system. Observe failure.
Change-Id: I1356e263b7b32d6063129e079f3ba7ab4ff132a7
2021-04-19 22:31:01 +00:00
Treehugger Robot b2233cf162 Merge "Fix bug: repeated restricted effective conditions." 2021-04-15 21:51:20 +00:00
Bob Badour 1f69c4404a Fix bug: repeated restricted effective conditions.
Test: m all
Change-Id: I0fc8f66dd72e3d3983b9d2b5fa7416c09a776ccc
2021-04-15 10:59:40 -07:00
Kelvin Zhang 6c17ed3185 Re-raise exceptions instead of sys.exit
Test: th
Change-Id: I3ac343b51eeeaa948712be81b640122f9981137d
2021-04-14 14:59:12 -04:00
Bob Badour f7e9c43464 Merge "Fix bug: include all dirs not just the last one." 2021-04-14 00:16:12 +00:00
Daniel Norman 4b7ee39a70 Merge changes Ic269fa99,I045be7cb
* changes:
  Generate care_map.pb when merging target files packages.
  Moves care map generation logic to common.py, so it can be reused.
2021-04-13 23:54:08 +00:00
Mateusz Zięba 5371607b50 Fix bug: include all dirs not just the last one.
Test: m all

Change-Id: I5724f792ee36c2f66786761e5d55b4f6c456753c
2021-04-13 13:14:13 -07:00
Daniel Norman db8cacc976 Generate care_map.pb when merging target files packages.
Test: build a merged target using Forrest,
      Observe META/care_map.pb
Bug: 182296208
Change-Id: Ic269fa99ec8ed2bd474a2f69b1be1f545c567112
2021-04-13 11:43:02 -07:00
Kelvin Zhang 2732413fa2 Moves care map generation logic to common.py, so it can be reused.
Test: th
Bug: 182296208
Change-Id: I045be7cb208412431d6ab1c26e31d38d2285738b
2021-04-13 11:42:26 -07:00
Justin Yun 48aa78ed3c Remove grf_required_api_level
As we don't fix the grf window, we may not calculate the grf
expiration date and the required api level.
The verification of this will be covered by the tests at run time.

Bug: 176950752
Test: atest --host post_process_props_unittest
Change-Id: I1205f0d9a9da5bc508a49acbcbb7da581800bf45
2021-04-13 17:58:59 +09:00