Skip to content

Commit

Permalink
scripts/qemu.py: allow arches use KVM for their 32bit cousins
Browse files Browse the repository at this point in the history
A lot of architectures can run their 32 bit cousins on KVM so the
kvm_available function needs to be a little less restricting when
deciding if KVM is available.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
  • Loading branch information
stsquad committed Feb 8, 2019
1 parent ddafa31 commit 2d4e4c0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/qemu.py
Expand Up @@ -25,10 +25,18 @@

LOG = logging.getLogger(__name__)

# Mapping host architecture to any additional architectures it can
# support which often includes its 32 bit cousin.
ADDITIONAL_ARCHES = {
"x86_64" : "i386",
"aarch64" : "armhf"
}

def kvm_available(target_arch=None):
if target_arch and target_arch != os.uname()[4]:
return False
host_arch = os.uname()[4]
if target_arch and target_arch != host_arch:
if target_arch != ADDITIONAL_ARCHES.get(host_arch):
return False
return os.access("/dev/kvm", os.R_OK | os.W_OK)


Expand Down

0 comments on commit 2d4e4c0

Please sign in to comment.