summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sherwood <paul.sherwood@codethink.co.uk>2016-04-16 14:25:41 +0100
committerPaul Sherwood <paul.sherwood@codethink.co.uk>2016-04-16 14:25:41 +0100
commit3f6d5886531b8c1fafc943bff96cfa3b55965cf0 (patch)
tree51f97094dee5a17672089ee8e1dd84941cd5765b
parent18ac1e9c39803df9418aead1f3c53e2d10c1b042 (diff)
downloadybd-3f6d5886531b8c1fafc943bff96cfa3b55965cf0.tar.gz
Move cpus map into defaults.conf
-rw-r--r--ybd/config/defaults.conf10
-rw-r--r--ybd/defaults.py1
-rw-r--r--ybd/definitions.py6
-rw-r--r--ybd/sandbox.py11
4 files changed, 15 insertions, 13 deletions
diff --git a/ybd/config/defaults.conf b/ybd/config/defaults.conf
index 8d2b3b5..6f3657f 100644
--- a/ybd/config/defaults.conf
+++ b/ybd/config/defaults.conf
@@ -1,3 +1,13 @@
+# Mapping from arch to cpu defaults
+cpus:
+ x86_32: 'i686'
+ armv8l64: 'aarch64'
+ armv8b64: 'aarch64_be'
+ mips64b: 'mips64'
+ mips64l: 'mips64el'
+ mips32b: 'mips'
+ mips32l: 'mipsel'
+
# Baserock definitions defaults
build-steps: ['pre-bootstrap-commands',
'bootstrap-commands',
diff --git a/ybd/defaults.py b/ybd/defaults.py
index 6b37c66..c81593e 100644
--- a/ybd/defaults.py
+++ b/ybd/defaults.py
@@ -36,6 +36,7 @@ class Defaults(object):
self.build_steps = defaults.get('build-steps', {})
self.build_systems = defaults.get('build-systems', {})
self.split_rules = defaults.get('split-rules', {})
+ self.cpus = defaults.get('cpus', {})
def _load_defaults(self, defaults_file='./DEFAULTS'):
'''Get defaults, either from a DEFAULTS file, or built-in defaults.'''
diff --git a/ybd/definitions.py b/ybd/definitions.py
index c451b9d..e27484c 100644
--- a/ybd/definitions.py
+++ b/ybd/definitions.py
@@ -20,7 +20,7 @@ import app
import cache
from subprocess import check_output, PIPE
import hashlib
-import defaults
+from defaults import Defaults
import jsonschema
@@ -30,6 +30,8 @@ class Definitions(object):
'''Load all definitions from a directory tree.'''
self._definitions = {}
self._trees = {}
+ self.defaults = Defaults()
+ app.config['cpu'] = self.defaults.cpus.get('arch', app.config['arch'])
schemas = self.load_schemas()
with app.chdir(directory):
@@ -48,8 +50,6 @@ class Definitions(object):
self._fix_keys(data)
self._tidy_and_insert_recursively(data)
- self.defaults = defaults.Defaults()
-
caches_are_valid = self._check_trees()
for path in self._definitions:
try:
diff --git a/ybd/sandbox.py b/ybd/sandbox.py
index 7669279..a425174 100644
--- a/ybd/sandbox.py
+++ b/ybd/sandbox.py
@@ -254,15 +254,6 @@ def ccache_mounts(this, ccache_target):
def env_vars_for_build(defs, this):
env = {}
extra_path = []
- arch_dict = {
- "x86_32": 'i686',
- 'armv8l64': "aarch64",
- 'armv8b64': "aarch64_be",
- 'mips64b': 'mips64',
- 'mips64l': 'mips64el',
- 'mips32b': 'mips',
- 'mips32l': 'mipsel',
- }
if app.config['no-ccache']:
ccache_path = []
@@ -309,7 +300,7 @@ def env_vars_for_build(defs, this):
env['TZ'] = 'UTC'
arch = app.config['arch']
- cpu = arch_dict.get(arch, arch)
+ cpu = app.config['cpu']
abi = ''
if arch.startswith(('armv7', 'armv5')):
abi = 'eabi'