]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
buildman: Add a way to build a particular target
authorSimon Glass <sjg@chromium.org>
Tue, 17 Dec 2024 13:26:16 +0000 (06:26 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 27 May 2025 08:57:06 +0000 (09:57 +0100)
At present buildman only supports building the default target. Generally
this is what is wanted, but in some cases boards erroneously have a
different target for product extra files.

Add a --target option to help. Also add a comment indicating which
letters are free for new options.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/buildman/builder.py
tools/buildman/builderthread.py
tools/buildman/buildman.rst
tools/buildman/cmdline.py
tools/buildman/control.py
tools/buildman/func_test.py

index 4bea0a02b78395b4446d47f47c5548adf8533094..6538a3d296fe937a75ec9a95b731bae344af3d09 100644 (file)
@@ -265,7 +265,7 @@ class Builder:
                  reproducible_builds=False, force_build=False,
                  force_build_failures=False, force_reconfig=False,
                  in_tree=False, force_config_on_failure=False, make_func=None,
-                 dtc_skip=False):
+                 dtc_skip=False, build_target=None):
         """Create a new Builder object
 
         Args:
@@ -315,6 +315,7 @@ class Builder:
                 retrying a failed build
             make_func (function): Function to call to run 'make'
             dtc_skip (bool): True to skip building dtc and use the system one
+            build_target (str): Build target to use (None to use the default)
         """
         self.toolchains = toolchains
         self.base_dir = base_dir
@@ -363,6 +364,7 @@ class Builder:
                 raise ValueError('Cannot find dtc')
         else:
             self.dtc = None
+        self.build_target = build_target
 
         if not self.squash_config_y:
             self.config_filenames += EXTRA_CONFIG_FILENAMES
index b8578d5b97b99b437489f93722ad07c654c732f9..b4cb66397bb777562b4b5218a8534a7839c7e3cc 100644 (file)
@@ -285,6 +285,8 @@ class BuilderThread(threading.Thread):
         """
         if config_only:
             args.append('cfg')
+        elif self.builder.build_target:
+            args.append(self.builder.build_target)
         result = self.make(commit, brd, 'build', cwd, *args, env=env)
         cmd_list.append([self.builder.gnu_make] + args)
         if (result.return_code == 2 and
index 07ecc5c110ce261c10131c58322275636bd7c450..5fa7b277cb8cf24ba43ca3375d8f7703e2ee7002 100644 (file)
@@ -1329,6 +1329,10 @@ sometimes useful to have buildman wait until the others have finished. Use the
 --process-limit option for this: --process-limit 1 will allow only one buildman
 to process jobs at a time.
 
+To build a particular target, rather than the default U-Boot target, use the
+`--target` option. This is unlikely to be useful unless you are building a
+single board.
+
 Build summary
 -------------
 
index 7573e5bdfe87344bb423a1f461c59d1f5a4edaab..9236d6187cf668927a4a7cb3ff622ab7cfc8c277 100644 (file)
@@ -22,6 +22,7 @@ def add_upto_m(parser):
 
     This is split out to avoid having too many statements in one function
     """
+    # Available JqzZ
     parser.add_argument('-a', '--adjust-cfg', type=str, action='append',
           help='Adjust the Kconfig settings in .config before building')
     parser.add_argument('-A', '--print-prefix', action='store_true',
@@ -153,6 +154,8 @@ def add_after_m(parser):
     parser.add_argument('-T', '--threads', type=int,
           default=None,
           help='Number of builder threads to use (0=single-thread)')
+    parser.add_argument('--target', type=str,
+          default=None, help='Build target to use')
     parser.add_argument('-u', '--show_unknown', action='store_true',
           default=False, help='Show boards with unknown build result')
     parser.add_argument('-U', '--show-environment', action='store_true',
index 5109b1cd5ce64d89469a3828188014c5619a46b8..4c9489126c170d64c581c642fcb92c12172bbfa5 100644 (file)
@@ -785,6 +785,9 @@ def do_buildman(args, toolchains=None, make_func=None, brds=None,
                      args.verbose)
         return 0
 
+    if args.config_only and args.target:
+        raise ValueError('Cannot use --config-only with --target')
+
     # Create a new builder with the selected args
     builder = Builder(toolchains, output_dir, git_dir,
             args.threads, args.jobs, checkout=True,
@@ -810,7 +813,7 @@ def do_buildman(args, toolchains=None, make_func=None, brds=None,
             force_build_failures = args.force_build_failures,
             force_reconfig = args.force_reconfig, in_tree = args.in_tree,
             force_config_on_failure=not args.quick, make_func=make_func,
-            dtc_skip=args.dtc_skip)
+            dtc_skip=args.dtc_skip, build_target=args.target)
 
     TEST_BUILDER = builder
 
index b45eb95a1e6aafdf7da0e1f2e2ace36db794776d..d70849b47abde3f1d31205d1793db23af47e0f4d 100644 (file)
@@ -1152,3 +1152,13 @@ CONFIG_SOC="fred"
             'board': 'ARM Board 0',
             'config': 'config0',
             'target': 'board0'}, []), res)
+
+    def testTarget(self):
+        """Test that the --target flag works"""
+        lines = self.check_command('--target', 'u-boot.dtb')[0]
+
+        # It should not affect the defconfig line
+        self.assertNotIn(b'u-boot.dtb', lines[0])
+
+        # It should appear at the end of the build line
+        self.assertEqual(b'u-boot.dtb', lines[1].split()[-1])