Fixes to allow (32 bit) arm guests to run on aarch64 hosts.
[mclu.git] / template.ml
index 4db0b66..20a5cc7 100644 (file)
@@ -73,6 +73,7 @@ let run_template ~verbose filename subcmd args =
 
 type template_info = {
   base_image : string;
+  guest_arch : string option;
   minimum_memory : int64 option;
   recommended_memory : int64 option;
   minimum_size : int64 option;
@@ -98,6 +99,10 @@ let probe ?(verbose = false) filename =
     | _ ->
       eprintf "mclu: cannot parse '%s base-image'\n" filename;
       exit 1 in
+  let guest_arch =
+    match run_template ~verbose filename "guest-arch" [] with
+    | Some [arch] -> Some arch
+    | _ -> None in
   let minimum_memory =
     match run_template ~verbose filename "minimum-memory" [] with
     | Some [memory] ->
@@ -146,6 +151,7 @@ let probe ?(verbose = false) filename =
     | Some _ -> false in
 
   { base_image = base_image;
+    guest_arch = guest_arch;
     minimum_memory = minimum_memory;
     recommended_memory = recommended_memory;
     minimum_size = minimum_size;