Skip to contentSkip to conversation

buildman: Correct various issues with missing blobs

PATCH Superseded Simon Glass 2 participants 15 messages Nov 7, 2022 – Nov 10, 2022 Kbuild

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover buildman: Correct various issues with missing blobs

This series attempts to tidy up the problem of missing blobs, making U-Boot default to failing the build, but providing ways to configure this so that buildman can still be used for build testing by people who don't have the blobs or don't care about them.

This is based on discussion in [1] as well as some experimentation.

It also moves the buildman docs to rST and tidies up some toolchain settings and documentation.

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Changes in v4:
- Add a patch to update the arc toolchain
- Add new patch to update the default settings file
- Leave the arc toolchain in there

Changes in v3:
- Add new patch to convert documentation to rST
- Add new patch to drop mention of MAKEALL
- Add new patch to drop mention of old architectures
- Add tests docs and a settings-file option

Changes in v2:
- Use a separate rule for running binman

Simon Glass (9):
Makefile: Correct the binman rule
doc: Correct the path to the Makefile documentation
binman: Use an exit code when blobs are missing
buildman: Convert documentation to rST
buildman: Drop mention of MAKEALL
buildman: Update the arc toolchain
buildman: Update the default settings file
buildman: Drop mention of old architectures
buildman: Detect binman reporting missing blobs

Tom Rini (2):
global: Do not default to faking missing binaries for buildman
buildman: Add --allow-missing flag to allow missing blobs

 .azure-pipelines.yml            |    2 +-
 .gitlab-ci.yml                  |    6 +-
 Makefile                        |   15 +-
 doc/build/buildman.rst          |    1 +
 doc/build/index.rst             |    1 +
 scripts/Kbuild.include          |    2 +-
 tools/binman/binman.rst         |   21 +
 tools/binman/cmdline.py         |    3 +
 tools/binman/control.py         |    7 +-
 tools/binman/ftest.py           |   20 +-
 tools/buildman/README           | 1349 -------------------------------
 tools/buildman/README.rst       |    1 +
 tools/buildman/bsettings.py     |   21 +-
 tools/buildman/builder.py       |    5 +-
 tools/buildman/builderthread.py |    8 +-
 tools/buildman/buildman.rst     | 1335 ++++++++++++++++++++++++++++++
 tools/buildman/cmdline.py       |    6 +
 tools/buildman/control.py       |   33 +-
 tools/buildman/func_test.py     |  100 ++-
 19 files changed, 1558 insertions(+), 1378 deletions(-)
 create mode 120000 doc/build/buildman.rst
 delete mode 100644 tools/buildman/README
 create mode 120000 tools/buildman/README.rst
 create mode 100644 tools/buildman/buildman.rst
Signature · 1 line
2.38.1.431.g37b22c650d-goog
#1 lore raw

PATCH v4 1/11 Makefile: Correct the binman rule

This currently uses if_changed on a phony target. Use a real file as the target and add FORCE at the end, as required. Drop the 'inputs' phony since it is not needed.

---

(no changes since v2)

Changes in v2:
- Use a separate rule for running binman

 Makefile | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
Makefile +4 -7
index d5c2c970092..3f900855c22 100644
@@ -1108,18 +1108,15 @@ define deprecated
 
 endef
 
-PHONY += inputs
-inputs: $(INPUTS-y)
-
-all: .binman_stamp inputs
+# Timestamp file to make sure that binman always runs
+.binman_stamp: $(INPUTS-y) FORCE
 ifeq ($(CONFIG_BINMAN),y)
 	$(call if_changed,binman)
 endif
-
-# Timestamp file to make sure that binman always runs
-.binman_stamp: FORCE
 	@touch $@
 
+all: .binman_stamp
+
 ifeq ($(CONFIG_DEPRECATED),y)
 	$(warning "You have deprecated configuration options enabled in your .config! Please check your configuration.")
 endif
Signature · 1 line
2.38.1.431.g37b22c650d-goog
#2 lore raw

PATCH v4 2/11 doc: Correct the path to the Makefile documentation

In reply to Simon Glass

This is out-of-date now. Fix it.

---

(no changes since v1)

 scripts/Kbuild.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Kbuild.include +1 -1
index 9c14310ad40..62e0207f91b 100644
@@ -229,7 +229,7 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
 # if_changed_dep  - as if_changed, but uses fixdep to reveal dependencies
 #                   including used config symbols
 # if_changed_rule - as if_changed but execute rule instead
-# See Documentation/kbuild/makefiles.txt for more info
+# See doc/develop/makefiles.rst for more info
 
 ifneq ($(KBUILD_NOCMDDEP),1)
 # Check if both arguments are the same including their order. Result is empty
Signature · 1 line
2.38.1.431.g37b22c650d-goog
#3 lore raw

PATCH v4 3/11 binman: Use an exit code when blobs are missing

In reply to Simon Glass

At present binman returns success when told to handle missing blobs. This is confusing this in fact the resulting image cannot work.

Use exit code 103 to signal this problem, with a -W option to convert it to a warning.

Add documentation about exit codes while we are here.

---

(no changes since v1)

 tools/binman/binman.rst | 21 +++++++++++++++++++++
 tools/binman/cmdline.py |  3 +++
 tools/binman/control.py |  7 ++++++-
 tools/binman/ftest.py   | 20 ++++++++++++++++++--
 4 files changed, 48 insertions(+), 3 deletions(-)
tools/binman/binman.rst +21 -0
index fda16f1992d..30ced31e43b 100644
@@ -1461,6 +1461,10 @@ space-separated list of directories to search for binary blobs::
        odroid-c4/build/board/hardkernel/odroidc4/firmware \
        odroid-c4/build/scp_task" binman ...
 
+Note that binman fails with exit code 103 when there are missing blobs. If you
+wish binman to continue anyway, you can pass `-W` to binman.
+
+
 Code coverage
 -------------
 
@@ -1472,6 +1476,23 @@ To enable Python test coverage on Debian-type distributions (e.g. Ubuntu)::
    $ sudo apt-get install python-coverage python3-coverage python-pytest
 
 
+Exit status
+-----------
+
+Binman produces the following exit codes:
+
+0
+    Success
+
+1
+    Any sort of failure - see output for more details
+
+103
+    There are missing external blobs or bintools. This is only returned if
+    -M is passed to binman, otherwise missing blobs return in an exit status of
+    1.
+
+
 Error messages
 --------------
 
