400 Commits

Author SHA1 Message Date
Andrew Gunnerson a7c872be3e Version 2.3.3
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
v2.3.3
2023-11-15 18:59:43 -05:00
Andrew Gunnerson cf1ab6ecca CHANGELOG.md: Add entry for PR #208
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-15 18:58:53 -05:00
Andrew Gunnerson 7364e8d725 Merge pull request #208 from chenxiaolong/descriptors
cli/ota: Merge property and kernel cmdline descriptors from child into parent
2023-11-15 18:57:26 -05:00
Andrew Gunnerson 935a86e72c cli/ota: Merge property and kernel cmdline descriptors from child into parent
Some devices use the legacy Android/ChromiumOS-specific `dm=` kernel
command line option to configure dm-verity without userspace helpers.
These options are specified in kernel command line descriptors in the
system partition's vbmeta header, which need to be merged into the
parent vbmeta image for the bootloader to see them.

This commit adds support for merging property descriptors and kernel
command line descriptors. Property descriptors are merged based on an
exact string match of the property key. Kernel command line descriptors
are merged based on the (non-empty) text before the first equal sign.

Issue: #203

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-15 18:39:55 -05:00
Andrew Gunnerson a9a6107043 CHANGELOG.md: Add entry for PR #207
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-15 17:46:49 -05:00
Andrew Gunnerson 3c1d5a8bb3 Merge pull request #207 from chenxiaolong/xz
compression: Add support for XZ-compressed ramdisks
2023-11-15 17:11:23 -05:00
Andrew Gunnerson 26ec8098e5 compression: Add support for XZ-compressed ramdisks
`lineage-20.0-20231109-nightly-taimen-signed.zip` is an example of an
OTA that uses XZ-compressed ramdisks.

Issue: #203

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-15 16:37:00 -05:00
Andrew Gunnerson 2a293147b1 Version 2.3.2
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
v2.3.2
2023-11-14 19:19:15 -05:00
Andrew Gunnerson aea12c8d58 CHANGELOG.md: Add entry for PR #206
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-14 19:18:43 -05:00
Andrew Gunnerson 5545b0fe1b Merge pull request #206 from chenxiaolong/promote
cli/avb: Promote insecure hash algorithms to secure ones
2023-11-14 19:17:18 -05:00
Andrew Gunnerson 9c818fb165 cli/avb: Promote insecure hash algorithms to secure ones
This is done unconditionally because there shouldn't be any real-world
device that uses AVB2 and has a kernel compiled without sha256 support.

Issue: #203

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-14 19:10:07 -05:00
Andrew Gunnerson d174af8969 CHANGELOG.md: Add entry for PR #205
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-14 18:54:14 -05:00
Andrew Gunnerson 2cf11094de Merge pull request #205 from chenxiaolong/cmdline
cli/avb: Update kernel cmdline descriptor for devices that use `dm=`
2023-11-14 18:52:16 -05:00
Andrew Gunnerson 6f565969b7 cli/avb: Update kernel cmdline descriptor for devices that use dm=
Older Pixel devices (and ChromiumOS) specify the dm-verity options on
the kernel command line using a custom `dm=` parameter instead of using
dm-init or a userspace helper. This commit updates the avb pack and
repack commands to automatically update the relevant kernel command line
descriptor if it exists.

Issue: #203

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-14 18:36:07 -05:00
Andrew Gunnerson da2eb6b717 Merge pull request #204 from chenxiaolong/readme
README.md: Make sections easier to follow
2023-11-13 15:50:01 -05:00
Andrew Gunnerson 2f8d0264eb README.md: Make sections easier to follow
* Split out requirements from the warnings/caveats section and move it
  to the top. Hopefully this helps new users determine whether they can
  even use avbroot quicker.
* Split usage section into separate usage, initial install, and updates
  sections. This should hopefully make the steps much easier to follow
  without a bunch of steps being prefixed with `[Initial setup only]`.
* Explicitly state what arguments are required for Magisk, KernelSU, and
  unrooted setups instead of directing users to the advanced usage
  section.
* Don't assume that everyone will use Magisk in the other sections.
* Explicitly state the assumption that the device should already running
  the OS build that the user wants to patch during initial install.
