diff options
author | Han Shen <shenhan@chromium.org> | 2014-04-28 16:36:28 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-05-03 04:03:56 +0000 |
commit | fe3001c80006e3b86ee891d72a03b1f6ab04f5ed (patch) | |
tree | e1d603a1ea38949405610e19b374ff716df5862b /build_tool.py | |
parent | 57f71b3df9db76e45412da01511899b36db2e3fc (diff) | |
download | toolchain-utils-fe3001c80006e3b86ee891d72a03b1f6ab04f5ed.tar.gz |
Add support to build mutiple boards for binutils/gcc.
Now you can specify multiple boards in one command line like this
./build_tool.py --board='x86-alex,lumpy'
TEST=None
BUG=None
Change-Id: Idac899bb225ce51eab922f5ab0b08b36ce7b0e20
Reviewed-on: https://chrome-internal-review.googlesource.com/161923
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Han Shen <shenhan@google.com>
Tested-by: Han Shen <shenhan@google.com>
Diffstat (limited to 'build_tool.py')
-rwxr-xr-x | build_tool.py | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/build_tool.py b/build_tool.py index 22dc7d31..e81b77c4 100755 --- a/build_tool.py +++ b/build_tool.py @@ -403,24 +403,37 @@ class Bootstrapper(object): True if operation succeeds. """ - if self._board == 'host': - command = 'sudo emerge sys-devel/{0}'.format(tool_name) - else: - target = misc.GetCtargetFromBoard(self._board, self._chromeos_root) - if not target: - self._logger.LogError('Unsupported board "{0}", aborted.'.format( - self._board)) - return False - command = 'sudo emerge cross-{0}/{1}'.format(target, tool_name) + boards_to_build = self._board.split(',') - rv = self._ce.ChrootRunCommand( - self._chromeos_root, - command, return_output=False, - print_to_console=True) - if rv: + failed = [] + for board in boards_to_build: + if board == 'host': + command = 'sudo emerge sys-devel/{0}'.format(tool_name) + else: + target = misc.GetCtargetFromBoard(board, self._chromeos_root) + if not target: + self._logger.LogError( + 'Unsupported board "{0}", skip.'.format(board)) + failed.append(board) + continue + command = 'sudo emerge cross-{0}/{1}'.format(target, tool_name) + + rv = self._ce.ChrootRunCommand(self._chromeos_root, command, + return_output=False, print_to_console=True) + if rv: + self._logger.LogError( + 'Build "{0}" failed for "{1}", aborted.'.format(tool_name, board)) + failed.append(board) + else: + self._logger.LogOutput( + 'Successfully built "{0}" for board "{1}".'.format(tool_name, board)) + + if not failed: self._logger.LogError( - 'Build {0} failed for "{1}", aborted.'.format(tool_name, self._board)) + 'Failed to build {0} for the following board(s): "{1}"'.format( + tool_name, ' '.join(failed))) return False + # All boards build successfully return True def DoBootstrapping(self): @@ -521,8 +534,9 @@ def Main(argv): 'and exit. This should not be used with -- ' 'gcc/binutils_dir/branch options.')) parser.add_option('--board', dest='board', default=None, - help=('Only build toolchain for a specific board. ' + help=('Only build toolchain for specific board(s). ' 'Use "host" to build for host. ' + 'Use "," to seperate multiple boards. ' 'This does not perform a chroot bootstrap.')) parser.add_option('--bootstrap', dest='bootstrap', default=False, action='store_true', |