Commit graph

329 commits

Author SHA1 Message Date
Dmitry Muhomor
0691a32fa6 generate-all: pass extra commands to lunch/choosecombo in envsetup.sh
Requires the corresponding patch in build/make repo.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
55c6f0db6b rewrite aapt2-based overlay parser
Previous parser relied on text output of `aapt2/ dump xmltree` and `aapt2 dump resources` commands,
which is not meant for parsing.

This led to multiple parsing bugs: cutoff multiline strings, floating point parsing issues,
quoting issues, non-English locale issues etc.

Rewritten parser instead relies on protobuf aapt2 output, which allows to resolve most of these
issues.

A simple patch to aapt2 in frameworks/base is required to slightly expand its protobuf output.

Other notable changes:
- support for the "fraction" resource type
- parsing is now parallelized at APK level
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
2543191d23 add ts-proto output for Resources.proto from aapt2 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
86c7472066 do not use BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
3416e4a554 generate-all: verify the result against a reference FileTreeSpec
This commit adds an extra step to generate-all:
- if --updateSpec flag is specified, FileTreeSpec of the generated vendor module is written out
to vendor-specs/$VENDOR/$DEVICE.yaml file ("reference FileTreeSpec").
- if --updateSpec is not specified, FileTreeSpec of the generated vendor module is compared against
the reference FileTreeSpec. If there are any differences, generated vendor module is deleted and an
exception is thrown.

Also, when --updateSpec flag is used, text files inside vendor module are written out to
vendor-skels/$VENDOR/$DEVICE directory.

Contents of vendor-skels/ are useful for keeping track of vendor module changes via git and for
showing diffs in case text files in the generated module don't match the reference ones.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
73c1f665f3 add code for generating and comparing FileTreeSpecs 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
c84d027c23 update links to adevtool GitHub 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
bcc612c622 sort items in generated overlay resource files
This makes them easier to read.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
5c9e695863 reorder PRODUCT_{PACKAGES,COPY_FILES} in device makefile
These directives are usually very large and are less interesting than PRODUCT_<partition>_PROPERTIES,
PRODUCT_OVERRIDE_FINGERPRINT variables. Move them to the bottom to improve readability.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
2aaa970886 add show-status command
It shows BUILD_ID, AOSP tag, platform security patch level and stock OS image availability for
each of specified devices.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
3bf5977e81 add command for making "BUILD_ID to AOSP tag" map 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
dcc8339fd7 update generate-all command
- pass device config with the standard -d flag instead of through argument
- default to using factory and OTA images for current build ID when --stockSrc is not specified
- add extract_android_ota_payload.py as the final step, with an option to skip it
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
12e586385f update generate-prep command
- pass device config with the standard -d flag instead of through argument. This allows to specify
multiple devices without using DeviceList config file
- default to using factory image for current build ID when --stockSrc is not specified
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
97b724790b improve handling of device factory images
- support unpacking factory images without root by using debugfs rdump (ext4) and
fsck.erofs --extract (erofs)
- support reusing unpacked factory images between adevtool runs to reduce latency
- unpack factory images for multiple devices in parallel. Extraction of files from partition images
is parallelized too
- extract partition images from factory image inner zip directly, without extracting it, since this
inner zip is uncompressed
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
9750841f3d collect-state: support specifying device names with DeviceList(s)
For example, `collect-state -d pixel-gen{6,7} barbet`
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
40354ec422 collect-state: set default output path to vendor/state 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
2a3fba5d2e generate-all: set default of customSrc flag to vendor/state 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
22b2d700db add helper functions for async spawning of processes 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
8d8604dbe7 check PLATFORM_SECURITY_PATCH value in product Makefile
On devices that no longer receive vendor updates (e.g. Pixel 4 / 4 XL), PLATFORM_SECURITY_PATCH
should be overriden to correctly indicate that.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
70129836eb check in product Makefile that BUILD_ID is set correctly 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
0b0b76ef70 do not use bright green color for action spinner text
It has bad readability when using dark-on-light terminal color schemes.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
d7594443cd make file system type of OS partitions part of device config 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
694afd844b improve device image downloading
- define a default download directory
- obtain image URL and checksum from the Git-tracked local build index instead of fetching it from
remote server
- default to downloading images for the current build ID
- download image to a temporary file first, mark it as complete only after checksum verification
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
e29dbb7aea add update-build-index command
See its description.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
1d3c8c59c8 add support for loading build index from YAML
Default path is config/build-index/build-index.yml, 'includes' directive is supported.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
e1d69888dd add fetch-build-index command 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
822c196d02 add parser of Pixel factory, OTA and vendor image pages
Extracts the following image properties:
- device name
- build ID
- build desctiption
- image download link
- image file SHA-256

