@@ -51,6 +51,8 @@ type Config struct {
5151 // The chipset to be used: PIIX3 or ICH9.
5252 // When set to piix3, the firmare is PIIX3. This is the default.
5353 // When set to ich9, the firmare is ICH9.
54+ // When set to armv8, the firmare is ARMv8.
55+ // When set to armv8virtual, the firmare is ARMv8 Virtual.
5456 Chipset string `mapstructure:"chipset" required:"false"`
5557 // The firmware to be used: BIOS or EFI.
5658 // When set to bios, the firmare is BIOS. This is the default.
@@ -75,16 +77,36 @@ type Config struct {
7577 // When set to Am79C973, the NICs are AMD PCNet-FAST III network card (Am79C973).
7678 // When set to Am79C960, the NICs are AMD PCnet-ISA/NE2100 (Am79C960).
7779 // When set to virtio, the NICs are VirtIO.
80+ // When set to usbnet, the NICs are USB Network.
7881 NICType string `mapstructure:"nic_type" required:"false"`
7982 // The audio controller type to be used.
8083 // When set to ac97, the audio controller is ICH AC97. This is the default.
8184 // When set to hda, the audio controller is Intel HD Audio.
8285 // When set to sb16, the audio controller is SoundBlaster 16.
86+ // When set to none, the audio controller is disabled.
8387 AudioController string `mapstructure:"audio_controller" required:"false"`
88+ // The USB controller type to be used.
89+ // When set to ohci, the USB controller is USB 1.1 (OHCI).
90+ // When set to ehci, the USB controller is USB 2.0 (EHCI). This is the default when usb is enabled.
91+ // When set to xhci, the USB controller is USB 3.0 (xHCI).
92+ // When set to none, no USB controller is configured even if usb is enabled.
93+ // This setting is only used when usb is set to true.
94+ USBController string `mapstructure:"usb_controller" required:"false"`
95+ // The mouse device type to be used.
96+ // When set to ps2, a PS/2 mouse is emulated. This is the default.
97+ // When set to usb, a USB mouse is emulated (requires USB to be enabled).
98+ // When set to usbtablet, a USB tablet device is emulated (absolute positioning, requires USB).
99+ // When set to usbmultitouch, a USB multi-touch device is emulated (requires USB).
100+ Mouse string `mapstructure:"mouse" required:"false"`
101+ // The keyboard device type to be used.
102+ // When set to ps2, a PS/2 keyboard is emulated. This is the default.
103+ // When set to usb, a USB keyboard is emulated (requires USB to be enabled).
104+ Keyboard string `mapstructure:"keyboard" required:"false"`
84105 // The graphics controller type to be used.
85106 // When set to vboxvga, the graphics controller is VirtualBox VGA. This is the default.
86107 // When set to vboxsvga, the graphics controller is VirtualBox SVGA.
87108 // When set to vmsvga, the graphics controller is VMware SVGA.
109+ // When set to qemuramfb, the graphics controller is QEMU RAMFB.
88110 // When set to none, the graphics controller is disabled.
89111 // When this configuration is omitted, the default value is determined by VirtualBox.
90112 GfxController string `mapstructure:"gfx_controller" required:"false"`
@@ -224,11 +246,11 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
224246 b .config .Chipset = "piix3"
225247 }
226248 switch b .config .Chipset {
227- case "piix3" , "ich9" :
249+ case "piix3" , "ich9" , "armv8" , "armv8virtual" :
228250 // do nothing
229251 default :
230252 errs = packersdk .MultiErrorAppend (
231- errs , errors .New ("chipset can only be piix3 or ich9 " ))
253+ errs , errors .New ("chipset can only be piix3, ich9, armv8, or armv8virtual " ))
232254 }
233255
234256 if b .config .Firmware == "" {
@@ -265,19 +287,19 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
265287 b .config .NICType = "82540EM"
266288 }
267289 switch b .config .NICType {
268- case "82540EM" , "82543GC" , "82545EM" , "Am79C970A" , "Am79C973" , "Am79C960" , "virtio" :
290+ case "82540EM" , "82543GC" , "82545EM" , "Am79C970A" , "Am79C973" , "Am79C960" , "virtio" , "usbnet" :
269291 // do nothing
270292 default :
271293 errs = packersdk .MultiErrorAppend (
272- errs , errors .New ("NIC type can only be 82540EM, 82543GC, 82545EM, Am79C970A, Am79C973, Am79C960 or virtio" ))
294+ errs , errors .New ("NIC type can only be 82540EM, 82543GC, 82545EM, Am79C970A, Am79C973, Am79C960, usbnet, virtio" ))
273295 }
274296
275297 switch b .config .GfxController {
276- case "vboxvga" , "vboxsvga" , "vmsvga" , "none" , "" :
298+ case "vboxvga" , "vboxsvga" , "vmsvga" , "qemuramfb" , " none" , "" :
277299 // do nothing
278300 default :
279301 errs = packersdk .MultiErrorAppend (
280- errs , errors .New ("Graphics controller type can only be vboxvga, vboxsvga, vmsvga, none" ))
302+ errs , errors .New ("Graphics controller type can only be vboxvga, vboxsvga, vmsvga, qemuramfb, none" ))
281303 }
282304
283305 if b .config .GfxVramSize == 0 {
@@ -302,13 +324,46 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
302324 b .config .AudioController = "ac97"
303325 }
304326 switch b .config .AudioController {
305- case "ac97" , "hda" , "sb16" :
327+ case "ac97" , "hda" , "sb16" , "none" :
306328 // do nothing
307329 default :
308330 errs = packersdk .MultiErrorAppend (
309331 errs , errors .New ("Audio controller type can only be ac97, hda or sb16" ))
310332 }
311333
334+ if b .config .USBController == "" {
335+ b .config .USBController = "ehci"
336+ }
337+ switch b .config .USBController {
338+ case "ohci" , "ehci" , "xhci" , "none" :
339+ // do nothing
340+ default :
341+ errs = packersdk .MultiErrorAppend (
342+ errs , errors .New ("USB controller type can only be ohci, ehci, xhci, or none" ))
343+ }
344+
345+ if b .config .Mouse == "" {
346+ b .config .Mouse = "ps2"
347+ }
348+ switch b .config .Mouse {
349+ case "ps2" , "usb" , "usbtablet" , "usbmultitouch" :
350+ // do nothing
351+ default :
352+ errs = packersdk .MultiErrorAppend (
353+ errs , errors .New ("Mouse type can only be ps2, usb, usbtablet, or usbmultitouch" ))
354+ }
355+
356+ if b .config .Keyboard == "" {
357+ b .config .Keyboard = "ps2"
358+ }
359+ switch b .config .Keyboard {
360+ case "ps2" , "usb" :
361+ // do nothing
362+ default :
363+ errs = packersdk .MultiErrorAppend (
364+ errs , errors .New ("Keyboard type can only be ps2 or usb" ))
365+ }
366+
312367 if b .config .GuestOSType == "" {
313368 b .config .GuestOSType = "Other"
314369 }
0 commit comments