tools/binman/cmdline.py +3 -0
index 1d1ca43993d..144c0c916a2 100644
@@ -128,6 +128,9 @@ controlled by a description in the board device tree.'''
         default=False, help='Update the binman node with offset/size info')
     build_parser.add_argument('--update-fdt-in-elf', type=str,
         help='Update an ELF file with the output dtb: infile,outfile,begin_sym,end_sym')
+    build_parser.add_argument(
+        '-W', '--ignore-missing-blobs', action='store_true', default=False,
+        help='Return success even if there are missing blobs')
 
     subparsers.add_parser(
         'bintool-docs', help='Write out bintool documentation (see bintool.rst)')
tools/binman/control.py +6 -1
index bfe63a15204..8b94db60113 100644
@@ -742,7 +742,12 @@ def Binman(args):
                 elf.UpdateFile(*elf_params, data)
 
             if invalid:
-                tout.warning("\nSome images are invalid")
+                msg = '\nSome images are invalid'
+                if args.ignore_missing_blobs:
+                    tout.warning(msg)
+                else:
+                    tout.error(msg)
+                    return 103
 
             # Use this to debug the time take to pack the image
             #state.TimingShow()
tools/binman/ftest.py +18 -2
index e849d96587c..fc38a2efccd 100644
@@ -340,7 +340,7 @@ class TestFunctional(unittest.TestCase):
                     use_expanded=False, verbosity=None, allow_missing=False,
                     allow_fake_blobs=False, extra_indirs=None, threads=None,
                     test_section_timeout=False, update_fdt_in_elf=None,
-                    force_missing_bintools=''):
+                    force_missing_bintools='', ignore_missing_blobs=False):
         """Run binman with a given test file
 
         Args:
@@ -403,6 +403,8 @@ class TestFunctional(unittest.TestCase):
                 args.append('-a%s=%s' % (arg, value))
         if allow_missing:
             args.append('-M')
+        if ignore_missing_blobs:
+            args.append('-W')
         if allow_fake_blobs:
             args.append('--fake-ext-blobs')
         if force_missing_bintools:
@@ -3725,9 +3727,23 @@ class TestFunctional(unittest.TestCase):
     def testExtblobMissingOk(self):
         """Test an image with an missing external blob that is allowed"""
         with test_util.capture_sys_output() as (stdout, stderr):
-            self._DoTestFile('158_blob_ext_missing.dts', allow_missing=True)
+            ret = self._DoTestFile('158_blob_ext_missing.dts',
+                                   allow_missing=True)
+        self.assertEqual(103, ret)
         err = stderr.getvalue()
         self.assertRegex(err, "Image 'main-section'.*missing.*: blob-ext")
+        self.assertIn('Some images are invalid', err)
+
+    def testExtblobMissingOkFlag(self):
+        """Test an image with an missing external blob allowed with -W"""
+        with test_util.capture_sys_output() as (stdout, stderr):
+            ret = self._DoTestFile('158_blob_ext_missing.dts',
+                                   allow_missing=True,
+                                   ignore_missing_blobs=True)
+        self.assertEqual(0, ret)
+        err = stderr.getvalue()
+        self.assertRegex(err, "Image 'main-section'.*missing.*: blob-ext")
+        self.assertIn('Some images are invalid', err)
 
     def testExtblobMissingOkSect(self):
         """Test an image with an missing external blob that is allowed"""
Signature · 1 line
2.38.1.431.g37b22c650d-goog
#4 lore raw

PATCH v4 4/11 buildman: Convert documentation to rST

In reply to Simon Glass

Convert the buildman documentation to rST format and include it in the 'build' section.

---

(no changes since v3)

Changes in v3:
- Add new patch to convert documentation to rST

 doc/build/buildman.rst      |    1 +
 doc/build/index.rst         |    1 +
 tools/buildman/README       | 1349 ---------------------------------
 tools/buildman/README.rst   |    1 +
 tools/buildman/buildman.rst | 1413 +++++++++++++++++++++++++++++++++++
 tools/buildman/control.py   |    4 +-
 tools/buildman/func_test.py |    4 +-
 7 files changed, 1420 insertions(+), 1353 deletions(-)
 create mode 120000 doc/build/buildman.rst
 delete mode 100644 tools/buildman/README
 create mode 120000 tools/buildman/README.rst
 create mode 100644 tools/buildman/buildman.rst
doc/build/buildman.rst new file +1 -0
new file mode 120000
index 00000000000..beeaa425720
@@ -0,0 +1 @@
+../../tools/buildman/buildman.rst
\ No newline at end of file
doc/build/index.rst +1 -0
index 69952f90d89..9a8105db21d 100644
@@ -11,3 +11,4 @@ Build U-Boot
    clang
    docker
    tools
+   buildman
tools/buildman/README deleted +0 -1349

1,349 lines not on this page · raw message

tools/buildman/README.rst new file +1 -0
new file mode 120000
index 00000000000..c359387b2b5
@@ -0,0 +1 @@
+buildman.rst
\ No newline at end of file
tools/buildman/buildman.rst new file +1413 -0

1,413 lines not on this page · raw message

tools/buildman/control.py +2 -2
index 0c75466fbd3..377b580b253 100644
@@ -136,8 +136,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
 
     if options.full_help:
         tools.print_full_help(
-            os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), 'README')
-        )
+            os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
+                         'README.rst'))
         return 0
 
     gitutil.setup()
tools/buildman/func_test.py +2 -2
index f12e9966349..b4f3b46fcb1 100644
@@ -249,7 +249,7 @@ class TestFunctional(unittest.TestCase):
     def testFullHelp(self):
         command.test_result = None
         result = self._RunBuildman('-H')
-        help_file = os.path.join(self._buildman_dir, 'README')
+        help_file = os.path.join(self._buildman_dir, 'README.rst')
         # Remove possible extraneous strings
         extra = '::::::::::::::\n' + help_file + '\n::::::::::::::\n'
         gothelp = result.stdout.replace(extra, '')
@@ -260,7 +260,7 @@ class TestFunctional(unittest.TestCase):
     def testHelp(self):
         command.test_result = None
         result = self._RunBuildman('-h')
-        help_file = os.path.join(self._buildman_dir, 'README')
+        help_file = os.path.join(self._buildman_dir, 'README.rst')
         self.assertTrue(len(result.stdout) > 1000)
         self.assertEqual(0, len(result.stderr))
         self.assertEqual(0, result.return_code)
Signature · 1 line
2.38.1.431.g37b22c650d-goog
#5 lore raw

Re: [PATCH v4 04/11] buildman: Convert documentation to rST

Hi Simon,

Quoted 6 lines · Simon Glass

Convert the buildman documentation to rST format and include it in the 'build' section.

---

[...]

Quoted 7 lines
tools/buildman/buildman.rst new file +7 -0
+Other options
+-------------
+
+Buildman has various other command-line options. Try --help to see them.
+
+To find out what toolchain prefix buildman will use for a build, use the -A
+option.

tools/buildman/buildman.rst line 1224

Quoted 10 lines
tools/buildman/buildman.rst new file +10 -0
+
+To request that compiler warnings be promoted to errors, use -E. This passes the
+-Werror flag to the compiler. Note that the build can still produce warnings
+with -E, e.g. the migration warnings::
+
+   --------------------- WARNING ----------------------
+   This board does not use CONFIG_DM_MMC. Please update
+   ...
+   ----------------------------------------------------
+

s/-/=/

Cheers,
Quentin

#6 lore raw

PATCH v4 5/11 buildman: Drop mention of MAKEALL

In reply to Simon Glass

This script was removed about 6 years ago so most people should be aware that it is not needed anymore. Drop mention of it.

---

(no changes since v3)

Changes in v3:
- Add new patch to drop mention of MAKEALL

 tools/buildman/buildman.rst | 110 ------------------------------------
 1 file changed, 110 deletions(-)
tools/buildman/buildman.rst +0 -110
index 69a83ec3087..1ec4acbe474 100644
@@ -3,8 +3,6 @@
 Buildman build tool
 ===================
 
-(Please read 'How to change from MAKEALL' if you are used to that tool)
-
 Quick-start
 -----------
 
@@ -1257,114 +1255,6 @@ latter number depends on the speed of your machine and the efficiency of the
 U-Boot build.
 
 
-How to change from MAKEALL
---------------------------
-
-Buildman includes most of the features of MAKEALL and is generally faster
-and easier to use. In particular it builds entire branches: if a particular
-commit introduces an error in a particular board, buildman can easily show
-you this, even if a later commit fixes that error.
-
-The reasons to deprecate MAKEALL are:
-- We don't want to maintain two build systems
-- Buildman is typically faster
-- Buildman has a lot more features
-
-But still, many people will be sad to lose MAKEALL. If you are used to
-MAKEALL, here are a few pointers.
-
-First you need to set up your tool chains - see the 'Setting up' section
-for details. Once you have your required toolchain(s) detected then you are
-ready to go.
-
-To build the current source tree, run buildman without a -b flag:
-
-.. code-block:: bash
-
-   ./tools/buildman/buildman <list of things to build>
-
-This will build the current source tree for the given boards and display
-the results and errors.
-
-However buildman usually works on entire branches, and for that you must
-specify a board flag:
-
-.. code-block:: bash
-
-   ./tools/buildman/buildman -b <branch_name> <list of things to build>
-
-followed by (afterwards, or perhaps concurrently in another terminal):
-
-.. code-block:: bash
-
-   ./tools/buildman/buildman -b <branch_name> -s <list of things to build>
-
-to see the results of the build. Rather than showing you all the output,
-buildman just shows a summary, with red indicating that a commit introduced
-an error and green indicating that a commit fixed an error. Use the -e
-flag to see the full errors and -l to see which boards caused which errors.
-
-If you really want to see build results as they happen, use -v when doing a
-build (and -e to see the errors/warnings too).
-
-You don't need to stick around on that branch while buildman is running. It
-checks out its own copy of the source code, so you can change branches,
-add commits, etc. without affecting the build in progress.
-
-The <list of things to build> can include board names, architectures or the
-like. There are no flags to disambiguate since ambiguities are rare. Using
-the examples from MAKEALL:
-
-Examples::
-
-  - build all Power Architecture boards:
-      MAKEALL -a powerpc
-      MAKEALL --arch powerpc
-      MAKEALL powerpc
-          ** buildman -b <branch> powerpc
-  - build all PowerPC boards manufactured by vendor "esd":
-      MAKEALL -a powerpc -v esd
-          ** buildman -b <branch> esd
-  - build all PowerPC boards manufactured either by "keymile" or "siemens":
-      MAKEALL -a powerpc -v keymile -v siemens
-          ** buildman -b <branch> keymile siemens
-  - build all Freescale boards with MPC83xx CPUs, plus all 4xx boards:
-      MAKEALL -c mpc83xx -v freescale 4xx
-          ** buildman -b <branch> mpc83xx freescale 4xx
-
-Buildman automatically tries to use all the CPUs in your machine. If you
-are building a lot of boards it will use one thread for every CPU core
-it detects in your machine. This is like MAKEALL's BUILD_NBUILDS option.
-You can use the -T flag to change the number of threads. If you are only
-building a few boards, buildman will automatically run make with the -j
-flag to increase the number of concurrent make tasks. It isn't normally
-that helpful to fiddle with this option, but if you use the BUILD_NCPUS
-option in MAKEALL then -j is the equivalent in buildman.
-
-Buildman puts its output in ../<branch_name> by default but you can change
-this with the -o option. Buildman normally does out-of-tree builds: use -i
-to disable that if you really want to. But be careful that once you have
-used -i you pollute buildman's copies of the source tree, and you will need
-to remove the build directory (normally ../<branch_name>) to run buildman
-in normal mode (without -i).
-
-Buildman doesn't keep the output result normally, but use the -k option to
-do this.
-
-Please read 'Theory of Operation' a few times as it will make a lot of
-things clearer.
-
-Some options you might like are::
-
-   -B shows which functions are growing/shrinking in which commit - great
-        for finding code bloat.
-   -S shows image sizes for each commit (just an overall summary)
-   -u shows boards that you haven't built yet
-   --step 0 will build just the upstream commit and the last commit of your
-        branch. This is often a quick sanity check that your branch doesn't
-        break anything. But note this does not check bisectability!
-
-
 Using boards.cfg
 ----------------
 
Signature · 1 line
2.38.1.431.g37b22c650d-goog
#7 lore raw

PATCH v4 6/11 buildman: Update the arc toolchain

In reply to Simon Glass

There is one on kernel.org but it does not build the hsdk_4xd board. Add a link to one which does.

---

Changes in v4:
- Add a patch to update the arc toolchain

 tools/buildman/buildman.rst | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/buildman/buildman.rst +4 -1
index 1ec4acbe474..06602c14d01 100644
@@ -202,6 +202,9 @@ Setting up
    arm: /opt/linaro/gcc-linaro-arm-linux-gnueabihf-4.8-2013.08_linux
    aarch64: /opt/linaro/gcc-linaro-aarch64-none-elf-4.8-2013.10_linux
 
+   [toolchain-prefix]
+   arc = /opt/arc/arc_gnu_2021.03_prebuilt_elf32_le_linux_install/bin/arc-elf32-
+
    [toolchain-alias]
    x86: i386
    blackfin: bfin
@@ -1287,7 +1290,7 @@ Thanks to Grant Grundler <[email protected]> for his ideas for improving
 the build speed by building all commits for a board instead of the other
 way around.
 
-.. _`Arc Toolchain`: https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2016.09-release/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install.tar.gz
+.. _`Arc Toolchain`: https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2021.03-release/arc_gnu_2021.03_prebuilt_elf32_le_linux_install.tar.gz
 .. _`Blackfin Toolchain`: http://sourceforge.net/projects/adi-toolchain/files/blackfin-toolchain-elf-gcc-4.5-2014R1_45-RC2.x86_64.tar.bz2
 .. _`Nios2 Toolchain`: http://sourcery.mentor.com/public/gnu_toolchain/nios2-linux-gnu/sourceryg++-2015.11-27-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2
 .. _`SH Toolchain`: http://sourcery.mentor.com/public/gnu_toolchain/sh-linux-gnu/renesas-4.4-200-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2
Signature · 1 line
2.38.1.431.g37b22c650d-goog
#8 lore raw

PATCH v4 7/11 buildman: Update the default settings file

In reply to Simon Glass

The settings file omits a few lines which are useful for getting every board building. Add these and update the documentation tool.

---

Changes in v4:
- Add new patch to update the default settings file

 tools/buildman/bsettings.py | 3 +++
 tools/buildman/buildman.rst | 2 ++
 2 files changed, 5 insertions(+)
tools/buildman/bsettings.py +3 -0
index 35bb2c1d03a..f53564e0f8a 100644
@@ -79,10 +79,13 @@ other = /
 [toolchain-prefix]
 # name = path to prefix
 # e.g. x86 = /opt/gcc-4.6.3-nolibc/x86_64-linux/bin/x86_64-linux-
+# arc = /opt/arc/arc_gnu_2021.03_prebuilt_elf32_le_linux_install/bin/arc-elf32-
 
 [toolchain-alias]
 # arch = alias
 # Indicates which toolchain should be used to build for that arch
+riscv = riscv32
+sh = sh4
 x86 = i386
 blackfin = bfin
 openrisc = or1k
tools/buildman/buildman.rst +2 -0
index 06602c14d01..fbff98b89d9 100644
@@ -206,6 +206,8 @@ Setting up
    arc = /opt/arc/arc_gnu_2021.03_prebuilt_elf32_le_linux_install/bin/arc-elf32-
 
    [toolchain-alias]
+   riscv = riscv32
+   sh = sh4
    x86: i386
    blackfin: bfin
    openrisc: or1k
Signature · 1 line
2.38.1.431.g37b22c650d-goog
#9 lore raw

PATCH v4 8/11 buildman: Drop mention of old architectures

In reply to Simon Glass

Support for some architectures has been removed since buildman was first written. Also all toolchains are now available at kernel.org so we don't need the links, except for arc where the kernel.org toolchain fails to build all boards.

---

Changes in v4:
- Leave the arc toolchain in there

Changes in v3:
- Add new patch to drop mention of old architectures

 tools/buildman/bsettings.py |  2 --
 tools/buildman/buildman.rst | 18 +-----------------
 2 files changed, 1 insertion(+), 19 deletions(-)
tools/buildman/bsettings.py +0 -2
index f53564e0f8a..dcc200ea79d 100644
@@ -87,8 +87,6 @@ other = /
 riscv = riscv32
 sh = sh4
 x86 = i386
-blackfin = bfin
-openrisc = or1k
 
 [make-flags]
 # Special flags to pass to 'make' for certain boards, e.g. to pass a test
tools/buildman/buildman.rst +1 -17
index fbff98b89d9..33ad6d9e2c9 100644
@@ -209,8 +209,6 @@ Setting up
    riscv = riscv32
    sh = sh4
    x86: i386
-   blackfin: bfin
-   openrisc: or1k
 
 
    This selects the available toolchain paths. Add the base directory for
@@ -487,21 +485,12 @@ Setting up
    For those not available from kernel.org, download from the following links:
 
    - `Arc Toolchain`_
-   - `Blackfin Toolchain`_
-   - `Nios2 Toolchain`_
-   - `SH Toolchain`_
-
-   Note openrisc kernel.org toolchain is out of date. Download the latest one
-   from `OpenRISC Toolchains`_, e.g. `OpenRISC 4.8.1`_.
 
    Buildman should now be set up to use your new toolchain.
 
    At the time of writing, U-Boot has these architectures:
 
-      arc, arm, blackfin, m68k, microblaze, mips, nios2, openrisc
-      powerpc, sandbox, sh, sparc, x86
-
-   Of these, only arc is not available at kernel.org.
+      arc, arm, m68k, microblaze, mips, nios2, powerpc, sandbox, sh, x86, xtensa
 
 
 How to run it
@@ -1293,11 +1282,6 @@ the build speed by building all commits for a board instead of the other
 way around.
 
 .. _`Arc Toolchain`: https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2021.03-release/arc_gnu_2021.03_prebuilt_elf32_le_linux_install.tar.gz
-.. _`Blackfin Toolchain`: http://sourceforge.net/projects/adi-toolchain/files/blackfin-toolchain-elf-gcc-4.5-2014R1_45-RC2.x86_64.tar.bz2
-.. _`Nios2 Toolchain`: http://sourcery.mentor.com/public/gnu_toolchain/nios2-linux-gnu/sourceryg++-2015.11-27-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2
-.. _`SH Toolchain`: http://sourcery.mentor.com/public/gnu_toolchain/sh-linux-gnu/renesas-4.4-200-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2
-.. _`OpenRISC Toolchains`: http://opencores.org/or1k/OpenRISC_GNU_tool_chain#Prebuilt_versions
-.. _`OpenRISC 4.8.1`: ftp://ocuser:[email protected]/toolchain/gcc-or1k-elf-4.8.1-x86.tar.bz2
 
 .. sectionauthor:: Simon Glass
 .. sectionauthor:: Copyright (c) 2013 The Chromium OS Authors.
Signature · 1 line
2.38.1.431.g37b22c650d-goog
#10 lore raw

PATCH v4 9/11 buildman: Detect binman reporting missing blobs

In reply to Simon Glass

Buildman should consider a build as a success (with warnings) if missing blobs have been dealt with by binman, even though buildman itself returns and error code overall. This is how other warnings are dealt with.

We cannot easily access the 103 exit code, so detect the problem in the output.

With this change, missing blobs result in an exit code of 101, although they still indicate failure.

---

(no changes since v1)

 tools/buildman/builderthread.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/buildman/builderthread.py +5 -1
index 6240e08c767..065d836d68c 100644
@@ -288,10 +288,14 @@ class BuilderThread(threading.Thread):
                         args.append('cfg')
                     result = self.Make(commit, brd, 'build', cwd, *args,
                             env=env)
+                    if (result.return_code == 2 and
+                        ('Some images are invalid' in result.stderr)):
+                        # This is handled later by the check for output in
+                        # stderr
+                        result.return_code = 0
                     if adjust_cfg:
                         errs = cfgutil.check_cfg_file(cfg_file, adjust_cfg)
                         if errs:
-                            print('errs', errs)
                             result.stderr += errs
                             result.return_code = 1
                 result.stderr = result.stderr.replace(src_dir + '/', '')
Signature · 1 line
2.38.1.431.g37b22c650d-goog
#11 lore raw

PATCH v4 10/11 global: Do not default to faking missing binaries for buildman

In reply to Simon Glass

From: Tom Rini <[email protected]>

While it is possible and documented on how to re-run buildman to replace faked required binary files after the fact, this behavior ends up being more confusing than helpful in practice. Switch to requiring BINMAN_ALLOW_MISSING=1 to be passed on the 'make' line to enable this behavior.

Cc Rasmus Villemoes <[email protected]>
Cc Simon Glass <[email protected]>

---

(no changes since v1)

 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 3f900855c22..5bbb6dc3a71 100644
@@ -1333,8 +1333,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
 		$(foreach f,$(BINMAN_TOOLPATHS),--toolpath $(f)) \
                 --toolpath $(objtree)/tools \
 		$(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
-		build -u -d u-boot.dtb -O . -m --allow-missing \
-		--fake-ext-blobs \
+		build -u -d u-boot.dtb -O . -m \
+		$(if $(BINMAN_ALLOW_MISSING),--allow-missing --fake-ext-blobs) \
 		-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
 		-I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \
 		$(foreach f,$(BINMAN_INDIRS),-I $(f)) \
Signature · 1 line
2.38.1.431.g37b22c650d-goog
#12 lore raw

PATCH v4 11/11 buildman: Add --allow-missing flag to allow missing blobs

In reply to Simon Glass

From: Tom Rini <[email protected]>

Add a new flag to buildman so that we will in turn pass BINMAN_ALLOW_MISSING=1 to 'make'. Make use of this flag in CI.

Allow the settings file to control this.

Cc Rasmus Villemoes <[email protected]>
Cc Simon Glass <[email protected]>

---

(no changes since v3)

Changes in v3:
- Add tests docs and a settings-file option

 .azure-pipelines.yml            |  2 +-
 .gitlab-ci.yml                  |  6 +--
 tools/buildman/bsettings.py     | 16 ++++++
 tools/buildman/builder.py       |  5 +-
 tools/buildman/builderthread.py |  2 +
 tools/buildman/buildman.rst     | 43 +++++++++++++++
 tools/buildman/cmdline.py       |  6 +++
 tools/buildman/control.py       | 29 +++++++++-
 tools/buildman/func_test.py     | 96 +++++++++++++++++++++++++++++++--
 9 files changed, 196 insertions(+), 9 deletions(-)
.azure-pipelines.yml +1 -1
index bda762451fd..665b5d2026f 100644
@@ -553,7 +553,7 @@ stages:
           cat << "EOF" >> build.sh
           if [[ "${BUILDMAN}" != "" ]]; then
               ret=0;
-              tools/buildman/buildman -o /tmp -P -E -W ${BUILDMAN} ${OVERRIDE} || ret=$?;
+              tools/buildman/buildman -o /tmp -PEWM ${BUILDMAN} ${OVERRIDE} || ret=$?;
               if [[ $ret -ne 0 ]]; then
                   tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
                   exit $ret;
.gitlab-ci.yml +3 -3
index 6f4c34fc4a3..3deaeca1cdd 100644
@@ -81,7 +81,7 @@ build all 32bit ARM platforms:
   stage: world build
   script:
     - ret=0;
-      ./tools/buildman/buildman -o /tmp -P -E -W arm -x aarch64 || ret=$?;
+      ./tools/buildman/buildman -o /tmp -PEWM arm -x aarch64 || ret=$?;
       if [[ $ret -ne 0 ]]; then
         ./tools/buildman/buildman -o /tmp -seP;
         exit $ret;
@@ -93,7 +93,7 @@ build all 64bit ARM platforms:
     - virtualenv -p /usr/bin/python3 /tmp/venv
     - . /tmp/venv/bin/activate
     - ret=0;
-      ./tools/buildman/buildman -o /tmp -P -E -W aarch64 || ret=$?;
+      ./tools/buildman/buildman -o /tmp -PEWM aarch64 || ret=$?;
       if [[ $ret -ne 0 ]]; then
         ./tools/buildman/buildman -o /tmp -seP;
         exit $ret;
@@ -113,7 +113,7 @@ build all other platforms:
   stage: world build
   script:
     - ret=0;
-      ./tools/buildman/buildman -o /tmp -P -E -W -x arm,powerpc || ret=$?;
+      ./tools/buildman/buildman -o /tmp -PEWM -x arm,powerpc || ret=$?;
       if [[ $ret -ne 0 ]]; then
         ./tools/buildman/buildman -o /tmp -seP;
         exit $ret;
tools/buildman/bsettings.py +16 -0
index dcc200ea79d..9df87f53e49 100644
@@ -5,6 +5,7 @@ import configparser
 import os
 import io
 
+config_fname = None
 
 def Setup(fname=''):
     """Set up the buildman settings module by reading config files
@@ -46,6 +47,21 @@ def GetItems(section):
     except:
         raise
 
+def GetGlobalItem(name):
+    """Get an items from the 'global' section of the config.
+
+    Args:
+        name: name of item to retrieve
+
+    Returns:
+        str: Value of item, or None if not present
+    """
+    items = GetItems('global')
+    for item in items:
+        if item[0] == name:
+            return item[1]
+    return None
+
 def SetItem(section, tag, value):
     """Set an item and write it back to the settings file"""
     global settings
tools/buildman/builder.py +4 -1
index 76252b90792..c2a69027f88 100644
@@ -252,7 +252,8 @@ class Builder:
                  mrproper=False, per_board_out_dir=False,
                  config_only=False, squash_config_y=False,
                  warnings_as_errors=False, work_in_output=False,
-                 test_thread_exceptions=False, adjust_cfg=None):
+                 test_thread_exceptions=False, adjust_cfg=None,
+                 allow_missing=False):
         """Create a new Builder object
 
         Args:
@@ -290,6 +291,7 @@ class Builder:
                     ~C to disable C
                     C=val to set the value of C (val must have quotes if C is
                         a string Kconfig
+            allow_missing: Run build with BINMAN_ALLOW_MISSING=1
 
         """
         self.toolchains = toolchains
@@ -327,6 +329,7 @@ class Builder:
         self.config_filenames = BASE_CONFIG_FILENAMES
         self.work_in_output = work_in_output
         self.adjust_cfg = adjust_cfg
+        self.allow_missing = allow_missing
         self._ide = False
 
         if not self.squash_config_y:
tools/buildman/builderthread.py +2 -0
index 065d836d68c..680efae02d7 100644
@@ -253,6 +253,8 @@ class BuilderThread(threading.Thread):
                     args.extend(['-j', str(self.builder.num_jobs)])
                 if self.builder.warnings_as_errors:
                     args.append('KCFLAGS=-Werror')
+                if self.builder.allow_missing:
+                    args.append('BINMAN_ALLOW_MISSING=1')
                 config_args = ['%s_defconfig' % brd.target]
                 config_out = ''
                 args.extend(self.builder.toolchains.GetMakeArguments(brd))
tools/buildman/buildman.rst +43 -0

55 lines not on this page · raw message

tools/buildman/cmdline.py +6 -0
index b29c1eb5ee7..c485994e9fe 100644
@@ -75,6 +75,12 @@ def ParseArgs():
           help='List available tool chains (use -v to see probing detail)')
     parser.add_option('-m', '--mrproper', action='store_true',
           default=False, help="Run 'make mrproper before reconfiguring")
+    parser.add_option(
+          '-M', '--allow-missing', action='store_true', default=False,
+          help='Tell binman to allow missing blobs and generate fake ones as needed'),
+    parser.add_option(
+          '--no-allow-missing', action='store_true', default=False,
+          help='Disable telling binman to allow missing blobs'),
     parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run',
           default=False, help="Do a dry run (describe actions, but do nothing)")
     parser.add_option('-N', '--no-subdirs', action='store_true', dest='no_subdirs',
tools/buildman/control.py +28 -1
index 377b580b253..b1a22cdfc14 100644
@@ -111,6 +111,23 @@ def ShowToolchainPrefix(brds, toolchains):
     print(tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE))
     return None
 
+def get_allow_missing(opt_allow, opt_no_allow, num_selected, has_branch):
+    allow_missing = False
+    am_setting = bsettings.GetGlobalItem('allow-missing')
+    if am_setting:
+        if am_setting == 'always':
+            allow_missing = True
+        if 'multiple' in am_setting and num_selected > 1:
+            allow_missing = True
+        if 'branch' in am_setting and has_branch:
+            allow_missing = True
+
+    if opt_allow:
+        allow_missing = True
+    if opt_no_allow:
+        allow_missing = False
+    return allow_missing
+
 def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
                clean_dir=False, test_thread_exceptions=False):
     """The main control code for buildman
@@ -305,6 +322,15 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
     if not gnu_make:
         sys.exit('GNU Make not found')
 
+    allow_missing = get_allow_missing(options.allow_missing,
+                                      options.no_allow_missing, len(selected),
+                                      options.branch)
+
+    if options.allow_missing:
+        allow_missing = True
+    if options.no_allow_missing:
+        allow_missing = False
+
     # Create a new builder with the selected options.
     output_dir = options.output_dir
     if options.branch:
@@ -329,7 +355,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
             warnings_as_errors=options.warnings_as_errors,
             work_in_output=options.work_in_output,
             test_thread_exceptions=test_thread_exceptions,
-            adjust_cfg=adjust_cfg)
+            adjust_cfg=adjust_cfg,
+            allow_missing=allow_missing)
     builder.force_config_on_failure = not options.quick
     if make_func:
         builder.do_make = make_func
tools/buildman/func_test.py +93 -3

125 lines not on this page · raw message

Signature · 1 line
2.38.1.431.g37b22c650d-goog
#13 lore raw

Re: [PATCH v4 11/11] buildman: Add --allow-missing flag to allow missing blobs

Hi Simon,

Quoted 7 lines · Simon Glass

From: Tom Rini <[email protected]>

Add a new flag to buildman so that we will in turn pass BINMAN_ALLOW_MISSING=1 to 'make'. Make use of this flag in CI.

Allow the settings file to control this.

Quoted 8 lines
Cc Rasmus Villemoes <[email protected]>
Cc Simon Glass <[email protected]>

---

(no changes since v3)

There were actually substantial changes between v3 and v4.

Quoted 63 lines

Changes in v3:
- Add tests docs and a settings-file option

  .azure-pipelines.yml            |  2 +-
  .gitlab-ci.yml                  |  6 +--
  tools/buildman/bsettings.py     | 16 ++++++
  tools/buildman/builder.py       |  5 +-
  tools/buildman/builderthread.py |  2 +
  tools/buildman/buildman.rst     | 43 +++++++++++++++
  tools/buildman/cmdline.py       |  6 +++
  tools/buildman/control.py       | 29 +++++++++-
  tools/buildman/func_test.py     | 96 +++++++++++++++++++++++++++++++--
  9 files changed, 196 insertions(+), 9 deletions(-)
.azure-pipelines.yml +1 -1
index bda762451fd..665b5d2026f 100644
@@ -553,7 +553,7 @@ stages:
            cat << "EOF" >> build.sh
            if [[ "${BUILDMAN}" != "" ]]; then
                ret=0;
-              tools/buildman/buildman -o /tmp -P -E -W ${BUILDMAN} ${OVERRIDE} || ret=$?;
+              tools/buildman/buildman -o /tmp -PEWM ${BUILDMAN} ${OVERRIDE} || ret=$?;
                if [[ $ret -ne 0 ]]; then
                    tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
                    exit $ret;
.gitlab-ci.yml +3 -3
index 6f4c34fc4a3..3deaeca1cdd 100644
@@ -81,7 +81,7 @@ build all 32bit ARM platforms:
    stage: world build
    script:
      - ret=0;
-      ./tools/buildman/buildman -o /tmp -P -E -W arm -x aarch64 || ret=$?;
+      ./tools/buildman/buildman -o /tmp -PEWM arm -x aarch64 || ret=$?;
        if [[ $ret -ne 0 ]]; then
          ./tools/buildman/buildman -o /tmp -seP;
          exit $ret;
@@ -93,7 +93,7 @@ build all 64bit ARM platforms:
      - virtualenv -p /usr/bin/python3 /tmp/venv
      - . /tmp/venv/bin/activate
      - ret=0;
-      ./tools/buildman/buildman -o /tmp -P -E -W aarch64 || ret=$?;
+      ./tools/buildman/buildman -o /tmp -PEWM aarch64 || ret=$?;
        if [[ $ret -ne 0 ]]; then
          ./tools/buildman/buildman -o /tmp -seP;
          exit $ret;
@@ -113,7 +113,7 @@ build all other platforms:
    stage: world build
    script:
      - ret=0;
-      ./tools/buildman/buildman -o /tmp -P -E -W -x arm,powerpc || ret=$?;
+      ./tools/buildman/buildman -o /tmp -PEWM -x arm,powerpc || ret=$?;
        if [[ $ret -ne 0 ]]; then
          ./tools/buildman/buildman -o /tmp -seP;
          exit $ret;
tools/buildman/bsettings.py +0 -0
index dcc200ea79d..9df87f53e49 100644

tools/buildman/bsettings.py import configparser · line 9

Quoted 5 lines
tools/buildman/bsettings.py +1 -0
@@ -5,6 +5,7 @@ import configparser
  import os
  import io
 
+config_fname = None
 

This seems unrelated?

tools/buildman/bsettings.py def GetItems(section): · line 50

Quoted 7 lines
tools/buildman/bsettings.py +1 -0
  def Setup(fname=''):
      """Set up the buildman settings module by reading config files
@@ -46,6 +47,21 @@ def GetItems(section):
      except:
          raise
 
+def GetGlobalItem(name):

I would rename this to GetGlobalItemValue or something more explicit, it's not clear that you're returning the value of a key from its name.

tools/buildman/bsettings.py def GetItems(section): · line 52

Quoted 2 lines
tools/buildman/bsettings.py +2 -0
+    """Get an items from the 'global' section of the config.
+

s/items/item/

tools/buildman/bsettings.py def GetItems(section): · line 62

Quoted 10 lines
tools/buildman/bsettings.py +10 -0
+    Args:
+        name: name of item to retrieve
+
+    Returns:
+        str: Value of item, or None if not present
+    """
+    items = GetItems('global')
+    for item in items:
+        if item[0] == name:
+            return item[1]

I had to run an example myself to see why this was done this way. configparser returns tuples with (key, value).

You could simply do:
return settings.get('global', name, fallback=None)

Quoted 53 lines
tools/buildman/bsettings.py +2 -0
+    return None
+
  def SetItem(section, tag, value):
      """Set an item and write it back to the settings file"""
      global settings
tools/buildman/builder.py +4 -1
index 76252b90792..c2a69027f88 100644
@@ -252,7 +252,8 @@ class Builder:
                   mrproper=False, per_board_out_dir=False,
                   config_only=False, squash_config_y=False,
                   warnings_as_errors=False, work_in_output=False,
-                 test_thread_exceptions=False, adjust_cfg=None):
+                 test_thread_exceptions=False, adjust_cfg=None,
+                 allow_missing=False):
          """Create a new Builder object
 
          Args:
@@ -290,6 +291,7 @@ class Builder:
                      ~C to disable C
                      C=val to set the value of C (val must have quotes if C is
                          a string Kconfig
+            allow_missing: Run build with BINMAN_ALLOW_MISSING=1
 
          """
          self.toolchains = toolchains
@@ -327,6 +329,7 @@ class Builder:
          self.config_filenames = BASE_CONFIG_FILENAMES
          self.work_in_output = work_in_output
          self.adjust_cfg = adjust_cfg
+        self.allow_missing = allow_missing
          self._ide = False
 
          if not self.squash_config_y:
tools/buildman/builderthread.py +2 -0
index 065d836d68c..680efae02d7 100644
@@ -253,6 +253,8 @@ class BuilderThread(threading.Thread):
                      args.extend(['-j', str(self.builder.num_jobs)])
                  if self.builder.warnings_as_errors:
                      args.append('KCFLAGS=-Werror')
+                if self.builder.allow_missing:
+                    args.append('BINMAN_ALLOW_MISSING=1')
                  config_args = ['%s_defconfig' % brd.target]
                  config_out = ''
                  args.extend(self.builder.toolchains.GetMakeArguments(brd))
tools/buildman/buildman.rst +0 -0
index 33ad6d9e2c9..dd1a2be27b1 100644

tools/buildman/buildman.rst also allows build flags to be passed to 'make'. It consists of several · line 916

Quoted 4 lines
tools/buildman/buildman.rst +1 -0
@@ -913,6 +913,25 @@ also allows build flags to be passed to 'make'. It consists of several
  sections, with the section name in square brackets. Within each section are
  a set of (tag, value) pairs.
 
+global section

'[global]' section
to match how the other sections are shown? I don't think it is specific?

tools/buildman/buildman.rst also allows build flags to be passed to 'make'. It consists of several · line 919

Quoted 3 lines
tools/buildman/buildman.rst +3 -0
+    allow-missing
+        Indicates the policy to use for missing blobs. Note that the flags
+        --allow-missing (-M) and --no-allow-missing (--no-a) override these

Double-tick quote the arguments to highlight them (I also remember (maybe incorrectly) that two dashes are modified into something else than just two dashes when not highlighted?).

Quoted 97 lines
tools/buildman/buildman.rst +39 -0
+        setting.
+
+        always
+           Run with -M by default.
+
+        multiple
+           Run with -M if more than one board is being built.
+
+        branch
+           Run with -M if a branch is being built.
+
+        Note that the last two can be given together::
+
+           allow-missing = multiple branch
+
  '[toolchain]' section
      This lists the available toolchains. The tag here doesn't matter, but
      make sure it is unique. The value is the path to the toolchain. Buildman
@@ -1140,6 +1159,30 @@ not cause the build to fail:
     buildman -o /tmp/build --board sandbox -wWI
 
 
+Support for binary blobs
+------------------------
+
+U-Boot is moving to using Binman (see :doc:`../develop/package/binman`) for
+dealing with the complexities of packaging U-Boot along with binary files from
+other projects. These are called 'external blobs' by Binman.
+
+Typically a missing external blob causes a build failure. For build testing of
+a lot of boards, or boards for which you do not have the blobs, you can use the
+-M flag to allow missing blobs. This marks the build as if it succeeded,
+although with warnings shown, including 'Some images are invalid'. If any boards
+fail in this way, buildman exits with status 101.
+
+To convert warnings to errors, use -E. To make buildman return success with
+these warnings, use -W.
+
+It is generally safe to default to enabling -M for all runs of buildman, so long
+as you check the exit code. To do this, add::
+
+   allow-missing = "always"
+
+to the top of the buildman_settings_ file.
+
+
  Changing the configuration
  --------------------------
 
tools/buildman/cmdline.py +6 -0
index b29c1eb5ee7..c485994e9fe 100644
@@ -75,6 +75,12 @@ def ParseArgs():
            help='List available tool chains (use -v to see probing detail)')
      parser.add_option('-m', '--mrproper', action='store_true',
            default=False, help="Run 'make mrproper before reconfiguring")
+    parser.add_option(
+          '-M', '--allow-missing', action='store_true', default=False,
+          help='Tell binman to allow missing blobs and generate fake ones as needed'),
+    parser.add_option(
+          '--no-allow-missing', action='store_true', default=False,
+          help='Disable telling binman to allow missing blobs'),
      parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run',
            default=False, help="Do a dry run (describe actions, but do nothing)")
      parser.add_option('-N', '--no-subdirs', action='store_true', dest='no_subdirs',
tools/buildman/control.py +17 -0
index 377b580b253..b1a22cdfc14 100644
@@ -111,6 +111,23 @@ def ShowToolchainPrefix(brds, toolchains):
      print(tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE))
      return None
 
+def get_allow_missing(opt_allow, opt_no_allow, num_selected, has_branch):
+    allow_missing = False
+    am_setting = bsettings.GetGlobalItem('allow-missing')
+    if am_setting:
+        if am_setting == 'always':
+            allow_missing = True
+        if 'multiple' in am_setting and num_selected > 1:
+            allow_missing = True
+        if 'branch' in am_setting and has_branch:
+            allow_missing = True
+
+    if opt_allow:
+        allow_missing = True
+    if opt_no_allow:
+        allow_missing = False
+    return allow_missing
+
  def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
                 clean_dir=False, test_thread_exceptions=False):
      """The main control code for buildman
@@ -305,6 +322,15 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
      if not gnu_make:
          sys.exit('GNU Make not found')

tools/buildman/control.py def DoBuildman(options, args, toolchains=None, make_func=None, brds=None, · line 333

Quoted 10 lines
tools/buildman/control.py +9 -0
 
+    allow_missing = get_allow_missing(options.allow_missing,
+                                      options.no_allow_missing, len(selected),
+                                      options.branch)
+
+    if options.allow_missing:
+        allow_missing = True
+    if options.no_allow_missing:
+        allow_missing = False
+

This is already done in get_allow_missing so no need to be rundundant I think?

Quoted 31 lines
tools/buildman/control.py +2 -1
      # Create a new builder with the selected options.
      output_dir = options.output_dir
      if options.branch:
@@ -329,7 +355,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
              warnings_as_errors=options.warnings_as_errors,
              work_in_output=options.work_in_output,
              test_thread_exceptions=test_thread_exceptions,
-            adjust_cfg=adjust_cfg)
+            adjust_cfg=adjust_cfg,
+            allow_missing=allow_missing)
      builder.force_config_on_failure = not options.quick
      if make_func:
          builder.do_make = make_func
tools/buildman/func_test.py +3 -0
index b4f3b46fcb1..32e305b8c59 100644
@@ -22,6 +22,7 @@ from patman import tools
 
  settings_data = '''
  # Buildman settings file
