summaryrefslogtreecommitdiff
path: root/shrinkwrap/utils/config.py
diff options
context:
space:
mode:
authorRyan Roberts <ryan.roberts@arm.com>2022-10-12 12:14:04 +0100
committerRyan Roberts <ryan.roberts@arm.com>2022-11-17 15:30:09 +0000
commit3f3a52ef5110ff4dacf993baf89b1d650f432e31 (patch)
tree1222a4e92c35a5f90cf8aaff791cf8983ce6590b /shrinkwrap/utils/config.py
parent2e4b499be9ab6c53856e803405e0154310fc260c (diff)
config: Require each component to specify their toolchain.
Add a 'toolchain' key to the component dictionary, which specifies the toolchain to use. This string is set in the CROSS_COMPILE environment variable before invoking any prebuild, build, postbuild or clean commands. When using the standard docker runtime image, the following options are supported. Users are free to configure their own thing when using the null runtime. * aarch64-none-elf- (arm64 bare-metal, from Arm) * arm-none-eabi- (arm32 bare-metal, from Arm) * aarch64-linux-gnu- (arm64 linux, from Debian) * arm-linux-gnueabihf- (arm32 linux, from Debian) Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Diffstat (limited to 'shrinkwrap/utils/config.py')
-rw-r--r--shrinkwrap/utils/config.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/shrinkwrap/utils/config.py b/shrinkwrap/utils/config.py
index 9ea9167..3a6ba17 100644
--- a/shrinkwrap/utils/config.py
+++ b/shrinkwrap/utils/config.py
@@ -34,6 +34,9 @@ def _component_normalize(component, name):
if 'builddir' not in component:
component['builddir'] = None
+ if 'toolchain' not in component:
+ component['toolchain'] = None
+
if 'prebuild' not in component:
component['prebuild'] = []
@@ -140,7 +143,7 @@ def _component_sort(component):
Sort the component so that the keys are in a canonical order. This
improves readability by humans.
"""
- lut = ['repo', 'sourcedir', 'builddir', 'params',
+ lut = ['repo', 'sourcedir', 'builddir', 'toolchain', 'params',
'prebuild', 'build', 'postbuild', 'clean', 'artifacts']
lut = {k: i for i, k in enumerate(lut)}
return dict(sorted(component.items(), key=lambda x: lut[x[0]]))
@@ -805,6 +808,7 @@ def build_graph(configs):
len(component['build']) + \
len(component['postbuild']) > 0:
b.append(f'# Build for config={config["name"]} component={name}.')
+ b.append(f'export CROSS_COMPILE={component["toolchain"] if component["toolchain"] else ""}')
b.append(f'pushd {component["sourcedir"]}')
for cmd in component['prebuild']:
b.append(cmd)
@@ -860,6 +864,7 @@ def clean_graph(configs, clean_repo):
c = Script('Cleaning', config["name"], name, preamble=pre)
c.append(f'# Clean for config={config["name"]} component={name}.')
if len(component['clean']) > 0:
+ c.append(f'export CROSS_COMPILE={component["toolchain"] if component["toolchain"] else ""}')
c.append(f'if [ -d "{component["sourcedir"]}" ]; then')
c.append(f'\tpushd {component["sourcedir"]}')
for cmd in component['clean']: