Fix kernel decompression method for crosvm
Crosvm requires kernels to be decompressed on aarch64, and it requires
kernels to be compressed on x86. Remove the effect of the
-decompress_kernel option for crosvm.
Bug: 156517356
Change-Id: I940b67b09bed53f167ee6b026137da820434bd7a
Merged-In: I940b67b09bed53f167ee6b026137da820434bd7a
diff --git a/host/commands/assemble_cvd/flags.cc b/host/commands/assemble_cvd/flags.cc
index 827ac4f..b67c360 100644
--- a/host/commands/assemble_cvd/flags.cc
+++ b/host/commands/assemble_cvd/flags.cc
@@ -275,8 +275,9 @@
tmp_config_obj.AssemblyPath(kKernelDefaultPath.c_str()));
tmp_config_obj.set_use_unpacked_kernel(true);
}
+
tmp_config_obj.set_decompress_kernel(FLAGS_decompress_kernel);
- if (FLAGS_decompress_kernel) {
+ if (tmp_config_obj.decompress_kernel()) {
tmp_config_obj.set_decompressed_kernel_image_path(
tmp_config_obj.AssemblyPath("vmlinux"));
}
@@ -433,6 +434,16 @@
void SetDefaultFlagsForCrosvm() {
SetCommandLineOptionWithMode("logcat_mode", cvd::kLogcatVsockMode,
google::FlagSettingMode::SET_FLAGS_DEFAULT);
+
+ // Crosvm requires a specific setting for kernel decompression; it must be
+ // on for aarch64 and off for x86, no other mode is supported.
+ bool decompress_kernel = false;
+ if (cvd::HostArch() == "aarch64") {
+ decompress_kernel = true;
+ }
+ SetCommandLineOptionWithMode("decompress_kernel",
+ (decompress_kernel ? "true" : "false"),
+ google::FlagSettingMode::SET_FLAGS_DEFAULT);
}
bool ParseCommandLineFlags(int* argc, char*** argv) {