204 Commits

Author SHA1 Message Date
HZ
60f7c4c7d4 Add bluetooth to default key map
Previously the key mapping in releasetool/sign_target_files_apks.py
is missing the aforementioned keys that introduced in Android 13, so
it's writing corrupted signatures in plat_mac_permissions.xml.

Test: make target-files-package otatools
sign_target_files_apks -o -d <CERT_ROOT> ...

Change-Id: If42907cffbd500281876f8f822cbb645583d06ed
Signed-off-by: RITEFANG <1721985272@qq.com>
2025-02-05 20:41:13 +08:00
Kelvin Zhang
e2b7599437 Fix error in payload_signer_args passing
payload_signer_args is a list returned from shlex.split, need to unparse
it before passing to shell CLI

Test: th
Bug: 354019928
Change-Id: I4d308557b5bb808bf34c9d4514408c21176c81f6
2024-09-13 16:53:33 +00:00
Kelvin Zhang
4837944712 Fix OTA package re-sign on release key servers
Release key signing passes more args than just --package_key, honor
these flags properly in signing script.

Test: th
Bug: 354019928
Change-Id: I49215e92f28da2ac4cd72fb9e5c6bbc94a3e3f02
2024-09-11 16:07:04 -07:00
Kelvin Zhang
2427d9d402 Fix missing dir error for certain targets
Test: th
Bug: 364967828
Change-Id: I31f76533c3e3be63aa55f96be8fd697c4a629e65
2024-09-09 11:14:53 -07:00
Kelvin Zhang
065c5f5f5b Reland Support incremental dev option OTA during signing
This allows incremental dev option to be used on release-key devices.
Boot images are signed during the signing process, and hence the dev
option OTAs(which are derivative of boot image) need to be re-generated.
Previously we only re-generate full OTAs, now we support incrementals
too.

Previous land of the CL had a bug where AddDtbo() is called even for
devices which do not have a DTBO partition, causing signing failures.
This reland fixes the issue above by checking "has_dtbo" in
misc_info.txt

Test: th
Bug: 339658378

This reverts commit 29c7842c02.

Change-Id: Ifb080aaa15faf752ab1cff687c54d00290c1bfa6
2024-09-05 10:50:03 -07:00
Treehugger Robot
f54075d5d4 Merge "Fix str/bytes type error in ReplaceOtaKeys" into main 2024-09-05 17:27:48 +00:00
Kelvin Zhang
0c9a6ffb00 Fix str/bytes type error in ReplaceOtaKeys
ZipFile.read() returns byte sequence, while re.match expects str.
Decode the bytes read first.

Test: th
Bug: 315855025
Change-Id: Id2da071f3caeab56cfac845a9e4f842c4e102f49
2024-09-04 17:03:24 -07:00
Priyanka Advani (xWF)
29c7842c02 Revert "Support incremental dev option OTA during signing"
This reverts commit 5fcaa1f635.

Reason for revert: Droidmonitor created revert due to b/363090380.

Change-Id: I366b12a303190f73e6ac16a1fcff83b1e16ebf2d
2024-08-30 00:33:08 +00:00
Kelvin Zhang
5fcaa1f635 Support incremental dev option OTA during signing
This allows incremental dev option to be used on release-key devices.
Boot images are signed during the signing process, and hence the dev
option OTAs(which are derivative of boot image) need to be re-generated.
Previously we only re-generate full OTAs, now we support incrementals
too.

Test: th
Bug: 339658378
Change-Id: I4755379b49ff8adf351ccaf76fe38f19c1685e9e
2024-08-29 13:38:45 -07:00
Kelvin Zhang
b707ea0206 Re-generate 4K boot OTAs using signed boot.img during signing process
Currently, dev option OTAs are generated using dev-key signed boot.img
On release-key devices, OTA will install successfully, but user would be
using dev-key signed boot image after reverting to 4K mode, and
subsequent OTAs would fail. This CL re-generates 4K boot OTA using
release-key signed boot.img , which allows normal OTAs after toggling
dev options.

Test: th
Bug: 354019928
Change-Id: I40811d6ed7a37f50edea77d245bf559b66da5a71
2024-08-21 10:36:57 -07:00
LuK1337
fc51de4553 releasetools: Resolve symlinks in IsEntryOtaPackage()
Test: Sign target files package where
      SYSTEM/product/media/bootanimation-dark.zip is a symlink to
      bootanimation.zip.
Change-Id: I4648c3c39c094cb090cbe337c566c3e9ad894691
2024-03-24 21:18:17 +01:00
Seungjae Yoo
b345651e6c Add unit test for parsing avb info
Bug: 328195652
Test: atest --host releasetools_test
Test: sign_target_files_apks
Change-Id: Ie38c3883907bc70c794606b20caf55a70dbcdf7c
2024-03-11 14:41:22 +09:00
Seungjae Yoo
976035677c Resign microdroid_vendor.img with avb_vendor_key
microdroid_vendor.img is vendor image for running Microdroid, a type of
VM run on top of Android. microdroid_vendor.img is currently stored in
host device's vendor partition. However the original key signed for
microdroid_vendor.img is not enrolled in the signing server, so it can
make possible test breakage if there's a test checking all files in the
partition is signed with trusted key.

Therefore, this is the patch to resign micrdoroid_vendor.img with
avb_vendor_key. When vendor image of host device is resigned with that
key, microdroid_vendor.img would be resigned as well with the same key.

Bug: 285855442
Test: First, for testing, modify the script to skip all files except
VENDOR/etc/avf/microdroid/microdroid_vendor.img in ProcessTargetFiles.
Second, run following commands and check if script doesn't throw any
error until ProcessTargetFiles ends.
- sign_target_files_apks --avb_vendor_key external/avb/test/data/testkey_rsa2048.pem --avb_vendor_algorithm SHA256_RSA2048 <source_zip_file> <target_zip_file>
- sign_target_files_apks --avb_vendor_key external/avb/test/data/testkey_rsa4096.pem --avb_vendor_algorithm SHA256_RSA4096 <source_zip_file> <target_zip_file>
- sign_target_files_apks --avb_vendor_key external/avb/test/data/testkey_rsa8192.pem --avb_vendor_algorithm SHA256_RSA8192 <source_zip_file> <target_zip_file>
Third, `unzip <target_zip_file>` and do `avbtool info_image`

Change-Id: I5337f61ab9eca7e6d0f92860486bc820b6e09eac
2024-02-23 11:58:15 +09:00
Yi-Yo Chiang
a4d5f4380b Re-land: releasetools: Deprecate GKI build rules
(Re-land of Ie882fccd864920289e48366e99a4ebd67e784d0d)

We no longer build GKIs from the platform tree.
These build commands were neither used nor maintained anymore, so clean
them up to reduce maintenance effort.
Keep the command line options as no-op, so existing scripts that still
specifies the deprecated options don't break.

Bug: 229701033
Test: presubmit
Change-Id: I0f7d05562dbc3eed29e902d6dc9a0f2e4083aaa6
2024-01-25 11:21:00 +08:00
Cloud You
0dbd877e5f Fixed not mapping sdk_sandbox key to vendor key
Some apps are signed with default sdk_sandbox key.
It results in failure of GtsPackageSignatureTest

Bug: 318798881
Test: run gts -m GtsPackageSignatureTest
Change-Id: I676f48eb2844866f4e61af60d78026a87303d15a
2024-01-10 15:12:39 +08:00
Treehugger Robot
ca96bcb0c8 Merge "Sign OTA packages inside target_files during signing" into main 2023-12-05 21:46:55 +00:00
Yi-Yo Chiang
18650c7be0 releasetools: Remove deprecated BOARD_BUILD_SYSTEM_ROOT_IMAGE
This variable is always false or empty now, so clean up remaining
references to the variable.

Bug: 241346584
Test: Presubmit
Change-Id: I5dd3d356729d0bd2639633580bbb85f8b03582cf
2023-12-01 09:03:08 +00:00
Yi-Yo Chiang
92a517d75e Revert "releasetools: Deprecate GKI build rules"
This reverts commit faaede0f01.

Reason for revert: caused GSI sign failure b/311134118#comment23

