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>
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>
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>
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>
This is useful for folks who want to apply the Magisk root patch
themselves via the Magisk app or use KernelSU. When `--prepatched` is
used, avbroot will skip the root patch, but still apply the otacerts
patch.
To help protect against accidental use of the wrong boot image, avbroot
will only accept a prepatched image if all the header fields and section
types match the original image. The only exception is the number of
ramdisks, which is allowed to increase (Magisk may create a ramdisk in
an image that didn't originally have one).
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
Yes, this is installing msys2 packages directory on the Arch Linux root
filesystem. Yes, it works!
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
Otherwise, the "version made by" field in the central directory (2 bytes
immediately after CD magic) are \x14\x00 on Windows and \x14\x03
everywhere else.
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
This fixes an issue where BrokenPipeError was being raised while
handling a KeyboardInterrupt on Linux. This was happening because ^C and
^\ cause SIGINT/SIGQUIT to be sent to the entire process group,
including `openssl cms`. openssl would die and ZipFile's __exit__ would
try to finalize the zip during stack unwinding, causing a write to a
dead pipe.
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
This fixes temporary output files sometimes not being cleaned up and
openssl cms sometimes not being killed when the user interrupts the
process.
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
The officially supported distros are now Alpine, Arch, Debian, Fedora,
Fedora, OpenSUSE, and Ubuntu. The new script will build images for these
distros and concurrently run tests.py inside containers.
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
Like bootimagetool, this is another CLI interface to the
avbroot.formats.compression and avbroot.formats.cpio libraries to help
with troubleshooting.
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
This just adds a simple CLI for avbroot.formats.bootimage library. It's
not strictly related to avbroot, but is useful for troubleshooting since
the library supports all AOSP-compatible boot images.
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
For v2 boot images that use gzip headers, the current system time was
begin added to the gzip header while recompressing the ramdisk, which
broke reproducibility. This commit hardcodes the timestamp to 0 (unix
epoch time).
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
This helps guard against future directory structure changes. So far,
this has remained the same across Magisk versions 22 through 25.2.
The check can be overridden with `--ignore-magisk-version`.
Issue: #37
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
On bluejay, the boot image does not contain a ramdisk. In this scenario,
magiskboot creates a new lz4_legacy-compressed ramdisk, so we'll do the
same.
This commit also changes the .backup/ directory structure generation so
that it is done dynamically.
Fixes: #42
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
There are no interdependencies across different boot images, so run the
patches in parallel. It only saves a few seconds, but it's a free
optimization.
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>