Blame 0003-linux-user-default-cpu-model.patch

05f42e
From: Roberto Campesato <render@metalabs.org>
05f42e
diff --git a/linux-user/main.c b/linux-user/main.c
05f42e
index 0cdaf30d34..553faf1309 100644
05f42e
--- a/linux-user/main.c
05f42e
+++ b/linux-user/main.c
05f42e
@@ -357,6 +357,10 @@ static void handle_arg_uname(const char *arg)
05f42e
05f42e
 static void handle_arg_cpu(const char *arg)
05f42e
 {
05f42e
+    if (cpu_model != NULL) {
05f42e
+        free(cpu_model);
05f42e
+        cpu_model = NULL;
05f42e
+    }
05f42e
     cpu_model = strdup(arg);
05f42e
     if (cpu_model == NULL || is_help_option(cpu_model)) {
05f42e
         list_cpus();
05f42e
@@ -717,7 +721,16 @@ int main(int argc, char **argv, char **envp)
05f42e
         }
05f42e
     }
05f42e
05f42e
+    /* This is a pretty disgusting hack, in place to get a default
05f42e
+       CPU that has x86_64-v2 support, required for emulating a
05f42e
+       CPU that CentOS 9 is happy to run on (via binfmt_misc).  */
05f42e
+#if defined(TARGET_X86_64) && !defined(__x86_64__)
05f42e
+    cpu_model = strdup("Nehalem-v1");
05f42e
+#elif defined(TARGET_AARCH64) && !defined(__aarch64__)
05f42e
+    cpu_model = strdup("cortex-a72");
05f42e
+#else
05f42e
     cpu_model = NULL;
05f42e
+#endif
05f42e
05f42e
     qemu_add_opts(&qemu_trace_opts);
05f42e
     qemu_plugin_add_opts();