Change-Id: Id794a8ab3369c907834a73cc88ea1640dc7492d1
2023-12-01 07:02:17 +00:00
Kelvin Zhang
b84d2aa7d1 Sign OTA packages inside target_files during signing
Test: th
Bug: 293313353
Change-Id: Ifd5dd08153c5970dac8166808173f7dfbbb3411d
2023-11-28 10:08:38 -08:00
Yi-Yo Chiang
faaede0f01 releasetools: Deprecate GKI build rules
We no longer build GKIs from the platform tree.
These build commands were neither used nor maintained anymore, so clean
them up to reduce maintenance effort.

Bug: 229701033
Fix: 229701033
Test: presubmit
Change-Id: Ie882fccd864920289e48366e99a4ebd67e784d0d
2023-11-28 08:54:33 +00:00
Treehugger Robot
d5474ac3da Merge "Add the option for custom_image to be AVB or NONAVB" into main 2023-08-01 19:08:06 +00:00
Ray-cy.lee
e97e0cb16b Add the option for custom_image to be AVB or NONAVB
Check BOARD_AVB_$(call to-upper,$(partition))_KEY_PATH to decide whether custom_image should sign AVB or not. If key path isn't set, the custom image will be excluded from AVB and copied to /IMAGES in target-files directly. This allows vendor to use custom_images flow packing unsigned image.
And to every non-avb custom partition, one image whose name is partition name must be added in its BOARD_<CUSTOM_PARTITION>_IMAGE_LIST.

BOARD_CUSTOMIMAGES_PARTITION_LIST := tvconfig
BOARD_TVCONFIG_IMAGE_LIST := \
    device/xxxx/yyyy/tvconfig.img \
    device/xxxx/yyyy/tvconfig_custom1.img

Test:
1) Build image, target-files, OTA package by m and m dist
2) Sign images by sign_target_files_apk.py

Fix: 285227850
Change-Id: I7477dafe023e4b168f0f08fb7aedd9e511a60e1b
2023-07-26 20:21:29 +08:00
Cole Faust
4f3dc8759f Remove BOARD_BPT* variables and the bpt parition table image
These variables appear to never be set.

Test: Presubmits
Change-Id: If4b89376f73204ad5780dff421f1216da255c3eb
2023-07-11 16:58:06 -07:00
Treehugger Robot
7b640806da Merge "Revert "Remove all ZIP64LIMIT hack"" 2023-04-15 01:48:58 +00:00
Kelvin Zhang
f92f7f046a Revert "Remove all ZIP64LIMIT hack"
This reverts commit 37a4290909.

Reason for revert: b/278156419

Change-Id: I67ea667619a9623be849d911993010ef0f0bfd88
2023-04-14 21:32:54 +00:00
Hongguang Chen
1a7323390b Overwrite prop.default in all ramdisk fragments
default.prop can be linked to prop.default. To rewrite the fingerprints,
the original prop.default should be overwritten.

Bug: 264853953
Test: sign_target_files_apks, check artifacts
Change-Id: I8d22b8391dbfe13e74880ffad0619ef7fc4e20e0
2023-01-29 19:43:04 +00:00
Kelvin Zhang
30669e6c29 Ovewrite build props in all ramdisk fragments
Under some build configuration, there could be build prop stored under
path VENDOR_BOOT/RAMDISK_FRAGMENTS/recovery/RAMDISK/default.prop .
When signing, we must overwrite all build props, or device would display
incorrect build fingerprint.

Bug: 264853953
Change-Id: Id3b176b4ce4efa348ecfb3c9848f72273c5ccca8
2023-01-10 21:09:14 -08:00
Hongguang Chen
0d6b727e03 Support chained init_boot partition signing
Bug: 256048561
Bug: 256237041
Test: sign_target_files_apks -d certs --avb_init_boot_algorithm \
        SHA256_RSA4096 --avb_init_boot_key init_boot_rsa4096.pem \
	xxx.zip signed.zip (Check signed.zip/META/misc_info.txt)
Change-Id: I65fc7913089ae318d90df55a533d3e2ebd93b029
2022-11-07 15:48:23 -08:00
Kelvin Zhang
37a4290909 Remove all ZIP64LIMIT hack
In the old days, we hacked values of ZIP64LIMIT to get around size
limitations of non-zip64 supported zip files. Now that we switched to
python3 + zip64, there's no point in keeping those hacks.

Test: th
Bug: 255683436
Change-Id: I913db33dad5503736c68a7a1f1321aa952019f60
2022-10-26 13:22:52 -07:00
jiangxu5
2d8a4cbf84 [Bugfix] Fix compilation problems
vbmeta_system does not need to be rebuilt with vendor side

Signed-off-by: jiangxu5 <jiangxu5@xiaomi.com>
Change-Id: Ieb2076055aa3342a6071ec2ed5c976e22f59acd1
2022-09-18 12:38:51 +00:00
hungweichen
dd3fca09f6 Remove replace verity key args
We are removing VB support from release tools. This change aims to
remove the args related to replace verity key.

Bug: 242672222
Test: atest under build/make
Change-Id: I446a0b16e482c43542a1c0e41b24e80eb9fbc8e6
2022-08-24 06:37:12 +00:00
Treehugger Robot
2e30eed994 Merge "Add flags to override all apex/apk keys" am: c7cd55bf17
Original change: https://android-review.googlesource.com/c/platform/build/+/2171705

Change-Id: I6c3556e51fa839c078e1eea6f6daa2dd8d6e4024
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-06 04:53:55 +00:00
Kelvin Zhang
e50bb51fa9 Add flags to override all apex/apk keys
Currently, if we want to override all apex/apk key, we must specify all apk/apex names exhaustively. This causes CLI arguments to be very long and sometimes exceeds OS's limit.

Test: run signing test locally on build 8862875 on git_master
Bug: 239991438
Change-Id: Idbd3b7eef9b2a27236f4ca7a27449fcdf0d2dd3f
2022-08-02 18:32:38 +00:00
Kelvin Zhang
89c59b8fa5 Merge "Fix typo in recently changed extra_apex_payload_key flag" am: 193de78dfd
Original change: https://android-review.googlesource.com/c/platform/build/+/2167622

Change-Id: Ia46cc5f2a651aefc4884d5d642a0c6c04d66a536
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-29 17:08:22 +00:00
Kelvin Zhang
87e452739e Fix typo in recently changed extra_apex_payload_key flag
The intention was to make extra_apex_payload_key take a comma separted
list of keys. Iterating over a string will only iterate over each
characters individually. Must split by "," to iterate over keys.

Test: Run signing test locally using tradefed.sh
Bug: 239991438
Change-Id: I51bfed53a43b1b0fc1e33e0dc3d418a727e6ff15
2022-07-27 11:15:58 -07:00
Treehugger Robot
488525a889 Merge "Allow extra_apex_payload_key to take multiple names at once" am: d024518e1e
Original change: https://android-review.googlesource.com/c/platform/build/+/2164515

Change-Id: I0d2545f758d7469cf3a68ccf505a6183306630b3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-27 02:04:03 +00:00
Kelvin Zhang
085b6f3e84 Allow extra_apex_payload_key to take multiple names at once
When running tests, we might need to add many
extra_payload_keys. Currently we have to add --extra_apex_payload_key
for each key pair we pass, resulting in extremely long argument list.

Test: th
Bug: 239991438
Change-Id: I3e5f9d76c7f45822fb986b603dc089407c35b76b
2022-07-25 16:16:13 -07:00
Xin Li
05442a9213 Merge tm-dev-plus-aosp-without-vendor@8763363
Bug: 236760014
Merged-In: I1dffeb055a68250f574630d4ef5fedc51bad4a2b
Change-Id: I4e4b6a02fc140a1e38ce533031d7eb0a739396df
2022-06-28 21:23:05 +00:00
jiajia tang
e5ddfcd004 Fix potential issues if str has spaces
Uniform the split() function
str.split() will return a list split all spaces in str,
while str.split(' ') will return a list might contain ''
which might have potential issues.

Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
Change-Id: I0961659b140f800bdbe285f63bb4f02b8459ff8b
Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
2022-06-23 23:56:45 +00:00
Treehugger Robot
71880d9de6 Merge "[Bugfix] Check for presence before ZipWrite" am: bb8d9ed70f am: c3a915294b
Original change: https://android-review.googlesource.com/c/platform/build/+/2115654

Change-Id: Ifb49b4e8f30ea1da194e914c68cd01f63d8ccd4a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-04 05:36:55 +00:00
jiangxu5
b67b0d5bc0 [Bugfix] Check for presence before ZipWrite
There are vendor products but no *.map situation

