Categorygithub.com/AndroidPlusProject/aota
modulepackage
0.0.0-20240513011957-6bad4574d2ee
Repository: https://github.com/androidplusproject/aota.git
Documentation: pkg.go.dev

# README

aota

A multithreaded Android OTA installer, written in Go.

Installing

  • Install Go, setup your $GOBIN directory.
  • Install liblzma-dev (required to prevent usage of older and incompatible C code for xz).
  • Clone this repo and navigate to it using your terminal.
  • cd cmd/aota
  • CGO_CFLAGS=-DGOXZ_SKIP_C_COMPILATION CGO_LDFLAGS=-llzma go install
  • Start using $GOBIN/aota, or add it to your $PATH.

Usage

On Linux, Mac, and pretty much everything else:

aota -a value or aota --arg value

On Windows:

.\aota.exe -a value or .\aota.exe --arg value

--input <required: path to OTA.zip or payload.bin>
--out <optional: path to output folder>
--extract <optional: comma,separated,partition,list>
--cap <optional: memory limit in bytes for buffering install operations, anything above 64MiB is pointless>
--jobs <optional: limit or increase the number of Go processes that can spawn>
--debug <optional: no value, just shows debug logs when used>

For example, to extract boot, dtbo, and vendor_boot from raven-ota.zip:

aota -i raven-ota.zip -e boot,dtbo,vendor_boot

It can parse your payload.bin directly, or it can temporarily extract it from an OTA.zip file.

About

Inspired by https://github.com/cyxx/extract_android_ota_payload.

Forked from https://github.com/tobyxdd/android-ota-payload-extractor.

Further inspired by https://github.com/ssut/payload-dumper-go.

Just like the original project by tobyxdd (inspired by cyxx), the goal of aota is to provide stable and high performance OTA payload parsing so that you can utilize the data within. For example, most users will want to extract the boot image from an OTA update so that they can install Magisk without a custom recovery. tobyxdd laid the groundwork so I could skip the part where I reinvent a wheel again, but aota has more than just one goal!

The main driver for creating this fork was to multithread the OTA extraction process so that full OTA extractions would take less time to finish on multi-core systems. Eventually I was told about payload-dumper-go which already achieved this goal, and I was already at the middle point between the slowness of the old project and the high speed of that project just by spawning one goroutine per install operation and allowing any free CPU core to finish ops that aren't blocking. So I took a hint on replacing the xz package and pre-extracting the payload to disk from ZIP files, replaced the bzip2 package, and did some logic magic to gain a whopping 3 seconds over payload-dumper-go. I was achieving 1min13s on a 16x AMD EPYC with 32GB of RAM (which was particularly unbusy) versus 1min16s on the same system.

Due to the nature of app environments within Android, it's been rather difficult to test aota in an accurate manner on my Pixel 6 Pro. But after some further bugfixes, if I use a payload.bin directly and already have the space allocated for the partition images (simulating a streamed install but without the networking), aota is now reaching 1min19s on the Pixel 6 Pro within Termux! There's no certainty in which CPU core will be executing a given install operation, so it can vary mildly, but it hasn't gone above 1min33s yet during my own testing. I miss the 1min16s mark that I reached before on this same phone, but it's hard to argue with the improvements across the board.

I will likely update this about section as time goes on, but I can at least state the main goal of aota now that I've reached my desired performance (with exception to the bug running on real Android with timings):

aota is taking all of this logic and converting it into a Go package so any program can make use of it. Import it into your Go code, compile it as a shared library so it can be linked to other languages, or make use of the aota cmd wrapper that implements every feature.


If you do something cool or interesting with aota, I may link it here!


appOTA

appOTA - the open source Android Plus Project OTA server

appOTA was created as a reverse-engineering effort of hentaiOS Updater to allow it to be used in appOS and other distributions of Android.

appOTA uses aota to parse and manipulate OTA payloads before serving them to the Updater app. It is intended to serve OTAs to AOSP's update_engine service.

appOS and appOTA are not yet available to consumers, check back shortly!


# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

identical blocks.
Raw replace operation.
used when src/dst blocks are highly similar.
Like SOURCE_BSDIFF, but compressed with brotli.
The data is a bsdiff binary diff.
Discard the destination blocks, reading as undefined.
On minor version 9 or newer, these operations are supported:.
No description provided by the author
Move source extents to target extents.
The data is in puffdiff format.
Replace destination extents w/ attached data.
Replace destination extents w/ attached bzipped data.
Replace destination extents w/ attached xz data.
Like BSDIFF, but read from source partition.
Copy from source to target partition.
Write zeros in the destination.
On minor version 8 or newer, these operations are supported:.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

Enum value maps for CowMergeOperation_Type.
Enum value maps for CowMergeOperation_Type.
No description provided by the author
Enum value maps for InstallOperation_Type.
Enum value maps for InstallOperation_Type.
Enum value maps for OtaMetadata_OtaType.
Enum value maps for OtaMetadata_OtaType.

# Structs

No description provided by the author
Just a container to hold repeated apex_info, so that we can easily serialize a list of apex_info to string.
Hints to VAB snapshot to skip writing some blocks if these blocks are identical to the ones on the source image.
No description provided by the author
The build information on the device.
No description provided by the author
Metadata related to all dynamic partitions.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
The metadata of an OTA package.
No description provided by the author
The build information of a particular partition on the device.
Describes the update to apply to a single partition.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author