mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 00:07:16 +00:00
Dragonball: use LinuxBootConfigurator::write_bootparams to writes
the boot parameters into guest memory. Fixes: #6813 Signed-off-by: Shuaiyi Zhang <zhang_syi@qq.com>
This commit is contained in:
parent
20ac3917ad
commit
197c336516
@ -7,7 +7,6 @@
|
|||||||
// found in the THIRD-PARTY file.
|
// found in the THIRD-PARTY file.
|
||||||
|
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::mem;
|
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use dbs_address_space::AddressSpace;
|
use dbs_address_space::AddressSpace;
|
||||||
@ -16,8 +15,9 @@ use dbs_utils::epoll_manager::EpollManager;
|
|||||||
use dbs_utils::time::TimestampUs;
|
use dbs_utils::time::TimestampUs;
|
||||||
use kvm_bindings::{kvm_irqchip, kvm_pit_config, kvm_pit_state2, KVM_PIT_SPEAKER_DUMMY};
|
use kvm_bindings::{kvm_irqchip, kvm_pit_config, kvm_pit_state2, KVM_PIT_SPEAKER_DUMMY};
|
||||||
use linux_loader::cmdline::Cmdline;
|
use linux_loader::cmdline::Cmdline;
|
||||||
|
use linux_loader::configurator::{linux::LinuxBootConfigurator, BootConfigurator, BootParams};
|
||||||
use slog::info;
|
use slog::info;
|
||||||
use vm_memory::{Address, Bytes, GuestAddress, GuestAddressSpace, GuestMemory};
|
use vm_memory::{Address, GuestAddress, GuestAddressSpace, GuestMemory};
|
||||||
|
|
||||||
use crate::address_space_manager::{GuestAddressSpaceImpl, GuestMemoryImpl};
|
use crate::address_space_manager::{GuestAddressSpaceImpl, GuestMemoryImpl};
|
||||||
use crate::error::{Error, Result, StartMicroVmError};
|
use crate::error::{Error, Result, StartMicroVmError};
|
||||||
@ -110,15 +110,11 @@ fn configure_system<M: GuestMemory>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let zero_page_addr = GuestAddress(layout::ZERO_PAGE_START);
|
LinuxBootConfigurator::write_bootparams(
|
||||||
guest_mem
|
&BootParams::new(¶ms, GuestAddress(layout::ZERO_PAGE_START)),
|
||||||
.checked_offset(zero_page_addr, mem::size_of::<bootparam::boot_params>())
|
guest_mem,
|
||||||
.ok_or(Error::ZeroPagePastRamEnd)?;
|
)
|
||||||
guest_mem
|
.map_err(|_| Error::ZeroPageSetup)
|
||||||
.write_obj(params, zero_page_addr)
|
|
||||||
.map_err(|_| Error::ZeroPageSetup)?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Vm {
|
impl Vm {
|
||||||
|
Loading…
Reference in New Issue
Block a user