* Add step to updates section for installing an updated Magisk or
  KernelSU app.
* Move command for building the modules from the modules section to the
  building from source section.
* Update sample error message in the clear vbmeta flags section to match
  what avbroot will actually print out.
* General rewording to try and make things clearer (especially reducing
  parenthesized parts).

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-13 03:51:17 -05:00
Andrew Gunnerson ec1fe74900 CHANGELOG.md: Add entry for PR #202
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-12 18:53:13 -05:00
Andrew Gunnerson b3b7c7b738 Merge pull request #202 from chenxiaolong/error
cli/ota: Improve error reporting when descriptor types are mismatched
2023-11-12 18:51:56 -05:00
Andrew Gunnerson 2f1ee1ae4f cli/ota: Improve error reporting when descriptor types are mismatched
Issue: #201

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-12 18:32:55 -05:00
Andrew Gunnerson cb62996b9f Version 2.3.1
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
v2.3.1
2023-11-06 16:59:49 -05:00
Andrew Gunnerson 54c06835c5 CHANGELOG.md: Add entry for PR #199
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-06 16:59:16 -05:00
Andrew Gunnerson 65a1b80da5 Merge pull request #199 from chenxiaolong/magisk_26.4
boot.rs: Bump Magisk version upper bound to 26500
2023-11-06 16:58:50 -05:00
Andrew Gunnerson 76ff1ddcda boot.rs: Bump Magisk version upper bound to 26500
There are no upstream changes that impact avbroot.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-11-06 16:40:14 -05:00
Andrew Gunnerson 0a4dda14cd README.md: Clarify that dmesg step should be run on the device
Fixes: #198

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-29 14:02:57 -04:00
Andrew Gunnerson bde8dbfbcd Version 2.3.0
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
v2.3.0
2023-10-27 18:10:51 -04:00
Andrew Gunnerson fbafbafe90 CHANGELOG.md: Fix typo: Reword -> Rework
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-27 18:03:51 -04:00
Andrew Gunnerson a14cab71e5 CHANGELOG.md: Add entry for PR #197
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-27 18:01:17 -04:00
Andrew Gunnerson c2f4297bb7 Merge pull request #197 from chenxiaolong/deps
Update dependencies
2023-10-27 17:59:15 -04:00
Andrew Gunnerson 9d63c9759d Update dependencies
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-27 17:44:25 -04:00
Andrew Gunnerson 73b893f3ed changelog.txt: Add entry for PR #196
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-27 17:42:00 -04:00
Andrew Gunnerson fd7bbf5751 Merge pull request #196 from chenxiaolong/legacy
ota: Add support for legacy OTA metadata
2023-10-27 17:36:03 -04:00
Andrew Gunnerson 409867a8e5 ota: Add support for legacy OTA metadata
Android 11 OTAs use the same `payload.bin` format, but lack the
`metadata.pb` protobuf representation of the OTA metadata. This commit
adds support for parsing the legacy plain-text `metadata` format. Like
before, the output files will still contain both the legacy and
protobuf representations.

Note that the legacy format allowed OEMs to specify arbitrary key/value
pairs. These will be discarded during patching because they cannot be
represented in the protobuf format, which is used in avbroot's internal
representation.

Issue: #195

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-27 15:15:13 -04:00
Andrew Gunnerson f96a2887df README.md: Add instructions for reverting to stock firmware
Fixes: #194

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-17 15:47:27 -04:00
Andrew Gunnerson 8140e25620 Merge pull request #193 from pascallj/patch-1
Update README.md to use new options
2023-10-15 15:55:52 -04:00
Pascal Roeleven ce05477ab1 Update README.md to use new options
During the migration to avbroot 2.0, these options have been renamed. Reflect this in the Readme.

