summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-12-01 17:34:00 -0700
committerSimon Glass <sjg@chromium.org>2015-01-14 21:16:53 -0800
commitbb1501f2c22c979961b735db775605cccedd98f6 (patch)
tree0dc4473b382bdb69949bb756f4f3ebb04be96981 /tools
parentf210b58734b750fcab3d4fef6477a6eaf39b5d51 (diff)
downloadblackbird-obmc-uboot-bb1501f2c22c979961b735db775605cccedd98f6.tar.gz
blackbird-obmc-uboot-bb1501f2c22c979961b735db775605cccedd98f6.zip
buildman: Add an option to use the full tool chain path
In some cases there may be multiple toolchains with the same name in the path. Provide an option to use the full path in the CROSS_COMPILE environment variable. Note: Wolfgang mentioned that this is dangerous since in some cases there may be other tools on the path that are needed. So this is set up as an option, not the default. I will need test confirmation (i.e. that this commit fixes a real problem) before merging it. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Steve Rae <srae@broadcom.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/buildman/builder.py7
-rw-r--r--tools/buildman/builderthread.py4
-rw-r--r--tools/buildman/cmdline.py2
-rw-r--r--tools/buildman/control.py2
-rw-r--r--tools/buildman/toolchain.py20
5 files changed, 25 insertions, 10 deletions
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index ca74c3645e..93d048b568 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -175,7 +175,7 @@ class Builder:
def __init__(self, toolchains, base_dir, git_dir, num_threads, num_jobs,
gnu_make='make', checkout=True, show_unknown=True, step=1,
- no_subdirs=False):
+ no_subdirs=False, full_path=False):
"""Create a new Builder object
Args:
@@ -189,6 +189,10 @@ class Builder:
This is used for testing.
show_unknown: Show unknown boards (those not built) in summary
step: 1 to process every commit, n to process every nth commit
+ no_subdirs: Don't create subdirectories when building current
+ source for a single board
+ full_path: Return the full path in CROSS_COMPILE and don't set
+ PATH
"""
self.toolchains = toolchains
self.base_dir = base_dir
@@ -215,6 +219,7 @@ class Builder:
self.in_tree = False
self._error_lines = 0
self.no_subdirs = no_subdirs
+ self.full_path = full_path
self.col = terminal.Color()
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index bc4541cb3e..a803481458 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -177,7 +177,7 @@ class BuilderThread(threading.Thread):
commit = 'current'
# Set up the environment and command line
- env = self.toolchain.MakeEnvironment()
+ env = self.toolchain.MakeEnvironment(self.builder.full_path)
Mkdir(out_dir)
args = []
cwd = work_dir
@@ -284,7 +284,7 @@ class BuilderThread(threading.Thread):
print >>fd, 'path', result.toolchain.path
# Write out the image and function size information and an objdump
- env = result.toolchain.MakeEnvironment()
+ env = result.toolchain.MakeEnvironment(self.builder.full_path)
lines = []
for fname in ['u-boot', 'spl/u-boot-spl']:
cmd = ['%snm' % self.toolchain.cross, '--size-sort', fname]
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 2b75653512..6ad376db72 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -62,6 +62,8 @@ def ParseArgs():
help='Directory where all builds happen and buildman has its workspace (default is ../)')
parser.add_option('-Q', '--quick', action='store_true',
default=False, help='Do a rough build, with limited warning resolution')
+ parser.add_option('-p', '--full-path', action='store_true',
+ default=False, help="Use full toolchain path in CROSS_COMPILE")
parser.add_option('-s', '--summary', action='store_true',
default=False, help='Show a build summary')
parser.add_option('-S', '--show-sizes', action='store_true',
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index e10ed867fb..cd0333ca1d 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -232,7 +232,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
builder = Builder(toolchains, output_dir, options.git_dir,
options.threads, options.jobs, gnu_make=gnu_make, checkout=True,
show_unknown=options.show_unknown, step=options.step,
- no_subdirs=options.no_subdirs)
+ no_subdirs=options.no_subdirs, full_path=options.full_path)
builder.force_config_on_failure = not options.quick
if make_func:
builder.do_make = make_func
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py
index ab08193349..cb693f4641 100644
--- a/tools/buildman/toolchain.py
+++ b/tools/buildman/toolchain.py
@@ -41,7 +41,7 @@ class Toolchain:
pos = self.cross.find('-')
self.arch = self.cross[:pos] if pos != -1 else 'sandbox'
- env = self.MakeEnvironment()
+ env = self.MakeEnvironment(False)
# As a basic sanity check, run the C compiler with --version
cmd = [fname, '--version']
@@ -81,15 +81,23 @@ class Toolchain:
return prio
return prio
- def MakeEnvironment(self):
+ def MakeEnvironment(self, full_path):
"""Returns an environment for using the toolchain.
- Thie takes the current environment, adds CROSS_COMPILE and
- augments PATH so that the toolchain will operate correctly.
+ Thie takes the current environment and adds CROSS_COMPILE so that
+ the tool chain will operate correctly.
+
+ Args:
+ full_path: Return the full path in CROSS_COMPILE and don't set
+ PATH
"""
env = dict(os.environ)
- env['CROSS_COMPILE'] = self.cross
- env['PATH'] = self.path + ':' + env['PATH']
+ if full_path:
+ env['CROSS_COMPILE'] = os.path.join(self.path, self.cross)
+ else:
+ env['CROSS_COMPILE'] = self.cross
+ env['PATH'] = self.path + ':' + env['PATH']
+
return env
OpenPOWER on IntegriCloud