+def get_qemu_arm_binary(arch):
+ if arch == "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)
+ elif arch == "mipsel":
+ node = "/proc/sys/fs/binfmt_misc/mipsel"
+ arm_binary = "qemu-mipsel"
+ if not os.path.exists("/usr/bin/%s" % arm_binary) or not is_statically_linked("/usr/bin/%s"):
+ arm_binary = "qemu-mipsel-static"
+ if not os.path.exists("/usr/bin/%s" % arm_binary):
+ raise CreatorError("Please install a statically-linked %s" % arm_binary)
+ else:
+ 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/%s" % arm_binary):
+ raise CreatorError("Please install a statically-linked %s" % arm_binary)
+
+ return (arm_binary, node)
+