[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] linux-user: Support explicit targets for PowerP

From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH] linux-user: Support explicit targets for PowerPC
Date: Tue, 7 Nov 2017 10:24:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Le 07/11/2017 à 03:50, Aaron Sierra a écrit :
> Enable building PowerPC targets supporting a specific CPU, without 
> having to set QEMU_CPU via the environment. For example these build 
> targets (and many more) become available:
> qemu-ppc.e500mc qemu-ppc.e500v2 qemu-ppc.e5500 qemu-ppc.e600 
> qemu-ppc.e6500
> These (statically compiled) binaries have proven useful for
> emulating PowerPC CPUs within Docker containers, where it's hard to
> reliably define environment variables that are available for every
> process.

An other idea would be to extract the default cpu from argv[0].

We don't change the default CPU at compile time, but we check the binary
- if it's qemu-ppc, let's use the default cpu for qemu-ppc
- if it's not qemu-ppc, but something like qemu-ppc.XXX, let's set the
CPU to XXX. For instance "qemu-ppc.e600" will be a shortcut for
"qemu-ppc -cpu e600". [1]

I think it's easy to implement and don't change the default behavior of
qemu. And you can use hardlink to define several binaries with different
defaults (like busybox)


[1] something like:

-- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4165,6 +4165,7 @@ static void usage(int exitcode)
 static int parse_args(int argc, char **argv)
     const char *r;
+    const char *cpuname;
     int optind;
     const struct qemu_argument *arginfo;

@@ -4179,6 +4180,11 @@ static int parse_args(int argc, char **argv)

+    cpuname = strrchr(argv[0], '.');
+    if (cpuname && cpuname[1] != 0) {
+        cpu_model = strdup(cpuname + 1);
+    }
     optind = 1;
     for (;;) {
         if (optind >= argc) {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]