-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmain.go
55 lines (45 loc) · 959 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"log"
"os"
"github.com/bobuhiro11/gokvm/flag"
"github.com/bobuhiro11/gokvm/probe"
"github.com/bobuhiro11/gokvm/vmm"
)
func main() {
bootArgs, probeArgs, err := flag.ParseArgs(os.Args)
if err != nil {
log.Fatal(err)
}
if bootArgs != nil {
c := &vmm.Config{
Dev: bootArgs.Dev,
Kernel: bootArgs.Kernel,
Initrd: bootArgs.Initrd,
Params: bootArgs.Params,
TapIfName: bootArgs.TapIfName,
Disk: bootArgs.Disk,
NCPUs: bootArgs.NCPUs,
MemSize: bootArgs.MemSize,
TraceCount: bootArgs.TraceCount,
}
vmm := vmm.New(*c)
if err := vmm.Init(); err != nil {
log.Fatal(err)
}
if err := vmm.Setup(); err != nil {
log.Fatal(err)
}
if err := vmm.Boot(); err != nil {
log.Fatal(err)
}
}
if probeArgs != nil {
if err := probe.KVMCapabilities(); err != nil {
log.Fatal(err)
}
if err := probe.CPUID(); err != nil {
log.Fatal(err)
}
}
}