Commit graph

7192 commits

Author SHA1 Message Date
Sasha Smundak
57bb5081d7 Always use /bin/sh to run the command.
SHELL environment variable cannot be relied on because the rbcrun
can be run as `env - rbcrun ...`

Fixes: 184278019
Test: build/soong/soong_ui.bash --make-mode USE_BAZEL=1 TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug droid dist platform_tests
Change-Id: Id8fc7fd1ae8f2e674028ba5ffb3616f87eea6bc4
2021-04-01 16:44:47 -07:00
Tianjie Xu
98c8507215 Merge "Fix error if ramdisk is minigzip compression" 2021-04-01 20:15:35 +00:00
Bob Badour
bfa8d0cacc [LSC] Add LOCAL_LICENSE_KINDS to build/make
Added SPDX-license-identifier-Apache-2.0 to:
  tools/rbcrun/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I6a1c75458115b15d9d0d9f0dbc11e0acffc1fe7b
2021-03-31 19:57:06 -07:00
jiajia tang
f3f842b676 Fix error if ramdisk is minigzip compression
This change intends to fix if ramdisk is not "lz4" compression.
Legacy is "minigzip" compression.

If not lz4, the following error will happen when exec build_super_image.py:
  Unable to get boot image build props: Failed to run command '['lz4', '-d', '/tmp/boot_omdZZ8.img/ramdisk', '/tmp/boot_omdZZ8.img/uncompressed_ramdisk']' (exit code 44):
  Error 44 : Unrecognized header : file cannot be decoded

Change-Id: I71248387bbeecbf184e0c24e6346c235d728518e
Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
2021-04-01 10:41:00 +08:00
Alexander Smundak
fe5799af6b Merge changes from topic "product_config_star"
* changes:
  Product configuration in Starlark support files.
  Roboleaf product configuration runner
2021-03-31 18:28:50 +00:00
Yo Chiang
e86bab474b Revert^2 "Add option to allow product makefiles to skip building s..."
This reverts commit ccfea17fb7.

Reason for revert: Original bug was resolved by updating branch config

Change-Id: I2327092261a2147fa8f2be3d878db04228e65511
2021-03-25 10:12:28 +00:00
Tianjie Xu
ccfea17fb7 Revert "Add option to allow product makefiles to skip building s..."
Revert submission 1644988-nextgen-release-img-zip-cleanup

Reason for revert: b/183654818
Reverted Changes:
I2474e5fd6:Nextgen release: Don't build super_empty.img
I549439528:Add option to allow product makefiles to skip buil...

Change-Id: I711d1c288eed17686b048144d8d41c0fdd5cd8e1
2021-03-25 05:00:12 +00:00
Yi-Yo Chiang
ba959a5ff1 Add option to allow product makefiles to skip building super_empty.img
This change doesn't change the condition for building super_empty.img,
it just add a toggle PRODUCT_BUILD_SUPER_EMPTY_IMAGE that product
makefiles can use to skip building super_empty.img.
Products that don't use super_empty at all, for example GSI, can set
this option to ensure the super_empty.img is not built.

Bug: 183068624
Test: "m dist" on GSI and check the build artifacts under OUT and DIST
  directories, and check the contents of *-img-*.zip
Change-Id: I54943952873d2d297fd9d18cbe14742bc12ae9c6
2021-03-24 05:35:10 +00:00
Treehugger Robot
30f09a1a2e Merge "Support GKI boot.img v4 signing" 2021-03-23 00:24:33 +00:00
Bowgo Tsai
27c39b0af2 Support GKI boot.img v4 signing
Commit I9967d06bde0e18a12b84b5b0b568db09765fe305 supports adding a
generic boot_signature into boot.img v4. This change allows replacing
the boot_signture signing key with a release key during the release
process.

The default GKI signing key can be specified in a BoardConfig.mk via:

  BOARD_GKI_SIGNING_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
  BOARD_GKI_SIGNING_ALGORITHM := SHA256_RSA2048
  BOARD_GKI_SIGNING_SIGNATURE_ARGS := --prop foo:bar

The release signing key/algorithm can be specified by the following options
when invoking sign_target_files_apks:

  --gki_signing_key=external/avb/test/data/testkey_rsa4096.pem
  --gki_signing_algorithm=SHA256_RSA4096

Additional arguments for generating the GKI signature can be
specified as below:

  --gki_signing_extra_args="--prop gki:prop1 --prop gki:prop2"

Bug: 177862434
Test: make dist
Test: sign_target_files_apks \
        --gki_signing_key=external/avb/test/data/testkey_rsa4096.pem \
        --gki_signing_algorithm=SHA256_RSA4096 \
        --gki_signing_extra_args="--prop gki:prop1 --prop gki:prop2" \
        ./out/dist/*-target_files-eng.*.zip signed.zip
Test: Checks GKI boot_signature is expected after signing:
      `unzip signed.zip IMAGES/boot.img`
      `unpack_bootimg --boot_img IMAGES/boot.img --out unpack`
      `avbtool info_image --image unpack/boot_signature`
Test: unit test: releasetools_test and releasetools_py3_test

Change-Id: I61dadbc242360e4cab3dc70295931b4a5b9422a9
2021-03-19 17:11:04 +08:00
Tianjie Xu
c63bf0ad7a Merge "Check that sum of DAP groups is smaller than super" 2021-03-18 17:33:29 +00:00
Sasha Smundak
24159db21e Roboleaf product configuration runner
The application rbcrun executes Starlark scripts that define Android product configurations.
See README.md for details.

Test: go test
Fixes: 180529448
Change-Id: I7d728b47d3f381b7052a0d7d51c9e698e5c2e316
2021-03-18 10:03:59 -07:00
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
Tianjie
8ba4270e24 Check that sum of DAP groups is smaller than super
The maximum size of all dynamic partition groups should not exceed
the super size - DAP metadata size. Today the configuration of
some devices don't take the metadata into acount. So turn the CheckLe
into CheckLt.

Also, display a warning if the reserved size for DAP metadata is less
than 1M.

Bug: 182431975
Test: mm -j32 check-all-partition-sizes
Change-Id: Ie278f224321083e457d68da000c2b22ec8a54085
2021-03-16 22:13:13 -07: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
Joe Onorato
6af489099a Merge "ALLOW_RULES_IN_PRODUCT_CONFIG" 2021-02-24 17:43:37 +00:00
Devin Moore
fd4f3c4c63 Merge "Support vendor bootconfig creation" 2021-02-24 15:56:48 +00:00
Joe Onorato
749c1955a2 ALLOW_RULES_IN_PRODUCT_CONFIG
If ALLOW_RULES_IN_PRODUCT_CONFIG is set, pass it to kati via
.KATI_ALLOW_RULES, to issue warnings or errors about rules
during product configuration.

Test: CHECK_FOR_RULES=true ./build/make/tools/product_config/test.sh
Test: ALLOW_RULES_IN_PRODUCT_CONFIG=error m nothing
Test: ALLOW_RULES_IN_PRODUCT_CONFIG=warning m nothing
Test: m nothing
Change-Id: I35dd9ffe4ec71f97beaa8b8a2f10d80502088af2
2021-02-23 22:40:39 -08:00
Joe Onorato
fbabf70394 Merge "Generate FlatConfig objects from GenericConfig objects." 2021-02-24 05:57:33 +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
Joe Onorato
38a57bf1df Generate FlatConfig objects from GenericConfig objects.
Doesn't include tests. More of those will come later.

Test: build/make/tools/product_config/test.sh
Change-Id: Icd2b455ac5f7b4773ba332fc40e994dc6f024f1b
2021-02-22 17:18:07 -08:00
Joe Onorato
5af98130b8 Merge "Add tool to find problems with build repeatability." 2021-02-22 05:34:34 +00:00
Joe Onorato
2590206000 Move VarType out of its respective outer classes.
It's used more than I originally thought it would be and it's
unnecessarily nested.

Test: rm -rf out/config/ && m product-config-test product-config && java -jar out/host/linux-x86/testcases/product-config-test/product-config-test.jar && time ( product-config --ckati_bin /source/kati/ckati > ~/Desktop/out.txt )
Change-Id: Id5a075863151e37ec60e5d9dbeb817c2df245bc7
2021-02-21 14:33:33 -08:00
Tianjie Xu
5b1c0a347c Merge "Sign APEXes on all partitions" 2021-02-19 21:41:02 +00:00
Joe Onorato
2fd88e0600 Merge changes I9c1995f8,Id6763781,I52e5c07f,I4706e32f,I7d74b226
* changes:
  Keep the first and last snapshot of variables.
  Generate GenericConfig objects from MakeConfig objects.
  Emit and parse the product config variables from kati/make
  Add class to fork and exec kati, based on the commandline option given.
  Add a CSV parser to parse the output from kati.
2021-02-19 16:56:13 +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
Joe Onorato
64f3db2ec1 Keep the first and last snapshot of variables.
So we can compare our reconstruction of the variable state.

Test: treehugger
Change-Id: I9c1995f8969dcf95256aa7c05a01d0431e36caa2
2021-02-17 10:02:41 -08:00
Joe Onorato
8523601ce9 Generate GenericConfig objects from MakeConfig objects.
Applies heuristics to the sequence of Blocks to do so.

Test: rm -rf out/config/ && m product-config-test product-config && java -jar out/host/linux-x86/testcases/product-config-test/product-config-test.jar && time ( out/host/linux-x86/bin/product-config --ckati_bin /source/kati/ckati > ~/Desktop/out.txt )
Change-Id: Id6763781bc876e2b2e0be320a7259c1ed41c2334
2021-02-17 10:02:41 -08:00
Joe Onorato
f20c93afa3 Emit and parse the product config variables from kati/make
Test: cls && rm -rf out/config/ && m product-config-test product-config && java -jar out/host/linux-x86/testcases/product-config-test/product-config-test.jar && time ( product-config --ckati_bin /source/kati/ckati > ~/Desktop/out.txt )
Change-Id: I52e5c07f9aaf899f9d45680313275c6d9e246ff2
2021-02-17 10:02:41 -08:00
Joe Onorato
9de9652582 Add class to fork and exec kati, based on the commandline option given.
Test: m product-config-test && java -jar out/host/linux-x86/testcases/product-config-test/product-config-test.jar
Change-Id: I4706e32ff7ac4424b6835b94fef40a2c838f8492
2021-02-17 10:02:41 -08:00
Joe Onorato
7c01d47c9a Add a CSV parser to parse the output from kati.
(Yet another class that would be great for android to have in a host
tools library)

Test: m product-config-test && java -jar out/host/linux-x86/testcases/product-config-test/product-config-test.jar
Change-Id: I7d74b2265393e4f340729ca5ba82d1ec92a20f85
2021-02-17 10:02:41 -08: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
Treehugger Robot
3c1a6ee5ad Merge "Fix error where otacerts in VENDOR_BOOT isn't replaced" 2021-02-12 06:06:11 +00:00
Treehugger Robot
ba106847ff Merge "Fix signing errors where some partitions aren't properly signed" 2021-02-12 04:29:44 +00:00
Treehugger Robot
d3f5268dfb Merge changes Icd25d2d0,I39ef10b0,I06bb80fe
* changes:
  Rearrange the methods on ErrorReporter to be more convenient.
  Add glue to run product-config-test as a standalone commandline executable.
  CommandException to cleanly exit product-config on error.
2021-02-12 04:03:44 +00: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