Signed-off-by: jiangxu5 <jiangxu5@xiaomi.com>
Change-Id: I93a710fd10870b7406b1d7beb5a6f51b6badc104
2022-06-03 14:46:56 +08:00
Melisa Carranza Zúñiga
da308bf773 Revert "Merge "Adding sepolicy sign params to sign_target_files_apks." am: fb042449e0 am: bd8c313275 am: a2db49becd"
Test: sign_target_files_apks target_files.zip target_out.zip

This reverts commit 6e6c22c70e.

Reason for revert: Updateable SEPolicy is punted.

Change-Id: I99524d13811028a4036aa85c74cf10974fe08165
Merged-In: I99524d13811028a4036aa85c74cf10974fe08165
2022-05-31 09:55:22 +00:00
Iavor-Valentin Iftime
42a7160300 Merge "Rebuild and copy recovery and boot img when using vendor_otatools" am: 71585eae2b am: 7ee275cb81 am: 9fd594c53c
Original change: https://android-review.googlesource.com/c/platform/build/+/2068347

Change-Id: Id6c31fc941b14f5349b3b43f314c1a97872a4b4e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-21 17:06:22 +00:00
Iavor-Valentin Iftime
71585eae2b Merge "Rebuild and copy recovery and boot img when using vendor_otatools" 2022-04-21 16:07:12 +00:00
Lucas Wei
035fdee0ef Merge "vendor_kernel_boot: Update releasetools for vendor_kernel_boot" am: 2d5ecef1b3 am: bd66e32393 am: b8b3c0d0ab
Original change: https://android-review.googlesource.com/c/platform/build/+/2064760

Change-Id: Ibcf742f858c37141ab59cbd2d9c589ae15cf6ada
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-21 04:48:40 +00:00
Lucas Wei
03230250a3 vendor_kernel_boot: Update releasetools for vendor_kernel_boot
add_img_to_target_files.py will re-make image and build a new
signed vbmeta.img with new images in target-file.
We need to add vendor_kernel_boot into AVB signing list and make it
support that image.

Test: make dist -j110 and check vbmeta.img
Bug: 214409109
Signed-off-by: Lucas Wei <lucaswei@google.com>
Change-Id: Id07433f3dc33f95e2edd49de890f1e098cb9ef31
2022-04-21 00:27:27 +08:00
Iavor-Valentin Iftime
40adb17a1c Rebuild and copy recovery and boot img when using vendor_otatools
Rebuild recovery and boot images with vbmeta footers and copy together with recovery patch/install files when building vendor images using vendor otatools. Fixes validate_target_files failure.

Bug: 220126689
Bug: 186097910

Test: sign_target_files_apks \
        --vendor_otatools=otatools_vendor_dir \
	--vendor_partitions=vendor,odm \
	merged-target_files.zip \
	signed-target_files.zip
Test: validate_target_files signed-target_files.zip

Change-Id: Id45c67405bc37b769757db1701507f82cc6068d3
2022-04-19 18:35:36 +00:00
Melisa Carranza Zúñiga
69e6d82106 Revert "Merge "Adding sepolicy sign params to sign_target_files_apks." am: fb042449e0 am: bd8c313275 am: a2db49becd"
This reverts commit 6e6c22c70e.

Reason for revert: Updateable SEPolicy is punted.

Change-Id: I99524d13811028a4036aa85c74cf10974fe08165
2022-04-12 23:22:11 +00:00
Melisa Carranza Zúñiga
6e6c22c70e Merge "Adding sepolicy sign params to sign_target_files_apks." am: fb042449e0 am: bd8c313275 am: a2db49becd
Original change: https://android-review.googlesource.com/c/platform/build/+/2028269

Change-Id: Id27f7043ca2122cf43adf59e48843ffe5a445359
2022-03-22 18:46:25 +00:00
Treehugger Robot
7ecab5ff11 Merge "Rebuild and copy recovery patch files when using vendor_otatools" am: 93d7c150c9 am: c4a7031063 am: 07326c0417
Original change: https://android-review.googlesource.com/c/platform/build/+/2036543

Change-Id: Ic5871105c9867d22ee3666e6be02c523c6c5b493
2022-03-22 18:05:26 +00:00