From 099084e3b0f22483f2bbe1cd9d4d5b5a7a137c8d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 27 Feb 2016 12:22:27 +0000 Subject: [PATCH] Fixes to allow aarch64 guests to run on aarch64 hosts. --- mclu_boot.ml | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/mclu_boot.ml b/mclu_boot.ml index e0aeef8..6da1bc5 100644 --- a/mclu_boot.ml +++ b/mclu_boot.ml @@ -168,6 +168,16 @@ Try: `mclu on %s'\n" hostname hostname; 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 @@ -191,9 +201,27 @@ Try: `mclu on %s'\n" hostname hostname; let xml = xml ^ "\ - hvm " in + let xml = + match remote_arch with + | "aarch64" -> + xml ^ sprintf "\ + hvm +" + | _ -> + xml ^ "\ + hvm +" in + + let xml = + match nvram with + | Some (loader, nvram_template, nvram) -> + xml ^ sprintf "\ + %s + %s +" loader nvram_template nvram + | None -> xml in let xml = xml ^ if template_info.Template.needs_external_kernel then @@ -267,6 +295,10 @@ Try: `mclu on %s'\n" hostname hostname; +" in + let xml = + if remote_arch = "x86_64" then ( + xml ^ "\ @@ -274,6 +306,10 @@ Try: `mclu on %s'\n" hostname hostname; +" + ) else + xml in + let xml = xml ^ "\ " in xml @@ -361,6 +397,11 @@ Try: `mclu on %s'\n" hostname hostname; | "" -> () | 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); -- 1.8.3.1