-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Take care of writing boot parameters into memory #15
Comments
Yap, it makes a lot of sense. For example, in Firecracker we have this logic in the |
@bonzini I guess you meant: let result = KernelLoaderType.load(guest_mem, ...)?;
let boot_params = arch::build_boot_params()?;
result.configurator.write_boot_parameters(result, boot_params, guest_mem); where the |
Yes, precisely. |
After looking more closely at the code for building bootparams (at least for pub trait BootConfigurator {
type Error;
fn write_bootparams<B: ByteValued, M: GuestMemory>(
params: B,
guest_memory: &M,
addr: GuestAddress,
) -> Result<(), Self::Error>;
} Elf boot params: pub struct ElfBootParams {
bootparams: boot_params,
// TODO: cmdline, others?
}
impl ElfBootParams {
pub fn new(
cmdline_addr: GuestAddress,
cmdline_size: usize,
himem_start: GuestAddress,
...
) -> Result<Self>;
pub fn with_ebda(
&mut self,
ebda_start: GuestAddress
) -> Result<&mut Self>;
pub fn with_pci(
&mut self,
pci_mmconfig_start: GuestAddress,
pci_mmconfig_size: usize,
) -> Result<&mut Self>;
impl ByteValued for ElfBootParams {} Elf boot configurator: pub struct ElfBootConfigurator {}
pub enum ElfBootConfiguratorError {...}
impl BootConfigurator for ElfBootConfigurator {
type Error = ElfBootConfiguratorError;
fn write_bootparams<B: ByteValued, M: GuestMemory>(
params: B,
guest_memory: &M,
addr: GuestAddress,
) -> Result<(), Self::Error>;
} VMM: let loader_result = Elf::load(
&guest_mem,
Some(kernel_addr),
&mut Cursor::new(&image),
Some(himem_start),
)?;
let elf_boot_params = ElfBootParams::new(
cmdline_addr,
cmdline_size,
himem_start
)?.with_ebda(ebda_start)?.with_pci(pci_start, pci_size)?;
ElfBootConfigurator::write_bootparams(*elf_boot_params, &guest_mem, zeropage_addr); (I'm fighting dynamic dispatch issues for embedding a |
This commit introduces a new configurator module that takes boot parameters created in the VMM (boot_params / start_info + e820 map) and writes them into guest memory. The module is meant to be extended in order to include *building* the boot parameters as well. Fixes rust-vmm#15 Signed-off-by: Alexandra Iordache <[email protected]>
This commit introduces a new configurator module that takes boot parameters created in the VMM (boot_params / start_info + e820 map) and writes them into guest memory. The module is meant to be extended in order to include *building* the boot parameters as well. Fixes rust-vmm#15 Signed-off-by: Alexandra Iordache <[email protected]>
This commit introduces a new configurator module that takes boot parameters created in the VMM (boot_params / start_info + e820 map) and writes them into guest memory. The module is meant to be extended in order to include *building* the boot parameters as well. Fixes rust-vmm#15 Signed-off-by: Alexandra Iordache <[email protected]>
The embedding part can be done later. #31 is certainly a step in the right direction! |
This commit introduces a new configurator module that takes boot parameters created in the VMM (boot_params / start_info + e820 map) and writes them into guest memory. The module is meant to be extended in order to include *building* the boot parameters as well. Fixes rust-vmm#15 Signed-off-by: Alexandra Iordache <[email protected]>
The linux-loader crate does not handle writing in memory the setup header that it prepares, and there could also be extra parameters (e.g. kernel command line or, for PVH, the e820 map) that need to be written into memory. I am therefore proposing to add a "configurator" object that encapsulates all the logic needed to boot a kernel (later on this could include the CPU registers too). The basic structure would be:
and probably an associated type on KernelLoader like
that can be used like
The text was updated successfully, but these errors were encountered: