From 97e915262e06c5980124de2e0fe5c2f34b40ee8f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 14 Jul 2014 17:51:02 -0600 Subject: buildman: Add -C option to force a reconfigure for each commit Normally buildman wil try to configure U-Boot for a particular board on the first commit that it builds in a series. Subsequent commits are built without reconfiguring which normally works. Where it doesn't, buildman automatically reconfigures and retries. To fully emulate the way MAKEALL works, we should have an option to disable this optimisation. Add a -C option to cause buildman to always reconfigure on each commit. Signed-off-by: Simon Glass --- tools/buildman/builder.py | 10 +++++++++- tools/buildman/buildman.py | 3 +++ tools/buildman/control.py | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'tools/buildman') diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 39a6e8a..767b1f6 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -431,7 +431,8 @@ class BuilderThread(threading.Thread): result, request_config = self.RunCommit(commit_upto, brd, work_dir, True, True, False) did_config = True - do_config = request_config + if not self.builder.force_reconfig: + do_config = request_config # If we built that commit, then config is done. But if we got # an warning, reconfig next time to force it to build the same @@ -524,6 +525,12 @@ class Builder: toolchains: Toolchains object to use for building upto: Current commit number we are building (0.count-1) warned: Number of builds that produced at least one warning + force_reconfig: Reconfigure U-Boot on each comiit. This disables + incremental building, where buildman reconfigures on the first + commit for a baord, and then just does an incremental build for + the following commits. In fact buildman will reconfigure and + retry for any failing commits, so generally the only effect of + this option is to slow things down. Private members: _base_board_dict: Last-summarised Dict of boards @@ -593,6 +600,7 @@ class Builder: self._next_delay_update = datetime.now() self.force_config_on_failure = True self.force_build_failures = False + self.force_reconfig = False self._step = step self.col = terminal.Color() diff --git a/tools/buildman/buildman.py b/tools/buildman/buildman.py index 0da6797..5046b16 100755 --- a/tools/buildman/buildman.py +++ b/tools/buildman/buildman.py @@ -67,6 +67,9 @@ parser.add_option('-B', '--bloat', dest='show_bloat', help='Show changes in function code size for each board') parser.add_option('-c', '--count', dest='count', type='int', default=-1, help='Run build on the top n commits') +parser.add_option('-C', '--force-reconfig', dest='force_reconfig', + action='store_true', default=False, + help='Reconfigure for every commit (disable incremental build)') parser.add_option('-e', '--show_errors', action='store_true', default=False, help='Show errors and warnings') parser.add_option('-f', '--force-build', dest='force_build', diff --git a/tools/buildman/control.py b/tools/buildman/control.py index cfad535..a737fd1 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -157,6 +157,7 @@ def DoBuildman(options, args): else: builder.force_build = options.force_build builder.force_build_failures = options.force_build_failures + builder.force_reconfig = options.force_reconfig # Work out which boards to build board_selected = boards.GetSelectedDict() -- cgit v1.1 From 189a496825aefe7c8e9be80c0f2a4cf5923d4f55 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 14 Jul 2014 17:51:03 -0600 Subject: buildman: Support in-tree builds At present buildman always builds out-of-tree, that is it uses a separate output directory from the source directory. Normally this is what you want, but it is important that in-tree builds work also. Some Makefile changes may break this. Add a -i option to tell buildman to use in-tree builds, so that it is easy to test this feature. Signed-off-by: Simon Glass --- tools/buildman/builder.py | 14 ++++++++++++-- tools/buildman/buildman.py | 3 +++ tools/buildman/control.py | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) (limited to 'tools/buildman') diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 767b1f6..0a3900c 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -213,7 +213,10 @@ class BuilderThread(threading.Thread): # self.Make() below, in the event that we do a build. result = command.CommandResult() result.return_code = 0 - out_dir = os.path.join(work_dir, 'build') + if self.builder.in_tree: + out_dir = work_dir + else: + out_dir = os.path.join(work_dir, 'build') # Check if the job was already completed last time done_file = self.builder.GetDoneFile(commit_upto, brd.target) @@ -257,7 +260,10 @@ class BuilderThread(threading.Thread): # Set up the environment and command line env = self.toolchain.MakeEnvironment() Mkdir(out_dir) - args = ['O=build', '-s'] + args = [] + if not self.builder.in_tree: + args.append('O=build') + args.append('-s') if self.builder.num_jobs is not None: args.extend(['-j', str(self.builder.num_jobs)]) config_args = ['%s_config' % brd.target] @@ -531,6 +537,9 @@ class Builder: the following commits. In fact buildman will reconfigure and retry for any failing commits, so generally the only effect of this option is to slow things down. + in_tree: Build U-Boot in-tree instead of specifying an output + directory separate from the source code. This option is really + only useful for testing in-tree builds. Private members: _base_board_dict: Last-summarised Dict of boards @@ -602,6 +611,7 @@ class Builder: self.force_build_failures = False self.force_reconfig = False self._step = step + self.in_tree = False self.col = terminal.Color() diff --git a/tools/buildman/buildman.py b/tools/buildman/buildman.py index 5046b16..42847ac 100755 --- a/tools/buildman/buildman.py +++ b/tools/buildman/buildman.py @@ -85,6 +85,9 @@ parser.add_option('-g', '--git', type='string', help='Git repo containing branch to build', default='.') parser.add_option('-H', '--full-help', action='store_true', dest='full_help', default=False, help='Display the README file') +parser.add_option('-i', '--in-tree', dest='in_tree', + action='store_true', default=False, + help='Build in the source tree instead of a separate directory') parser.add_option('-j', '--jobs', dest='jobs', type='int', default=None, help='Number of jobs to run at once (passed to make)') parser.add_option('-k', '--keep-outputs', action='store_true', diff --git a/tools/buildman/control.py b/tools/buildman/control.py index a737fd1..2dd8043 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -158,6 +158,7 @@ def DoBuildman(options, args): builder.force_build = options.force_build builder.force_build_failures = options.force_build_failures builder.force_reconfig = options.force_reconfig + builder.in_tree = options.in_tree # Work out which boards to build board_selected = boards.GetSelectedDict() -- cgit v1.1 From 99796923831445f29b029a0b6c15e8130bea393a Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 22 Jul 2014 11:19:09 +0900 Subject: buildman: make sure to invoke GNU Make Since the command name 'make' may not be GNU Make on some platforms such as FreeBSD, buildman should call scripts/show-gnu-make to get the command name for GNU MAKE (and error out if it is not found). Signed-off-by: Masahiro Yamada Acked-by: Simon Glass Tested-by: Jeroen Hofstee --- tools/buildman/builder.py | 6 ++++-- tools/buildman/control.py | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'tools/buildman') diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 0a3900c..7de8125 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -576,7 +576,7 @@ class Builder: self.func_sizes = func_sizes def __init__(self, toolchains, base_dir, git_dir, num_threads, num_jobs, - checkout=True, show_unknown=True, step=1): + gnu_make='make', checkout=True, show_unknown=True, step=1): """Create a new Builder object Args: @@ -585,6 +585,7 @@ class Builder: git_dir: Git directory containing source repository num_threads: Number of builder threads to run num_jobs: Number of jobs to run at once (passed to make as -j) + gnu_make: the command name of GNU Make. checkout: True to check out source, False to skip that step. This is used for testing. show_unknown: Show unknown boards (those not built) in summary @@ -596,6 +597,7 @@ class Builder: self.threads = [] self.active = True self.do_make = self.Make + self.gnu_make = gnu_make self.checkout = checkout self.num_threads = num_threads self.num_jobs = num_jobs @@ -700,7 +702,7 @@ class Builder: args: Arguments to pass to make kwargs: Arguments to pass to command.RunPipe() """ - cmd = ['make'] + list(args) + cmd = [self.gnu_make] + list(args) result = command.RunPipe([cmd], capture=True, capture_stderr=True, cwd=cwd, raise_on_error=False, **kwargs) return result diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 2dd8043..267b7d9 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -14,6 +14,7 @@ import gitutil import patchstream import terminal import toolchain +import command def GetPlural(count): """Returns a plural 's' if count is not 1""" @@ -144,10 +145,16 @@ def DoBuildman(options, args): if not options.step: options.step = len(series.commits) - 1 + gnu_make = command.Output(os.path.join(options.git, + 'scripts/show-gnu-make')).rstrip() + if not gnu_make: + print >> sys.stderr, 'GNU Make not found' + sys.exit(1) + # Create a new builder with the selected options output_dir = os.path.join(options.output_dir, options.branch) builder = Builder(toolchains, output_dir, options.git_dir, - options.threads, options.jobs, checkout=True, + options.threads, options.jobs, gnu_make=gnu_make, checkout=True, show_unknown=options.show_unknown, step=options.step) builder.force_config_on_failure = not options.quick -- cgit v1.1 From 73f30b9b8097b1a25f48fbe035f1dee3dac89317 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 30 Jul 2014 14:08:22 +0900 Subject: buildman: adjust for Kconfig Use "make _defconfig" instead of "make _config". Invoke tools/genboardscfg.py to generate boards.cfg when it is missing. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- tools/buildman/board.py | 2 +- tools/buildman/builder.py | 6 +++--- tools/buildman/control.py | 10 ++++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'tools/buildman') diff --git a/tools/buildman/board.py b/tools/buildman/board.py index 5172a47..7bcc932 100644 --- a/tools/buildman/board.py +++ b/tools/buildman/board.py @@ -17,7 +17,7 @@ class Board: soc: Name of SOC, or '' if none (e.g. mx31) vendor: Name of vendor (e.g. armltd) board_name: Name of board (e.g. integrator) - target: Target name (use make _config to configure) + target: Target name (use make _defconfig to configure) options: board-specific options (e.g. integratorcp:CM1136) """ self.target = target diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 7de8125..48408ff 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -199,7 +199,7 @@ class BuilderThread(threading.Thread): commit_upto: Commit number to build (0...n-1) brd: Board object to build work_dir: Directory to which the source will be checked out - do_config: True to run a make _config on the source + do_config: True to run a make _defconfig on the source force_build: Force a build even if one was previously done force_build_failures: Force a bulid if the previous result showed failure @@ -266,7 +266,7 @@ class BuilderThread(threading.Thread): args.append('-s') if self.builder.num_jobs is not None: args.extend(['-j', str(self.builder.num_jobs)]) - config_args = ['%s_config' % brd.target] + config_args = ['%s_defconfig' % brd.target] config_out = '' args.extend(self.builder.toolchains.GetMakeArguments(brd)) @@ -419,7 +419,7 @@ class BuilderThread(threading.Thread): work_dir = self.builder.GetThreadDir(self.thread_num) self.toolchain = None if job.commits: - # Run 'make board_config' on the first commit + # Run 'make board_defconfig' on the first commit do_config = True commit_upto = 0 force_build = False diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 267b7d9..75b6498 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -15,6 +15,7 @@ import patchstream import terminal import toolchain import command +import subprocess def GetPlural(count): """Returns a plural 's' if count is not 1""" @@ -109,6 +110,15 @@ def DoBuildman(options, args): sys.exit(1) # Work out what subset of the boards we are building + board_file = os.path.join(options.git, 'boards.cfg') + if not os.path.exists(board_file): + print 'Could not find %s' % board_file + status = subprocess.call([os.path.join(options.git, + 'tools/genboardscfg.py')]) + if status != 0: + print >> sys.stderr, "Failed to generate boards.cfg" + sys.exit(1) + boards = board.Boards() boards.ReadBoards(os.path.join(options.git, 'boards.cfg')) why_selected = boards.SelectBoards(args) -- cgit v1.1