Images are grouped by '$DEVICE $BUILD_ID' key.

Beta factory/OTA image pages are supported too.

JSDOM dependency is added for simple and correct parsing of these pages.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
31d493f58c make current and previous build ID part of device config
Previous build ID is useful when doing comparisons.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
81adbb0c42 improve device config loading
- support specifying device{,-list} config with config file name instead of config path
- support loading mutliple device{,-list} configs at once. Previously, loading multiple device
configs was supported only by passing a device-list config
- parallelize config loading with promises
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
4503081dbf require device config name to match device name
This is already the case for all device configs.
2023-08-31 16:03:43 -04:00
Dmitry Muhomor
65e3e84583 add path constants for OS checkout, adevtool, (device) config dirs 2023-08-31 16:03:43 -04:00
Dmitry Muhomor
c4e850b86b factor out loadAndMergeConfig()
It's useful for non-device kind of configs too.
2023-08-31 16:03:43 -04:00
Daniel Micay
86a44792dd fix setting radio version 2023-06-23 13:50:43 -04:00
Dmitry Muhomor
84aa406348 support devices that don't have a baseband 2023-06-21 03:54:54 -04:00
Dmitry Muhomor
06114545f4 make addition of "require partition-exists=vendor_kernel_boot" generic
Instead of hardcoding the list of devices (which is now missing lynx), check whether
vendor_kernel_boot is present in the list of stock A/B partitions.
2023-06-21 03:54:54 -04:00
Dmitry Muhomor
2b26cec4e3 factor out reading of ro.product.ab_ota_partitions prop into a function 2023-06-21 03:54:54 -04:00
Dmitry Muhomor
6743fe4639 disable broken support for file reference overlays 2023-06-21 02:19:31 -04:00
Dmitry Muhomor
0a0d6add20 support overriding the auto-detected "privileged: true" flag in APK modules 2023-03-18 18:10:01 -04:00
Dmitry Muhomor
c5a7db6c85 remove a redundant null-check
customProps is not nullable.
2023-03-18 18:10:01 -04:00
smdyv
a038824da2 Include partition requirement in android_info.txt
Instead of silently failing, an error is raised now when using an
incompatible fastboot version.
2022-11-25 13:55:42 -05:00
flawedworld
325335544a Don't explicitly state filesystem type when mounting 2022-05-04 01:54:09 -04:00
flawedworld
f37ea5c8a7 Fix path issue on Android 13 images 2022-05-04 01:53:58 -04:00
flawedworld
eae4e2f901 Revert "[temporary] include OTA firmware on 6th generation devices"
This reverts commit b411a2a14c.
2022-04-18 15:12:51 -04:00
flawedworld
ba517e2515 Automatically add all radio files 2022-04-18 15:12:51 -04:00
flawedworld
1dbd18af2b Add OTA firmware extraction command 2022-04-18 15:12:51 -04:00
flawedworld
b411a2a14c [temporary] include OTA firmware on 6th generation devices 2022-04-04 15:47:01 -04:00
flawedworld
701136ca8d Overwrite existing files always during unzip extraction
Otherwise adevtool hangs :(
2022-04-04 15:47:01 -04:00
Danny Lin
95f25fde97 download: Get latest build from last match instead of sorting
This fails for 12L: SP2A.220305.013.A3 < SQ1D.220205.004. Google always
adds builds to the bottom anyway, so just pick the last matched URL.
2022-04-04 15:47:01 -04:00
Danny Lin
b5b62ec4dd build: Fix duplicate generated modules for cross-partition conflicts
The partition check for conflicts fails when we have cross-partition
conflicts, as the same-partition module may also be a conflict.

To fix the issue, keep a separate map of all candidate modules with the
same name and check all of them for duplicate entries, even if some fail
the partition check.
2022-04-04 15:47:01 -04:00
Danny Lin
56c8fcc4e7 config: device: Add type definition for structuredClone 2022-04-04 15:47:01 -04:00