mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 02:40:08 +00:00
parent
80687e702c
commit
bfa90ab3e8
@ -26,7 +26,8 @@ Configuration attributes explained in more detail:
|
||||
|
||||
:initrd_rom:
|
||||
This attribute is optional. It denotes the ROM, which is requested as initramfs
|
||||
resp. initrd to be loaded. The default name requested will be "initrd".
|
||||
resp. initrd to be loaded. If no name is given, no initramfs will be provided
|
||||
to the guest OS.
|
||||
|
||||
:ram_size:
|
||||
This attribute is mandatory. It defines the size of the VM's memory.
|
||||
|
@ -37,7 +37,7 @@ Config::Virtio_device::~Virtio_device()
|
||||
void Vmm::Config::update(Xml_node node)
|
||||
{
|
||||
_kernel_name = node.attribute_value("kernel_rom", Name("linux"));
|
||||
_initrd_name = node.attribute_value("initrd_rom", Name("initrd"));
|
||||
_initrd_name = node.attribute_value("initrd_rom", Name());
|
||||
_ram_size = node.attribute_value("ram_size", Number_of_bytes());
|
||||
_cpu_count = node.attribute_value("cpu_count", 0U);
|
||||
_cpu_type = node.attribute_value("cpu_type", Name("arm,cortex-a15"));
|
||||
|
@ -130,6 +130,8 @@ class Vmm::Config
|
||||
Config(Heap & heap) : _heap(heap) {
|
||||
_mmio_alloc.add_range(VIRTIO_MMIO_START, VIRTIO_MMIO_SIZE); }
|
||||
|
||||
bool initrd() const { return _initrd_name.valid(); }
|
||||
|
||||
const char * kernel_name() const { return _kernel_name.string(); }
|
||||
const char * initrd_name() const { return _initrd_name.string(); }
|
||||
const char * cpu_type() const { return _cpu_type.string(); }
|
||||
|
@ -338,12 +338,16 @@ void Vmm::Fdt_generator::_generate_tree(uint32_t & off, Config const & config,
|
||||
|
||||
node(Name("chosen"), [&] ()
|
||||
{
|
||||
property(Name("bootargs"), Name(config.bootargs()));
|
||||
property(Name("stdout-path"), Name("/pl011"));
|
||||
|
||||
if (!initrd_size)
|
||||
return;
|
||||
|
||||
/* we're sure that the initrd start address is wide below 4GB */
|
||||
uint32_t start = (uint32_t)((addr_t)initrd_start & 0xffffffff);
|
||||
property(Name("linux,initrd-start"), Value(start));
|
||||
property(Name("linux,initrd-end"), Value(start+initrd_size));
|
||||
property(Name("bootargs"), Name(config.bootargs()));
|
||||
property(Name("stdout-path"), Name("/pl011"));
|
||||
});
|
||||
|
||||
config.for_each_virtio_device([&] (Config::Virtio_device const & dev) {
|
||||
|
@ -46,9 +46,15 @@ Genode::addr_t Vm::_initrd_offset() const
|
||||
}
|
||||
|
||||
|
||||
Genode::size_t Vm::_initrd_size() const
|
||||
{
|
||||
return _initrd_rom.constructed() ? _initrd_rom->size() : 0UL;
|
||||
}
|
||||
|
||||
|
||||
Genode::addr_t Vm::_dtb_offset() const
|
||||
{
|
||||
return align_addr(_initrd_offset()+_initrd_rom.size(), LOG2_2MB);
|
||||
return align_addr(_initrd_offset() + _initrd_size(), LOG2_2MB);
|
||||
}
|
||||
|
||||
|
||||
@ -61,15 +67,20 @@ void Vm::_load_kernel()
|
||||
|
||||
void Vm::_load_initrd()
|
||||
{
|
||||
if (!_config.initrd())
|
||||
return;
|
||||
|
||||
_initrd_rom.construct(_env, _config.initrd_name());
|
||||
memcpy((void*)(_ram.local() + _initrd_offset()),
|
||||
_initrd_rom.local_addr<void>(), _initrd_rom.size());
|
||||
_initrd_rom->local_addr<void>(), _initrd_size());
|
||||
}
|
||||
|
||||
|
||||
void Vm::_load_dtb()
|
||||
{
|
||||
Fdt_generator fdt(_env, _heap, _ram.local() + _dtb_offset(), 1 << LOG2_2MB);
|
||||
fdt.generate(_config, (void*)(_ram.base()+_initrd_offset()), _initrd_rom.size());
|
||||
fdt.generate(_config, (void*)(_ram.base() + _initrd_offset()),
|
||||
_initrd_size());
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +54,6 @@ class Vmm::Vm
|
||||
Config & _config;
|
||||
Vm_connection _vm { _env };
|
||||
Attached_rom_dataspace _kernel_rom { _env, _config.kernel_name() };
|
||||
Attached_rom_dataspace _initrd_rom { _env, _config.initrd_name() };
|
||||
Attached_ram_dataspace _vm_ram { _env.ram(), _env.rm(),
|
||||
_config.ram_size(), CACHED };
|
||||
Ram _ram { RAM_START, _config.ram_size(),
|
||||
@ -65,9 +64,11 @@ class Vmm::Vm
|
||||
List<Virtio_device_base> _device_list;
|
||||
Pl011 _uart;
|
||||
|
||||
Constructible<Gui::Connection> _gui {};
|
||||
Constructible<Attached_rom_dataspace> _initrd_rom {};
|
||||
Constructible<Gui::Connection> _gui {};
|
||||
|
||||
addr_t _initrd_offset() const;
|
||||
size_t _initrd_size() const;
|
||||
addr_t _dtb_offset() const;
|
||||
|
||||
void _load_kernel();
|
||||
|
Loading…
Reference in New Issue
Block a user