From b50113f373a95d28cf001eb20adc6ef56f8ba14c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 13 Nov 2016 14:25:51 -0700 Subject: buildman: Add an option to just create the config Normally buildman does a full build of a board. This includes creating the u-boot.cfg file which contains all the configuration options. Buildman uses this file with the -K option, to show differences in effective configuration for each commit. Doing a full build of U-Boot just to create the u-boot.cfg file is wasteful. Add a -D option which causes buildman to only create the configuration. This is enough to support use of -K and can be done much more quickly (typically 5-10 times faster). Signed-off-by: Simon Glass --- tools/buildman/builder.py | 5 ++++- tools/buildman/builderthread.py | 14 +++++++++----- tools/buildman/cmdline.py | 2 ++ tools/buildman/control.py | 3 ++- 4 files changed, 17 insertions(+), 7 deletions(-) (limited to 'tools/buildman') diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index e27a28577c..d834d314f3 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -207,7 +207,8 @@ 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, full_path=False, verbose_build=False, - incremental=False, per_board_out_dir=False): + incremental=False, per_board_out_dir=False, + config_only=False): """Create a new Builder object Args: @@ -230,6 +231,7 @@ class Builder: mrproper when configuring per_board_out_dir: Build in a separate persistent directory per board rather than a thread-specific directory + config_only: Only configure each build, don't build it """ self.toolchains = toolchains self.base_dir = base_dir @@ -257,6 +259,7 @@ class Builder: self.no_subdirs = no_subdirs self.full_path = full_path self.verbose_build = verbose_build + self.config_only = config_only self.col = terminal.Color() diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 8974351225..926f267e21 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -110,8 +110,8 @@ class BuilderThread(threading.Thread): return self.builder.do_make(commit, brd, stage, cwd, *args, **kwargs) - def RunCommit(self, commit_upto, brd, work_dir, do_config, force_build, - force_build_failures): + def RunCommit(self, commit_upto, brd, work_dir, do_config, do_build, + force_build, force_build_failures): """Build a particular commit. If the build is already done, and we are not forcing a build, we skip @@ -122,6 +122,7 @@ class BuilderThread(threading.Thread): brd: Board object to build work_dir: Directory to which the source will be checked out do_config: True to run a make _defconfig on the source + do_build: Try to build 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 @@ -231,6 +232,8 @@ class BuilderThread(threading.Thread): config_out += result.combined do_config = False # No need to configure next time if result.return_code == 0: + if not do_build: + args.append('cfg') result = self.Make(commit, brd, 'build', cwd, *args, env=env) result.stderr = result.stderr.replace(src_dir + '/', '') @@ -401,7 +404,7 @@ class BuilderThread(threading.Thread): force_build = False for commit_upto in range(0, len(job.commits), job.step): result, request_config = self.RunCommit(commit_upto, brd, - work_dir, do_config, + work_dir, do_config, not self.builder.config_only, force_build or self.builder.force_build, self.builder.force_build_failures) failed = result.return_code or result.stderr @@ -411,7 +414,7 @@ class BuilderThread(threading.Thread): # with a reconfig. if self.builder.force_config_on_failure: result, request_config = self.RunCommit(commit_upto, - brd, work_dir, True, True, False) + brd, work_dir, True, False, True, False) did_config = True if not self.builder.force_reconfig: do_config = request_config @@ -455,7 +458,8 @@ class BuilderThread(threading.Thread): else: # Just build the currently checked-out build result, request_config = self.RunCommit(None, brd, work_dir, True, - True, self.builder.force_build_failures) + not self.builder.config_only, True, + self.builder.force_build_failures) result.commit_upto = 0 self._WriteResult(result, job.keep_outputs) self.builder.out_queue.put(result) diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index 3e3bd63e32..bd3776a75f 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -28,6 +28,8 @@ def ParseArgs(): parser.add_option('-d', '--detail', dest='show_detail', action='store_true', default=False, help='Show detailed information for each board in summary') + parser.add_option('-D', '--config-only', action='store_true', default=False, + help="Don't build, just configure each commit") 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 0b6ab03b4c..0b3ba9410d 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -258,7 +258,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, no_subdirs=options.no_subdirs, full_path=options.full_path, verbose_build=options.verbose_build, incremental=options.incremental, - per_board_out_dir=options.per_board_out_dir,) + per_board_out_dir=options.per_board_out_dir, + config_only=options.config_only) builder.force_config_on_failure = not options.quick if make_func: builder.do_make = make_func -- cgit From 94d2ebe5bcbbbd15e879ee2204e037f321d66b68 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 13 Nov 2016 14:25:52 -0700 Subject: buildman: Add documentation for CONFIG checking The -K option is not mentioned in the README at present. Add some notes to describe how this is used. Signed-off-by: Simon Glass --- tools/buildman/README | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'tools/buildman') diff --git a/tools/buildman/README b/tools/buildman/README index 514bebc9f8..89df94db73 100644 --- a/tools/buildman/README +++ b/tools/buildman/README @@ -968,6 +968,43 @@ of the source tree, thus allowing rapid tested evolution of the code. SOURCE_DATE_EPOCH=0 ./tools/buildman/buildman -I -P tegra +Checking configuration +====================== + +A common requirement when converting CONFIG options to Kconfig is to check +that the effective configuration has not changed due to the conversion. +Buildman supports this with the -K option, used after a build. This shows +differences in effective configuration between one commit and the next. + +For example: + + $ buildman -b kc4 -sK + ... + 43: Convert CONFIG_SPL_USBETH_SUPPORT to Kconfig + arm: + + u-boot.cfg: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_NET_SUPPORT=1 + + u-boot-spl.cfg: CONFIG_SPL_MMC_SUPPORT=1 CONFIG_SPL_NAND_SUPPORT=1 + + all: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_MMC_SUPPORT=1 CONFIG_SPL_NAND_SUPPORT=1 CONFIG_SPL_NET_SUPPORT=1 + am335x_evm_usbspl : + + u-boot.cfg: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_NET_SUPPORT=1 + + u-boot-spl.cfg: CONFIG_SPL_MMC_SUPPORT=1 CONFIG_SPL_NAND_SUPPORT=1 + + all: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_MMC_SUPPORT=1 CONFIG_SPL_NAND_SUPPORT=1 CONFIG_SPL_NET_SUPPORT=1 + 44: Convert CONFIG_SPL_USB_HOST_SUPPORT to Kconfig + ... + +This shows that commit 44 enabled three new options for the board +am335x_evm_usbspl which were not enabled in commit 43. There is also a +summary for 'arm' showing all the changes detected for that architecture. +In this case there is only one board with changes, so 'arm' output is the +same as 'am335x_evm_usbspl'/ + +The -K option uses the u-boot.cfg, spl/u-boot-spl.cfg and tpl/u-boot-tpl.cfg +files which are produced by a build. If all you want is to check the +configuration you can in fact avoid doing a full build, using -D. This tells +buildman to configuration U-Boot and create the .cfg files, but not actually +build the source. This is 5-10 times faster than doing a full build. + + Other options ============= -- cgit From b464f8e7ded33dc3f3c26dd905e1fa9807dd7526 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 13 Nov 2016 14:25:53 -0700 Subject: buildman: Squash useless output from -K When using #define CONFIG_SOME_OPTION, the value it set to '1'. When using defconfig (i.e. CONFIG_SOME_OPTION=y) the value is set to 'y'. This results in differences showing up with -K. These differences are seldom useful. Adjust buildman to suppress these differences by default. Signed-off-by: Simon Glass --- tools/buildman/README | 12 ++++++++++++ tools/buildman/builder.py | 34 ++++++++++++++++++++++------------ tools/buildman/cmdline.py | 2 ++ tools/buildman/control.py | 3 ++- 4 files changed, 38 insertions(+), 13 deletions(-) (limited to 'tools/buildman') diff --git a/tools/buildman/README b/tools/buildman/README index 89df94db73..62ab7b7441 100644 --- a/tools/buildman/README +++ b/tools/buildman/README @@ -1004,6 +1004,18 @@ configuration you can in fact avoid doing a full build, using -D. This tells buildman to configuration U-Boot and create the .cfg files, but not actually build the source. This is 5-10 times faster than doing a full build. +By default buildman considers the follow two configuration methods +equivalent: + + #define CONFIG_SOME_OPTION + + CONFIG_SOME_OPTION=y + +The former would appear in a header filer and the latter in a defconfig +file. The achieve this, buildman considers 'y' to be '1' in configuration +variables. This avoids lots of useless output when converting a CONFIG +option to Kconfig. To disable this behaviour, use --squash-config-y. + Other options ============= diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index d834d314f3..6905ed94ab 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -98,19 +98,22 @@ OUTCOME_OK, OUTCOME_WARNING, OUTCOME_ERROR, OUTCOME_UNKNOWN = range(4) # Translate a commit subject into a valid filename trans_valid_chars = string.maketrans("/: ", "---") -CONFIG_FILENAMES = [ +BASE_CONFIG_FILENAMES = [ + 'u-boot.cfg', 'u-boot-spl.cfg', 'u-boot-tpl.cfg' +] + +EXTRA_CONFIG_FILENAMES = [ '.config', '.config-spl', '.config-tpl', 'autoconf.mk', 'autoconf-spl.mk', 'autoconf-tpl.mk', 'autoconf.h', 'autoconf-spl.h','autoconf-tpl.h', - 'u-boot.cfg', 'u-boot-spl.cfg', 'u-boot-tpl.cfg' ] class Config: """Holds information about configuration settings for a board.""" - def __init__(self, target): + def __init__(self, config_filename, target): self.target = target self.config = {} - for fname in CONFIG_FILENAMES: + for fname in config_filename: self.config[fname] = {} def Add(self, fname, key, value): @@ -208,7 +211,7 @@ class Builder: gnu_make='make', checkout=True, show_unknown=True, step=1, no_subdirs=False, full_path=False, verbose_build=False, incremental=False, per_board_out_dir=False, - config_only=False): + config_only=False, squash_config_y=False): """Create a new Builder object Args: @@ -232,6 +235,7 @@ class Builder: per_board_out_dir: Build in a separate persistent directory per board rather than a thread-specific directory config_only: Only configure each build, don't build it + squash_config_y: Convert CONFIG options with the value 'y' to '1' """ self.toolchains = toolchains self.base_dir = base_dir @@ -260,6 +264,10 @@ class Builder: self.full_path = full_path self.verbose_build = verbose_build self.config_only = config_only + self.squash_config_y = squash_config_y + self.config_filenames = BASE_CONFIG_FILENAMES + if not self.squash_config_y: + self.config_filenames += EXTRA_CONFIG_FILENAMES self.col = terminal.Color() @@ -586,13 +594,15 @@ class Builder: key, value = values else: key = values[0] - value = '' + value = '1' if self.squash_config_y else '' if not key.startswith('CONFIG_'): continue elif not line or line[0] in ['#', '*', '/']: continue else: key, value = line.split('=', 1) + if self.squash_config_y and value == 'y': + value = '1' config[key] = value return config @@ -659,7 +669,7 @@ class Builder: if read_config: output_dir = self.GetBuildDir(commit_upto, target) - for name in CONFIG_FILENAMES: + for name in self.config_filenames: fname = os.path.join(output_dir, name) config[name] = self._ProcessConfig(fname) @@ -736,8 +746,8 @@ class Builder: line, board) last_was_warning = is_warning last_func = None - tconfig = Config(board.target) - for fname in CONFIG_FILENAMES: + tconfig = Config(self.config_filenames, board.target) + for fname in self.config_filenames: if outcome.config: for key, value in outcome.config[fname].iteritems(): tconfig.Add(fname, key, value) @@ -1193,7 +1203,7 @@ class Builder: arch_config_plus[arch] = {} arch_config_minus[arch] = {} arch_config_change[arch] = {} - for name in CONFIG_FILENAMES: + for name in self.config_filenames: arch_config_plus[arch][name] = {} arch_config_minus[arch][name] = {} arch_config_change[arch][name] = {} @@ -1210,7 +1220,7 @@ class Builder: tbase = self._base_config[target] tconfig = config[target] lines = [] - for name in CONFIG_FILENAMES: + for name in self.config_filenames: if not tconfig.config[name]: continue config_plus = {} @@ -1254,7 +1264,7 @@ class Builder: all_plus = {} all_minus = {} all_change = {} - for name in CONFIG_FILENAMES: + for name in self.config_filenames: all_plus.update(arch_config_plus[arch][name]) all_minus.update(arch_config_minus[arch][name]) all_change.update(arch_config_change[arch][name]) diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index bd3776a75f..0060e0317c 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -59,6 +59,8 @@ def ParseArgs(): default=False, help='Keep all build output files (e.g. binaries)') parser.add_option('-K', '--show-config', action='store_true', default=False, help='Show configuration changes in summary (both board config files and Kconfig)') + parser.add_option('--preserve-config-y', action='store_true', + default=False, help="Don't convert y to 1 in configs") parser.add_option('-l', '--list-error-boards', action='store_true', default=False, help='Show a list of boards next to each error/warning') parser.add_option('--list-tool-chains', action='store_true', default=False, diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 0b3ba9410d..545c2cb44a 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -259,7 +259,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, verbose_build=options.verbose_build, incremental=options.incremental, per_board_out_dir=options.per_board_out_dir, - config_only=options.config_only) + config_only=options.config_only, + squash_config_y=not options.preserve_config_y) builder.force_config_on_failure = not options.quick if make_func: builder.do_make = make_func -- cgit From 960421ecb3db9220609b6f1dbcb9f972dbca9975 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 15 Nov 2016 15:32:59 -0700 Subject: buildman: Clean up odd characters on the terminal At present buildman leaves behind a few characters during its progress updates, which looks odd. Fix it. Signed-off-by: Simon Glass --- tools/buildman/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/buildman') diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 6905ed94ab..236e0617ac 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -443,7 +443,7 @@ class Builder: name += target Print(line + name, newline=False) - length = 14 + len(name) + length = 16 + len(name) self.ClearLine(length) def _GetOutputDir(self, commit_upto): -- cgit From a9401b2bc93a750d1566174b18d23bcdc2a45b7b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 16 Nov 2016 14:09:25 -0700 Subject: buildman: Rename do_build to config_only This variable name is needlessly confusion. Adjust it to use a 'positive' name instead. Signed-off-by: Simon Glass --- tools/buildman/builderthread.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tools/buildman') diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 926f267e21..f2b2acd1eb 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -110,7 +110,7 @@ class BuilderThread(threading.Thread): return self.builder.do_make(commit, brd, stage, cwd, *args, **kwargs) - def RunCommit(self, commit_upto, brd, work_dir, do_config, do_build, + def RunCommit(self, commit_upto, brd, work_dir, do_config, config_only, force_build, force_build_failures): """Build a particular commit. @@ -122,7 +122,7 @@ class BuilderThread(threading.Thread): brd: Board object to build work_dir: Directory to which the source will be checked out do_config: True to run a make _defconfig on the source - do_build: Try to build the source + config_only: Only configure the source, do not build it force_build: Force a build even if one was previously done force_build_failures: Force a bulid if the previous result showed failure @@ -232,7 +232,7 @@ class BuilderThread(threading.Thread): config_out += result.combined do_config = False # No need to configure next time if result.return_code == 0: - if not do_build: + if config_only: args.append('cfg') result = self.Make(commit, brd, 'build', cwd, *args, env=env) @@ -404,7 +404,7 @@ class BuilderThread(threading.Thread): force_build = False for commit_upto in range(0, len(job.commits), job.step): result, request_config = self.RunCommit(commit_upto, brd, - work_dir, do_config, not self.builder.config_only, + work_dir, do_config, self.builder.config_only, force_build or self.builder.force_build, self.builder.force_build_failures) failed = result.return_code or result.stderr @@ -458,7 +458,7 @@ class BuilderThread(threading.Thread): else: # Just build the currently checked-out build result, request_config = self.RunCommit(None, brd, work_dir, True, - not self.builder.config_only, True, + self.builder.config_only, True, self.builder.force_build_failures) result.commit_upto = 0 self._WriteResult(result, job.keep_outputs) -- cgit