let remote_external_kernel_dir = sprintf "/var/tmp/%s.boot" name in
let remote_external_kernel = sprintf "/var/tmp/%s.boot/kernel" name in
let remote_external_initrd = sprintf "/var/tmp/%s.boot/initrd" name in
+ let remote_arch = node.MS.node_status.node_info.model in
+
+ (* UEFI firmware and NVRAM on remote, if required. *)
+ let nvram =
+ match remote_arch with
+ | "aarch64" ->
+ Some ("/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw",
+ "/usr/share/edk2.git/aarch64/vars-template-pflash.raw",
+ remote_image ^ ".nvram")
+ | _ -> None in
(* Get ready to generate the guest XML. *)
let vcpus = !vcpus in
let xml = xml ^ "\
<os>
- <type>hvm</type>
<boot dev='hd'/>
" in
+ let xml =
+ match remote_arch with
+ | "aarch64" ->
+ xml ^ sprintf "\
+ <type machine='virt'>hvm</type>
+"
+ | _ ->
+ xml ^ "\
+ <type>hvm</type>
+" in
+
+ let xml =
+ match nvram with
+ | Some (loader, nvram_template, nvram) ->
+ xml ^ sprintf "\
+ <loader readonly='yes' type='pflash'>%s</loader>
+ <nvram template='%s'>%s</nvram>
+" loader nvram_template nvram
+ | None -> xml in
let xml = xml ^
if template_info.Template.needs_external_kernel then
<console type='pty'>
<target type='serial' port='0'/>
</console>
+" in
+ let xml =
+ if remote_arch = "x86_64" then (
+ xml ^ "\
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>
</video>
+"
+ ) else
+ xml in
+ let xml = xml ^ "\
</devices>
</domain>" in
xml
| "" -> ()
| tz -> fpf "export timezone=%s\n" (quote (sprintf "--timezone %s" tz))
);
+ (match nvram with
+ | Some (_, nvram_template, nvram) ->
+ fpf "cp %s %s\n" (quote nvram_template) (quote nvram)
+ | None -> ()
+ );
fpf "%s build\n" remote_template;
if template_info.Template.needs_external_kernel then (
fpf "rm -rf %s\n" (quote remote_external_kernel_dir);