Signed-off-by: Pascal Roeleven <dev@pascalroeleven.nl>
2023-10-15 21:36:35 +02:00
Andrew Gunnerson 1c4800c0cb CHANGELOG.md: Add entry for PR #191
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-14 17:05:53 -04:00
Andrew Gunnerson d402fdf5f1 Merge pull request #191 from chenxiaolong/sign
boot: Avoid setting signature algorithm when image is indirectly signed
2023-10-14 17:04:29 -04:00
Andrew Gunnerson 4930527598 boot: Avoid setting signature algorithm when image is indirectly signed
Previously, the AVB `algorithm_type` field was unconditionally being set
to a value that is compatible with the AVB private key. However, for
indirectly-signed boot images, the value should be set to `None`. Pixel
bootloaders accept the incorrect value, but other devices' bootloaders
might not.

Issue: #186

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-13 18:46:52 -04:00
Andrew Gunnerson 9b970c6d25 CHANGELOG.md: Add entry for PR #190
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-13 18:04:44 -04:00
Andrew Gunnerson e7fb4004cd Merge pull request #190 from chenxiaolong/sha1
avb: Allow computing insecure SHA1 hashes for verification
2023-10-13 18:03:04 -04:00
Andrew Gunnerson 2773dcddcf avb: Allow computing insecure SHA1 hashes for verification
Some partitions, like system_ext in the Pixel Experience build for
`avicii`, use SHA1 for the dm-verity hash tree. This is technically
valid, so allow the `avb verify` command to compute these hashes. SHA1
will still be rejected when creating AVB images.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-13 17:33:45 -04:00
Andrew Gunnerson 36765290fd CHANGELOG.md: Add entry for PR #189
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-13 17:32:33 -04:00
Andrew Gunnerson 6d8268e472 Merge pull request #189 from chenxiaolong/reopen
Move reopen functionality to a new trait
2023-10-13 17:31:15 -04:00
Andrew Gunnerson 2e8e86766b Move reopen functionality to a new trait
This is still not the ideal API, but it makes the code quite a bit more
readable since we no longer have to pass around closures everywhere that
multithreaded reads and writes to the same file are needed.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-11 22:09:45 -04:00
Andrew Gunnerson 8ae1c54c13 CHANGELOG.md: Add entry for PR #188
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-11 20:47:03 -04:00
Andrew Gunnerson 5212d4de51 Merge pull request #188 from chenxiaolong/avb_check
Add more checks to ensure AVB is actually providing security
2023-10-11 20:43:07 -04:00
Andrew Gunnerson 61bb9d6a81 Add more checks to ensure AVB is actually providing security
avbroot currently has a check to ensure that AVB signature verification
isn't completely disabled by non-zero vbmeta header flags. This is done
to ensure that the user isn't given a false sense of security when the
OS is built in an insecure way. This commit makes a few changes better
reject insecure OTAs.

The first change is extending the non-zero flags check to all vbmeta
images. Previously, only vbmeta images that needed to be updated as a
result of patching/re-signing were checked.

The second change is ensuring that there are no critical partitions
present in `payload.bin`, but missing from the vbmeta descriptors. For
example, if the vbmeta descriptor for `system.img` is missing, the
patching process will fail with a fatal error that cannot be bypassed.

Unfortunately, it's not feasible to check every partition because there
is no known device where every partition is protected by AVB. Google's
Tensor-based devices are the best and only have a single partition not
protected by AVB: `modem`. Qualcomm-based devices have many partitions
not protected by AVB. OnePlus devices have many partitions that are
checked directly (against the appended header) and thus, aren't listed
in any vbmeta image.

Due to this, only partitions that AOSP understands are checked. OEM-
specific partitions (which, security-wise, may be just as important) are
not checked.

The third change is ensuring that there's only a single root of trust
among the vbmeta images. This way, it's impossible to have, for example,
a `vbmeta_unused` image that contains all the descriptors and an empty
`vbmeta` image that's actually read by the bootloader.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-11 20:28:32 -04:00
Andrew Gunnerson 6d86fbf8a0 CHANGELOG.md: Add entry for PR #184
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-08 20:56:35 -04:00
Andrew Gunnerson 621ccc254c Merge pull request #184 from chenxiaolong/patch
Group `ota patch --help` options into sections
2023-10-08 20:55:19 -04:00
Andrew Gunnerson f41ef844e0 Group ota patch --help options into sections
There are a ton of options and simply displaying them in a giant list is
not very readable.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-10-07 17:04:38 -04:00