1
0

Export qemu arguments

This commit is contained in:
dump_stack() 2023-04-07 21:17:34 +00:00
parent 21daac4fbc
commit bb319a9ff6
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -208,14 +208,16 @@ func (q System) cmdline() (s string) {
return return
} }
// Start qemu process func (q System) Executable() string {
func (q *System) Start() (err error) { return "qemu-system-" + string(q.arch)
rand.Seed(time.Now().UnixNano()) // Are you sure? }
func (q *System) Args() (qemuArgs []string) {
if q.sshAddrPort == "" { if q.sshAddrPort == "" {
q.sshAddrPort = getFreeAddrPort() q.sshAddrPort = getFreeAddrPort()
} }
hostfwd := fmt.Sprintf("hostfwd=tcp:%s-:22", q.sshAddrPort) hostfwd := fmt.Sprintf("hostfwd=tcp:%s-:22", q.sshAddrPort)
qemuArgs := []string{"-nographic", qemuArgs = []string{"-nographic",
"-hda", q.drivePath, "-hda", q.drivePath,
"-kernel", q.kernel.KernelPath, "-kernel", q.kernel.KernelPath,
"-smp", fmt.Sprintf("%d", q.Cpus), "-smp", fmt.Sprintf("%d", q.Cpus),
@ -245,8 +247,14 @@ func (q *System) Start() (err error) {
} }
qemuArgs = append(qemuArgs, "-append", q.cmdline()) qemuArgs = append(qemuArgs, "-append", q.cmdline())
return
}
q.cmd = exec.Command("qemu-system-"+string(q.arch), qemuArgs...) // Start qemu process
func (q *System) Start() (err error) {
rand.Seed(time.Now().UnixNano()) // Are you sure?
q.cmd = exec.Command(q.Executable(), q.Args()...)
q.log.Debug().Msgf("%v", q.cmd) q.log.Debug().Msgf("%v", q.cmd)
if q.pipe.stdin, err = q.cmd.StdinPipe(); err != nil { if q.pipe.stdin, err = q.cmd.StdinPipe(); err != nil {