Working version of QEMU configuration
This commit is contained in:
parent
49cc960703
commit
78d7233ff3
3 changed files with 138 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
require 'downloader'
|
||||
require 'system'
|
||||
require_relative 'data/resources/iso-images'
|
||||
require 'vm/qemu'
|
||||
|
||||
module VirtualMachine
|
||||
def self.distro(name, arch, type = :install)
|
||||
|
|
@ -27,14 +28,23 @@ module VirtualMachine
|
|||
|
||||
Downloader.get(url) do |path|
|
||||
disk_img_path = File.join(User.cache_path, "vm", distro.to_s, arch.to_s, options[:name], "root.img")
|
||||
create_disk_image(disk_img_path, 500)
|
||||
create_disk_image(disk_img_path, 5000)
|
||||
|
||||
puts path
|
||||
puts disk_img_path
|
||||
|
||||
Qemu.launch(
|
||||
arch,
|
||||
disk_img_path,
|
||||
cpus: [1, System.cpus - 2].max,
|
||||
cdrom: path,
|
||||
detach: false
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
# size in MB
|
||||
# lsof /Users/artur/.cache/dat/vm/debian/arm64/debian/root.img
|
||||
def self.create_disk_image(path, size)
|
||||
size_in_bytes = 1024 * 1024 * size
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue