From 42488d371663d712854aaf8acbe2b75d2eb6f9e5 Mon Sep 17 00:00:00 2001 From: lihongsx Date: Wed, 13 Aug 2014 19:34:16 +0800 Subject: [PATCH] Check whether '/usr/bin/qemu-aarch64' exist. Change-Id: I3d15f5ee386802c23e438e453aedfdace72739d5 --- mic/utils/misc.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/mic/utils/misc.py b/mic/utils/misc.py index eefa822..47f3491 100644 --- a/mic/utils/misc.py +++ b/mic/utils/misc.py @@ -977,17 +977,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") -- 2.7.4