Add the boot partition to the composite disk.
Previously the boot partition was only used with the boot_image_unpacker
to acquire the kernel to pass to the VMM, but the bootloader will need
access to the complete boot partition.
Bug: 133797099
Test: Run with composite disk, check /dev/block/by-name for boot
Change-Id: I5fb196074b31a65be306cd91ff9e716ca51471b3
diff --git a/host/commands/launch/flags.cc b/host/commands/launch/flags.cc
index 55afb49..105741b 100644
--- a/host/commands/launch/flags.cc
+++ b/host/commands/launch/flags.cc
@@ -436,6 +436,7 @@
tmp_config_obj.set_cache_image_path(FLAGS_cache_image);
tmp_config_obj.set_data_image_path(FLAGS_data_image);
tmp_config_obj.set_metadata_image_path(FLAGS_metadata_image);
+ tmp_config_obj.set_boot_image_path(FLAGS_boot_image);
tmp_config_obj.set_composite_disk_path(FLAGS_composite_disk);
tmp_config_obj.set_mempath(FLAGS_mempath);
@@ -754,7 +755,7 @@
{config->system_image_path(), config->cache_image_path(),
config->data_image_path(), config->vendor_image_path(),
config->metadata_image_path(), config->product_image_path(),
- config->super_image_path()}) {
+ config->super_image_path(), config->boot_image_path()}) {
if (!file.empty() && !cvd::FileHasContent(file.c_str())) {
LOG(ERROR) << "File not found: " << file;
exit(cvd::kCuttlefishConfigurationInitError);
diff --git a/host/libs/config/cuttlefish_config.cpp b/host/libs/config/cuttlefish_config.cpp
index 25d6422..34df60e 100644
--- a/host/libs/config/cuttlefish_config.cpp
+++ b/host/libs/config/cuttlefish_config.cpp
@@ -97,6 +97,7 @@
const char* kMetadataImagePath = "metadata_image_path";
const char* kProductImagePath = "product_image_path";
const char* kSuperImagePath = "super_image_path";
+const char* kBootImagePath = "boot_image_path";
const char* kCompositeDiskPath = "composite_disk_path";
const char* kUsbV1SocketName = "usb_v1_socket_name";
const char* kVhciPort = "vhci_port";
@@ -403,6 +404,14 @@
SetPath(kSuperImagePath, super_image_path);
}
+std::string CuttlefishConfig::boot_image_path() const {
+ return (*dictionary_)[kBootImagePath].asString();
+}
+void CuttlefishConfig::set_boot_image_path(
+ const std::string& boot_image_path) {
+ SetPath(kBootImagePath, boot_image_path);
+}
+
std::string CuttlefishConfig::composite_disk_path() const {
return (*dictionary_)[kCompositeDiskPath].asString();
}
diff --git a/host/libs/config/cuttlefish_config.h b/host/libs/config/cuttlefish_config.h
index d153ce7..74118b1 100644
--- a/host/libs/config/cuttlefish_config.h
+++ b/host/libs/config/cuttlefish_config.h
@@ -156,6 +156,9 @@
std::string super_image_path() const;
void set_super_image_path(const std::string& super_image_path);
+ std::string boot_image_path() const;
+ void set_boot_image_path(const std::string& boot_image_path);
+
std::string composite_disk_path() const;
void set_composite_disk_path(const std::string& composite_disk_path);
diff --git a/host/libs/vm_manager/disk_config.cpp b/host/libs/vm_manager/disk_config.cpp
index f8123b6..1616d69 100644
--- a/host/libs/vm_manager/disk_config.cpp
+++ b/host/libs/vm_manager/disk_config.cpp
@@ -63,6 +63,10 @@
.image_file_path = config.vendor_image_path(),
});
}
+ partitions.push_back(ImagePartition {
+ .label = "boot",
+ .image_file_path = config.boot_image_path(),
+ });
return partitions;
}