mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 04:25:21 +00:00
build: bump linux-loader from 0.3.0 to 0.4.0
Requires manual change to command line loading. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
7383087230
commit
1a2d0e6dd8
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -516,9 +516,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "linux-loader"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c819cc8275b0f2c1ed9feec455ca288b45d82932384a6a5f7a86812ee3427459"
|
||||
checksum = "8a5e77493808403a6bd56a301a64ea6b9342e36ea845044bf0dfdf56fe52fa08"
|
||||
dependencies = [
|
||||
"vm-memory",
|
||||
]
|
||||
|
@ -15,7 +15,7 @@ anyhow = "1.0.44"
|
||||
byteorder = "1.4.3"
|
||||
hypervisor = { path = "../hypervisor" }
|
||||
libc = "0.2.102"
|
||||
linux-loader = { version = "0.3.0", features = ["elf", "bzimage", "pe"] }
|
||||
linux-loader = { version = "0.4.0", features = ["elf", "bzimage", "pe"] }
|
||||
log = "0.4.14"
|
||||
serde = { version = "1.0.130", features = ["rc"] }
|
||||
thiserror = "1.0.29"
|
||||
|
@ -82,7 +82,7 @@ type Result<T> = result::Result<T, Error>;
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn create_fdt<T: DeviceInfoForFdt + Clone + Debug, S: ::std::hash::BuildHasher>(
|
||||
guest_mem: &GuestMemoryMmap,
|
||||
cmdline: &CStr,
|
||||
cmdline: &str,
|
||||
vcpu_mpidr: Vec<u64>,
|
||||
vcpu_topology: Option<(u8, u8, u8)>,
|
||||
device_info: &HashMap<(DeviceType, String), T, S>,
|
||||
@ -111,7 +111,7 @@ pub fn create_fdt<T: DeviceInfoForFdt + Clone + Debug, S: ::std::hash::BuildHash
|
||||
fdt.property_u32("interrupt-parent", GIC_PHANDLE)?;
|
||||
create_cpu_nodes(&mut fdt, &vcpu_mpidr, vcpu_topology, numa_nodes)?;
|
||||
create_memory_node(&mut fdt, guest_mem, numa_nodes)?;
|
||||
create_chosen_node(&mut fdt, cmdline.to_str().unwrap(), initrd)?;
|
||||
create_chosen_node(&mut fdt, cmdline, initrd)?;
|
||||
create_gic_node(&mut fdt, gic_device)?;
|
||||
create_timer_node(&mut fdt)?;
|
||||
create_clock_node(&mut fdt)?;
|
||||
|
@ -19,7 +19,6 @@ use gic::GicDevice;
|
||||
use log::{log_enabled, Level};
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryInto;
|
||||
use std::ffi::CStr;
|
||||
use std::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
use vm_memory::{
|
||||
@ -136,7 +135,7 @@ pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, Region
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn configure_system<T: DeviceInfoForFdt + Clone + Debug, S: ::std::hash::BuildHasher>(
|
||||
guest_mem: &GuestMemoryMmap,
|
||||
cmdline_cstring: &CStr,
|
||||
cmdline: &str,
|
||||
vcpu_mpidr: Vec<u64>,
|
||||
vcpu_topology: Option<(u8, u8, u8)>,
|
||||
device_info: &HashMap<(DeviceType, String), T, S>,
|
||||
@ -148,7 +147,7 @@ pub fn configure_system<T: DeviceInfoForFdt + Clone + Debug, S: ::std::hash::Bui
|
||||
) -> super::Result<()> {
|
||||
let fdt_final = fdt::create_fdt(
|
||||
guest_mem,
|
||||
cmdline_cstring,
|
||||
cmdline,
|
||||
vcpu_mpidr,
|
||||
vcpu_topology,
|
||||
device_info,
|
||||
|
@ -28,7 +28,7 @@ event_monitor = { path = "../event_monitor" }
|
||||
hypervisor = { path = "../hypervisor" }
|
||||
lazy_static = "1.4.0"
|
||||
libc = "0.2.102"
|
||||
linux-loader = { version = "0.3.0", features = ["elf", "bzimage", "pe"] }
|
||||
linux-loader = { version = "0.4.0", features = ["elf", "bzimage", "pe"] }
|
||||
log = "0.4.14"
|
||||
micro_http = { git = "https://github.com/firecracker-microvm/micro-http", branch = "main" }
|
||||
net_util = { path = "../net_util" }
|
||||
|
@ -53,7 +53,6 @@ use std::cmp;
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryInto;
|
||||
use std::ffi::CString;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use std::fmt;
|
||||
use std::fs::{File, OpenOptions};
|
||||
@ -112,9 +111,6 @@ pub enum Error {
|
||||
/// Cannot modify the command line
|
||||
CmdLineInsertStr(linux_loader::cmdline::Error),
|
||||
|
||||
/// Cannot convert command line into CString
|
||||
CmdLineCString(std::ffi::NulError),
|
||||
|
||||
/// Cannot configure system
|
||||
ConfigureSystem(arch::Error),
|
||||
|
||||
@ -935,7 +931,7 @@ impl Vm {
|
||||
Ok(arch::InitramfsConfig { address, size })
|
||||
}
|
||||
|
||||
fn get_cmdline(&mut self) -> Result<CString> {
|
||||
fn get_cmdline(&mut self) -> Result<Cmdline> {
|
||||
let mut cmdline = Cmdline::new(arch::CMDLINE_MAX_SIZE);
|
||||
cmdline
|
||||
.insert_str(self.config.lock().unwrap().cmdline.args.clone())
|
||||
@ -943,7 +939,7 @@ impl Vm {
|
||||
for entry in self.device_manager.lock().unwrap().cmdline_additions() {
|
||||
cmdline.insert_str(entry).map_err(Error::CmdLineInsertStr)?;
|
||||
}
|
||||
CString::new(cmdline).map_err(Error::CmdLineCString)
|
||||
Ok(cmdline)
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
@ -988,7 +984,7 @@ impl Vm {
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn load_kernel(&mut self) -> Result<EntryPoint> {
|
||||
info!("Loading kernel");
|
||||
let cmdline_cstring = self.get_cmdline()?;
|
||||
let cmdline = self.get_cmdline()?;
|
||||
let guest_memory = self.memory_manager.lock().as_ref().unwrap().guest_memory();
|
||||
let mem = guest_memory.memory();
|
||||
let mut kernel = self.kernel.as_ref().unwrap();
|
||||
@ -1004,11 +1000,7 @@ impl Vm {
|
||||
}
|
||||
};
|
||||
|
||||
linux_loader::loader::load_cmdline(
|
||||
mem.deref(),
|
||||
arch::layout::CMDLINE_START,
|
||||
&cmdline_cstring,
|
||||
)
|
||||
linux_loader::loader::load_cmdline(mem.deref(), arch::layout::CMDLINE_START, &cmdline)
|
||||
.map_err(Error::LoadCmdLine)?;
|
||||
|
||||
if let PvhEntryPresent(entry_addr) = entry_addr.pvh_boot_cap {
|
||||
@ -1072,7 +1064,7 @@ impl Vm {
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
fn configure_system(&mut self) -> Result<()> {
|
||||
let cmdline_cstring = self.get_cmdline()?;
|
||||
let cmdline = self.get_cmdline()?;
|
||||
let vcpu_mpidrs = self.cpu_manager.lock().unwrap().get_mpidrs();
|
||||
let vcpu_topology = self.cpu_manager.lock().unwrap().get_vcpu_topology();
|
||||
let mem = self.memory_manager.lock().unwrap().boot_guest_memory();
|
||||
@ -1138,7 +1130,7 @@ impl Vm {
|
||||
|
||||
arch::configure_system(
|
||||
&mem,
|
||||
&cmdline_cstring,
|
||||
cmdline.as_str(),
|
||||
vcpu_mpidrs,
|
||||
vcpu_topology,
|
||||
device_info,
|
||||
@ -2617,7 +2609,7 @@ mod tests {
|
||||
let gic = create_gic(&vm, 1).unwrap();
|
||||
assert!(create_fdt(
|
||||
&mem,
|
||||
&CString::new("console=tty0").unwrap(),
|
||||
"console=tty0",
|
||||
vec![0],
|
||||
Some((0, 0, 0)),
|
||||
&dev_info,
|
||||
|
Loading…
x
Reference in New Issue
Block a user