Build U-Boot by default, so we can select the correct board and make the
process of trying different boards less error-prone.

Signed-off-by: Simon Glass <s...@chromium.org>
---

 scripts/build-efi.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/scripts/build-efi.py b/scripts/build-efi.py
index 495817bc064..3a1bf180ade 100755
--- a/scripts/build-efi.py
+++ b/scripts/build-efi.py
@@ -48,6 +48,8 @@ def parse_args():
         epilog='Script for running U-Boot as an EFI app/payload')
     parser.add_argument('-a', '--app', action='store_true',
                         help='Package up the app')
+    parser.add_argument('-B', '--no-build', action='store_true',
+                        help="Don't build (an existing build must be present")
     parser.add_argument('-k', '--kernel', action='store_true',
                         help='Add a kernel')
     parser.add_argument('-o', '--old', action='store_true',
@@ -229,6 +231,15 @@ class BuildEfi:
                 time.sleep(0.5)
                 command.output(*cmd)
 
+    def do_build(self, build):
+        """Build U-Boot for the selected board"""
+        res = command.run_one('buildman', '-w', '-o',
+                              f'{self.build_dir}/{build}', '--board', build,
+                              '-I', raise_on_error=False)
+        if res.return_code and res.return_code != 101:  # Allow warnings
+            raise ValueError(
+                f'buildman exited with {res.return_code}: {res.combined}')
+
     def start(self):
         """This does all the work"""
         args = self.args
@@ -237,6 +248,9 @@ class BuildEfi:
         self.tmp = f'{self.build_dir}/efi{bitness}{build_type}'
         build = f'efi-x86_{build_type}{bitness}'
 
+        if not args.no_build:
+            self.do_build(build)
+
         if args.old and bitness == 32:
             build = f'efi-x86_{build_type}'
 
-- 
2.43.0

Reply via email to