+[global]
 
  [toolchain]
 
@@ -205,13 +206,16 @@ class TestFunctional(unittest.TestCase):
 
          self._test_branch = TEST_BRANCH
 
+        # Set to True to report missing blobs
+        self._missing = False

tools/buildman/func_test.py class TestFunctional(unittest.TestCase): · line 219

Quoted 10 lines
tools/buildman/func_test.py +2 -1
+
          # Avoid sending any output and clear all terminal output
          terminal.set_print_test_mode()
          terminal.get_print_test_lines()
 
      def tearDown(self):
          shutil.rmtree(self._base_dir)
-        #shutil.rmtree(self._output_dir)
+        shutil.rmtree(self._output_dir)
 

Is this actually related?

Quoted 46 lines
tools/buildman/func_test.py +29 -2
      def setupToolchains(self):
          self._toolchains = toolchain.Toolchains()
@@ -424,10 +428,21 @@ class TestFunctional(unittest.TestCase):
                      out_dir = arg[2:]
              fname = os.path.join(cwd or '', out_dir, 'u-boot')
              tools.write_file(fname, b'U-Boot')
-            if type(commit) is not str:
+
+            # Handle missing blobs
+            if self._missing:
+                if 'BINMAN_ALLOW_MISSING=1' in args:
+                    stderr = '''+Image 'main-section' is missing external blobs and is non-functional: intel-descriptor intel-ifwi intel-fsp-m intel-fsp-s intel-vbt
+Image 'main-section' has faked external blobs and is non-functional: descriptor.bin fsp_m.bin fsp_s.bin vbt.bin
+
+Some images are invalid'''
+                else:
+                    stderr = "binman: Filename 'fsp.bin' not found in input path"
+            elif type(commit) is not str:
                  stderr = self._error.get((brd.target, commit.sequence))
