Patchwork [flasher,2/4] build: implement --socs, --boards options

login
register
mail settings
Submitter Stephen Warren
Date June 14, 2013, 7:52 p.m.
Message ID <1371239544-26165-2-git-send-email-swarren@wwwdotorg.org>
Download mbox | patch
Permalink /patch/251516/
State Accepted, archived
Headers show

Comments

Stephen Warren - June 14, 2013, 7:52 p.m.
From: Stephen Warren <swarren@nvidia.com>

This will restrict the build process to a subset of SoCs or boards,
which can be useful if you want to:

./build --boards seaboard build
./tegra-uboot-flasher exec seaboard

... in order to iterate testing on a single board at a time.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 build | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Patch

diff --git a/build b/build
index d14231f..924ac88 100755
--- a/build
+++ b/build
@@ -102,6 +102,28 @@  def all_enabled_boardnames():
         seen[boardname] = True
         yield boardname
 
+def user_restrict_socs(enabled_socs):
+    enabled_socs = enabled_socs.split(',')
+    for socname in socs.keys():
+        if not socname in enabled_socs:
+            socs[socname]['disabled'] = True
+
+def user_restrict_boards(enabled_boards):
+    enabled_boards = enabled_boards.split(',')
+    for boardname in boards.keys():
+        if not boardname in enabled_boards:
+            boards[boardname]['disabled'] = True
+
+def restrict_boards():
+    for board in boards.values():
+        if socs[board['soc']].has_key('disabled'):
+            board['disabled'] = True
+
+def restrict_configs():
+    for config in configs.values():
+        if boards[config['board']].has_key('disabled'):
+            config['disabled'] = True
+
 def dtb_filename(config):
     extra = configs[config]['dtbfn-extra']
     boardname = configs[config]['board']
@@ -176,6 +198,11 @@  def cmd_help():
 parser = argparse.ArgumentParser(description='Build U-Boot, BCT, and flash ' +
     'images for Tegra boards.')
 
+parser.add_argument('--socs', type=str,
+    help='Restrict the build to a (comma-separated) list of SoCs.')
+parser.add_argument('--boards', type=str,
+    help='Restrict the build to a (comma-separated) list of boards.')
+
 subparsers = parser.add_subparsers()
 
 parser_list_configs = subparsers.add_parser('build-uboots',
@@ -197,4 +224,10 @@  parser_list_configs.set_defaults(func = cmd_build)
 if __name__ == '__main__':
     args = parser.parse_args()
     load_configs(os.path.join(scripts_dir, 'configs'))
+    if args.socs:
+        user_restrict_socs(args.socs)
+    if args.boards:
+        user_restrict_boards(args.boards)
+    restrict_boards()
+    restrict_configs()
     args.func()