crosvm/aarch64
David Brazdil d04f288a7a kernel_loader: Add support for LZ4-compressed kernels
Kernel images are often stored compressed because they can take up a
significant amount of disk space. One of the popular formats for this is
LZ4. Even though it does not offer the best compression ratio, it excels
at decompression speeds.

On arm64, kernels do not come with their own decompressor like they do
on x86. Instead, it is the job of the bootloader to decompress the
kernel before it is executed.

To this end, add crosvm support for LZ4 decompression of kernel images,
via the Rust-safe lz4_flex library. LZ4 file format is detected
automatically via one of its magic numbers. Otherwise crosvm will fall
back to loading the kernel as a raw image.

Some rough numbers using Android's Generic Kernel Image on Pixel 8:
 * compresion rate: 49% (33MB -> 16MB)
 * decompression time: 20-30ms
Given that the total VM boot takes about 1.5s, the overhead is more than
acceptable.

BUG=b:315141974
TEST=tools/dev_container tools/run_tests --platform=aarch64

Change-Id: I1030abe6fdf7087603cea9ac5273bf9136bad693
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5110323
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: David Brazdil <dbrazdil@google.com>
2024-01-24 22:48:25 +00:00
..
src kernel_loader: Add support for LZ4-compressed kernels 2024-01-24 22:48:25 +00:00
.build_test_skip
Cargo.toml