summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-01-22 10:23:42 (GMT)
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-01-22 10:23:42 (GMT)
commit2a702ed211532e277ecbeaff3f0bc345a34cbfe6 (patch)
treef6bbf48d4d815a5cb892a0d34f985db93b6d00e9
parent18f24fbb0c35905af06f5af0915813fd1f0c22b3 (diff)
parent898ea08575925c77d398125a27a12f5b18634a95 (diff)
downloadmorph-2a702ed211532e277ecbeaff3f0bc345a34cbfe6.tar.gz
Merge branch 'baserock/pedroalvarez/armhf'
-rw-r--r--morphlib/__init__.py3
-rw-r--r--morphlib/util.py23
2 files changed, 24 insertions, 2 deletions
diff --git a/morphlib/__init__.py b/morphlib/__init__.py
index 3377379..f416ae0 100644
--- a/morphlib/__init__.py
+++ b/morphlib/__init__.py
@@ -38,7 +38,8 @@ __version__ = gitversion.version
# List of architectures that Morph supports
-valid_archs = ['armv7l', 'armv7b', 'testarch', 'x86_32', 'x86_64', 'ppc64']
+valid_archs = ['armv7l', 'armv7lhf', 'armv7b', 'testarch',
+ 'x86_32', 'x86_64', 'ppc64']
class Error(cliapp.AppException):
diff --git a/morphlib/util.py b/morphlib/util.py
index 68aed60..024de49 100644
--- a/morphlib/util.py
+++ b/morphlib/util.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2013 Codethink Limited
+# Copyright (C) 2011-2014 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,6 +16,7 @@
import itertools
import os
import re
+import subprocess
import fs.osfs
@@ -399,6 +400,23 @@ def parse_environment_pairs(env, pairs):
return dict(env.items() + extra_env.items())
+def has_hardware_fp(): # pragma: no cover
+ '''
+ This function returns whether the binary /proc/self/exe is compiled
+ with hardfp _not_ whether the platform is hardfp.
+
+ We expect the binaries on our build platform to be compiled with
+ hardfp.
+
+ This is not ideal but at the time of writing this is the only
+ reliable way to decide whether our architecture is a hardfp
+ architecture.
+ '''
+
+ output = subprocess.check_output(['readelf', '-A', '/proc/self/exe'])
+ return 'Tag_ABI_VFP_args: VFP registers' in output
+
+
def get_host_architecture(): # pragma: no cover
'''Get the canonical Morph name for the host's architecture.'''
@@ -418,6 +436,9 @@ def get_host_architecture(): # pragma: no cover
if machine not in table:
raise morphlib.Error('Unknown host architecture %s' % machine)
+ if machine == 'armv7l' and has_hardware_fp():
+ return 'armv7lhf'
+
return table[machine]