+
              if stderr:
-                return command.CommandResult(return_code=1, stderr=stderr)
+                return command.CommandResult(return_code=2, stderr=stderr)
              return command.CommandResult(return_code=0)
 
          # Not handled, so abort
@@ -621,3 +636,78 @@ class TestFunctional(unittest.TestCase):
          self.assertIn(
              'Thread exception (use -T0 to run without threads): test exception',
              stdout.getvalue())
+
+    def testBlobs(self):
+        """Test handling of missing blobs"""
+        self._missing = True
+
+        board0_dir = os.path.join(self._output_dir, 'current', 'board0')
+        errfile = os.path.join(board0_dir, 'err')
+        logfile = os.path.join(board0_dir, 'log')
+
+        # We expect failure when there are missing blobs
+        result = self._RunControl('board0', '-o', self._output_dir)
+        self.assertEqual(100, result)
+        self.assertTrue(os.path.exists(os.path.join(board0_dir, 'done')))
+        self.assertTrue(os.path.exists(errfile))
+        self.assertIn(b"Filename 'fsp.bin' not found in input path",
+                      tools.read_file(errfile))

tools/buildman/func_test.py class TestFunctional(unittest.TestCase): · line 662

Quoted 10 lines
tools/buildman/func_test.py +8 -0
+
 
 
+        # Allow missing blobs - still failure but a different exit code
+        result = self._RunControl('board0', '-o', self._output_dir, '-M',
+                                  clean_dir=True)
+        self.assertEqual(101, result)
+        self.assertTrue(os.path.exists(errfile))
+        self.assertIn(b'Some images are invalid', tools.read_file(errfile))
+

I would have a separate test for this one.

tools/buildman/func_test.py class TestFunctional(unittest.TestCase): · line 667

Quoted 5 lines
tools/buildman/func_test.py +5 -0
+        # Allow missing blobs and ignore warnings
+        result = self._RunControl('board0', '-o', self._output_dir, '-MW')
+        self.assertEqual(0, result)
+        self.assertIn(b'Some images are invalid', tools.read_file(errfile))
+

Ditto.

Otherwise if there's a regression you don't know which one exactly easily.

tools/buildman/func_test.py class TestFunctional(unittest.TestCase): · line 676

Quoted 9 lines
tools/buildman/func_test.py +9 -0
+    def testBlobSettings(self):
+        # Test with no settings
+        self.assertEqual(False,
+                         control.get_allow_missing(False, False, 1, False))
+        self.assertEqual(True,
+                         control.get_allow_missing(True, False, 1, False))
+        self.assertEqual(False,
+                         control.get_allow_missing(True, True, 1, False))
+

Same here and the tests below.

Cheers,
Quentin

#14 lore raw

Re: [PATCH v4 11/11] buildman: Add --allow-missing flag to allow missing blobs

Hi Quentin & Heinrich,

Quoted 17 lines · Quentin Schulz

Hi Simon,

Quoted 13 lines · Simon Glass

From: Tom Rini <[email protected]>

Add a new flag to buildman so that we will in turn pass BINMAN_ALLOW_MISSING=1 to 'make'. Make use of this flag in CI.

Allow the settings file to control this.

Cc Rasmus Villemoes <[email protected]>
Cc Simon Glass <[email protected]>

---

Quoted 18 lines
Quoted 2 lines

(no changes since v3)

There were actually substantial changes between v3 and v4.

Quoted 13 lines

Changes in v3:
- Add tests docs and a settings-file option

  .azure-pipelines.yml            |  2 +-
  .gitlab-ci.yml                  |  6 +--
  tools/buildman/bsettings.py     | 16 ++++++
  tools/buildman/builder.py       |  5 +-
  tools/buildman/builderthread.py |  2 +
  tools/buildman/buildman.rst     | 43 +++++++++++++++
  tools/buildman/cmdline.py       |  6 +++
  tools/buildman/control.py       | 29 +++++++++-
  tools/buildman/func_test.py     | 96 +++++++++++++++++++++++++++++++--
  9 files changed, 196 insertions(+), 9 deletions(-)

Thanks for the reviews. I'll send v5 soon.

Regards,
Simon