save
This commit is contained in:
parent
c8b057e6a2
commit
54d4dfcb33
3 changed files with 68 additions and 8 deletions
|
|
@ -81,7 +81,7 @@ module Qemu
|
|||
arch: System::ARCH,
|
||||
cdrom: nil,
|
||||
detach: true,
|
||||
ram: 2048,
|
||||
ram: 2048 * 8,
|
||||
cpus: 1,
|
||||
display: DisplayMode::none
|
||||
}
|
||||
|
|
@ -102,7 +102,9 @@ module Qemu
|
|||
|
||||
if System::OS == :macos && arch == :arm64
|
||||
# args += ["-bios", "/opt/homebrew/share/qemu/edk2-aarch64-code.fd"]
|
||||
# cp /opt/homebrew/share/qemu/edk2-arm-vars.fd ~/edk2-arm-vars.fd
|
||||
args += ["-drive", "if=pflash,format=raw,unit=0,readonly=on,file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd"]
|
||||
args += ["-drive", "if=pflash,format=raw,unit=1,file=/Users/agurgul/edk2-arm-vars.fd"]
|
||||
|
||||
if opts[:display] == DisplayMode::none
|
||||
port = 2222
|
||||
|
|
@ -156,10 +158,40 @@ module Qemu
|
|||
args += machine_args_for(arch)
|
||||
args += ["-m", opts[:ram].to_s, "-smp", opts[:cpus].to_s]
|
||||
args += ["-name", "FirstVM", "-boot", "order=d"] # boot from CD first
|
||||
args += ["-drive", "file=#{disk_path},if=virtio,cache=writeback,format=raw"]
|
||||
args += ["-drive", "file=#{disk_path},if=virtio,cache=writeback,format=raw,id=nvme0"]
|
||||
#args += ["-device", "nvme,serial=nvme0,drive=nvme0,bootindex=2"]
|
||||
|
||||
if opts[:cdrom] != nil
|
||||
args += ["-cdrom", opts[:cdrom]]
|
||||
#args += ["-cdrom", opts[:cdrom]]
|
||||
|
||||
# args += ["-device", "virtio-scsi-pci,id=scsi"]
|
||||
# args += ["-drive", "if=none,id=cd,format=raw,file=#{opts[:cdrom]},media=cdrom"]
|
||||
# args += ["-device", "scsi-cd,drive=cd,bootindex=1"]
|
||||
|
||||
|
||||
args += ["-drive", "id=cd,format=raw,file=#{opts[:cdrom]},media=cdrom"]
|
||||
args += ["-device", "usb-storage,drive=cd,bootindex=1"]
|
||||
|
||||
args += ["-device", "ramfb"]
|
||||
# args += ["-device", "virtio-gpu-pci"]
|
||||
# args += ["-display", "default,show-cursor=on"]
|
||||
end
|
||||
|
||||
if opts[:tpm]
|
||||
# brew install swtpm
|
||||
# swtpm socket --tpm2 --ctrl type=unixio,path=./tpm/tpm.sock --tpmstate dir=./tpm --daemon
|
||||
|
||||
# args += ["-chardev", "socket,id=chrtpm,path=/Users/agurgul/Downloads/tpm/tpm.sock"]
|
||||
# args += ["-tpmdev", "emulator,id=tpm0,chardev=chrtpm"]
|
||||
# args += ["-device", "tpm-crb-device,tpmdev=tpm0"]
|
||||
|
||||
args += ["-chardev", "socket,id=chrtpm,path=/Users/agurgul/Downloads/tpm/tpm.sock"]
|
||||
args += ["-tpmdev", "emulator,id=tpm0,chardev=chrtpm"]
|
||||
#args += ["-device", "tpm-tis,tpmdev=tpm0"]
|
||||
args += ["-device", "tpm-tis-device,tpmdev=tpm0"]
|
||||
# nic user,ipv6=off,model=rtl8139,mac=84:1b:77:c9:03:a6
|
||||
end
|
||||
|
||||
# args += ["-device", "virtio-net,netdev=n0", "-netdev", "user,id=n0"] # user-mode NAT
|
||||
# optional: uncomment to run headless with VNC on :5901
|
||||
# args += ["-display", "none", "-vnc", "127.0.0.1:1"]
|
||||
|
|
@ -181,3 +213,5 @@ module Qemu
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue