Commit Graph

154 Commits

Author SHA1 Message Date
Andrew Gunnerson 545007eee0 Merge pull request #74 from chenxiaolong/sparse
Produce sparse output files
2023-03-02 16:04:13 -05:00
Andrew Gunnerson 21225c218b Produce sparse output files
This significantly reduces the size when patching dummy OTAs. This is a
naive implementation that just seeks when the entire write() buffer is
all zeroes, but that seems to be more than sufficient. The output files
have fewer blocks allocated than the (dummy) input files.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-03-02 15:58:06 -05:00
Andrew Gunnerson 190dd23e35 Merge pull request #73 from pascallj/sparse
Use sparse testing images
2023-03-02 15:26:00 -05:00
Pascal Roeleven 9dec3f8408 Use sparse images in GA
Also invalidate caches by adding version prefix
2023-03-02 15:22:34 +01:00
Pascal Roeleven 632cbeecaa Don't compress images by default
Now that we are writing sparse images, compressing is no longer
necessary by default.
2023-03-02 15:22:25 +01:00
Pascal Roeleven d9495219f7 Write sparse file instead of zeros 2023-03-02 14:08:01 +01:00
Pascal Roeleven 91447ba986 Make Crc32Hasher more Pythonic 2023-03-02 13:54:10 +01:00
Andrew Gunnerson 216c3b7d06 Merge pull request #72 from chenxiaolong/parallel_download
tests: Add native Python parallel download implementation
2023-03-01 17:51:10 -05:00
Andrew Gunnerson 003fbf18ba tests/downloader.py: Add MiB/s to DefaultDisplayCallback output
No fancy algorithm. Just a simple moving average over 5 seconds, updated
at 100ms intervals.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-03-01 17:44:17 -05:00
Andrew Gunnerson 76eec8fb6e tests/downloader.py: Avoid unnecessary buffer allocations in DownloadWorker
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-03-01 17:44:16 -05:00
Andrew Gunnerson db562315e9 tests: Drop aria2 dependency
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-03-01 17:44:15 -05:00
Andrew Gunnerson 69cb0dd4d7 tests: Add native Python parallel download implementation
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-03-01 17:44:03 -05:00
Andrew Gunnerson 1e07010eb7 Merge pull request #70 from pascallj/ci
Test all device images in Github Actions
2023-03-01 17:33:53 -05:00
Andrew Gunnerson e7c6d06e45 Merge pull request #69 from pascallj/device_test
Use dummy images for testing
2023-03-01 17:22:16 -05:00
Pascal Roeleven f8ef998794 Reorder steps 2023-03-01 16:50:12 +01:00
Pascal Roeleven 4ac7826c32 Cache tox environments with tox hash 2023-03-01 16:11:32 +01:00
Pascal Roeleven 50b8d28779 Cache images with database hash 2023-03-01 16:04:14 +01:00
Pascal Roeleven 0b6f76637f Move caching of Magisk to setup workflow
It's unnecessary to spin up an entire runner for just this short and
simple task.
2023-03-01 16:04:14 +01:00
Pascal Roeleven 41ce7d653f Cache Magisk with database hash
Simplify caching by caching on database hash instead of Magisk hash.
hashFiles is only available in the steps, hence the reason for it being
exported to the outputs from the steps (and not directly).
2023-03-01 16:03:59 +01:00
Pascal Roeleven ccf64c40b0 Add url for Oneplus 10 Pro 2023-03-01 13:12:24 +01:00
Pascal Roeleven a7170ea4c0 Replace double quotes with single quotes where possible
Also formatted differently to adhere more to the style used in the rest
of the project
2023-02-28 21:39:54 +01:00
Pascal Roeleven 13b9877e2c Fix testing for Oneplus images
Also added to the database
2023-02-28 21:35:07 +01:00
Pascal Roeleven f12d42359d Update database 2023-02-28 21:35:07 +01:00
Pascal Roeleven 017889684d Automatically test full OTA zip 2023-02-28 21:35:07 +01:00
Pascal Roeleven 6ce86be917 Add hashes to database automatically 2023-02-28 21:35:07 +01:00
Pascal Roeleven 38dd0917e6 Automatically add device to database 2023-02-28 21:35:07 +01:00
Pascal Roeleven 10d964b7ef Zero all partitions we never intend to use 2023-02-28 21:35:07 +01:00
Pascal Roeleven fc6564ea47 Use constant instead of value 2023-02-28 21:35:07 +01:00
Pascal Roeleven 0aa18ff0a6 Use unittest.mock instead of manually patching 2023-02-28 21:34:49 +01:00
Pascal Roeleven a4f0086368 Improve reliability for getting file offset in zip 2023-02-28 12:55:47 +01:00
Andrew Gunnerson 07b0e552f9 Merge pull request #71 from chenxiaolong/ota
avbroot/ota.py: Remove OnePlus comment about ZERO blocks
2023-02-27 20:14:41 -05:00
Andrew Gunnerson 3bd5f77716 avbroot/ota.py: Remove OnePlus comment about ZERO blocks
There's no OnePlus-specific behavior here. ZERO blocks are supposed to
be missing several fields, including data_sha256_hash.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-02-27 20:13:06 -05:00
Andrew Gunnerson ed915b5ad6 Merge pull request #68 from pascallj/external
Import external in ota
2023-02-27 16:30:07 -05:00
Pascal Roeleven fb2c512248 Test all device images in Github Actions 2023-02-27 16:38:39 +01:00
Pascal Roeleven 0090de3a48 Test dummy images with tox 2023-02-27 16:38:26 +01:00
Pascal Roeleven 8f2d09b447 Add script to test with dummy images 2023-02-27 16:38:26 +01:00
Pascal Roeleven e129f2478c Add creation of dummy images for use in tests 2023-02-27 16:38:26 +01:00
Pascal Roeleven 5e0a0be981 Import external in ota 2023-02-27 16:38:03 +01:00
Andrew Gunnerson d911945a05 Merge pull request #67 from chenxiaolong/kmi
avbroot/boot.py: Check KMI version when using prepatched image
2023-02-27 01:19:20 -05:00
Andrew Gunnerson 8ea3d185ca avbroot/boot.py: Check KMI version when using prepatched image
This ensures that the user isn't replacing the kernel image with another
one that's not binary compatible (based on the GKI kernel module
interface version).

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-02-27 01:10:43 -05:00
Andrew Gunnerson 794755be0c Merge pull request #66 from chenxiaolong/readme
tests: README.md: Document that --prepatched is now tested
2023-02-26 22:42:29 -05:00
Andrew Gunnerson d74f7c77ff tests: README.md: Document that --prepatched is now tested
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-02-26 22:41:54 -05:00
Andrew Gunnerson 0449b606ff Merge pull request #65 from chenxiaolong/extract
README.md: Add section about extracting the entire OTA
2023-02-26 22:39:17 -05:00
Andrew Gunnerson ed1310d243 README.md: Add section about extracting the entire OTA
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-02-26 22:38:32 -05:00
Andrew Gunnerson 56013dd027 Merge pull request #64 from chenxiaolong/parallel
Extract images from payload in parallel
2023-02-26 22:37:30 -05:00
Andrew Gunnerson 282adf36cb Extract images from payload in parallel
Due to zipfile's internal locking (no pread support), the actual I/O
isn't parallelized. However, this still speeds up `extract --all` very
significantly because the extraction process is mostly CPU bound by
decompression.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-02-26 21:25:10 -05:00
Andrew Gunnerson b326b6f4a0 Merge pull request #63 from chenxiaolong/all
avbroot/main.py: Add --all option for extract subcommand
2023-02-26 20:26:47 -05:00
Andrew Gunnerson 3f85a441e4 avbroot/main.py: Add --all option for extract subcommand
Not really needed for normal usage, but nice to have a way to extract
everything without needing other tools.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-02-26 20:25:10 -05:00
Andrew Gunnerson 02f8942642 Merge pull request #62 from chenxiaolong/clear_vbmeta_flags
Add option to clear vbmeta flags
2023-02-26 20:22:33 -05:00
Andrew Gunnerson a927d09936 Add option to clear vbmeta flags
Some Android builds ship with a root vbmeta image with flags that
disable AVB completely. This commit adds a new check for these flags so
that the patching process will fail and also adds a new
`--clear-vbmeta-flags` option for forcibly setting the flags to 0.

Issue: #60

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-02-26 19:01:34 -05:00