Check whether '/usr/bin/qemu-aarch64' exist.
authorlihongsx <lihongx.sun@intel.com>
Wed, 13 Aug 2014 11:34:16 +0000 (19:34 +0800)
committeradmin <yuhuan.yang@samsung.com>
Thu, 4 Feb 2016 10:24:53 +0000 (18:24 +0800)
Change-Id: I3d15f5ee386802c23e438e453aedfdace72739d5

mic/utils/misc.py

index b90df8c..24f08bf 100755 (executable)
@@ -897,17 +897,26 @@ def setup_qemu_emulator(rootdir, arch):
     # qemu_emulator is a special case, we can't use find_binary_path
     # qemu emulator should be a statically-linked executable file
     if arch == "aarch64":
-        arm_binary = "qemu-aarch64"
         node = "/proc/sys/fs/binfmt_misc/aarch64"
+        if os.path.exists("/usr/bin/qemu-arm64") and is_statically_linked("/usr/bin/qemu-arm64"):
+            arm_binary = "qemu-arm64"
+        elif os.path.exists("/usr/bin/qemu-aarch64") and is_statically_linked("/usr/bin/qemu-aarch64"):
+            arm_binary = "qemu-aarch64"
+        elif os.path.exists("/usr/bin/qemu-arm64-static"):
+            arm_binary = "qemu-arm64-static"
+        elif os.path.exists("/usr/bin/qemu-aarch64-static"):
+            arm_binary = "qemu-aarch64-static"
+        else:
+            raise CreatorError("Please install a statically-linked %s" % arm_binary)
     else:
-        arm_binary = "qemu-arm"
         node = "/proc/sys/fs/binfmt_misc/arm"
+        arm_binary = "qemu-arm"
+        if not os.path.exists("/usr/bin/qemu-arm") or not is_statically_linked("/usr/bin/qemu-arm"):
+            arm_binary = "qemu-arm-static"
+        if not os.path.exists("/usr/bin/qemu-arm-static"):
+            raise CreatorError("Please install a statically-linked %s" % arm_binary)
 
     qemu_emulator = "/usr/bin/%s" % arm_binary
-    if not os.path.exists(qemu_emulator) or not is_statically_linked(qemu_emulator):
-        qemu_emulator = "/usr/bin/%s-static" % arm_binary
-    if not os.path.exists(qemu_emulator):
-        raise CreatorError("Please install a statically-linked %s" % arm_binary)
 
     if not os.path.exists(rootdir + "/usr/bin"):
         makedirs(rootdir + "/usr/bin")