all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#64149] WIP update u-boot to 2023.07-rc4
@ 2023-06-18  8:49 Vagrant Cascadian
  2023-07-03  1:26 ` [bug#64149] WIP update u-boot to 2023.07-rc5 Vagrant Cascadian
                   ` (2 more replies)
  0 siblings, 3 replies; 46+ messages in thread
From: Vagrant Cascadian @ 2023-06-18  8:49 UTC (permalink / raw)
  To: 64149; +Cc: ludo, efraim


[-- Attachment #1.1: Type: text/plain, Size: 1385 bytes --]

The attached patch updates u-boot to 2023.07-rc4... though mostly just
getting this patch out there for review purposes, but should probably
wait until 2023.07 is released in July. Alternately, could try to update
to 2023.04, although honestly that version had quite a few issues in
Debian and might be best skipped!

Builds most of the u-boot-* packages successfully, notable issues are
with u-boot-tools failing to build, and unable to cross-build
u-boot-puma-rk3399 and u-boot-rockpro64-rk3399 due to the dependency on
python-pyelftools not being cross-buildable ... though
u-boot-pinebook-pro-rk3399 uses python-pyelftools just fine, somehow?!

I have not boot-tested anything with this patch.

This patch depends on the patch updating python-pyelftools:

  https://issues.guix.gnu.org/64144

...or fixing the failing build of python-pyelftools some other way!

It also would be nice to pull in the updated arm-trusted-firmware:

  https://issues.guix.gnu.org/64142

...although this is not strictly necessary.

(e.g. python-pyelftools and arm-trusted-firmware are why this is patch 3
in a series, but strictly speaking, this *could* be applied
independently).

It also might be time to make some more noise on the forgotten
crust-firmware patch, as there is a workaround in this patch because
that is missing from guix:

  https://issues.guix.gnu.org/48371


live well,
  vagrant

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0003-gnu-u-boot-Update-to-2023.07-rc4.patch --]
[-- Type: text/x-diff, Size: 61586 bytes --]

From 041e3931296b2707ba7dada88b48890eacf45ba6 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Sat, 17 Jun 2023 23:06:18 -0700
Subject: [PATCH 3/3] gnu: u-boot: Update to 2023.07-rc4.

* gnu/packages/patches/u-boot-infodocs-target.patch: Remove file.
* gnu/packages/patches/u-boot-patman-guix-integration.patch: Remove file.
* gnu/local.mk: Remove patches.
* gnu/packages/patches/u-boot-allow-disabling-openssl.patch: Refresh.
* gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch: Refresh.
* gnu/packages/bootloaders.scm (u-boot): Update to 2023.07-rc4.
[native-inputs]: Add python-pyelftools.
[source]: Remove patches.
(u-boot-tools): Update substitution for python3-coverage.
(make-u-boot-sunxi64-package): Set SCP environment variable.
(u-boot-sifive-unleashed): Update to use opensbi.
---
 gnu/local.mk                                  |    2 -
 gnu/packages/bootloaders.scm                  |   28 +-
 .../u-boot-allow-disabling-openssl.patch      |   13 +-
 .../patches/u-boot-infodocs-target.patch      |   84 --
 .../u-boot-patman-guix-integration.patch      | 1244 -----------------
 ...boot-sifive-prevent-reloc-initrd-fdt.patch |    8 +-
 6 files changed, 31 insertions(+), 1348 deletions(-)
 delete mode 100644 gnu/packages/patches/u-boot-infodocs-target.patch
 delete mode 100644 gnu/packages/patches/u-boot-patman-guix-integration.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 2b3df5d75a..a430370094 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1995,8 +1995,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
-  %D%/packages/patches/u-boot-infodocs-target.patch		\
-  %D%/packages/patches/u-boot-patman-guix-integration.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index a9685a9ef9..28c4e2fb96 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -648,23 +648,21 @@ (define %u-boot-rk3399-enable-emmc-phy-patch
 (define u-boot
   (package
     (name "u-boot")
-    (version "2022.10")
+    (version "2023.07-rc4")
     (source (origin
               (patches
                (list %u-boot-rockchip-inno-usb-patch
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
                      %u-boot-rk3399-enable-emmc-phy-patch
-                     (search-patch "u-boot-fix-build-python-3.10.patch")
-                     (search-patch "u-boot-infodocs-target.patch")
-                     (search-patch "u-boot-patman-guix-integration.patch")))
+                     (search-patch "u-boot-fix-build-python-3.10.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
                     "u-boot-" version ".tar.bz2"))
               (sha256
                (base32
-                "1y5x8vxdgsqdqlsvq01mn8lmw53fqairkhvhhjx83hjva0m4id2h"))))
+                "0djrzqg6vmni8yi651yyp77w9h5sh07gq55r3a6mfh4gf5z7vamn"))))
     (build-system  gnu-build-system)
     (native-inputs
      (list bison
@@ -676,6 +674,7 @@ (define u-boot
            perl
            pkg-config                   ;for 'make menuconfig'
            python
+           python-pyelftools
            swig
            (list util-linux "lib")))
     (home-page "https://www.denx.de/wiki/U-Boot/")
@@ -739,7 +738,7 @@ (define-public u-boot-tools
                (("/bin/false") (which "false")))
              (substitute* "tools/dtoc/fdt_util.py"
                (("'cc'") "'gcc'"))
-             (substitute* "tools/patman/test_util.py"
+             (substitute* "tools/u_boot_pylib/test_util.py"
                ;; python3-coverage is simply called coverage in guix.
                (("python3-coverage") "coverage")
 
@@ -1009,6 +1008,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
           #~(modify-phases #$phases
               (add-after 'unpack 'set-environment
                 (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
+                  (setenv "SCP" "/dev/null")
                   (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
       (inputs
        (modify-inputs (package-inputs base)
@@ -1170,7 +1171,20 @@ (define-public u-boot-sandbox
                 (append sdl2))))))
 
 (define-public u-boot-sifive-unleashed
-  (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu"))
+  (let ((base (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu")))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'set-environment
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (setenv "OPENSBI" (search-input-file inputs
+                                                       "fw_dynamic.bin"))))))))
+      (inputs
+       (modify-inputs (package-inputs base)
+         (append opensbi-generic))))))
 
 (define-public u-boot-sifive-unmatched
   (let ((base (make-u-boot-package "sifive_unmatched" "riscv64-linux-gnu")))
diff --git a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
index 5f2856dbb4..5195a7a6f8 100644
--- a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
+++ b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
@@ -128,29 +128,28 @@ index 94b7685392..eec599b0ee 100644
  	datai = 0;
  	for (cfgi = 0; cfgi < cfgn; cfgi++) {
  		e = &image_cfg[cfgi];
-@@ -1552,9 +1568,11 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
+@@ -1624,10 +1640,12 @@ static void *image_create_v1(size_t *dataoff, struct image_tool_params *params,
  					      &datai, delay);
  	}
  
 +#if defined(CONFIG_KWB_SECURE)
- 	if (secure_hdr && add_secure_header_v1(params, ptr, payloadsz + headersz,
- 					       headersz, image, secure_hdr))
+ 	if (secure_hdr && add_secure_header_v1(params, ptr + *dataoff, payloadsz,
+ 					       image, headersz, secure_hdr))
  		return NULL;
 +#endif
  
- 	*imagesz = headersz;
+ 	/* Calculate and set the header checksum */
+ 	main_hdr->checksum = image_checksum8(main_hdr, headersz);
  
 --- a/tools/image-host.c
 +++ b/tools/image-host.c
-@@ -14,10 +14,12 @@
+@@ -14,8 +14,10 @@
  #include <image.h>
  #include <version.h>
  
 +#ifdef CONFIG_FIT_PRELOAD
  #include <openssl/pem.h>
  #include <openssl/evp.h>
- 
- #define IMAGE_PRE_LOAD_PATH                             "/image/pre-load/sig"
 +#endif
  
  /**
diff --git a/gnu/packages/patches/u-boot-infodocs-target.patch b/gnu/packages/patches/u-boot-infodocs-target.patch
deleted file mode 100644
index 5b21a99de3..0000000000
--- a/gnu/packages/patches/u-boot-infodocs-target.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-Upstream status: https://patchwork.ozlabs.org/project/uboot/list/?series=333259
-
-diff --git a/Makefile b/Makefile
-index de5746399a..597a8886c3 100644
---- a/Makefile
-+++ b/Makefile
-@@ -2372,7 +2372,7 @@ tcheck:
- # Documentation targets
- # ---------------------------------------------------------------------------
- DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
--	       linkcheckdocs dochelp refcheckdocs
-+	       linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
- PHONY += $(DOC_TARGETS)
- $(DOC_TARGETS): scripts_basic FORCE
- 	$(Q)$(MAKE) $(build)=doc $@
-diff --git a/doc/Makefile b/doc/Makefile
-index f5de65e927..d0904a9f99 100644
---- a/doc/Makefile
-+++ b/doc/Makefile
-@@ -69,6 +69,14 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
- htmldocs:
- 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
- 
-+texinfodocs:
-+	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,texinfo,$(var),texinfo,$(var)))
-+
-+# Note: the 'info' Make target is generated by sphinx itself when
-+# running the texinfodocs target defined above.
-+infodocs: texinfodocs
-+	$(MAKE) -C $(BUILDDIR)/texinfo info
-+
- linkcheckdocs:
- 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
- 
-@@ -109,6 +117,8 @@ cleandocs:
- dochelp:
- 	@echo  ' U-Boot documentation in different formats from ReST:'
- 	@echo  '  htmldocs        - HTML'
-+	@echo  '  texinfodocs     - Texinfo'
-+	@echo  '  infodocs        - Info'
- 	@echo  '  latexdocs       - LaTeX'
- 	@echo  '  pdfdocs         - PDF'
- 	@echo  '  epubdocs        - EPUB'
-diff --git a/doc/conf.py b/doc/conf.py
-index 62c8d31270..3db70f80c1 100644
---- a/doc/conf.py
-+++ b/doc/conf.py
-@@ -449,7 +449,7 @@ for fn in os.listdir('.'):
- # One entry per manual page. List of tuples
- # (source start file, name, description, authors, manual section).
- man_pages = [
--    (master_doc, 'dasuboot', 'The U-Boot Documentation',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-      [author], 1)
- ]
- 
-@@ -463,8 +463,8 @@ man_pages = [
- # (source start file, target name, title, author,
- #  dir menu entry, description, category)
- texinfo_documents = [
--    (master_doc, 'DasUBoot', 'The U-Boot Documentation',
--     author, 'DasUBoot', 'One line description of project.',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-+     author, 'U-Boot', 'Boot loader for embedded systems',
-      'Miscellaneous'),
- ]
- 
-diff --git a/doc/media/Makefile b/doc/media/Makefile
-index b9b43a34c3..9b32258696 100644
---- a/doc/media/Makefile
-+++ b/doc/media/Makefile
-@@ -22,10 +22,11 @@ $(BUILDDIR)/linker_lists.h.rst: ${API}/linker_lists.h ${PARSER} $(SRC_DIR)/linke
- 
- # Media build rules
- 
--.PHONY: all html epub xml latex
-+.PHONY: all html texinfo epub xml latex
- 
- all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
- html: all
-+texinfo: all
- epub: all
- xml: all
- latex: $(IMGPDF) all
diff --git a/gnu/packages/patches/u-boot-patman-guix-integration.patch b/gnu/packages/patches/u-boot-patman-guix-integration.patch
deleted file mode 100644
index 3472656c99..0000000000
--- a/gnu/packages/patches/u-boot-patman-guix-integration.patch
+++ /dev/null
@@ -1,1244 +0,0 @@
-These changes correspond to commits 9ff7500ace..3154de3dd6 already merged to
-the u-boot-dm custodian repo (at
-https://source.denx.de/u-boot/custodians/u-boot-dm/-/commits/next), scheduled
-to be pulled after the next release.
-
-diff --git a/tools/patman/__init__.py b/tools/patman/__init__.py
-index c9d3e35052..1b98ec7fee 100644
---- a/tools/patman/__init__.py
-+++ b/tools/patman/__init__.py
-@@ -1,6 +1,6 @@
- # SPDX-License-Identifier: GPL-2.0+
- 
- __all__ = ['checkpatch', 'command', 'commit', 'control', 'cros_subprocess',
--           'func_test', 'get_maintainer', 'gitutil', 'main', 'patchstream',
-+           'func_test', 'get_maintainer', 'gitutil', '__main__', 'patchstream',
-            'project', 'series', 'setup', 'settings', 'terminal',
-            'test_checkpatch', 'test_util', 'tools', 'tout']
-diff --git a/tools/patman/main.py b/tools/patman/__main__.py
-similarity index 89%
-rename from tools/patman/main.py
-rename to tools/patman/__main__.py
-index 8067a288ab..749e6348b6 100755
---- a/tools/patman/main.py
-+++ b/tools/patman/__main__.py
-@@ -7,6 +7,7 @@
- """See README for more information"""
- 
- from argparse import ArgumentParser
-+import importlib.resources
- import os
- import re
- import sys
-@@ -19,6 +20,7 @@ if __name__ == "__main__":
- 
- # Our modules
- from patman import control
-+from patman import func_test
- from patman import gitutil
- from patman import project
- from patman import settings
-@@ -53,7 +55,8 @@ parser.add_argument('-H', '--full-help', action='store_true', dest='full_help',
-                     default=False, help='Display the README file')
- 
- subparsers = parser.add_subparsers(dest='cmd')
--send = subparsers.add_parser('send')
-+send = subparsers.add_parser(
-+    'send', help='Format, check and email patches (default command)')
- send.add_argument('-i', '--ignore-errors', action='store_true',
-        dest='ignore_errors', default=False,
-        help='Send patches email even if patch errors are found')
-@@ -62,6 +65,12 @@ send.add_argument('-l', '--limit-cc', dest='limit', type=int, default=None,
- send.add_argument('-m', '--no-maintainers', action='store_false',
-        dest='add_maintainers', default=True,
-        help="Don't cc the file maintainers automatically")
-+send.add_argument(
-+    '--get-maintainer-script', dest='get_maintainer_script', type=str,
-+    action='store',
-+    default=os.path.join(gitutil.get_top_level(), 'scripts',
-+                         'get_maintainer.pl') + ' --norolestats',
-+    help='File name of the get_maintainer.pl (or compatible) script.')
- send.add_argument('-n', '--dry-run', action='store_true', dest='dry_run',
-        default=False, help="Do a dry run (create but don't email patches)")
- send.add_argument('-r', '--in-reply-to', type=str, action='store',
-@@ -94,9 +103,11 @@ send.add_argument('--smtp-server', type=str,
- 
- send.add_argument('patchfiles', nargs='*')
- 
--test_parser = subparsers.add_parser('test', help='Run tests')
--test_parser.add_argument('testname', type=str, default=None, nargs='?',
--                         help="Specify the test to run")
-+# Only add the 'test' action if the test data files are available.
-+if os.path.exists(func_test.TEST_DATA_DIR):
-+    test_parser = subparsers.add_parser('test', help='Run tests')
-+    test_parser.add_argument('testname', type=str, default=None, nargs='?',
-+                             help="Specify the test to run")
- 
- status = subparsers.add_parser('status',
-                                help='Check status of patches in patchwork')
-@@ -113,7 +124,7 @@ status.add_argument('-f', '--force', action='store_true',
- argv = sys.argv[1:]
- args, rest = parser.parse_known_args(argv)
- if hasattr(args, 'project'):
--    settings.Setup(gitutil, parser, args.project, '')
-+    settings.Setup(parser, args.project)
-     args, rest = parser.parse_known_args(argv)
- 
- # If we have a command, it is safe to parse all arguments
-@@ -160,11 +171,8 @@ elif args.cmd == 'send':
-         fd.close()
- 
-     elif args.full_help:
--        tools.print_full_help(
--            os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                         'README.rst')
--        )
--
-+        with importlib.resources.path('patman', 'README.rst') as readme:
-+            tools.print_full_help(str(readme))
-     else:
-         # If we are not processing tags, no need to warning about bad ones
-         if not args.process_tags:
-diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
-index d1b902dd96..012c0d895c 100644
---- a/tools/patman/checkpatch.py
-+++ b/tools/patman/checkpatch.py
-@@ -211,7 +211,7 @@ def check_patch(fname, verbose=False, show_types=False, use_tree=False):
-             stdout: Full output of checkpatch
-     """
-     chk = find_check_patch()
--    args = [chk]
-+    args = [chk, '--u-boot', '--strict']
-     if not use_tree:
-         args.append('--no-tree')
-     if show_types:
-diff --git a/tools/patman/control.py b/tools/patman/control.py
-index bf426cf7bc..38e98dab84 100644
---- a/tools/patman/control.py
-+++ b/tools/patman/control.py
-@@ -94,8 +94,8 @@ def check_patches(series, patch_files, run_checkpatch, verbose, use_tree):
- 
- 
- def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
--                  ignore_bad_tags, add_maintainers, limit, dry_run, in_reply_to,
--                  thread, smtp_server):
-+                  ignore_bad_tags, add_maintainers, get_maintainer_script, limit,
-+                  dry_run, in_reply_to, thread, smtp_server):
-     """Email patches to the recipients
- 
-     This emails out the patches and cover letter using 'git send-email'. Each
-@@ -123,6 +123,8 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         ignore_bad_tags (bool): True to just print a warning for unknown tags,
-             False to halt with an error
-         add_maintainers (bool): Run the get_maintainer.pl script for each patch
-+        get_maintainer_script (str): The script used to retrieve which
-+            maintainers to cc
-         limit (int): Limit on the number of people that can be cc'd on a single
-             patch or the cover letter (None if no limit)
-         dry_run (bool): Don't actually email the patches, just print out what
-@@ -134,7 +136,7 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         smtp_server (str): SMTP server to use to send patches (None for default)
-     """
-     cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags,
--                                add_maintainers, limit)
-+                                add_maintainers, limit, get_maintainer_script)
- 
-     # Email the patches out (giving the user time to check / cancel)
-     cmd = ''
-@@ -174,8 +176,8 @@ def send(args):
-     email_patches(
-         col, series, cover_fname, patch_files, args.process_tags,
-         its_a_go, args.ignore_bad_tags, args.add_maintainers,
--        args.limit, args.dry_run, args.in_reply_to, args.thread,
--        args.smtp_server)
-+        args.get_maintainer_script, args.limit, args.dry_run,
-+        args.in_reply_to, args.thread, args.smtp_server)
- 
- def patchwork_status(branch, count, start, end, dest_branch, force,
-                      show_comments, url):
-diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
-index 7b92bc67be..c25a47bdeb 100644
---- a/tools/patman/func_test.py
-+++ b/tools/patman/func_test.py
-@@ -6,7 +6,9 @@
- 
- """Functional tests for checking that patman behaves correctly"""
- 
-+import contextlib
- import os
-+import pathlib
- import re
- import shutil
- import sys
-@@ -28,6 +30,21 @@ from patman.test_util import capture_sys_output
- import pygit2
- from patman import status
- 
-+PATMAN_DIR = pathlib.Path(__file__).parent
-+TEST_DATA_DIR = PATMAN_DIR / 'test/'
-+
-+
-+@contextlib.contextmanager
-+def directory_excursion(directory):
-+    """Change directory to `directory` for a limited to the context block."""
-+    current = os.getcwd()
-+    try:
-+        os.chdir(directory)
-+        yield
-+    finally:
-+        os.chdir(current)
-+
-+
- class TestFunctional(unittest.TestCase):
-     """Functional tests for checking that patman behaves correctly"""
-     leb = (b'Lord Edmund Blackadd\xc3\xabr <weasel@blackadder.org>'.
-@@ -57,8 +74,7 @@ class TestFunctional(unittest.TestCase):
-         Returns:
-             str: Full path to file in the test directory
-         """
--        return os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                            'test', fname)
-+        return TEST_DATA_DIR / fname
- 
-     @classmethod
-     def _get_text(cls, fname):
-@@ -200,6 +216,8 @@ class TestFunctional(unittest.TestCase):
-         text = self._get_text('test01.txt')
-         series = patchstream.get_metadata_for_test(text)
-         cover_fname, args = self._create_patches_for_test(series)
-+        get_maintainer_script = str(pathlib.Path(__file__).parent.parent.parent
-+                                    / 'get_maintainer.pl') + ' --norolestats'
-         with capture_sys_output() as out:
-             patchstream.fix_patches(series, args)
-             if cover_fname and series.get('cover'):
-@@ -207,7 +225,7 @@ class TestFunctional(unittest.TestCase):
-             series.DoChecks()
-             cc_file = series.MakeCcFile(process_tags, cover_fname,
-                                         not ignore_bad_tags, add_maintainers,
--                                        None)
-+                                        None, get_maintainer_script)
-             cmd = gitutil.email_patches(
-                 series, cover_fname, args, dry_run, not ignore_bad_tags,
-                 cc_file, in_reply_to=in_reply_to, thread=None)
-@@ -502,6 +520,37 @@ complicated as possible''')
-         finally:
-             os.chdir(orig_dir)
- 
-+    def test_custom_get_maintainer_script(self):
-+        """Validate that a custom get_maintainer script gets used."""
-+        self.make_git_tree()
-+        with directory_excursion(self.gitdir):
-+            # Setup git.
-+            os.environ['GIT_CONFIG_GLOBAL'] = '/dev/null'
-+            os.environ['GIT_CONFIG_SYSTEM'] = '/dev/null'
-+            tools.run('git', 'config', 'user.name', 'Dummy')
-+            tools.run('git', 'config', 'user.email', 'dumdum@dummy.com')
-+            tools.run('git', 'branch', 'upstream')
-+            tools.run('git', 'branch', '--set-upstream-to=upstream')
-+            tools.run('git', 'add', '.')
-+            tools.run('git', 'commit', '-m', 'new commit')
-+
-+            # Setup patman configuration.
-+            with open('.patman', 'w', buffering=1) as f:
-+                f.write('[settings]\n'
-+                        'get_maintainer_script: dummy-script.sh\n'
-+                        'check_patch: False\n')
-+            with open('dummy-script.sh', 'w', buffering=1) as f:
-+                f.write('#!/usr/bin/env python\n'
-+                        'print("hello@there.com")\n')
-+            os.chmod('dummy-script.sh', 0x555)
-+
-+            # Finally, do the test
-+            with capture_sys_output():
-+                output = tools.run(PATMAN_DIR / 'patman', '--dry-run')
-+                # Assert the email address is part of the dry-run
-+                # output.
-+                self.assertIn('hello@there.com', output)
-+
-     def test_tags(self):
-         """Test collection of tags in a patchstream"""
-         text = '''This is a patch
-diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
-index e1d15ff6ab..f7011be1e4 100644
---- a/tools/patman/get_maintainer.py
-+++ b/tools/patman/get_maintainer.py
-@@ -1,48 +1,61 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2012 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- import os
-+import shlex
-+import shutil
- 
- from patman import command
-+from patman import gitutil
- 
--def find_get_maintainer(try_list):
--    """Look for the get_maintainer.pl script.
- 
--    Args:
--        try_list: List of directories to try for the get_maintainer.pl script
-+def find_get_maintainer(script_file_name):
-+    """Try to find where `script_file_name` is.
- 
--    Returns:
--        If the script is found we'll return a path to it; else None.
-+    It searches in PATH and falls back to a path relative to the top
-+    of the current git repository.
-     """
--    # Look in the list
--    for path in try_list:
--        fname = os.path.join(path, 'get_maintainer.pl')
--        if os.path.isfile(fname):
--            return fname
-+    get_maintainer = shutil.which(script_file_name)
-+    if get_maintainer:
-+        return get_maintainer
-+
-+    git_relative_script = os.path.join(gitutil.get_top_level(),
-+                                       script_file_name)
-+    if os.path.exists(git_relative_script):
-+        return git_relative_script
- 
--    return None
- 
--def get_maintainer(dir_list, fname, verbose=False):
--    """Run get_maintainer.pl on a file if we find it.
-+def get_maintainer(script_file_name, fname, verbose=False):
-+    """Run `script_file_name` on a file.
- 
--    We look for get_maintainer.pl in the 'scripts' directory at the top of
--    git.  If we find it we'll run it.  If we don't find get_maintainer.pl
--    then we fail silently.
-+    `script_file_name` should be a get_maintainer.pl-like script that
-+    takes a patch file name as an input and return the email addresses
-+    of the associated maintainers to standard output, one per line.
-+
-+    If `script_file_name` does not exist we fail silently.
- 
-     Args:
--        dir_list: List of directories to try for the get_maintainer.pl script
--        fname: Path to the patch file to run get_maintainer.pl on.
-+        script_file_name: The file name of the get_maintainer.pl script
-+            (or compatible).
-+        fname: File name of the patch to process with get_maintainer.pl.
- 
-     Returns:
-         A list of email addresses to CC to.
-     """
--    get_maintainer = find_get_maintainer(dir_list)
-+    # Expand `script_file_name` into a file name and its arguments, if
-+    # any.
-+    cmd_args = shlex.split(script_file_name)
-+    file_name = cmd_args[0]
-+    arguments = cmd_args[1:]
-+
-+    get_maintainer = find_get_maintainer(file_name)
-     if not get_maintainer:
-         if verbose:
-             print("WARNING: Couldn't find get_maintainer.pl")
-         return []
- 
--    stdout = command.output(get_maintainer, '--norolestats', fname)
-+    stdout = command.output(get_maintainer, *arguments, fname)
-     lines = stdout.splitlines()
--    return [ x.replace('"', '') for x in lines ]
-+    return [x.replace('"', '') for x in lines]
-diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
-index ceaf2ce150..5e742102c2 100644
---- a/tools/patman/gitutil.py
-+++ b/tools/patman/gitutil.py
-@@ -2,21 +2,19 @@
- # Copyright (c) 2011 The Chromium OS Authors.
- #
- 
--import re
- import os
--import subprocess
- import sys
- 
- from patman import command
- from patman import settings
- from patman import terminal
--from patman import tools
- 
- # True to use --no-decorate - we check this in setup()
- use_no_decorate = True
- 
-+
- def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
--           count=None):
-+            count=None):
-     """Create a command to perform a 'git log'
- 
-     Args:
-@@ -49,6 +47,7 @@ def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
-     cmd.append('--')
-     return cmd
- 
-+
- def count_commits_to_branch(branch):
-     """Returns number of commits between HEAD and the tracking branch.
- 
-@@ -68,13 +67,14 @@ def count_commits_to_branch(branch):
-         rev_range = '@{upstream}..'
-     pipe = [log_cmd(rev_range, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             oneline=True, raise_on_error=False)
-+                              oneline=True, raise_on_error=False)
-     if result.return_code:
-         raise ValueError('Failed to determine upstream: %s' %
-                          result.stderr.strip())
-     patch_count = len(result.stdout.splitlines())
-     return patch_count
- 
-+
- def name_revision(commit_hash):
-     """Gets the revision name for a commit
- 
-@@ -91,6 +91,7 @@ def name_revision(commit_hash):
-     name = stdout.split(' ')[1].strip()
-     return name
- 
-+
- def guess_upstream(git_dir, branch):
-     """Tries to guess the upstream for a branch
- 
-@@ -109,7 +110,7 @@ def guess_upstream(git_dir, branch):
-     """
-     pipe = [log_cmd(branch, git_dir=git_dir, oneline=True, count=100)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Branch '%s' not found" % branch
-     for line in result.stdout.splitlines()[1:]:
-@@ -121,6 +122,7 @@ def guess_upstream(git_dir, branch):
-             return name, "Guessing upstream as '%s'" % name
-     return None, "Cannot find a suitable upstream for branch '%s'" % branch
- 
-+
- def get_upstream(git_dir, branch):
-     """Returns the name of the upstream for a branch
- 
-@@ -135,10 +137,10 @@ def get_upstream(git_dir, branch):
-     """
-     try:
-         remote = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                       'branch.%s.remote' % branch)
-+                                         'branch.%s.remote' % branch)
-         merge = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                      'branch.%s.merge' % branch)
--    except:
-+                                        'branch.%s.merge' % branch)
-+    except Exception:
-         upstream, msg = guess_upstream(git_dir, branch)
-         return upstream, msg
- 
-@@ -149,7 +151,8 @@ def get_upstream(git_dir, branch):
-         return '%s/%s' % (remote, leaf), None
-     else:
-         raise ValueError("Cannot determine upstream branch for branch "
--                "'%s' remote='%s', merge='%s'" % (branch, remote, merge))
-+                         "'%s' remote='%s', merge='%s'"
-+                         % (branch, remote, merge))
- 
- 
- def get_range_in_branch(git_dir, branch, include_upstream=False):
-@@ -168,6 +171,7 @@ def get_range_in_branch(git_dir, branch, include_upstream=False):
-     rstr = '%s%s..%s' % (upstream, '~' if include_upstream else '', branch)
-     return rstr, msg
- 
-+
- def count_commits_in_range(git_dir, range_expr):
-     """Returns the number of commits in the given range.
- 
-@@ -180,12 +184,13 @@ def count_commits_in_range(git_dir, range_expr):
-     """
-     pipe = [log_cmd(range_expr, git_dir=git_dir, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Range '%s' not found or is invalid" % range_expr
-     patch_count = len(result.stdout.splitlines())
-     return patch_count, None
- 
-+
- def count_commits_in_branch(git_dir, branch, include_upstream=False):
-     """Returns the number of commits in the given branch.
- 
-@@ -201,6 +206,7 @@ def count_commits_in_branch(git_dir, branch, include_upstream=False):
-         return None, msg
-     return count_commits_in_range(git_dir, range_expr)
- 
-+
- def count_commits(commit_range):
-     """Returns the number of commits in the given range.
- 
-@@ -215,6 +221,7 @@ def count_commits(commit_range):
-     patch_count = int(stdout)
-     return patch_count
- 
-+
- def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-     """Checkout the selected commit for this build
- 
-@@ -231,10 +238,11 @@ def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-         pipe.append('-f')
-     pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, raise_on_error=False,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git checkout (%s): %s' % (pipe, result.stderr))
- 
-+
- def clone(git_dir, output_dir):
-     """Checkout the selected commit for this build
- 
-@@ -243,10 +251,11 @@ def clone(git_dir, output_dir):
-     """
-     pipe = ['git', 'clone', git_dir, '.']
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git clone: %s' % result.stderr)
- 
-+
- def fetch(git_dir=None, work_tree=None):
-     """Fetch from the origin repo
- 
-@@ -263,6 +272,7 @@ def fetch(git_dir=None, work_tree=None):
-     if result.return_code != 0:
-         raise OSError('git fetch: %s' % result.stderr)
- 
-+
- def check_worktree_is_available(git_dir):
-     """Check if git-worktree functionality is available
- 
-@@ -274,9 +284,10 @@ def check_worktree_is_available(git_dir):
-     """
-     pipe = ['git', '--git-dir', git_dir, 'worktree', 'list']
-     result = command.run_pipe([pipe], capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     return result.return_code == 0
- 
-+
- def add_worktree(git_dir, output_dir, commit_hash=None):
-     """Create and checkout a new git worktree for this build
- 
-@@ -290,10 +301,11 @@ def add_worktree(git_dir, output_dir, commit_hash=None):
-     if commit_hash:
-         pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git worktree add: %s' % result.stderr)
- 
-+
- def prune_worktrees(git_dir):
-     """Remove administrative files for deleted worktrees
- 
-@@ -305,7 +317,8 @@ def prune_worktrees(git_dir):
-     if result.return_code != 0:
-         raise OSError('git worktree prune: %s' % result.stderr)
- 
--def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-+
-+def create_patches(branch, start, count, ignore_binary, series, signoff=True):
-     """Create a series of patches from the top of the current branch.
- 
-     The patch files are written to the current directory using
-@@ -321,9 +334,7 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-         Filename of cover letter (None if none)
-         List of filenames of patch files
-     """
--    if series.get('version'):
--        version = '%s ' % series['version']
--    cmd = ['git', 'format-patch', '-M' ]
-+    cmd = ['git', 'format-patch', '-M']
-     if signoff:
-         cmd.append('--signoff')
-     if ignore_binary:
-@@ -341,9 +352,10 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
- 
-     # We have an extra file if there is a cover letter
-     if series.get('cover'):
--       return files[0], files[1:]
-+        return files[0], files[1:]
-     else:
--       return None, files
-+        return None, files
-+
- 
- def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-     """Build a list of email addresses based on an input list.
-@@ -385,40 +397,43 @@ def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-         raw += lookup_email(item, alias, warn_on_error=warn_on_error)
-     result = []
-     for item in raw:
--        if not item in result:
-+        if item not in result:
-             result.append(item)
-     if tag:
-         return ['%s %s%s%s' % (tag, quote, email, quote) for email in result]
-     return result
- 
-+
- def check_suppress_cc_config():
-     """Check if sendemail.suppresscc is configured correctly.
- 
-     Returns:
-         True if the option is configured correctly, False otherwise.
-     """
--    suppresscc = command.output_one_line('git', 'config', 'sendemail.suppresscc',
--                                       raise_on_error=False)
-+    suppresscc = command.output_one_line(
-+        'git', 'config', 'sendemail.suppresscc', raise_on_error=False)
- 
-     # Other settings should be fine.
-     if suppresscc == 'all' or suppresscc == 'cccmd':
-         col = terminal.Color()
- 
-         print((col.build(col.RED, "error") +
--            ": git config sendemail.suppresscc set to %s\n"  % (suppresscc)) +
--            "  patman needs --cc-cmd to be run to set the cc list.\n" +
--            "  Please run:\n" +
--            "    git config --unset sendemail.suppresscc\n" +
--            "  Or read the man page:\n" +
--            "    git send-email --help\n" +
--            "  and set an option that runs --cc-cmd\n")
-+               ": git config sendemail.suppresscc set to %s\n"
-+               % (suppresscc)) +
-+              "  patman needs --cc-cmd to be run to set the cc list.\n" +
-+              "  Please run:\n" +
-+              "    git config --unset sendemail.suppresscc\n" +
-+              "  Or read the man page:\n" +
-+              "    git send-email --help\n" +
-+              "  and set an option that runs --cc-cmd\n")
-         return False
- 
-     return True
- 
-+
- def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
--        self_only=False, alias=None, in_reply_to=None, thread=False,
--        smtp_server=None):
-+                  self_only=False, alias=None, in_reply_to=None, thread=False,
-+                  smtp_server=None, get_maintainer_script=None):
-     """Email a patch series.
- 
-     Args:
-@@ -435,6 +450,7 @@ def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
-         thread: True to add --thread to git send-email (make
-             all patches reply to cover-letter or first patch in series)
-         smtp_server: SMTP server to use to send patches
-+        get_maintainer_script: File name of script to get maintainers emails
- 
-     Returns:
-         Git command that was/would be run
-@@ -487,9 +503,10 @@ send --cc-cmd cc-fname" cover p1 p2'
-                   "git config sendemail.to u-boot@lists.denx.de")
-             return
-     cc = build_email_list(list(set(series.get('cc')) - set(series.get('to'))),
--                        '--cc', alias, warn_on_error)
-+                          '--cc', alias, warn_on_error)
-     if self_only:
--        to = build_email_list([os.getenv('USER')], '--to', alias, warn_on_error)
-+        to = build_email_list([os.getenv('USER')], '--to',
-+                              alias, warn_on_error)
-         cc = []
-     cmd = ['git', 'send-email', '--annotate']
-     if smtp_server:
-@@ -565,7 +582,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-     if not alias:
-         alias = settings.alias
-     lookup_name = lookup_name.strip()
--    if '@' in lookup_name: # Perhaps a real email address
-+    if '@' in lookup_name:      # Perhaps a real email address
-         return [lookup_name]
- 
-     lookup_name = lookup_name.lower()
-@@ -581,7 +598,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-             return out_list
- 
-     if lookup_name:
--        if not lookup_name in alias:
-+        if lookup_name not in alias:
-             msg = "Alias '%s' not found" % lookup_name
-             if warn_on_error:
-                 print(col.build(col.RED, msg))
-@@ -589,11 +606,12 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-         for item in alias[lookup_name]:
-             todo = lookup_email(item, alias, warn_on_error, level + 1)
-             for new_item in todo:
--                if not new_item in out_list:
-+                if new_item not in out_list:
-                     out_list.append(new_item)
- 
-     return out_list
- 
-+
- def get_top_level():
-     """Return name of top-level directory for this git repo.
- 
-@@ -608,6 +626,7 @@ def get_top_level():
-     """
-     return command.output_one_line('git', 'rev-parse', '--show-toplevel')
- 
-+
- def get_alias_file():
-     """Gets the name of the git alias file.
- 
-@@ -615,7 +634,7 @@ def get_alias_file():
-         Filename of git alias file, or None if none
-     """
-     fname = command.output_one_line('git', 'config', 'sendemail.aliasesfile',
--            raise_on_error=False)
-+                                    raise_on_error=False)
-     if not fname:
-         return None
- 
-@@ -625,6 +644,7 @@ def get_alias_file():
- 
-     return os.path.join(get_top_level(), fname)
- 
-+
- def get_default_user_name():
-     """Gets the user.name from .gitconfig file.
- 
-@@ -634,6 +654,7 @@ def get_default_user_name():
-     uname = command.output_one_line('git', 'config', '--global', 'user.name')
-     return uname
- 
-+
- def get_default_user_email():
-     """Gets the user.email from the global .gitconfig file.
- 
-@@ -643,17 +664,19 @@ def get_default_user_email():
-     uemail = command.output_one_line('git', 'config', '--global', 'user.email')
-     return uemail
- 
-+
- def get_default_subject_prefix():
-     """Gets the format.subjectprefix from local .git/config file.
- 
-     Returns:
-         Subject prefix found in local .git/config file, or None if none
-     """
--    sub_prefix = command.output_one_line('git', 'config', 'format.subjectprefix',
--                 raise_on_error=False)
-+    sub_prefix = command.output_one_line(
-+        'git', 'config', 'format.subjectprefix', raise_on_error=False)
- 
-     return sub_prefix
- 
-+
- def setup():
-     """Set up git utils, by reading the alias files."""
-     # Check for a git alias file also
-@@ -666,6 +689,7 @@ def setup():
-     use_no_decorate = (command.run_pipe([cmd], raise_on_error=False)
-                        .return_code == 0)
- 
-+
- def get_head():
-     """Get the hash of the current HEAD
- 
-@@ -674,6 +698,7 @@ def get_head():
-     """
-     return command.output_one_line('git', 'show', '-s', '--pretty=format:%H')
- 
-+
- if __name__ == "__main__":
-     import doctest
- 
-diff --git a/tools/patman/patman b/tools/patman/patman
-index 11a5d8e18a..5a427d1942 120000
---- a/tools/patman/patman
-+++ b/tools/patman/patman
-@@ -1 +1 @@
--main.py
-\ No newline at end of file
-+__main__.py
-\ No newline at end of file
-diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst
-index 8c5c9cc2cc..6113962fb4 100644
---- a/tools/patman/patman.rst
-+++ b/tools/patman/patman.rst
-@@ -1,6 +1,7 @@
- .. SPDX-License-Identifier: GPL-2.0+
- .. Copyright (c) 2011 The Chromium OS Authors
- .. Simon Glass <sjg@chromium.org>
-+.. Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- .. v1, v2, 19-Oct-11
- .. revised v3 24-Nov-11
- .. revised v4 Independence Day 2020, with Patchwork integration
-@@ -68,13 +69,28 @@ this once::
- 
-     git config sendemail.aliasesfile doc/git-mailrc
- 
--For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles figuring
--out where to send patches pretty well.
-+For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles
-+figuring out where to send patches pretty well. For other projects,
-+you may want to specify a different script to be run, for example via
-+a project-specific `.patman` file::
-+
-+    # .patman configuration file at the root of some project
-+
-+    [settings]
-+    get_maintainer_script: etc/teams.scm get-maintainer
-+
-+The `get_maintainer_script` option corresponds to the
-+`--get-maintainer-script` argument of the `send` command.  It is
-+looked relatively to the root of the current git repository, as well
-+as on PATH.  It can also be provided arguments, as shown above.  The
-+contract is that the script should accept a patch file name and return
-+a list of email addresses, one per line, like `get_maintainer.pl`
-+does.
- 
- During the first run patman creates a config file for you by taking the default
- user name and email address from the global .gitconfig file.
- 
--To add your own, create a file ~/.patman like this::
-+To add your own, create a file `~/.patman` like this::
- 
-     # patman alias file
- 
-@@ -85,6 +101,12 @@ To add your own, create a file ~/.patman like this::
-     wolfgang: Wolfgang Denk <wd@denx.de>
-     others: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net>
- 
-+As hinted above, Patman will also look for a `.patman` configuration
-+file at the root of the current project git repository, which makes it
-+possible to override the `project` settings variable or anything else
-+in a project-specific way. The values of this "local" configuration
-+file take precedence over those of the "global" one.
-+
- Aliases are recursive.
- 
- The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
-@@ -680,6 +702,16 @@ them:
- 
-     $ tools/patman/patman test
- 
-+Note that since the test suite depends on data files only available in
-+the git checkout, the `test` command is hidden unless `patman` is
-+invoked from the U-Boot git repository.
-+
-+Alternatively, you can run the test suite via Pytest:
-+
-+.. code-block:: bash
-+
-+    $ cd tools/patman && pytest
-+
- Error handling doesn't always produce friendly error messages - e.g.
- putting an incorrect tag in a commit may provide a confusing message.
- 
-diff --git a/tools/patman/pytest.ini b/tools/patman/pytest.ini
-new file mode 100644
-index 0000000000..df3eb518d0
---- /dev/null
-+++ b/tools/patman/pytest.ini
-@@ -0,0 +1,2 @@
-+[pytest]
-+addopts = --doctest-modules
-diff --git a/tools/patman/series.py b/tools/patman/series.py
-index 3075378ac1..2eeeef71dc 100644
---- a/tools/patman/series.py
-+++ b/tools/patman/series.py
-@@ -235,7 +235,7 @@ class Series(dict):
-             print(col.build(col.RED, str))
- 
-     def MakeCcFile(self, process_tags, cover_fname, warn_on_error,
--                   add_maintainers, limit):
-+                   add_maintainers, limit, get_maintainer_script):
-         """Make a cc file for us to use for per-commit Cc automation
- 
-         Also stores in self._generated_cc to make ShowActions() faster.
-@@ -249,6 +249,8 @@ class Series(dict):
-                 True/False to call the get_maintainers to CC maintainers
-                 List of maintainers to include (for testing)
-             limit: Limit the length of the Cc list (None if no limit)
-+            get_maintainer_script: The file name of the get_maintainer.pl
-+                script (or compatible).
-         Return:
-             Filename of temp file created
-         """
-@@ -267,8 +269,9 @@ class Series(dict):
-             if type(add_maintainers) == type(cc):
-                 cc += add_maintainers
-             elif add_maintainers:
--                dir_list = [os.path.join(gitutil.get_top_level(), 'scripts')]
--                cc += get_maintainer.get_maintainer(dir_list, commit.patch)
-+
-+                cc += get_maintainer.get_maintainer(get_maintainer_script,
-+                                                    commit.patch)
-             for x in set(cc) & set(settings.bounces):
-                 print(col.build(col.YELLOW, 'Skipping "%s"' % x))
-             cc = list(set(cc) - set(settings.bounces))
-diff --git a/tools/patman/settings.py b/tools/patman/settings.py
-index 903d6fcb0b..636983e32d 100644
---- a/tools/patman/settings.py
-+++ b/tools/patman/settings.py
-@@ -1,18 +1,18 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2011 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- try:
-     import configparser as ConfigParser
--except:
-+except Exception:
-     import ConfigParser
- 
- import argparse
- import os
- import re
- 
--from patman import command
--from patman import tools
-+from patman import gitutil
- 
- """Default settings per-project.
- 
-@@ -32,7 +32,8 @@ _default_settings = {
-     },
- }
- 
--class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-+
-+class _ProjectConfigParser(ConfigParser.ConfigParser):
-     """ConfigParser that handles projects.
- 
-     There are two main goals of this class:
-@@ -83,14 +84,14 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-     def __init__(self, project_name):
-         """Construct _ProjectConfigParser.
- 
--        In addition to standard SafeConfigParser initialization, this also loads
--        project defaults.
-+        In addition to standard ConfigParser initialization, this also
-+        loads project defaults.
- 
-         Args:
-             project_name: The name of the project.
-         """
-         self._project_name = project_name
--        ConfigParser.SafeConfigParser.__init__(self)
-+        ConfigParser.ConfigParser.__init__(self)
- 
-         # Update the project settings in the config based on
-         # the _default_settings global.
-@@ -102,31 +103,31 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-             self.set(project_settings, setting_name, setting_value)
- 
-     def get(self, section, option, *args, **kwargs):
--        """Extend SafeConfigParser to try project_section before section.
-+        """Extend ConfigParser to try project_section before section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         try:
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, "%s_%s" % (self._project_name, section), option,
-                 *args, **kwargs
-             )
-         except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, section, option, *args, **kwargs
-             )
-         return val
- 
-     def items(self, section, *args, **kwargs):
--        """Extend SafeConfigParser to add project_section to section.
-+        """Extend ConfigParser to add project_section to section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         project_items = []
-         has_project_section = False
-@@ -134,7 +135,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get items from the project section
-         try:
--            project_items = ConfigParser.SafeConfigParser.items(
-+            project_items = ConfigParser.ConfigParser.items(
-                 self, "%s_%s" % (self._project_name, section), *args, **kwargs
-             )
-             has_project_section = True
-@@ -143,7 +144,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get top-level items
-         try:
--            top_items = ConfigParser.SafeConfigParser.items(
-+            top_items = ConfigParser.ConfigParser.items(
-                 self, section, *args, **kwargs
-             )
-         except ConfigParser.NoSectionError:
-@@ -155,6 +156,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-         item_dict.update(project_items)
-         return {(item, val) for item, val in item_dict.items()}
- 
-+
- def ReadGitAliases(fname):
-     """Read a git alias file. This is in the form used by git:
- 
-@@ -170,7 +172,7 @@ def ReadGitAliases(fname):
-         print("Warning: Cannot find alias file '%s'" % fname)
-         return
- 
--    re_line = re.compile('alias\s+(\S+)\s+(.*)')
-+    re_line = re.compile(r'alias\s+(\S+)\s+(.*)')
-     for line in fd.readlines():
-         line = line.strip()
-         if not line or line[0] == '#':
-@@ -190,7 +192,8 @@ def ReadGitAliases(fname):
- 
-     fd.close()
- 
--def CreatePatmanConfigFile(gitutil, config_fname):
-+
-+def CreatePatmanConfigFile(config_fname):
-     """Creates a config file under $(HOME)/.patman if it can't find one.
- 
-     Args:
-@@ -200,12 +203,12 @@ def CreatePatmanConfigFile(gitutil, config_fname):
-         None
-     """
-     name = gitutil.get_default_user_name()
--    if name == None:
-+    if name is None:
-         name = input("Enter name: ")
- 
-     email = gitutil.get_default_user_email()
- 
--    if email == None:
-+    if email is None:
-         email = input("Enter email: ")
- 
-     try:
-@@ -220,7 +223,8 @@ me: %s <%s>
- [bounces]
- nxp = Zhikang Zhang <zhikang.zhang@nxp.com>
- ''' % (name, email), file=f)
--    f.close();
-+    f.close()
-+
- 
- def _UpdateDefaults(main_parser, config):
-     """Update the given OptionParser defaults based on config.
-@@ -242,8 +246,8 @@ def _UpdateDefaults(main_parser, config):
-     # Find all the parsers and subparsers
-     parsers = [main_parser]
-     parsers += [subparser for action in main_parser._actions
--                  if isinstance(action, argparse._SubParsersAction)
--                  for _, subparser in action.choices.items()]
-+                if isinstance(action, argparse._SubParsersAction)
-+                for _, subparser in action.choices.items()]
- 
-     # Collect the defaults from each parser
-     defaults = {}
-@@ -270,8 +274,9 @@ def _UpdateDefaults(main_parser, config):
-     # Set all the defaults and manually propagate them to subparsers
-     main_parser.set_defaults(**defaults)
-     for parser, pdefs in zip(parsers, parser_defaults):
--        parser.set_defaults(**{ k: v for k, v in defaults.items()
--                                    if k in pdefs })
-+        parser.set_defaults(**{k: v for k, v in defaults.items()
-+                               if k in pdefs})
-+
- 
- def _ReadAliasFile(fname):
-     """Read in the U-Boot git alias file if it exists.
-@@ -298,6 +303,7 @@ def _ReadAliasFile(fname):
-         if bad_line:
-             print(bad_line)
- 
-+
- def _ReadBouncesFile(fname):
-     """Read in the bounces file if it exists
- 
-@@ -311,6 +317,7 @@ def _ReadBouncesFile(fname):
-                     continue
-                 bounces.add(line.strip())
- 
-+
- def GetItems(config, section):
-     """Get the items from a section of the config.
- 
-@@ -323,31 +330,50 @@ def GetItems(config, section):
-     """
-     try:
-         return config.items(section)
--    except ConfigParser.NoSectionError as e:
-+    except ConfigParser.NoSectionError:
-         return []
--    except:
--        raise
- 
--def Setup(gitutil, parser, project_name, config_fname=''):
-+
-+def Setup(parser, project_name, config_fname=None):
-     """Set up the settings module by reading config files.
- 
-+    Unless `config_fname` is specified, a `.patman` config file local
-+    to the git repository is consulted, followed by the global
-+    `$HOME/.patman`. If none exists, the later is created. Values
-+    defined in the local config file take precedence over those
-+    defined in the global one.
-+
-     Args:
--        parser:         The parser to update
-+        parser:         The parser to update.
-         project_name:   Name of project that we're working on; we'll look
-             for sections named "project_section" as well.
--        config_fname:   Config filename to read ('' for default)
-+        config_fname:   Config filename to read.  An error is raised if it
-+            does not exist.
-     """
-     # First read the git alias file if available
-     _ReadAliasFile('doc/git-mailrc')
-     config = _ProjectConfigParser(project_name)
--    if config_fname == '':
-+
-+    if config_fname and not os.path.exists(config_fname):
-+        raise Exception(f'provided {config_fname} does not exist')
-+
-+    if not config_fname:
-         config_fname = '%s/.patman' % os.getenv('HOME')
-+    has_config = os.path.exists(config_fname)
-+
-+    git_local_config_fname = os.path.join(gitutil.get_top_level(), '.patman')
-+    has_git_local_config = os.path.exists(git_local_config_fname)
- 
--    if not os.path.exists(config_fname):
--        print("No config file found ~/.patman\nCreating one...\n")
--        CreatePatmanConfigFile(gitutil, config_fname)
-+    # Read the git local config last, so that its values override
-+    # those of the global config, if any.
-+    if has_config:
-+        config.read(config_fname)
-+    if has_git_local_config:
-+        config.read(git_local_config_fname)
- 
--    config.read(config_fname)
-+    if not (has_config or has_git_local_config):
-+        print("No config file found.\nCreating ~/.patman...\n")
-+        CreatePatmanConfigFile(config_fname)
- 
-     for name, value in GetItems(config, 'alias'):
-         alias[name] = value.split(',')
-@@ -358,6 +384,7 @@ def Setup(gitutil, parser, project_name, config_fname=''):
- 
-     _UpdateDefaults(parser, config)
- 
-+
- # These are the aliases we understand, indexed by alias. Each member is a list.
- alias = {}
- bounces = set()
-diff --git a/tools/patman/setup.py b/tools/patman/setup.py
-index 5643bf1503..2ff791da0f 100644
---- a/tools/patman/setup.py
-+++ b/tools/patman/setup.py
-@@ -7,6 +7,6 @@ setup(name='patman',
-       scripts=['patman'],
-       packages=['patman'],
-       package_dir={'patman': ''},
--      package_data={'patman': ['README']},
-+      package_data={'patman': ['README.rst']},
-       classifiers=['Environment :: Console',
-                    'Topic :: Software Development'])
-diff --git a/tools/patman/test_settings.py b/tools/patman/test_settings.py
-new file mode 100644
-index 0000000000..c768a2fc64
---- /dev/null
-+++ b/tools/patman/test_settings.py
-@@ -0,0 +1,67 @@
-+# SPDX-License-Identifier: GPL-2.0+
-+#
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
-+#
-+
-+import argparse
-+import contextlib
-+import os
-+import sys
-+import tempfile
-+
-+from patman import settings
-+from patman import tools
-+
-+
-+@contextlib.contextmanager
-+def empty_git_repository():
-+    with tempfile.TemporaryDirectory() as tmpdir:
-+        os.chdir(tmpdir)
-+        tools.run('git', 'init', raise_on_error=True)
-+        yield tmpdir
-+
-+
-+@contextlib.contextmanager
-+def cleared_command_line_args():
-+    old_value = sys.argv[:]
-+    sys.argv = [sys.argv[0]]
-+    try:
-+        yield
-+    finally:
-+        sys.argv = old_value
-+
-+
-+def test_git_local_config():
-+    # Clearing the command line arguments is required, otherwise
-+    # arguments passed to the test running such as in 'pytest -k
-+    # filter' would be processed by _UpdateDefaults and fail.
-+    with cleared_command_line_args():
-+        with empty_git_repository():
-+            with tempfile.NamedTemporaryFile() as global_config:
-+                global_config.write(b'[settings]\n'
-+                                    b'project=u-boot\n')
-+                global_config.flush()
-+                parser = argparse.ArgumentParser()
-+                parser.add_argument('-p', '--project', default='unknown')
-+                subparsers = parser.add_subparsers(dest='cmd')
-+                send = subparsers.add_parser('send')
-+                send.add_argument('--no-check', action='store_false',
-+                                  dest='check_patch', default=True)
-+
-+                # Test "global" config is used.
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'u-boot'
-+                send_args, _ = send.parse_known_args([])
-+                assert send_args.check_patch
-+
-+                # Test local config can shadow it.
-+                with open('.patman', 'w', buffering=1) as f:
-+                    f.write('[settings]\n'
-+                            'project: guix-patches\n'
-+                            'check_patch: False\n')
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'guix-patches'
-+                send_args, _ = send.parse_known_args([])
-+                assert not send_args.check_patch
diff --git a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
index a5b92e3e8f..858f42efe7 100644
--- a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
+++ b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
@@ -5,12 +5,12 @@ Index: u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
 ===================================================================
 --- u-boot-2021.07~rc4+dfsg.orig/include/configs/sifive-unmatched.h
 +++ u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
-@@ -62,6 +62,8 @@
+@@ -55,6 +55,8 @@
  	"name=system,size=-,bootable,type=${type_guid_gpt_system};"
  
- #define CONFIG_EXTRA_ENV_SETTINGS \
+ #define CFG_EXTRA_ENV_SETTINGS \
 +	"fdt_high=0xffffffffffffffff\0" \
 +	"initrd_high=0xffffffffffffffff\0" \
  	"kernel_addr_r=0x84000000\0" \
- 	"fdt_addr_r=0x88000000\0" \
- 	"scriptaddr=0x88100000\0" \
+ 	"kernel_comp_addr_r=0x88000000\0" \
+ 	"kernel_comp_size=0x4000000\0" \
-- 
2.39.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] WIP update u-boot to 2023.07-rc5
  2023-06-18  8:49 [bug#64149] WIP update u-boot to 2023.07-rc4 Vagrant Cascadian
@ 2023-07-03  1:26 ` Vagrant Cascadian
  2023-07-04 22:59   ` Vagrant Cascadian
  2023-07-12 14:49 ` [bug#64149] [PATCH v3 0/6] Update u-boot to 2023.07.02 Vagrant Cascadian
  2023-07-20  1:44 ` [bug#64149] [PATCH v4 0/5] Update U-boot " vagrant
  2 siblings, 1 reply; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-03  1:26 UTC (permalink / raw)
  To: 64149; +Cc: ludo, efraim


[-- Attachment #1.1: Type: text/plain, Size: 1630 bytes --]

On 2023-06-18, Vagrant Cascadian wrote:
> The attached patch updates u-boot to 2023.07-rc4... though mostly just
> getting this patch out there for review purposes, but should probably
> wait until 2023.07 is released in July. Alternately, could try to update
> to 2023.04, although honestly that version had quite a few issues in
> Debian and might be best skipped!

This patch updates to 2023.07-rc5.

2023.07 is scheduled for upstream release tomorrow.


> Builds most of the u-boot-* packages successfully, notable issues are
> with u-boot-tools failing to build, and unable to cross-build
> u-boot-puma-rk3399 and u-boot-rockpro64-rk3399 due to the dependency on
> python-pyelftools not being cross-buildable ... though
> u-boot-pinebook-pro-rk3399 uses python-pyelftools just fine, somehow?!

Still similarly broken.


> I have not boot-tested anything with this patch.

Still have not done this either...


> This patch depends on the patch updating python-pyelftools:
>
>   https://issues.guix.gnu.org/64144
>
> ...or fixing the failing build of python-pyelftools some other way!

Merged that yesterday...


> It also would be nice to pull in the updated arm-trusted-firmware:
>
>   https://issues.guix.gnu.org/64142
>
> ...although this is not strictly necessary.

Still preferred, but not strictly necessary.


> It also might be time to make some more noise on the forgotten
> crust-firmware patch, as there is a workaround in this patch because
> that is missing from guix:
>
>   https://issues.guix.gnu.org/48371

This needs more research, may not be needed with recent
arm-trusted-firmware...


live well,
  vagrant

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0002-gnu-u-boot-Update-to-2023.07-rc5.patch --]
[-- Type: text/x-diff, Size: 61585 bytes --]

From 9f945a7192989567dee848266ea7023e59202202 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Sun, 2 Jul 2023 18:20:39 -0700
Subject: [PATCH 2/2] gnu: u-boot: Update to 2023.07-rc5.

* gnu/packages/patches/u-boot-infodocs-target.patch: Remove file.
* gnu/packages/patches/u-boot-patman-guix-integration.patch: Remove file.
* gnu/local.mk: Remove patches.
* gnu/packages/patches/u-boot-allow-disabling-openssl.patch: Refresh.
* gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch: Refresh.
* gnu/packages/bootloaders.scm (u-boot): Update to 2023.07-rc5.
[native-inputs]: Add python-pyelftools.
[source]: Remove patches.
(u-boot-tools): Update substitution for python3-coverage.
(make-u-boot-sunxi64-package): Set SCP environment variable.
(u-boot-sifive-unleashed): Update to use opensbi.
---
 gnu/local.mk                                  |    2 -
 gnu/packages/bootloaders.scm                  |   28 +-
 .../u-boot-allow-disabling-openssl.patch      |   13 +-
 .../patches/u-boot-infodocs-target.patch      |   84 --
 .../u-boot-patman-guix-integration.patch      | 1244 -----------------
 ...boot-sifive-prevent-reloc-initrd-fdt.patch |    8 +-
 6 files changed, 31 insertions(+), 1348 deletions(-)
 delete mode 100644 gnu/packages/patches/u-boot-infodocs-target.patch
 delete mode 100644 gnu/packages/patches/u-boot-patman-guix-integration.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index e65888a044..da9488e14e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1996,8 +1996,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
-  %D%/packages/patches/u-boot-infodocs-target.patch		\
-  %D%/packages/patches/u-boot-patman-guix-integration.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index a9685a9ef9..7cf11e5279 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -648,23 +648,21 @@ (define %u-boot-rk3399-enable-emmc-phy-patch
 (define u-boot
   (package
     (name "u-boot")
-    (version "2022.10")
+    (version "2023.07-rc5")
     (source (origin
               (patches
                (list %u-boot-rockchip-inno-usb-patch
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
                      %u-boot-rk3399-enable-emmc-phy-patch
-                     (search-patch "u-boot-fix-build-python-3.10.patch")
-                     (search-patch "u-boot-infodocs-target.patch")
-                     (search-patch "u-boot-patman-guix-integration.patch")))
+                     (search-patch "u-boot-fix-build-python-3.10.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
                     "u-boot-" version ".tar.bz2"))
               (sha256
                (base32
-                "1y5x8vxdgsqdqlsvq01mn8lmw53fqairkhvhhjx83hjva0m4id2h"))))
+                "06hf8h036p2ij1qa5mh6932cry4hzp739ridr6qckcc3y4dhg3zl"))))
     (build-system  gnu-build-system)
     (native-inputs
      (list bison
@@ -676,6 +674,7 @@ (define u-boot
            perl
            pkg-config                   ;for 'make menuconfig'
            python
+           python-pyelftools
            swig
            (list util-linux "lib")))
     (home-page "https://www.denx.de/wiki/U-Boot/")
@@ -739,7 +738,7 @@ (define-public u-boot-tools
                (("/bin/false") (which "false")))
              (substitute* "tools/dtoc/fdt_util.py"
                (("'cc'") "'gcc'"))
-             (substitute* "tools/patman/test_util.py"
+             (substitute* "tools/u_boot_pylib/test_util.py"
                ;; python3-coverage is simply called coverage in guix.
                (("python3-coverage") "coverage")
 
@@ -1009,6 +1008,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
           #~(modify-phases #$phases
               (add-after 'unpack 'set-environment
                 (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
+                  (setenv "SCP" "/dev/null")
                   (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
       (inputs
        (modify-inputs (package-inputs base)
@@ -1170,7 +1171,20 @@ (define-public u-boot-sandbox
                 (append sdl2))))))
 
 (define-public u-boot-sifive-unleashed
-  (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu"))
+  (let ((base (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu")))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'set-environment
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (setenv "OPENSBI" (search-input-file inputs
+                                                       "fw_dynamic.bin"))))))))
+      (inputs
+       (modify-inputs (package-inputs base)
+         (append opensbi-generic))))))
 
 (define-public u-boot-sifive-unmatched
   (let ((base (make-u-boot-package "sifive_unmatched" "riscv64-linux-gnu")))
diff --git a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
index 5f2856dbb4..5195a7a6f8 100644
--- a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
+++ b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
@@ -128,29 +128,28 @@ index 94b7685392..eec599b0ee 100644
  	datai = 0;
  	for (cfgi = 0; cfgi < cfgn; cfgi++) {
  		e = &image_cfg[cfgi];
-@@ -1552,9 +1568,11 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
+@@ -1624,10 +1640,12 @@ static void *image_create_v1(size_t *dataoff, struct image_tool_params *params,
  					      &datai, delay);
  	}
  
 +#if defined(CONFIG_KWB_SECURE)
- 	if (secure_hdr && add_secure_header_v1(params, ptr, payloadsz + headersz,
- 					       headersz, image, secure_hdr))
+ 	if (secure_hdr && add_secure_header_v1(params, ptr + *dataoff, payloadsz,
+ 					       image, headersz, secure_hdr))
  		return NULL;
 +#endif
  
- 	*imagesz = headersz;
+ 	/* Calculate and set the header checksum */
+ 	main_hdr->checksum = image_checksum8(main_hdr, headersz);
  
 --- a/tools/image-host.c
 +++ b/tools/image-host.c
-@@ -14,10 +14,12 @@
+@@ -14,8 +14,10 @@
  #include <image.h>
  #include <version.h>
  
 +#ifdef CONFIG_FIT_PRELOAD
  #include <openssl/pem.h>
  #include <openssl/evp.h>
- 
- #define IMAGE_PRE_LOAD_PATH                             "/image/pre-load/sig"
 +#endif
  
  /**
diff --git a/gnu/packages/patches/u-boot-infodocs-target.patch b/gnu/packages/patches/u-boot-infodocs-target.patch
deleted file mode 100644
index 5b21a99de3..0000000000
--- a/gnu/packages/patches/u-boot-infodocs-target.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-Upstream status: https://patchwork.ozlabs.org/project/uboot/list/?series=333259
-
-diff --git a/Makefile b/Makefile
-index de5746399a..597a8886c3 100644
---- a/Makefile
-+++ b/Makefile
-@@ -2372,7 +2372,7 @@ tcheck:
- # Documentation targets
- # ---------------------------------------------------------------------------
- DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
--	       linkcheckdocs dochelp refcheckdocs
-+	       linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
- PHONY += $(DOC_TARGETS)
- $(DOC_TARGETS): scripts_basic FORCE
- 	$(Q)$(MAKE) $(build)=doc $@
-diff --git a/doc/Makefile b/doc/Makefile
-index f5de65e927..d0904a9f99 100644
---- a/doc/Makefile
-+++ b/doc/Makefile
-@@ -69,6 +69,14 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
- htmldocs:
- 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
- 
-+texinfodocs:
-+	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,texinfo,$(var),texinfo,$(var)))
-+
-+# Note: the 'info' Make target is generated by sphinx itself when
-+# running the texinfodocs target defined above.
-+infodocs: texinfodocs
-+	$(MAKE) -C $(BUILDDIR)/texinfo info
-+
- linkcheckdocs:
- 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
- 
-@@ -109,6 +117,8 @@ cleandocs:
- dochelp:
- 	@echo  ' U-Boot documentation in different formats from ReST:'
- 	@echo  '  htmldocs        - HTML'
-+	@echo  '  texinfodocs     - Texinfo'
-+	@echo  '  infodocs        - Info'
- 	@echo  '  latexdocs       - LaTeX'
- 	@echo  '  pdfdocs         - PDF'
- 	@echo  '  epubdocs        - EPUB'
-diff --git a/doc/conf.py b/doc/conf.py
-index 62c8d31270..3db70f80c1 100644
---- a/doc/conf.py
-+++ b/doc/conf.py
-@@ -449,7 +449,7 @@ for fn in os.listdir('.'):
- # One entry per manual page. List of tuples
- # (source start file, name, description, authors, manual section).
- man_pages = [
--    (master_doc, 'dasuboot', 'The U-Boot Documentation',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-      [author], 1)
- ]
- 
-@@ -463,8 +463,8 @@ man_pages = [
- # (source start file, target name, title, author,
- #  dir menu entry, description, category)
- texinfo_documents = [
--    (master_doc, 'DasUBoot', 'The U-Boot Documentation',
--     author, 'DasUBoot', 'One line description of project.',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-+     author, 'U-Boot', 'Boot loader for embedded systems',
-      'Miscellaneous'),
- ]
- 
-diff --git a/doc/media/Makefile b/doc/media/Makefile
-index b9b43a34c3..9b32258696 100644
---- a/doc/media/Makefile
-+++ b/doc/media/Makefile
-@@ -22,10 +22,11 @@ $(BUILDDIR)/linker_lists.h.rst: ${API}/linker_lists.h ${PARSER} $(SRC_DIR)/linke
- 
- # Media build rules
- 
--.PHONY: all html epub xml latex
-+.PHONY: all html texinfo epub xml latex
- 
- all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
- html: all
-+texinfo: all
- epub: all
- xml: all
- latex: $(IMGPDF) all
diff --git a/gnu/packages/patches/u-boot-patman-guix-integration.patch b/gnu/packages/patches/u-boot-patman-guix-integration.patch
deleted file mode 100644
index 3472656c99..0000000000
--- a/gnu/packages/patches/u-boot-patman-guix-integration.patch
+++ /dev/null
@@ -1,1244 +0,0 @@
-These changes correspond to commits 9ff7500ace..3154de3dd6 already merged to
-the u-boot-dm custodian repo (at
-https://source.denx.de/u-boot/custodians/u-boot-dm/-/commits/next), scheduled
-to be pulled after the next release.
-
-diff --git a/tools/patman/__init__.py b/tools/patman/__init__.py
-index c9d3e35052..1b98ec7fee 100644
---- a/tools/patman/__init__.py
-+++ b/tools/patman/__init__.py
-@@ -1,6 +1,6 @@
- # SPDX-License-Identifier: GPL-2.0+
- 
- __all__ = ['checkpatch', 'command', 'commit', 'control', 'cros_subprocess',
--           'func_test', 'get_maintainer', 'gitutil', 'main', 'patchstream',
-+           'func_test', 'get_maintainer', 'gitutil', '__main__', 'patchstream',
-            'project', 'series', 'setup', 'settings', 'terminal',
-            'test_checkpatch', 'test_util', 'tools', 'tout']
-diff --git a/tools/patman/main.py b/tools/patman/__main__.py
-similarity index 89%
-rename from tools/patman/main.py
-rename to tools/patman/__main__.py
-index 8067a288ab..749e6348b6 100755
---- a/tools/patman/main.py
-+++ b/tools/patman/__main__.py
-@@ -7,6 +7,7 @@
- """See README for more information"""
- 
- from argparse import ArgumentParser
-+import importlib.resources
- import os
- import re
- import sys
-@@ -19,6 +20,7 @@ if __name__ == "__main__":
- 
- # Our modules
- from patman import control
-+from patman import func_test
- from patman import gitutil
- from patman import project
- from patman import settings
-@@ -53,7 +55,8 @@ parser.add_argument('-H', '--full-help', action='store_true', dest='full_help',
-                     default=False, help='Display the README file')
- 
- subparsers = parser.add_subparsers(dest='cmd')
--send = subparsers.add_parser('send')
-+send = subparsers.add_parser(
-+    'send', help='Format, check and email patches (default command)')
- send.add_argument('-i', '--ignore-errors', action='store_true',
-        dest='ignore_errors', default=False,
-        help='Send patches email even if patch errors are found')
-@@ -62,6 +65,12 @@ send.add_argument('-l', '--limit-cc', dest='limit', type=int, default=None,
- send.add_argument('-m', '--no-maintainers', action='store_false',
-        dest='add_maintainers', default=True,
-        help="Don't cc the file maintainers automatically")
-+send.add_argument(
-+    '--get-maintainer-script', dest='get_maintainer_script', type=str,
-+    action='store',
-+    default=os.path.join(gitutil.get_top_level(), 'scripts',
-+                         'get_maintainer.pl') + ' --norolestats',
-+    help='File name of the get_maintainer.pl (or compatible) script.')
- send.add_argument('-n', '--dry-run', action='store_true', dest='dry_run',
-        default=False, help="Do a dry run (create but don't email patches)")
- send.add_argument('-r', '--in-reply-to', type=str, action='store',
-@@ -94,9 +103,11 @@ send.add_argument('--smtp-server', type=str,
- 
- send.add_argument('patchfiles', nargs='*')
- 
--test_parser = subparsers.add_parser('test', help='Run tests')
--test_parser.add_argument('testname', type=str, default=None, nargs='?',
--                         help="Specify the test to run")
-+# Only add the 'test' action if the test data files are available.
-+if os.path.exists(func_test.TEST_DATA_DIR):
-+    test_parser = subparsers.add_parser('test', help='Run tests')
-+    test_parser.add_argument('testname', type=str, default=None, nargs='?',
-+                             help="Specify the test to run")
- 
- status = subparsers.add_parser('status',
-                                help='Check status of patches in patchwork')
-@@ -113,7 +124,7 @@ status.add_argument('-f', '--force', action='store_true',
- argv = sys.argv[1:]
- args, rest = parser.parse_known_args(argv)
- if hasattr(args, 'project'):
--    settings.Setup(gitutil, parser, args.project, '')
-+    settings.Setup(parser, args.project)
-     args, rest = parser.parse_known_args(argv)
- 
- # If we have a command, it is safe to parse all arguments
-@@ -160,11 +171,8 @@ elif args.cmd == 'send':
-         fd.close()
- 
-     elif args.full_help:
--        tools.print_full_help(
--            os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                         'README.rst')
--        )
--
-+        with importlib.resources.path('patman', 'README.rst') as readme:
-+            tools.print_full_help(str(readme))
-     else:
-         # If we are not processing tags, no need to warning about bad ones
-         if not args.process_tags:
-diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
-index d1b902dd96..012c0d895c 100644
---- a/tools/patman/checkpatch.py
-+++ b/tools/patman/checkpatch.py
-@@ -211,7 +211,7 @@ def check_patch(fname, verbose=False, show_types=False, use_tree=False):
-             stdout: Full output of checkpatch
-     """
-     chk = find_check_patch()
--    args = [chk]
-+    args = [chk, '--u-boot', '--strict']
-     if not use_tree:
-         args.append('--no-tree')
-     if show_types:
-diff --git a/tools/patman/control.py b/tools/patman/control.py
-index bf426cf7bc..38e98dab84 100644
---- a/tools/patman/control.py
-+++ b/tools/patman/control.py
-@@ -94,8 +94,8 @@ def check_patches(series, patch_files, run_checkpatch, verbose, use_tree):
- 
- 
- def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
--                  ignore_bad_tags, add_maintainers, limit, dry_run, in_reply_to,
--                  thread, smtp_server):
-+                  ignore_bad_tags, add_maintainers, get_maintainer_script, limit,
-+                  dry_run, in_reply_to, thread, smtp_server):
-     """Email patches to the recipients
- 
-     This emails out the patches and cover letter using 'git send-email'. Each
-@@ -123,6 +123,8 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         ignore_bad_tags (bool): True to just print a warning for unknown tags,
-             False to halt with an error
-         add_maintainers (bool): Run the get_maintainer.pl script for each patch
-+        get_maintainer_script (str): The script used to retrieve which
-+            maintainers to cc
-         limit (int): Limit on the number of people that can be cc'd on a single
-             patch or the cover letter (None if no limit)
-         dry_run (bool): Don't actually email the patches, just print out what
-@@ -134,7 +136,7 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         smtp_server (str): SMTP server to use to send patches (None for default)
-     """
-     cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags,
--                                add_maintainers, limit)
-+                                add_maintainers, limit, get_maintainer_script)
- 
-     # Email the patches out (giving the user time to check / cancel)
-     cmd = ''
-@@ -174,8 +176,8 @@ def send(args):
-     email_patches(
-         col, series, cover_fname, patch_files, args.process_tags,
-         its_a_go, args.ignore_bad_tags, args.add_maintainers,
--        args.limit, args.dry_run, args.in_reply_to, args.thread,
--        args.smtp_server)
-+        args.get_maintainer_script, args.limit, args.dry_run,
-+        args.in_reply_to, args.thread, args.smtp_server)
- 
- def patchwork_status(branch, count, start, end, dest_branch, force,
-                      show_comments, url):
-diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
-index 7b92bc67be..c25a47bdeb 100644
---- a/tools/patman/func_test.py
-+++ b/tools/patman/func_test.py
-@@ -6,7 +6,9 @@
- 
- """Functional tests for checking that patman behaves correctly"""
- 
-+import contextlib
- import os
-+import pathlib
- import re
- import shutil
- import sys
-@@ -28,6 +30,21 @@ from patman.test_util import capture_sys_output
- import pygit2
- from patman import status
- 
-+PATMAN_DIR = pathlib.Path(__file__).parent
-+TEST_DATA_DIR = PATMAN_DIR / 'test/'
-+
-+
-+@contextlib.contextmanager
-+def directory_excursion(directory):
-+    """Change directory to `directory` for a limited to the context block."""
-+    current = os.getcwd()
-+    try:
-+        os.chdir(directory)
-+        yield
-+    finally:
-+        os.chdir(current)
-+
-+
- class TestFunctional(unittest.TestCase):
-     """Functional tests for checking that patman behaves correctly"""
-     leb = (b'Lord Edmund Blackadd\xc3\xabr <weasel@blackadder.org>'.
-@@ -57,8 +74,7 @@ class TestFunctional(unittest.TestCase):
-         Returns:
-             str: Full path to file in the test directory
-         """
--        return os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                            'test', fname)
-+        return TEST_DATA_DIR / fname
- 
-     @classmethod
-     def _get_text(cls, fname):
-@@ -200,6 +216,8 @@ class TestFunctional(unittest.TestCase):
-         text = self._get_text('test01.txt')
-         series = patchstream.get_metadata_for_test(text)
-         cover_fname, args = self._create_patches_for_test(series)
-+        get_maintainer_script = str(pathlib.Path(__file__).parent.parent.parent
-+                                    / 'get_maintainer.pl') + ' --norolestats'
-         with capture_sys_output() as out:
-             patchstream.fix_patches(series, args)
-             if cover_fname and series.get('cover'):
-@@ -207,7 +225,7 @@ class TestFunctional(unittest.TestCase):
-             series.DoChecks()
-             cc_file = series.MakeCcFile(process_tags, cover_fname,
-                                         not ignore_bad_tags, add_maintainers,
--                                        None)
-+                                        None, get_maintainer_script)
-             cmd = gitutil.email_patches(
-                 series, cover_fname, args, dry_run, not ignore_bad_tags,
-                 cc_file, in_reply_to=in_reply_to, thread=None)
-@@ -502,6 +520,37 @@ complicated as possible''')
-         finally:
-             os.chdir(orig_dir)
- 
-+    def test_custom_get_maintainer_script(self):
-+        """Validate that a custom get_maintainer script gets used."""
-+        self.make_git_tree()
-+        with directory_excursion(self.gitdir):
-+            # Setup git.
-+            os.environ['GIT_CONFIG_GLOBAL'] = '/dev/null'
-+            os.environ['GIT_CONFIG_SYSTEM'] = '/dev/null'
-+            tools.run('git', 'config', 'user.name', 'Dummy')
-+            tools.run('git', 'config', 'user.email', 'dumdum@dummy.com')
-+            tools.run('git', 'branch', 'upstream')
-+            tools.run('git', 'branch', '--set-upstream-to=upstream')
-+            tools.run('git', 'add', '.')
-+            tools.run('git', 'commit', '-m', 'new commit')
-+
-+            # Setup patman configuration.
-+            with open('.patman', 'w', buffering=1) as f:
-+                f.write('[settings]\n'
-+                        'get_maintainer_script: dummy-script.sh\n'
-+                        'check_patch: False\n')
-+            with open('dummy-script.sh', 'w', buffering=1) as f:
-+                f.write('#!/usr/bin/env python\n'
-+                        'print("hello@there.com")\n')
-+            os.chmod('dummy-script.sh', 0x555)
-+
-+            # Finally, do the test
-+            with capture_sys_output():
-+                output = tools.run(PATMAN_DIR / 'patman', '--dry-run')
-+                # Assert the email address is part of the dry-run
-+                # output.
-+                self.assertIn('hello@there.com', output)
-+
-     def test_tags(self):
-         """Test collection of tags in a patchstream"""
-         text = '''This is a patch
-diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
-index e1d15ff6ab..f7011be1e4 100644
---- a/tools/patman/get_maintainer.py
-+++ b/tools/patman/get_maintainer.py
-@@ -1,48 +1,61 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2012 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- import os
-+import shlex
-+import shutil
- 
- from patman import command
-+from patman import gitutil
- 
--def find_get_maintainer(try_list):
--    """Look for the get_maintainer.pl script.
- 
--    Args:
--        try_list: List of directories to try for the get_maintainer.pl script
-+def find_get_maintainer(script_file_name):
-+    """Try to find where `script_file_name` is.
- 
--    Returns:
--        If the script is found we'll return a path to it; else None.
-+    It searches in PATH and falls back to a path relative to the top
-+    of the current git repository.
-     """
--    # Look in the list
--    for path in try_list:
--        fname = os.path.join(path, 'get_maintainer.pl')
--        if os.path.isfile(fname):
--            return fname
-+    get_maintainer = shutil.which(script_file_name)
-+    if get_maintainer:
-+        return get_maintainer
-+
-+    git_relative_script = os.path.join(gitutil.get_top_level(),
-+                                       script_file_name)
-+    if os.path.exists(git_relative_script):
-+        return git_relative_script
- 
--    return None
- 
--def get_maintainer(dir_list, fname, verbose=False):
--    """Run get_maintainer.pl on a file if we find it.
-+def get_maintainer(script_file_name, fname, verbose=False):
-+    """Run `script_file_name` on a file.
- 
--    We look for get_maintainer.pl in the 'scripts' directory at the top of
--    git.  If we find it we'll run it.  If we don't find get_maintainer.pl
--    then we fail silently.
-+    `script_file_name` should be a get_maintainer.pl-like script that
-+    takes a patch file name as an input and return the email addresses
-+    of the associated maintainers to standard output, one per line.
-+
-+    If `script_file_name` does not exist we fail silently.
- 
-     Args:
--        dir_list: List of directories to try for the get_maintainer.pl script
--        fname: Path to the patch file to run get_maintainer.pl on.
-+        script_file_name: The file name of the get_maintainer.pl script
-+            (or compatible).
-+        fname: File name of the patch to process with get_maintainer.pl.
- 
-     Returns:
-         A list of email addresses to CC to.
-     """
--    get_maintainer = find_get_maintainer(dir_list)
-+    # Expand `script_file_name` into a file name and its arguments, if
-+    # any.
-+    cmd_args = shlex.split(script_file_name)
-+    file_name = cmd_args[0]
-+    arguments = cmd_args[1:]
-+
-+    get_maintainer = find_get_maintainer(file_name)
-     if not get_maintainer:
-         if verbose:
-             print("WARNING: Couldn't find get_maintainer.pl")
-         return []
- 
--    stdout = command.output(get_maintainer, '--norolestats', fname)
-+    stdout = command.output(get_maintainer, *arguments, fname)
-     lines = stdout.splitlines()
--    return [ x.replace('"', '') for x in lines ]
-+    return [x.replace('"', '') for x in lines]
-diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
-index ceaf2ce150..5e742102c2 100644
---- a/tools/patman/gitutil.py
-+++ b/tools/patman/gitutil.py
-@@ -2,21 +2,19 @@
- # Copyright (c) 2011 The Chromium OS Authors.
- #
- 
--import re
- import os
--import subprocess
- import sys
- 
- from patman import command
- from patman import settings
- from patman import terminal
--from patman import tools
- 
- # True to use --no-decorate - we check this in setup()
- use_no_decorate = True
- 
-+
- def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
--           count=None):
-+            count=None):
-     """Create a command to perform a 'git log'
- 
-     Args:
-@@ -49,6 +47,7 @@ def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
-     cmd.append('--')
-     return cmd
- 
-+
- def count_commits_to_branch(branch):
-     """Returns number of commits between HEAD and the tracking branch.
- 
-@@ -68,13 +67,14 @@ def count_commits_to_branch(branch):
-         rev_range = '@{upstream}..'
-     pipe = [log_cmd(rev_range, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             oneline=True, raise_on_error=False)
-+                              oneline=True, raise_on_error=False)
-     if result.return_code:
-         raise ValueError('Failed to determine upstream: %s' %
-                          result.stderr.strip())
-     patch_count = len(result.stdout.splitlines())
-     return patch_count
- 
-+
- def name_revision(commit_hash):
-     """Gets the revision name for a commit
- 
-@@ -91,6 +91,7 @@ def name_revision(commit_hash):
-     name = stdout.split(' ')[1].strip()
-     return name
- 
-+
- def guess_upstream(git_dir, branch):
-     """Tries to guess the upstream for a branch
- 
-@@ -109,7 +110,7 @@ def guess_upstream(git_dir, branch):
-     """
-     pipe = [log_cmd(branch, git_dir=git_dir, oneline=True, count=100)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Branch '%s' not found" % branch
-     for line in result.stdout.splitlines()[1:]:
-@@ -121,6 +122,7 @@ def guess_upstream(git_dir, branch):
-             return name, "Guessing upstream as '%s'" % name
-     return None, "Cannot find a suitable upstream for branch '%s'" % branch
- 
-+
- def get_upstream(git_dir, branch):
-     """Returns the name of the upstream for a branch
- 
-@@ -135,10 +137,10 @@ def get_upstream(git_dir, branch):
-     """
-     try:
-         remote = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                       'branch.%s.remote' % branch)
-+                                         'branch.%s.remote' % branch)
-         merge = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                      'branch.%s.merge' % branch)
--    except:
-+                                        'branch.%s.merge' % branch)
-+    except Exception:
-         upstream, msg = guess_upstream(git_dir, branch)
-         return upstream, msg
- 
-@@ -149,7 +151,8 @@ def get_upstream(git_dir, branch):
-         return '%s/%s' % (remote, leaf), None
-     else:
-         raise ValueError("Cannot determine upstream branch for branch "
--                "'%s' remote='%s', merge='%s'" % (branch, remote, merge))
-+                         "'%s' remote='%s', merge='%s'"
-+                         % (branch, remote, merge))
- 
- 
- def get_range_in_branch(git_dir, branch, include_upstream=False):
-@@ -168,6 +171,7 @@ def get_range_in_branch(git_dir, branch, include_upstream=False):
-     rstr = '%s%s..%s' % (upstream, '~' if include_upstream else '', branch)
-     return rstr, msg
- 
-+
- def count_commits_in_range(git_dir, range_expr):
-     """Returns the number of commits in the given range.
- 
-@@ -180,12 +184,13 @@ def count_commits_in_range(git_dir, range_expr):
-     """
-     pipe = [log_cmd(range_expr, git_dir=git_dir, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Range '%s' not found or is invalid" % range_expr
-     patch_count = len(result.stdout.splitlines())
-     return patch_count, None
- 
-+
- def count_commits_in_branch(git_dir, branch, include_upstream=False):
-     """Returns the number of commits in the given branch.
- 
-@@ -201,6 +206,7 @@ def count_commits_in_branch(git_dir, branch, include_upstream=False):
-         return None, msg
-     return count_commits_in_range(git_dir, range_expr)
- 
-+
- def count_commits(commit_range):
-     """Returns the number of commits in the given range.
- 
-@@ -215,6 +221,7 @@ def count_commits(commit_range):
-     patch_count = int(stdout)
-     return patch_count
- 
-+
- def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-     """Checkout the selected commit for this build
- 
-@@ -231,10 +238,11 @@ def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-         pipe.append('-f')
-     pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, raise_on_error=False,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git checkout (%s): %s' % (pipe, result.stderr))
- 
-+
- def clone(git_dir, output_dir):
-     """Checkout the selected commit for this build
- 
-@@ -243,10 +251,11 @@ def clone(git_dir, output_dir):
-     """
-     pipe = ['git', 'clone', git_dir, '.']
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git clone: %s' % result.stderr)
- 
-+
- def fetch(git_dir=None, work_tree=None):
-     """Fetch from the origin repo
- 
-@@ -263,6 +272,7 @@ def fetch(git_dir=None, work_tree=None):
-     if result.return_code != 0:
-         raise OSError('git fetch: %s' % result.stderr)
- 
-+
- def check_worktree_is_available(git_dir):
-     """Check if git-worktree functionality is available
- 
-@@ -274,9 +284,10 @@ def check_worktree_is_available(git_dir):
-     """
-     pipe = ['git', '--git-dir', git_dir, 'worktree', 'list']
-     result = command.run_pipe([pipe], capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     return result.return_code == 0
- 
-+
- def add_worktree(git_dir, output_dir, commit_hash=None):
-     """Create and checkout a new git worktree for this build
- 
-@@ -290,10 +301,11 @@ def add_worktree(git_dir, output_dir, commit_hash=None):
-     if commit_hash:
-         pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git worktree add: %s' % result.stderr)
- 
-+
- def prune_worktrees(git_dir):
-     """Remove administrative files for deleted worktrees
- 
-@@ -305,7 +317,8 @@ def prune_worktrees(git_dir):
-     if result.return_code != 0:
-         raise OSError('git worktree prune: %s' % result.stderr)
- 
--def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-+
-+def create_patches(branch, start, count, ignore_binary, series, signoff=True):
-     """Create a series of patches from the top of the current branch.
- 
-     The patch files are written to the current directory using
-@@ -321,9 +334,7 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-         Filename of cover letter (None if none)
-         List of filenames of patch files
-     """
--    if series.get('version'):
--        version = '%s ' % series['version']
--    cmd = ['git', 'format-patch', '-M' ]
-+    cmd = ['git', 'format-patch', '-M']
-     if signoff:
-         cmd.append('--signoff')
-     if ignore_binary:
-@@ -341,9 +352,10 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
- 
-     # We have an extra file if there is a cover letter
-     if series.get('cover'):
--       return files[0], files[1:]
-+        return files[0], files[1:]
-     else:
--       return None, files
-+        return None, files
-+
- 
- def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-     """Build a list of email addresses based on an input list.
-@@ -385,40 +397,43 @@ def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-         raw += lookup_email(item, alias, warn_on_error=warn_on_error)
-     result = []
-     for item in raw:
--        if not item in result:
-+        if item not in result:
-             result.append(item)
-     if tag:
-         return ['%s %s%s%s' % (tag, quote, email, quote) for email in result]
-     return result
- 
-+
- def check_suppress_cc_config():
-     """Check if sendemail.suppresscc is configured correctly.
- 
-     Returns:
-         True if the option is configured correctly, False otherwise.
-     """
--    suppresscc = command.output_one_line('git', 'config', 'sendemail.suppresscc',
--                                       raise_on_error=False)
-+    suppresscc = command.output_one_line(
-+        'git', 'config', 'sendemail.suppresscc', raise_on_error=False)
- 
-     # Other settings should be fine.
-     if suppresscc == 'all' or suppresscc == 'cccmd':
-         col = terminal.Color()
- 
-         print((col.build(col.RED, "error") +
--            ": git config sendemail.suppresscc set to %s\n"  % (suppresscc)) +
--            "  patman needs --cc-cmd to be run to set the cc list.\n" +
--            "  Please run:\n" +
--            "    git config --unset sendemail.suppresscc\n" +
--            "  Or read the man page:\n" +
--            "    git send-email --help\n" +
--            "  and set an option that runs --cc-cmd\n")
-+               ": git config sendemail.suppresscc set to %s\n"
-+               % (suppresscc)) +
-+              "  patman needs --cc-cmd to be run to set the cc list.\n" +
-+              "  Please run:\n" +
-+              "    git config --unset sendemail.suppresscc\n" +
-+              "  Or read the man page:\n" +
-+              "    git send-email --help\n" +
-+              "  and set an option that runs --cc-cmd\n")
-         return False
- 
-     return True
- 
-+
- def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
--        self_only=False, alias=None, in_reply_to=None, thread=False,
--        smtp_server=None):
-+                  self_only=False, alias=None, in_reply_to=None, thread=False,
-+                  smtp_server=None, get_maintainer_script=None):
-     """Email a patch series.
- 
-     Args:
-@@ -435,6 +450,7 @@ def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
-         thread: True to add --thread to git send-email (make
-             all patches reply to cover-letter or first patch in series)
-         smtp_server: SMTP server to use to send patches
-+        get_maintainer_script: File name of script to get maintainers emails
- 
-     Returns:
-         Git command that was/would be run
-@@ -487,9 +503,10 @@ send --cc-cmd cc-fname" cover p1 p2'
-                   "git config sendemail.to u-boot@lists.denx.de")
-             return
-     cc = build_email_list(list(set(series.get('cc')) - set(series.get('to'))),
--                        '--cc', alias, warn_on_error)
-+                          '--cc', alias, warn_on_error)
-     if self_only:
--        to = build_email_list([os.getenv('USER')], '--to', alias, warn_on_error)
-+        to = build_email_list([os.getenv('USER')], '--to',
-+                              alias, warn_on_error)
-         cc = []
-     cmd = ['git', 'send-email', '--annotate']
-     if smtp_server:
-@@ -565,7 +582,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-     if not alias:
-         alias = settings.alias
-     lookup_name = lookup_name.strip()
--    if '@' in lookup_name: # Perhaps a real email address
-+    if '@' in lookup_name:      # Perhaps a real email address
-         return [lookup_name]
- 
-     lookup_name = lookup_name.lower()
-@@ -581,7 +598,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-             return out_list
- 
-     if lookup_name:
--        if not lookup_name in alias:
-+        if lookup_name not in alias:
-             msg = "Alias '%s' not found" % lookup_name
-             if warn_on_error:
-                 print(col.build(col.RED, msg))
-@@ -589,11 +606,12 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-         for item in alias[lookup_name]:
-             todo = lookup_email(item, alias, warn_on_error, level + 1)
-             for new_item in todo:
--                if not new_item in out_list:
-+                if new_item not in out_list:
-                     out_list.append(new_item)
- 
-     return out_list
- 
-+
- def get_top_level():
-     """Return name of top-level directory for this git repo.
- 
-@@ -608,6 +626,7 @@ def get_top_level():
-     """
-     return command.output_one_line('git', 'rev-parse', '--show-toplevel')
- 
-+
- def get_alias_file():
-     """Gets the name of the git alias file.
- 
-@@ -615,7 +634,7 @@ def get_alias_file():
-         Filename of git alias file, or None if none
-     """
-     fname = command.output_one_line('git', 'config', 'sendemail.aliasesfile',
--            raise_on_error=False)
-+                                    raise_on_error=False)
-     if not fname:
-         return None
- 
-@@ -625,6 +644,7 @@ def get_alias_file():
- 
-     return os.path.join(get_top_level(), fname)
- 
-+
- def get_default_user_name():
-     """Gets the user.name from .gitconfig file.
- 
-@@ -634,6 +654,7 @@ def get_default_user_name():
-     uname = command.output_one_line('git', 'config', '--global', 'user.name')
-     return uname
- 
-+
- def get_default_user_email():
-     """Gets the user.email from the global .gitconfig file.
- 
-@@ -643,17 +664,19 @@ def get_default_user_email():
-     uemail = command.output_one_line('git', 'config', '--global', 'user.email')
-     return uemail
- 
-+
- def get_default_subject_prefix():
-     """Gets the format.subjectprefix from local .git/config file.
- 
-     Returns:
-         Subject prefix found in local .git/config file, or None if none
-     """
--    sub_prefix = command.output_one_line('git', 'config', 'format.subjectprefix',
--                 raise_on_error=False)
-+    sub_prefix = command.output_one_line(
-+        'git', 'config', 'format.subjectprefix', raise_on_error=False)
- 
-     return sub_prefix
- 
-+
- def setup():
-     """Set up git utils, by reading the alias files."""
-     # Check for a git alias file also
-@@ -666,6 +689,7 @@ def setup():
-     use_no_decorate = (command.run_pipe([cmd], raise_on_error=False)
-                        .return_code == 0)
- 
-+
- def get_head():
-     """Get the hash of the current HEAD
- 
-@@ -674,6 +698,7 @@ def get_head():
-     """
-     return command.output_one_line('git', 'show', '-s', '--pretty=format:%H')
- 
-+
- if __name__ == "__main__":
-     import doctest
- 
-diff --git a/tools/patman/patman b/tools/patman/patman
-index 11a5d8e18a..5a427d1942 120000
---- a/tools/patman/patman
-+++ b/tools/patman/patman
-@@ -1 +1 @@
--main.py
-\ No newline at end of file
-+__main__.py
-\ No newline at end of file
-diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst
-index 8c5c9cc2cc..6113962fb4 100644
---- a/tools/patman/patman.rst
-+++ b/tools/patman/patman.rst
-@@ -1,6 +1,7 @@
- .. SPDX-License-Identifier: GPL-2.0+
- .. Copyright (c) 2011 The Chromium OS Authors
- .. Simon Glass <sjg@chromium.org>
-+.. Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- .. v1, v2, 19-Oct-11
- .. revised v3 24-Nov-11
- .. revised v4 Independence Day 2020, with Patchwork integration
-@@ -68,13 +69,28 @@ this once::
- 
-     git config sendemail.aliasesfile doc/git-mailrc
- 
--For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles figuring
--out where to send patches pretty well.
-+For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles
-+figuring out where to send patches pretty well. For other projects,
-+you may want to specify a different script to be run, for example via
-+a project-specific `.patman` file::
-+
-+    # .patman configuration file at the root of some project
-+
-+    [settings]
-+    get_maintainer_script: etc/teams.scm get-maintainer
-+
-+The `get_maintainer_script` option corresponds to the
-+`--get-maintainer-script` argument of the `send` command.  It is
-+looked relatively to the root of the current git repository, as well
-+as on PATH.  It can also be provided arguments, as shown above.  The
-+contract is that the script should accept a patch file name and return
-+a list of email addresses, one per line, like `get_maintainer.pl`
-+does.
- 
- During the first run patman creates a config file for you by taking the default
- user name and email address from the global .gitconfig file.
- 
--To add your own, create a file ~/.patman like this::
-+To add your own, create a file `~/.patman` like this::
- 
-     # patman alias file
- 
-@@ -85,6 +101,12 @@ To add your own, create a file ~/.patman like this::
-     wolfgang: Wolfgang Denk <wd@denx.de>
-     others: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net>
- 
-+As hinted above, Patman will also look for a `.patman` configuration
-+file at the root of the current project git repository, which makes it
-+possible to override the `project` settings variable or anything else
-+in a project-specific way. The values of this "local" configuration
-+file take precedence over those of the "global" one.
-+
- Aliases are recursive.
- 
- The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
-@@ -680,6 +702,16 @@ them:
- 
-     $ tools/patman/patman test
- 
-+Note that since the test suite depends on data files only available in
-+the git checkout, the `test` command is hidden unless `patman` is
-+invoked from the U-Boot git repository.
-+
-+Alternatively, you can run the test suite via Pytest:
-+
-+.. code-block:: bash
-+
-+    $ cd tools/patman && pytest
-+
- Error handling doesn't always produce friendly error messages - e.g.
- putting an incorrect tag in a commit may provide a confusing message.
- 
-diff --git a/tools/patman/pytest.ini b/tools/patman/pytest.ini
-new file mode 100644
-index 0000000000..df3eb518d0
---- /dev/null
-+++ b/tools/patman/pytest.ini
-@@ -0,0 +1,2 @@
-+[pytest]
-+addopts = --doctest-modules
-diff --git a/tools/patman/series.py b/tools/patman/series.py
-index 3075378ac1..2eeeef71dc 100644
---- a/tools/patman/series.py
-+++ b/tools/patman/series.py
-@@ -235,7 +235,7 @@ class Series(dict):
-             print(col.build(col.RED, str))
- 
-     def MakeCcFile(self, process_tags, cover_fname, warn_on_error,
--                   add_maintainers, limit):
-+                   add_maintainers, limit, get_maintainer_script):
-         """Make a cc file for us to use for per-commit Cc automation
- 
-         Also stores in self._generated_cc to make ShowActions() faster.
-@@ -249,6 +249,8 @@ class Series(dict):
-                 True/False to call the get_maintainers to CC maintainers
-                 List of maintainers to include (for testing)
-             limit: Limit the length of the Cc list (None if no limit)
-+            get_maintainer_script: The file name of the get_maintainer.pl
-+                script (or compatible).
-         Return:
-             Filename of temp file created
-         """
-@@ -267,8 +269,9 @@ class Series(dict):
-             if type(add_maintainers) == type(cc):
-                 cc += add_maintainers
-             elif add_maintainers:
--                dir_list = [os.path.join(gitutil.get_top_level(), 'scripts')]
--                cc += get_maintainer.get_maintainer(dir_list, commit.patch)
-+
-+                cc += get_maintainer.get_maintainer(get_maintainer_script,
-+                                                    commit.patch)
-             for x in set(cc) & set(settings.bounces):
-                 print(col.build(col.YELLOW, 'Skipping "%s"' % x))
-             cc = list(set(cc) - set(settings.bounces))
-diff --git a/tools/patman/settings.py b/tools/patman/settings.py
-index 903d6fcb0b..636983e32d 100644
---- a/tools/patman/settings.py
-+++ b/tools/patman/settings.py
-@@ -1,18 +1,18 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2011 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- try:
-     import configparser as ConfigParser
--except:
-+except Exception:
-     import ConfigParser
- 
- import argparse
- import os
- import re
- 
--from patman import command
--from patman import tools
-+from patman import gitutil
- 
- """Default settings per-project.
- 
-@@ -32,7 +32,8 @@ _default_settings = {
-     },
- }
- 
--class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-+
-+class _ProjectConfigParser(ConfigParser.ConfigParser):
-     """ConfigParser that handles projects.
- 
-     There are two main goals of this class:
-@@ -83,14 +84,14 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-     def __init__(self, project_name):
-         """Construct _ProjectConfigParser.
- 
--        In addition to standard SafeConfigParser initialization, this also loads
--        project defaults.
-+        In addition to standard ConfigParser initialization, this also
-+        loads project defaults.
- 
-         Args:
-             project_name: The name of the project.
-         """
-         self._project_name = project_name
--        ConfigParser.SafeConfigParser.__init__(self)
-+        ConfigParser.ConfigParser.__init__(self)
- 
-         # Update the project settings in the config based on
-         # the _default_settings global.
-@@ -102,31 +103,31 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-             self.set(project_settings, setting_name, setting_value)
- 
-     def get(self, section, option, *args, **kwargs):
--        """Extend SafeConfigParser to try project_section before section.
-+        """Extend ConfigParser to try project_section before section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         try:
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, "%s_%s" % (self._project_name, section), option,
-                 *args, **kwargs
-             )
-         except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, section, option, *args, **kwargs
-             )
-         return val
- 
-     def items(self, section, *args, **kwargs):
--        """Extend SafeConfigParser to add project_section to section.
-+        """Extend ConfigParser to add project_section to section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         project_items = []
-         has_project_section = False
-@@ -134,7 +135,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get items from the project section
-         try:
--            project_items = ConfigParser.SafeConfigParser.items(
-+            project_items = ConfigParser.ConfigParser.items(
-                 self, "%s_%s" % (self._project_name, section), *args, **kwargs
-             )
-             has_project_section = True
-@@ -143,7 +144,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get top-level items
-         try:
--            top_items = ConfigParser.SafeConfigParser.items(
-+            top_items = ConfigParser.ConfigParser.items(
-                 self, section, *args, **kwargs
-             )
-         except ConfigParser.NoSectionError:
-@@ -155,6 +156,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-         item_dict.update(project_items)
-         return {(item, val) for item, val in item_dict.items()}
- 
-+
- def ReadGitAliases(fname):
-     """Read a git alias file. This is in the form used by git:
- 
-@@ -170,7 +172,7 @@ def ReadGitAliases(fname):
-         print("Warning: Cannot find alias file '%s'" % fname)
-         return
- 
--    re_line = re.compile('alias\s+(\S+)\s+(.*)')
-+    re_line = re.compile(r'alias\s+(\S+)\s+(.*)')
-     for line in fd.readlines():
-         line = line.strip()
-         if not line or line[0] == '#':
-@@ -190,7 +192,8 @@ def ReadGitAliases(fname):
- 
-     fd.close()
- 
--def CreatePatmanConfigFile(gitutil, config_fname):
-+
-+def CreatePatmanConfigFile(config_fname):
-     """Creates a config file under $(HOME)/.patman if it can't find one.
- 
-     Args:
-@@ -200,12 +203,12 @@ def CreatePatmanConfigFile(gitutil, config_fname):
-         None
-     """
-     name = gitutil.get_default_user_name()
--    if name == None:
-+    if name is None:
-         name = input("Enter name: ")
- 
-     email = gitutil.get_default_user_email()
- 
--    if email == None:
-+    if email is None:
-         email = input("Enter email: ")
- 
-     try:
-@@ -220,7 +223,8 @@ me: %s <%s>
- [bounces]
- nxp = Zhikang Zhang <zhikang.zhang@nxp.com>
- ''' % (name, email), file=f)
--    f.close();
-+    f.close()
-+
- 
- def _UpdateDefaults(main_parser, config):
-     """Update the given OptionParser defaults based on config.
-@@ -242,8 +246,8 @@ def _UpdateDefaults(main_parser, config):
-     # Find all the parsers and subparsers
-     parsers = [main_parser]
-     parsers += [subparser for action in main_parser._actions
--                  if isinstance(action, argparse._SubParsersAction)
--                  for _, subparser in action.choices.items()]
-+                if isinstance(action, argparse._SubParsersAction)
-+                for _, subparser in action.choices.items()]
- 
-     # Collect the defaults from each parser
-     defaults = {}
-@@ -270,8 +274,9 @@ def _UpdateDefaults(main_parser, config):
-     # Set all the defaults and manually propagate them to subparsers
-     main_parser.set_defaults(**defaults)
-     for parser, pdefs in zip(parsers, parser_defaults):
--        parser.set_defaults(**{ k: v for k, v in defaults.items()
--                                    if k in pdefs })
-+        parser.set_defaults(**{k: v for k, v in defaults.items()
-+                               if k in pdefs})
-+
- 
- def _ReadAliasFile(fname):
-     """Read in the U-Boot git alias file if it exists.
-@@ -298,6 +303,7 @@ def _ReadAliasFile(fname):
-         if bad_line:
-             print(bad_line)
- 
-+
- def _ReadBouncesFile(fname):
-     """Read in the bounces file if it exists
- 
-@@ -311,6 +317,7 @@ def _ReadBouncesFile(fname):
-                     continue
-                 bounces.add(line.strip())
- 
-+
- def GetItems(config, section):
-     """Get the items from a section of the config.
- 
-@@ -323,31 +330,50 @@ def GetItems(config, section):
-     """
-     try:
-         return config.items(section)
--    except ConfigParser.NoSectionError as e:
-+    except ConfigParser.NoSectionError:
-         return []
--    except:
--        raise
- 
--def Setup(gitutil, parser, project_name, config_fname=''):
-+
-+def Setup(parser, project_name, config_fname=None):
-     """Set up the settings module by reading config files.
- 
-+    Unless `config_fname` is specified, a `.patman` config file local
-+    to the git repository is consulted, followed by the global
-+    `$HOME/.patman`. If none exists, the later is created. Values
-+    defined in the local config file take precedence over those
-+    defined in the global one.
-+
-     Args:
--        parser:         The parser to update
-+        parser:         The parser to update.
-         project_name:   Name of project that we're working on; we'll look
-             for sections named "project_section" as well.
--        config_fname:   Config filename to read ('' for default)
-+        config_fname:   Config filename to read.  An error is raised if it
-+            does not exist.
-     """
-     # First read the git alias file if available
-     _ReadAliasFile('doc/git-mailrc')
-     config = _ProjectConfigParser(project_name)
--    if config_fname == '':
-+
-+    if config_fname and not os.path.exists(config_fname):
-+        raise Exception(f'provided {config_fname} does not exist')
-+
-+    if not config_fname:
-         config_fname = '%s/.patman' % os.getenv('HOME')
-+    has_config = os.path.exists(config_fname)
-+
-+    git_local_config_fname = os.path.join(gitutil.get_top_level(), '.patman')
-+    has_git_local_config = os.path.exists(git_local_config_fname)
- 
--    if not os.path.exists(config_fname):
--        print("No config file found ~/.patman\nCreating one...\n")
--        CreatePatmanConfigFile(gitutil, config_fname)
-+    # Read the git local config last, so that its values override
-+    # those of the global config, if any.
-+    if has_config:
-+        config.read(config_fname)
-+    if has_git_local_config:
-+        config.read(git_local_config_fname)
- 
--    config.read(config_fname)
-+    if not (has_config or has_git_local_config):
-+        print("No config file found.\nCreating ~/.patman...\n")
-+        CreatePatmanConfigFile(config_fname)
- 
-     for name, value in GetItems(config, 'alias'):
-         alias[name] = value.split(',')
-@@ -358,6 +384,7 @@ def Setup(gitutil, parser, project_name, config_fname=''):
- 
-     _UpdateDefaults(parser, config)
- 
-+
- # These are the aliases we understand, indexed by alias. Each member is a list.
- alias = {}
- bounces = set()
-diff --git a/tools/patman/setup.py b/tools/patman/setup.py
-index 5643bf1503..2ff791da0f 100644
---- a/tools/patman/setup.py
-+++ b/tools/patman/setup.py
-@@ -7,6 +7,6 @@ setup(name='patman',
-       scripts=['patman'],
-       packages=['patman'],
-       package_dir={'patman': ''},
--      package_data={'patman': ['README']},
-+      package_data={'patman': ['README.rst']},
-       classifiers=['Environment :: Console',
-                    'Topic :: Software Development'])
-diff --git a/tools/patman/test_settings.py b/tools/patman/test_settings.py
-new file mode 100644
-index 0000000000..c768a2fc64
---- /dev/null
-+++ b/tools/patman/test_settings.py
-@@ -0,0 +1,67 @@
-+# SPDX-License-Identifier: GPL-2.0+
-+#
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
-+#
-+
-+import argparse
-+import contextlib
-+import os
-+import sys
-+import tempfile
-+
-+from patman import settings
-+from patman import tools
-+
-+
-+@contextlib.contextmanager
-+def empty_git_repository():
-+    with tempfile.TemporaryDirectory() as tmpdir:
-+        os.chdir(tmpdir)
-+        tools.run('git', 'init', raise_on_error=True)
-+        yield tmpdir
-+
-+
-+@contextlib.contextmanager
-+def cleared_command_line_args():
-+    old_value = sys.argv[:]
-+    sys.argv = [sys.argv[0]]
-+    try:
-+        yield
-+    finally:
-+        sys.argv = old_value
-+
-+
-+def test_git_local_config():
-+    # Clearing the command line arguments is required, otherwise
-+    # arguments passed to the test running such as in 'pytest -k
-+    # filter' would be processed by _UpdateDefaults and fail.
-+    with cleared_command_line_args():
-+        with empty_git_repository():
-+            with tempfile.NamedTemporaryFile() as global_config:
-+                global_config.write(b'[settings]\n'
-+                                    b'project=u-boot\n')
-+                global_config.flush()
-+                parser = argparse.ArgumentParser()
-+                parser.add_argument('-p', '--project', default='unknown')
-+                subparsers = parser.add_subparsers(dest='cmd')
-+                send = subparsers.add_parser('send')
-+                send.add_argument('--no-check', action='store_false',
-+                                  dest='check_patch', default=True)
-+
-+                # Test "global" config is used.
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'u-boot'
-+                send_args, _ = send.parse_known_args([])
-+                assert send_args.check_patch
-+
-+                # Test local config can shadow it.
-+                with open('.patman', 'w', buffering=1) as f:
-+                    f.write('[settings]\n'
-+                            'project: guix-patches\n'
-+                            'check_patch: False\n')
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'guix-patches'
-+                send_args, _ = send.parse_known_args([])
-+                assert not send_args.check_patch
diff --git a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
index a5b92e3e8f..858f42efe7 100644
--- a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
+++ b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
@@ -5,12 +5,12 @@ Index: u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
 ===================================================================
 --- u-boot-2021.07~rc4+dfsg.orig/include/configs/sifive-unmatched.h
 +++ u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
-@@ -62,6 +62,8 @@
+@@ -55,6 +55,8 @@
  	"name=system,size=-,bootable,type=${type_guid_gpt_system};"
  
- #define CONFIG_EXTRA_ENV_SETTINGS \
+ #define CFG_EXTRA_ENV_SETTINGS \
 +	"fdt_high=0xffffffffffffffff\0" \
 +	"initrd_high=0xffffffffffffffff\0" \
  	"kernel_addr_r=0x84000000\0" \
- 	"fdt_addr_r=0x88000000\0" \
- 	"scriptaddr=0x88100000\0" \
+ 	"kernel_comp_addr_r=0x88000000\0" \
+ 	"kernel_comp_size=0x4000000\0" \
-- 
2.39.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] WIP update u-boot to 2023.07-rc5
  2023-07-03  1:26 ` [bug#64149] WIP update u-boot to 2023.07-rc5 Vagrant Cascadian
@ 2023-07-04 22:59   ` Vagrant Cascadian
  2023-07-05  1:10     ` Vagrant Cascadian
  0 siblings, 1 reply; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-04 22:59 UTC (permalink / raw)
  To: 64149; +Cc: ludo, efraim

[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]

On 2023-07-02, Vagrant Cascadian wrote:
> On 2023-06-18, Vagrant Cascadian wrote:
>> The attached patch updates u-boot to 2023.07-rc4... though mostly just
>> getting this patch out there for review purposes, but should probably
>> wait until 2023.07 is released in July. Alternately, could try to update
>> to 2023.04, although honestly that version had quite a few issues in
>> Debian and might be best skipped!
>
> This patch updates to 2023.07-rc5.
>
> 2023.07 is scheduled for upstream release tomorrow.

Postponed another week, 2023.07-rc6 came out yesterday instead...


>> Builds most of the u-boot-* packages successfully, notable issues are
>> with u-boot-tools failing to build

u-boot-tools needs some updates to the patch disabling openssl
support...


>> , and unable to cross-build
>> u-boot-puma-rk3399 and u-boot-rockpro64-rk3399 due to the dependency on
>> python-pyelftools not being cross-buildable ... though
>> u-boot-pinebook-pro-rk3399 uses python-pyelftools just fine, somehow?!
>
> Still similarly broken.

Still a bit baffled by this, but maybe I can get a machine running on a
native build at least...


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] WIP update u-boot to 2023.07-rc5
  2023-07-04 22:59   ` Vagrant Cascadian
@ 2023-07-05  1:10     ` Vagrant Cascadian
  2023-07-05  1:13       ` Vagrant Cascadian
  0 siblings, 1 reply; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-05  1:10 UTC (permalink / raw)
  To: 64149; +Cc: ludo, efraim


[-- Attachment #1.1: Type: text/plain, Size: 1683 bytes --]

On 2023-07-04, Vagrant Cascadian wrote:
> On 2023-07-02, Vagrant Cascadian wrote:
>> On 2023-06-18, Vagrant Cascadian wrote:
>>> The attached patch updates u-boot to 2023.07-rc4... though mostly just
>>> getting this patch out there for review purposes, but should probably
>>> wait until 2023.07 is released in July. Alternately, could try to update
>>> to 2023.04, although honestly that version had quite a few issues in
>>> Debian and might be best skipped!
>>
>> This patch updates to 2023.07-rc5.
>>
>> 2023.07 is scheduled for upstream release tomorrow.
>
> Postponed another week, 2023.07-rc6 came out yesterday instead...

Updated patch to 2023.07-rc6 and fixed some things!


>>> Builds most of the u-boot-* packages successfully, notable issues are
>>> with u-boot-tools failing to build
>
> u-boot-tools needs some updates to the patch disabling openssl
> support...

Still needed, although I find it strange that we are running the u-boot
testsuite with the u-boot-tools package... as it mostly runs tests for
the u-boot-sandbox targets rather than the tools... seems much more
appropriate for the...  u-boot-sandbox package? :)

At any rate, whereever the tests are run from, it appears to also need
the python-filelock package as an input, as well as patching out
CONFIG_*_SIGNATURE and/or related variables... still poking at that.


>>> , and unable to cross-build
>>> u-boot-puma-rk3399 and u-boot-rockpro64-rk3399 due to the dependency on
>>> python-pyelftools not being cross-buildable ... though
>>> u-boot-pinebook-pro-rk3399 uses python-pyelftools just fine, somehow?!
>>
>> Still similarly broken.

These two are fixed with this patch!


live well,
  vagrant

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0002-gnu-u-boot-Update-to-2023.07-rc6.patch --]
[-- Type: text/x-diff, Size: 63452 bytes --]

From 4688e5ab3961a4c10c1f13ce9beea148d4959f3f Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Sun, 2 Jul 2023 18:20:39 -0700
Subject: [PATCH 2/2] gnu: u-boot: Update to 2023.07-rc6.

* gnu/packages/patches/u-boot-infodocs-target.patch: Remove file.
* gnu/packages/patches/u-boot-patman-guix-integration.patch: Remove file.
* gnu/local.mk: Remove patches.
* gnu/packages/patches/u-boot-allow-disabling-openssl.patch: Refresh.
* gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch: Refresh.
* gnu/packages/bootloaders.scm (u-boot): Update to 2023.07-rc6.
[native-inputs]: Add python-pyelftools.
[source]: Remove patches.
(u-boot-tools): Update substitution for python3-coverage.
(make-u-boot-sunxi64-package): Set SCP environment variable.
(u-boot-sifive-unleashed): Update to use opensbi.
(u-boot-puma-rk3399)[inputs]: Add arm-trusted-firmware-rk3399 to
package-inputs instead of native-inputs.
(u-boot-rockpro64-rk3399)[phases]: Add 'disable-spl-fit-signature.
---
 gnu/local.mk                                  |    2 -
 gnu/packages/bootloaders.scm                  |   40 +-
 .../u-boot-allow-disabling-openssl.patch      |   13 +-
 .../patches/u-boot-infodocs-target.patch      |   84 --
 .../u-boot-patman-guix-integration.patch      | 1244 -----------------
 ...boot-sifive-prevent-reloc-initrd-fdt.patch |    8 +-
 6 files changed, 41 insertions(+), 1350 deletions(-)
 delete mode 100644 gnu/packages/patches/u-boot-infodocs-target.patch
 delete mode 100644 gnu/packages/patches/u-boot-patman-guix-integration.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 6470f1abd4..fe46cd58f2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1997,8 +1997,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
-  %D%/packages/patches/u-boot-infodocs-target.patch		\
-  %D%/packages/patches/u-boot-patman-guix-integration.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index a9685a9ef9..0106808bfb 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -648,23 +648,21 @@ (define %u-boot-rk3399-enable-emmc-phy-patch
 (define u-boot
   (package
     (name "u-boot")
-    (version "2022.10")
+    (version "2023.07-rc6")
     (source (origin
               (patches
                (list %u-boot-rockchip-inno-usb-patch
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
                      %u-boot-rk3399-enable-emmc-phy-patch
-                     (search-patch "u-boot-fix-build-python-3.10.patch")
-                     (search-patch "u-boot-infodocs-target.patch")
-                     (search-patch "u-boot-patman-guix-integration.patch")))
+                     (search-patch "u-boot-fix-build-python-3.10.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
                     "u-boot-" version ".tar.bz2"))
               (sha256
                (base32
-                "1y5x8vxdgsqdqlsvq01mn8lmw53fqairkhvhhjx83hjva0m4id2h"))))
+                "1dgvr228imbhzq7vzr8iialijl3k4mhjdirjrm6hsy6qbm6jyj5r"))))
     (build-system  gnu-build-system)
     (native-inputs
      (list bison
@@ -676,6 +674,7 @@ (define u-boot
            perl
            pkg-config                   ;for 'make menuconfig'
            python
+           python-pyelftools
            swig
            (list util-linux "lib")))
     (home-page "https://www.denx.de/wiki/U-Boot/")
@@ -739,7 +738,7 @@ (define-public u-boot-tools
                (("/bin/false") (which "false")))
              (substitute* "tools/dtoc/fdt_util.py"
                (("'cc'") "'gcc'"))
-             (substitute* "tools/patman/test_util.py"
+             (substitute* "tools/u_boot_pylib/test_util.py"
                ;; python3-coverage is simply called coverage in guix.
                (("python3-coverage") "coverage")
 
@@ -1009,6 +1008,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
           #~(modify-phases #$phases
               (add-after 'unpack 'set-environment
                 (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
+                  (setenv "SCP" "/dev/null")
                   (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
       (inputs
        (modify-inputs (package-inputs base)
@@ -1104,7 +1105,7 @@ (define-public u-boot-puma-rk3399
               (delete 'strip)
               (delete 'validate-runpath)))))
       (inputs
-       (modify-inputs (package-native-inputs base)
+       (modify-inputs (package-inputs base)
          (append arm-trusted-firmware-rk3399))))))
 
 (define-public u-boot-qemu-arm
@@ -1170,7 +1171,20 @@ (define-public u-boot-sandbox
                 (append sdl2))))))
 
 (define-public u-boot-sifive-unleashed
-  (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu"))
+  (let ((base (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu")))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'set-environment
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (setenv "OPENSBI" (search-input-file inputs
+                                                       "fw_dynamic.bin"))))))))
+      (inputs
+       (modify-inputs (package-inputs base)
+         (append opensbi-generic))))))
 
 (define-public u-boot-sifive-unmatched
   (let ((base (make-u-boot-package "sifive_unmatched" "riscv64-linux-gnu")))
@@ -1230,7 +1244,8 @@ (define-public u-boot-rockpro64-rk3399
                                                "CONFIG_SATA_SIL=y"
                                                "CONFIG_SCSI=y"
                                                "CONFIG_SCSI_AHCI=y"
-                                               "CONFIG_DM_SCSI=y"))))
+                                               "CONFIG_DM_SCSI=y"
+                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
     (package
       (inherit base)
       (arguments
@@ -1240,6 +1255,13 @@ (define-public u-boot-rockpro64-rk3399
               (add-after 'unpack 'set-environment
                 (lambda* (#:key inputs #:allow-other-keys)
                   (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
+              ;; Disable SPL FIT signatures, due to GPLv2 and Openssl license
+              ;; incompatibilities
+              (add-after 'unpack 'disable-spl-fit-signature
+                (lambda _
+                  (substitute* "configs/rockpro64-rk3399_defconfig"
+                    (("CONFIG_SPL_FIT_SIGNATURE=y")
+                     "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
               (add-after 'unpack 'patch-header
                 (lambda _
                   (substitute* "include/config_distro_bootcmd.h"
diff --git a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
index 5f2856dbb4..5195a7a6f8 100644
--- a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
+++ b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
@@ -128,29 +128,28 @@ index 94b7685392..eec599b0ee 100644
  	datai = 0;
  	for (cfgi = 0; cfgi < cfgn; cfgi++) {
  		e = &image_cfg[cfgi];
-@@ -1552,9 +1568,11 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
+@@ -1624,10 +1640,12 @@ static void *image_create_v1(size_t *dataoff, struct image_tool_params *params,
  					      &datai, delay);
  	}
  
 +#if defined(CONFIG_KWB_SECURE)
- 	if (secure_hdr && add_secure_header_v1(params, ptr, payloadsz + headersz,
- 					       headersz, image, secure_hdr))
+ 	if (secure_hdr && add_secure_header_v1(params, ptr + *dataoff, payloadsz,
+ 					       image, headersz, secure_hdr))
  		return NULL;
 +#endif
  
- 	*imagesz = headersz;
+ 	/* Calculate and set the header checksum */
+ 	main_hdr->checksum = image_checksum8(main_hdr, headersz);
  
 --- a/tools/image-host.c
 +++ b/tools/image-host.c
-@@ -14,10 +14,12 @@
+@@ -14,8 +14,10 @@
  #include <image.h>
  #include <version.h>
  
 +#ifdef CONFIG_FIT_PRELOAD
  #include <openssl/pem.h>
  #include <openssl/evp.h>
- 
- #define IMAGE_PRE_LOAD_PATH                             "/image/pre-load/sig"
 +#endif
  
  /**
diff --git a/gnu/packages/patches/u-boot-infodocs-target.patch b/gnu/packages/patches/u-boot-infodocs-target.patch
deleted file mode 100644
index 5b21a99de3..0000000000
--- a/gnu/packages/patches/u-boot-infodocs-target.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-Upstream status: https://patchwork.ozlabs.org/project/uboot/list/?series=333259
-
-diff --git a/Makefile b/Makefile
-index de5746399a..597a8886c3 100644
---- a/Makefile
-+++ b/Makefile
-@@ -2372,7 +2372,7 @@ tcheck:
- # Documentation targets
- # ---------------------------------------------------------------------------
- DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
--	       linkcheckdocs dochelp refcheckdocs
-+	       linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
- PHONY += $(DOC_TARGETS)
- $(DOC_TARGETS): scripts_basic FORCE
- 	$(Q)$(MAKE) $(build)=doc $@
-diff --git a/doc/Makefile b/doc/Makefile
-index f5de65e927..d0904a9f99 100644
---- a/doc/Makefile
-+++ b/doc/Makefile
-@@ -69,6 +69,14 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
- htmldocs:
- 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
- 
-+texinfodocs:
-+	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,texinfo,$(var),texinfo,$(var)))
-+
-+# Note: the 'info' Make target is generated by sphinx itself when
-+# running the texinfodocs target defined above.
-+infodocs: texinfodocs
-+	$(MAKE) -C $(BUILDDIR)/texinfo info
-+
- linkcheckdocs:
- 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
- 
-@@ -109,6 +117,8 @@ cleandocs:
- dochelp:
- 	@echo  ' U-Boot documentation in different formats from ReST:'
- 	@echo  '  htmldocs        - HTML'
-+	@echo  '  texinfodocs     - Texinfo'
-+	@echo  '  infodocs        - Info'
- 	@echo  '  latexdocs       - LaTeX'
- 	@echo  '  pdfdocs         - PDF'
- 	@echo  '  epubdocs        - EPUB'
-diff --git a/doc/conf.py b/doc/conf.py
-index 62c8d31270..3db70f80c1 100644
---- a/doc/conf.py
-+++ b/doc/conf.py
-@@ -449,7 +449,7 @@ for fn in os.listdir('.'):
- # One entry per manual page. List of tuples
- # (source start file, name, description, authors, manual section).
- man_pages = [
--    (master_doc, 'dasuboot', 'The U-Boot Documentation',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-      [author], 1)
- ]
- 
-@@ -463,8 +463,8 @@ man_pages = [
- # (source start file, target name, title, author,
- #  dir menu entry, description, category)
- texinfo_documents = [
--    (master_doc, 'DasUBoot', 'The U-Boot Documentation',
--     author, 'DasUBoot', 'One line description of project.',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-+     author, 'U-Boot', 'Boot loader for embedded systems',
-      'Miscellaneous'),
- ]
- 
-diff --git a/doc/media/Makefile b/doc/media/Makefile
-index b9b43a34c3..9b32258696 100644
---- a/doc/media/Makefile
-+++ b/doc/media/Makefile
-@@ -22,10 +22,11 @@ $(BUILDDIR)/linker_lists.h.rst: ${API}/linker_lists.h ${PARSER} $(SRC_DIR)/linke
- 
- # Media build rules
- 
--.PHONY: all html epub xml latex
-+.PHONY: all html texinfo epub xml latex
- 
- all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
- html: all
-+texinfo: all
- epub: all
- xml: all
- latex: $(IMGPDF) all
diff --git a/gnu/packages/patches/u-boot-patman-guix-integration.patch b/gnu/packages/patches/u-boot-patman-guix-integration.patch
deleted file mode 100644
index 3472656c99..0000000000
--- a/gnu/packages/patches/u-boot-patman-guix-integration.patch
+++ /dev/null
@@ -1,1244 +0,0 @@
-These changes correspond to commits 9ff7500ace..3154de3dd6 already merged to
-the u-boot-dm custodian repo (at
-https://source.denx.de/u-boot/custodians/u-boot-dm/-/commits/next), scheduled
-to be pulled after the next release.
-
-diff --git a/tools/patman/__init__.py b/tools/patman/__init__.py
-index c9d3e35052..1b98ec7fee 100644
---- a/tools/patman/__init__.py
-+++ b/tools/patman/__init__.py
-@@ -1,6 +1,6 @@
- # SPDX-License-Identifier: GPL-2.0+
- 
- __all__ = ['checkpatch', 'command', 'commit', 'control', 'cros_subprocess',
--           'func_test', 'get_maintainer', 'gitutil', 'main', 'patchstream',
-+           'func_test', 'get_maintainer', 'gitutil', '__main__', 'patchstream',
-            'project', 'series', 'setup', 'settings', 'terminal',
-            'test_checkpatch', 'test_util', 'tools', 'tout']
-diff --git a/tools/patman/main.py b/tools/patman/__main__.py
-similarity index 89%
-rename from tools/patman/main.py
-rename to tools/patman/__main__.py
-index 8067a288ab..749e6348b6 100755
---- a/tools/patman/main.py
-+++ b/tools/patman/__main__.py
-@@ -7,6 +7,7 @@
- """See README for more information"""
- 
- from argparse import ArgumentParser
-+import importlib.resources
- import os
- import re
- import sys
-@@ -19,6 +20,7 @@ if __name__ == "__main__":
- 
- # Our modules
- from patman import control
-+from patman import func_test
- from patman import gitutil
- from patman import project
- from patman import settings
-@@ -53,7 +55,8 @@ parser.add_argument('-H', '--full-help', action='store_true', dest='full_help',
-                     default=False, help='Display the README file')
- 
- subparsers = parser.add_subparsers(dest='cmd')
--send = subparsers.add_parser('send')
-+send = subparsers.add_parser(
-+    'send', help='Format, check and email patches (default command)')
- send.add_argument('-i', '--ignore-errors', action='store_true',
-        dest='ignore_errors', default=False,
-        help='Send patches email even if patch errors are found')
-@@ -62,6 +65,12 @@ send.add_argument('-l', '--limit-cc', dest='limit', type=int, default=None,
- send.add_argument('-m', '--no-maintainers', action='store_false',
-        dest='add_maintainers', default=True,
-        help="Don't cc the file maintainers automatically")
-+send.add_argument(
-+    '--get-maintainer-script', dest='get_maintainer_script', type=str,
-+    action='store',
-+    default=os.path.join(gitutil.get_top_level(), 'scripts',
-+                         'get_maintainer.pl') + ' --norolestats',
-+    help='File name of the get_maintainer.pl (or compatible) script.')
- send.add_argument('-n', '--dry-run', action='store_true', dest='dry_run',
-        default=False, help="Do a dry run (create but don't email patches)")
- send.add_argument('-r', '--in-reply-to', type=str, action='store',
-@@ -94,9 +103,11 @@ send.add_argument('--smtp-server', type=str,
- 
- send.add_argument('patchfiles', nargs='*')
- 
--test_parser = subparsers.add_parser('test', help='Run tests')
--test_parser.add_argument('testname', type=str, default=None, nargs='?',
--                         help="Specify the test to run")
-+# Only add the 'test' action if the test data files are available.
-+if os.path.exists(func_test.TEST_DATA_DIR):
-+    test_parser = subparsers.add_parser('test', help='Run tests')
-+    test_parser.add_argument('testname', type=str, default=None, nargs='?',
-+                             help="Specify the test to run")
- 
- status = subparsers.add_parser('status',
-                                help='Check status of patches in patchwork')
-@@ -113,7 +124,7 @@ status.add_argument('-f', '--force', action='store_true',
- argv = sys.argv[1:]
- args, rest = parser.parse_known_args(argv)
- if hasattr(args, 'project'):
--    settings.Setup(gitutil, parser, args.project, '')
-+    settings.Setup(parser, args.project)
-     args, rest = parser.parse_known_args(argv)
- 
- # If we have a command, it is safe to parse all arguments
-@@ -160,11 +171,8 @@ elif args.cmd == 'send':
-         fd.close()
- 
-     elif args.full_help:
--        tools.print_full_help(
--            os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                         'README.rst')
--        )
--
-+        with importlib.resources.path('patman', 'README.rst') as readme:
-+            tools.print_full_help(str(readme))
-     else:
-         # If we are not processing tags, no need to warning about bad ones
-         if not args.process_tags:
-diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
-index d1b902dd96..012c0d895c 100644
---- a/tools/patman/checkpatch.py
-+++ b/tools/patman/checkpatch.py
-@@ -211,7 +211,7 @@ def check_patch(fname, verbose=False, show_types=False, use_tree=False):
-             stdout: Full output of checkpatch
-     """
-     chk = find_check_patch()
--    args = [chk]
-+    args = [chk, '--u-boot', '--strict']
-     if not use_tree:
-         args.append('--no-tree')
-     if show_types:
-diff --git a/tools/patman/control.py b/tools/patman/control.py
-index bf426cf7bc..38e98dab84 100644
---- a/tools/patman/control.py
-+++ b/tools/patman/control.py
-@@ -94,8 +94,8 @@ def check_patches(series, patch_files, run_checkpatch, verbose, use_tree):
- 
- 
- def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
--                  ignore_bad_tags, add_maintainers, limit, dry_run, in_reply_to,
--                  thread, smtp_server):
-+                  ignore_bad_tags, add_maintainers, get_maintainer_script, limit,
-+                  dry_run, in_reply_to, thread, smtp_server):
-     """Email patches to the recipients
- 
-     This emails out the patches and cover letter using 'git send-email'. Each
-@@ -123,6 +123,8 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         ignore_bad_tags (bool): True to just print a warning for unknown tags,
-             False to halt with an error
-         add_maintainers (bool): Run the get_maintainer.pl script for each patch
-+        get_maintainer_script (str): The script used to retrieve which
-+            maintainers to cc
-         limit (int): Limit on the number of people that can be cc'd on a single
-             patch or the cover letter (None if no limit)
-         dry_run (bool): Don't actually email the patches, just print out what
-@@ -134,7 +136,7 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         smtp_server (str): SMTP server to use to send patches (None for default)
-     """
-     cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags,
--                                add_maintainers, limit)
-+                                add_maintainers, limit, get_maintainer_script)
- 
-     # Email the patches out (giving the user time to check / cancel)
-     cmd = ''
-@@ -174,8 +176,8 @@ def send(args):
-     email_patches(
-         col, series, cover_fname, patch_files, args.process_tags,
-         its_a_go, args.ignore_bad_tags, args.add_maintainers,
--        args.limit, args.dry_run, args.in_reply_to, args.thread,
--        args.smtp_server)
-+        args.get_maintainer_script, args.limit, args.dry_run,
-+        args.in_reply_to, args.thread, args.smtp_server)
- 
- def patchwork_status(branch, count, start, end, dest_branch, force,
-                      show_comments, url):
-diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
-index 7b92bc67be..c25a47bdeb 100644
---- a/tools/patman/func_test.py
-+++ b/tools/patman/func_test.py
-@@ -6,7 +6,9 @@
- 
- """Functional tests for checking that patman behaves correctly"""
- 
-+import contextlib
- import os
-+import pathlib
- import re
- import shutil
- import sys
-@@ -28,6 +30,21 @@ from patman.test_util import capture_sys_output
- import pygit2
- from patman import status
- 
-+PATMAN_DIR = pathlib.Path(__file__).parent
-+TEST_DATA_DIR = PATMAN_DIR / 'test/'
-+
-+
-+@contextlib.contextmanager
-+def directory_excursion(directory):
-+    """Change directory to `directory` for a limited to the context block."""
-+    current = os.getcwd()
-+    try:
-+        os.chdir(directory)
-+        yield
-+    finally:
-+        os.chdir(current)
-+
-+
- class TestFunctional(unittest.TestCase):
-     """Functional tests for checking that patman behaves correctly"""
-     leb = (b'Lord Edmund Blackadd\xc3\xabr <weasel@blackadder.org>'.
-@@ -57,8 +74,7 @@ class TestFunctional(unittest.TestCase):
-         Returns:
-             str: Full path to file in the test directory
-         """
--        return os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                            'test', fname)
-+        return TEST_DATA_DIR / fname
- 
-     @classmethod
-     def _get_text(cls, fname):
-@@ -200,6 +216,8 @@ class TestFunctional(unittest.TestCase):
-         text = self._get_text('test01.txt')
-         series = patchstream.get_metadata_for_test(text)
-         cover_fname, args = self._create_patches_for_test(series)
-+        get_maintainer_script = str(pathlib.Path(__file__).parent.parent.parent
-+                                    / 'get_maintainer.pl') + ' --norolestats'
-         with capture_sys_output() as out:
-             patchstream.fix_patches(series, args)
-             if cover_fname and series.get('cover'):
-@@ -207,7 +225,7 @@ class TestFunctional(unittest.TestCase):
-             series.DoChecks()
-             cc_file = series.MakeCcFile(process_tags, cover_fname,
-                                         not ignore_bad_tags, add_maintainers,
--                                        None)
-+                                        None, get_maintainer_script)
-             cmd = gitutil.email_patches(
-                 series, cover_fname, args, dry_run, not ignore_bad_tags,
-                 cc_file, in_reply_to=in_reply_to, thread=None)
-@@ -502,6 +520,37 @@ complicated as possible''')
-         finally:
-             os.chdir(orig_dir)
- 
-+    def test_custom_get_maintainer_script(self):
-+        """Validate that a custom get_maintainer script gets used."""
-+        self.make_git_tree()
-+        with directory_excursion(self.gitdir):
-+            # Setup git.
-+            os.environ['GIT_CONFIG_GLOBAL'] = '/dev/null'
-+            os.environ['GIT_CONFIG_SYSTEM'] = '/dev/null'
-+            tools.run('git', 'config', 'user.name', 'Dummy')
-+            tools.run('git', 'config', 'user.email', 'dumdum@dummy.com')
-+            tools.run('git', 'branch', 'upstream')
-+            tools.run('git', 'branch', '--set-upstream-to=upstream')
-+            tools.run('git', 'add', '.')
-+            tools.run('git', 'commit', '-m', 'new commit')
-+
-+            # Setup patman configuration.
-+            with open('.patman', 'w', buffering=1) as f:
-+                f.write('[settings]\n'
-+                        'get_maintainer_script: dummy-script.sh\n'
-+                        'check_patch: False\n')
-+            with open('dummy-script.sh', 'w', buffering=1) as f:
-+                f.write('#!/usr/bin/env python\n'
-+                        'print("hello@there.com")\n')
-+            os.chmod('dummy-script.sh', 0x555)
-+
-+            # Finally, do the test
-+            with capture_sys_output():
-+                output = tools.run(PATMAN_DIR / 'patman', '--dry-run')
-+                # Assert the email address is part of the dry-run
-+                # output.
-+                self.assertIn('hello@there.com', output)
-+
-     def test_tags(self):
-         """Test collection of tags in a patchstream"""
-         text = '''This is a patch
-diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
-index e1d15ff6ab..f7011be1e4 100644
---- a/tools/patman/get_maintainer.py
-+++ b/tools/patman/get_maintainer.py
-@@ -1,48 +1,61 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2012 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- import os
-+import shlex
-+import shutil
- 
- from patman import command
-+from patman import gitutil
- 
--def find_get_maintainer(try_list):
--    """Look for the get_maintainer.pl script.
- 
--    Args:
--        try_list: List of directories to try for the get_maintainer.pl script
-+def find_get_maintainer(script_file_name):
-+    """Try to find where `script_file_name` is.
- 
--    Returns:
--        If the script is found we'll return a path to it; else None.
-+    It searches in PATH and falls back to a path relative to the top
-+    of the current git repository.
-     """
--    # Look in the list
--    for path in try_list:
--        fname = os.path.join(path, 'get_maintainer.pl')
--        if os.path.isfile(fname):
--            return fname
-+    get_maintainer = shutil.which(script_file_name)
-+    if get_maintainer:
-+        return get_maintainer
-+
-+    git_relative_script = os.path.join(gitutil.get_top_level(),
-+                                       script_file_name)
-+    if os.path.exists(git_relative_script):
-+        return git_relative_script
- 
--    return None
- 
--def get_maintainer(dir_list, fname, verbose=False):
--    """Run get_maintainer.pl on a file if we find it.
-+def get_maintainer(script_file_name, fname, verbose=False):
-+    """Run `script_file_name` on a file.
- 
--    We look for get_maintainer.pl in the 'scripts' directory at the top of
--    git.  If we find it we'll run it.  If we don't find get_maintainer.pl
--    then we fail silently.
-+    `script_file_name` should be a get_maintainer.pl-like script that
-+    takes a patch file name as an input and return the email addresses
-+    of the associated maintainers to standard output, one per line.
-+
-+    If `script_file_name` does not exist we fail silently.
- 
-     Args:
--        dir_list: List of directories to try for the get_maintainer.pl script
--        fname: Path to the patch file to run get_maintainer.pl on.
-+        script_file_name: The file name of the get_maintainer.pl script
-+            (or compatible).
-+        fname: File name of the patch to process with get_maintainer.pl.
- 
-     Returns:
-         A list of email addresses to CC to.
-     """
--    get_maintainer = find_get_maintainer(dir_list)
-+    # Expand `script_file_name` into a file name and its arguments, if
-+    # any.
-+    cmd_args = shlex.split(script_file_name)
-+    file_name = cmd_args[0]
-+    arguments = cmd_args[1:]
-+
-+    get_maintainer = find_get_maintainer(file_name)
-     if not get_maintainer:
-         if verbose:
-             print("WARNING: Couldn't find get_maintainer.pl")
-         return []
- 
--    stdout = command.output(get_maintainer, '--norolestats', fname)
-+    stdout = command.output(get_maintainer, *arguments, fname)
-     lines = stdout.splitlines()
--    return [ x.replace('"', '') for x in lines ]
-+    return [x.replace('"', '') for x in lines]
-diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
-index ceaf2ce150..5e742102c2 100644
---- a/tools/patman/gitutil.py
-+++ b/tools/patman/gitutil.py
-@@ -2,21 +2,19 @@
- # Copyright (c) 2011 The Chromium OS Authors.
- #
- 
--import re
- import os
--import subprocess
- import sys
- 
- from patman import command
- from patman import settings
- from patman import terminal
--from patman import tools
- 
- # True to use --no-decorate - we check this in setup()
- use_no_decorate = True
- 
-+
- def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
--           count=None):
-+            count=None):
-     """Create a command to perform a 'git log'
- 
-     Args:
-@@ -49,6 +47,7 @@ def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
-     cmd.append('--')
-     return cmd
- 
-+
- def count_commits_to_branch(branch):
-     """Returns number of commits between HEAD and the tracking branch.
- 
-@@ -68,13 +67,14 @@ def count_commits_to_branch(branch):
-         rev_range = '@{upstream}..'
-     pipe = [log_cmd(rev_range, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             oneline=True, raise_on_error=False)
-+                              oneline=True, raise_on_error=False)
-     if result.return_code:
-         raise ValueError('Failed to determine upstream: %s' %
-                          result.stderr.strip())
-     patch_count = len(result.stdout.splitlines())
-     return patch_count
- 
-+
- def name_revision(commit_hash):
-     """Gets the revision name for a commit
- 
-@@ -91,6 +91,7 @@ def name_revision(commit_hash):
-     name = stdout.split(' ')[1].strip()
-     return name
- 
-+
- def guess_upstream(git_dir, branch):
-     """Tries to guess the upstream for a branch
- 
-@@ -109,7 +110,7 @@ def guess_upstream(git_dir, branch):
-     """
-     pipe = [log_cmd(branch, git_dir=git_dir, oneline=True, count=100)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Branch '%s' not found" % branch
-     for line in result.stdout.splitlines()[1:]:
-@@ -121,6 +122,7 @@ def guess_upstream(git_dir, branch):
-             return name, "Guessing upstream as '%s'" % name
-     return None, "Cannot find a suitable upstream for branch '%s'" % branch
- 
-+
- def get_upstream(git_dir, branch):
-     """Returns the name of the upstream for a branch
- 
-@@ -135,10 +137,10 @@ def get_upstream(git_dir, branch):
-     """
-     try:
-         remote = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                       'branch.%s.remote' % branch)
-+                                         'branch.%s.remote' % branch)
-         merge = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                      'branch.%s.merge' % branch)
--    except:
-+                                        'branch.%s.merge' % branch)
-+    except Exception:
-         upstream, msg = guess_upstream(git_dir, branch)
-         return upstream, msg
- 
-@@ -149,7 +151,8 @@ def get_upstream(git_dir, branch):
-         return '%s/%s' % (remote, leaf), None
-     else:
-         raise ValueError("Cannot determine upstream branch for branch "
--                "'%s' remote='%s', merge='%s'" % (branch, remote, merge))
-+                         "'%s' remote='%s', merge='%s'"
-+                         % (branch, remote, merge))
- 
- 
- def get_range_in_branch(git_dir, branch, include_upstream=False):
-@@ -168,6 +171,7 @@ def get_range_in_branch(git_dir, branch, include_upstream=False):
-     rstr = '%s%s..%s' % (upstream, '~' if include_upstream else '', branch)
-     return rstr, msg
- 
-+
- def count_commits_in_range(git_dir, range_expr):
-     """Returns the number of commits in the given range.
- 
-@@ -180,12 +184,13 @@ def count_commits_in_range(git_dir, range_expr):
-     """
-     pipe = [log_cmd(range_expr, git_dir=git_dir, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Range '%s' not found or is invalid" % range_expr
-     patch_count = len(result.stdout.splitlines())
-     return patch_count, None
- 
-+
- def count_commits_in_branch(git_dir, branch, include_upstream=False):
-     """Returns the number of commits in the given branch.
- 
-@@ -201,6 +206,7 @@ def count_commits_in_branch(git_dir, branch, include_upstream=False):
-         return None, msg
-     return count_commits_in_range(git_dir, range_expr)
- 
-+
- def count_commits(commit_range):
-     """Returns the number of commits in the given range.
- 
-@@ -215,6 +221,7 @@ def count_commits(commit_range):
-     patch_count = int(stdout)
-     return patch_count
- 
-+
- def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-     """Checkout the selected commit for this build
- 
-@@ -231,10 +238,11 @@ def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-         pipe.append('-f')
-     pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, raise_on_error=False,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git checkout (%s): %s' % (pipe, result.stderr))
- 
-+
- def clone(git_dir, output_dir):
-     """Checkout the selected commit for this build
- 
-@@ -243,10 +251,11 @@ def clone(git_dir, output_dir):
-     """
-     pipe = ['git', 'clone', git_dir, '.']
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git clone: %s' % result.stderr)
- 
-+
- def fetch(git_dir=None, work_tree=None):
-     """Fetch from the origin repo
- 
-@@ -263,6 +272,7 @@ def fetch(git_dir=None, work_tree=None):
-     if result.return_code != 0:
-         raise OSError('git fetch: %s' % result.stderr)
- 
-+
- def check_worktree_is_available(git_dir):
-     """Check if git-worktree functionality is available
- 
-@@ -274,9 +284,10 @@ def check_worktree_is_available(git_dir):
-     """
-     pipe = ['git', '--git-dir', git_dir, 'worktree', 'list']
-     result = command.run_pipe([pipe], capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     return result.return_code == 0
- 
-+
- def add_worktree(git_dir, output_dir, commit_hash=None):
-     """Create and checkout a new git worktree for this build
- 
-@@ -290,10 +301,11 @@ def add_worktree(git_dir, output_dir, commit_hash=None):
-     if commit_hash:
-         pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git worktree add: %s' % result.stderr)
- 
-+
- def prune_worktrees(git_dir):
-     """Remove administrative files for deleted worktrees
- 
-@@ -305,7 +317,8 @@ def prune_worktrees(git_dir):
-     if result.return_code != 0:
-         raise OSError('git worktree prune: %s' % result.stderr)
- 
--def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-+
-+def create_patches(branch, start, count, ignore_binary, series, signoff=True):
-     """Create a series of patches from the top of the current branch.
- 
-     The patch files are written to the current directory using
-@@ -321,9 +334,7 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-         Filename of cover letter (None if none)
-         List of filenames of patch files
-     """
--    if series.get('version'):
--        version = '%s ' % series['version']
--    cmd = ['git', 'format-patch', '-M' ]
-+    cmd = ['git', 'format-patch', '-M']
-     if signoff:
-         cmd.append('--signoff')
-     if ignore_binary:
-@@ -341,9 +352,10 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
- 
-     # We have an extra file if there is a cover letter
-     if series.get('cover'):
--       return files[0], files[1:]
-+        return files[0], files[1:]
-     else:
--       return None, files
-+        return None, files
-+
- 
- def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-     """Build a list of email addresses based on an input list.
-@@ -385,40 +397,43 @@ def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-         raw += lookup_email(item, alias, warn_on_error=warn_on_error)
-     result = []
-     for item in raw:
--        if not item in result:
-+        if item not in result:
-             result.append(item)
-     if tag:
-         return ['%s %s%s%s' % (tag, quote, email, quote) for email in result]
-     return result
- 
-+
- def check_suppress_cc_config():
-     """Check if sendemail.suppresscc is configured correctly.
- 
-     Returns:
-         True if the option is configured correctly, False otherwise.
-     """
--    suppresscc = command.output_one_line('git', 'config', 'sendemail.suppresscc',
--                                       raise_on_error=False)
-+    suppresscc = command.output_one_line(
-+        'git', 'config', 'sendemail.suppresscc', raise_on_error=False)
- 
-     # Other settings should be fine.
-     if suppresscc == 'all' or suppresscc == 'cccmd':
-         col = terminal.Color()
- 
-         print((col.build(col.RED, "error") +
--            ": git config sendemail.suppresscc set to %s\n"  % (suppresscc)) +
--            "  patman needs --cc-cmd to be run to set the cc list.\n" +
--            "  Please run:\n" +
--            "    git config --unset sendemail.suppresscc\n" +
--            "  Or read the man page:\n" +
--            "    git send-email --help\n" +
--            "  and set an option that runs --cc-cmd\n")
-+               ": git config sendemail.suppresscc set to %s\n"
-+               % (suppresscc)) +
-+              "  patman needs --cc-cmd to be run to set the cc list.\n" +
-+              "  Please run:\n" +
-+              "    git config --unset sendemail.suppresscc\n" +
-+              "  Or read the man page:\n" +
-+              "    git send-email --help\n" +
-+              "  and set an option that runs --cc-cmd\n")
-         return False
- 
-     return True
- 
-+
- def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
--        self_only=False, alias=None, in_reply_to=None, thread=False,
--        smtp_server=None):
-+                  self_only=False, alias=None, in_reply_to=None, thread=False,
-+                  smtp_server=None, get_maintainer_script=None):
-     """Email a patch series.
- 
-     Args:
-@@ -435,6 +450,7 @@ def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
-         thread: True to add --thread to git send-email (make
-             all patches reply to cover-letter or first patch in series)
-         smtp_server: SMTP server to use to send patches
-+        get_maintainer_script: File name of script to get maintainers emails
- 
-     Returns:
-         Git command that was/would be run
-@@ -487,9 +503,10 @@ send --cc-cmd cc-fname" cover p1 p2'
-                   "git config sendemail.to u-boot@lists.denx.de")
-             return
-     cc = build_email_list(list(set(series.get('cc')) - set(series.get('to'))),
--                        '--cc', alias, warn_on_error)
-+                          '--cc', alias, warn_on_error)
-     if self_only:
--        to = build_email_list([os.getenv('USER')], '--to', alias, warn_on_error)
-+        to = build_email_list([os.getenv('USER')], '--to',
-+                              alias, warn_on_error)
-         cc = []
-     cmd = ['git', 'send-email', '--annotate']
-     if smtp_server:
-@@ -565,7 +582,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-     if not alias:
-         alias = settings.alias
-     lookup_name = lookup_name.strip()
--    if '@' in lookup_name: # Perhaps a real email address
-+    if '@' in lookup_name:      # Perhaps a real email address
-         return [lookup_name]
- 
-     lookup_name = lookup_name.lower()
-@@ -581,7 +598,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-             return out_list
- 
-     if lookup_name:
--        if not lookup_name in alias:
-+        if lookup_name not in alias:
-             msg = "Alias '%s' not found" % lookup_name
-             if warn_on_error:
-                 print(col.build(col.RED, msg))
-@@ -589,11 +606,12 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-         for item in alias[lookup_name]:
-             todo = lookup_email(item, alias, warn_on_error, level + 1)
-             for new_item in todo:
--                if not new_item in out_list:
-+                if new_item not in out_list:
-                     out_list.append(new_item)
- 
-     return out_list
- 
-+
- def get_top_level():
-     """Return name of top-level directory for this git repo.
- 
-@@ -608,6 +626,7 @@ def get_top_level():
-     """
-     return command.output_one_line('git', 'rev-parse', '--show-toplevel')
- 
-+
- def get_alias_file():
-     """Gets the name of the git alias file.
- 
-@@ -615,7 +634,7 @@ def get_alias_file():
-         Filename of git alias file, or None if none
-     """
-     fname = command.output_one_line('git', 'config', 'sendemail.aliasesfile',
--            raise_on_error=False)
-+                                    raise_on_error=False)
-     if not fname:
-         return None
- 
-@@ -625,6 +644,7 @@ def get_alias_file():
- 
-     return os.path.join(get_top_level(), fname)
- 
-+
- def get_default_user_name():
-     """Gets the user.name from .gitconfig file.
- 
-@@ -634,6 +654,7 @@ def get_default_user_name():
-     uname = command.output_one_line('git', 'config', '--global', 'user.name')
-     return uname
- 
-+
- def get_default_user_email():
-     """Gets the user.email from the global .gitconfig file.
- 
-@@ -643,17 +664,19 @@ def get_default_user_email():
-     uemail = command.output_one_line('git', 'config', '--global', 'user.email')
-     return uemail
- 
-+
- def get_default_subject_prefix():
-     """Gets the format.subjectprefix from local .git/config file.
- 
-     Returns:
-         Subject prefix found in local .git/config file, or None if none
-     """
--    sub_prefix = command.output_one_line('git', 'config', 'format.subjectprefix',
--                 raise_on_error=False)
-+    sub_prefix = command.output_one_line(
-+        'git', 'config', 'format.subjectprefix', raise_on_error=False)
- 
-     return sub_prefix
- 
-+
- def setup():
-     """Set up git utils, by reading the alias files."""
-     # Check for a git alias file also
-@@ -666,6 +689,7 @@ def setup():
-     use_no_decorate = (command.run_pipe([cmd], raise_on_error=False)
-                        .return_code == 0)
- 
-+
- def get_head():
-     """Get the hash of the current HEAD
- 
-@@ -674,6 +698,7 @@ def get_head():
-     """
-     return command.output_one_line('git', 'show', '-s', '--pretty=format:%H')
- 
-+
- if __name__ == "__main__":
-     import doctest
- 
-diff --git a/tools/patman/patman b/tools/patman/patman
-index 11a5d8e18a..5a427d1942 120000
---- a/tools/patman/patman
-+++ b/tools/patman/patman
-@@ -1 +1 @@
--main.py
-\ No newline at end of file
-+__main__.py
-\ No newline at end of file
-diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst
-index 8c5c9cc2cc..6113962fb4 100644
---- a/tools/patman/patman.rst
-+++ b/tools/patman/patman.rst
-@@ -1,6 +1,7 @@
- .. SPDX-License-Identifier: GPL-2.0+
- .. Copyright (c) 2011 The Chromium OS Authors
- .. Simon Glass <sjg@chromium.org>
-+.. Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- .. v1, v2, 19-Oct-11
- .. revised v3 24-Nov-11
- .. revised v4 Independence Day 2020, with Patchwork integration
-@@ -68,13 +69,28 @@ this once::
- 
-     git config sendemail.aliasesfile doc/git-mailrc
- 
--For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles figuring
--out where to send patches pretty well.
-+For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles
-+figuring out where to send patches pretty well. For other projects,
-+you may want to specify a different script to be run, for example via
-+a project-specific `.patman` file::
-+
-+    # .patman configuration file at the root of some project
-+
-+    [settings]
-+    get_maintainer_script: etc/teams.scm get-maintainer
-+
-+The `get_maintainer_script` option corresponds to the
-+`--get-maintainer-script` argument of the `send` command.  It is
-+looked relatively to the root of the current git repository, as well
-+as on PATH.  It can also be provided arguments, as shown above.  The
-+contract is that the script should accept a patch file name and return
-+a list of email addresses, one per line, like `get_maintainer.pl`
-+does.
- 
- During the first run patman creates a config file for you by taking the default
- user name and email address from the global .gitconfig file.
- 
--To add your own, create a file ~/.patman like this::
-+To add your own, create a file `~/.patman` like this::
- 
-     # patman alias file
- 
-@@ -85,6 +101,12 @@ To add your own, create a file ~/.patman like this::
-     wolfgang: Wolfgang Denk <wd@denx.de>
-     others: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net>
- 
-+As hinted above, Patman will also look for a `.patman` configuration
-+file at the root of the current project git repository, which makes it
-+possible to override the `project` settings variable or anything else
-+in a project-specific way. The values of this "local" configuration
-+file take precedence over those of the "global" one.
-+
- Aliases are recursive.
- 
- The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
-@@ -680,6 +702,16 @@ them:
- 
-     $ tools/patman/patman test
- 
-+Note that since the test suite depends on data files only available in
-+the git checkout, the `test` command is hidden unless `patman` is
-+invoked from the U-Boot git repository.
-+
-+Alternatively, you can run the test suite via Pytest:
-+
-+.. code-block:: bash
-+
-+    $ cd tools/patman && pytest
-+
- Error handling doesn't always produce friendly error messages - e.g.
- putting an incorrect tag in a commit may provide a confusing message.
- 
-diff --git a/tools/patman/pytest.ini b/tools/patman/pytest.ini
-new file mode 100644
-index 0000000000..df3eb518d0
---- /dev/null
-+++ b/tools/patman/pytest.ini
-@@ -0,0 +1,2 @@
-+[pytest]
-+addopts = --doctest-modules
-diff --git a/tools/patman/series.py b/tools/patman/series.py
-index 3075378ac1..2eeeef71dc 100644
---- a/tools/patman/series.py
-+++ b/tools/patman/series.py
-@@ -235,7 +235,7 @@ class Series(dict):
-             print(col.build(col.RED, str))
- 
-     def MakeCcFile(self, process_tags, cover_fname, warn_on_error,
--                   add_maintainers, limit):
-+                   add_maintainers, limit, get_maintainer_script):
-         """Make a cc file for us to use for per-commit Cc automation
- 
-         Also stores in self._generated_cc to make ShowActions() faster.
-@@ -249,6 +249,8 @@ class Series(dict):
-                 True/False to call the get_maintainers to CC maintainers
-                 List of maintainers to include (for testing)
-             limit: Limit the length of the Cc list (None if no limit)
-+            get_maintainer_script: The file name of the get_maintainer.pl
-+                script (or compatible).
-         Return:
-             Filename of temp file created
-         """
-@@ -267,8 +269,9 @@ class Series(dict):
-             if type(add_maintainers) == type(cc):
-                 cc += add_maintainers
-             elif add_maintainers:
--                dir_list = [os.path.join(gitutil.get_top_level(), 'scripts')]
--                cc += get_maintainer.get_maintainer(dir_list, commit.patch)
-+
-+                cc += get_maintainer.get_maintainer(get_maintainer_script,
-+                                                    commit.patch)
-             for x in set(cc) & set(settings.bounces):
-                 print(col.build(col.YELLOW, 'Skipping "%s"' % x))
-             cc = list(set(cc) - set(settings.bounces))
-diff --git a/tools/patman/settings.py b/tools/patman/settings.py
-index 903d6fcb0b..636983e32d 100644
---- a/tools/patman/settings.py
-+++ b/tools/patman/settings.py
-@@ -1,18 +1,18 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2011 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- try:
-     import configparser as ConfigParser
--except:
-+except Exception:
-     import ConfigParser
- 
- import argparse
- import os
- import re
- 
--from patman import command
--from patman import tools
-+from patman import gitutil
- 
- """Default settings per-project.
- 
-@@ -32,7 +32,8 @@ _default_settings = {
-     },
- }
- 
--class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-+
-+class _ProjectConfigParser(ConfigParser.ConfigParser):
-     """ConfigParser that handles projects.
- 
-     There are two main goals of this class:
-@@ -83,14 +84,14 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-     def __init__(self, project_name):
-         """Construct _ProjectConfigParser.
- 
--        In addition to standard SafeConfigParser initialization, this also loads
--        project defaults.
-+        In addition to standard ConfigParser initialization, this also
-+        loads project defaults.
- 
-         Args:
-             project_name: The name of the project.
-         """
-         self._project_name = project_name
--        ConfigParser.SafeConfigParser.__init__(self)
-+        ConfigParser.ConfigParser.__init__(self)
- 
-         # Update the project settings in the config based on
-         # the _default_settings global.
-@@ -102,31 +103,31 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-             self.set(project_settings, setting_name, setting_value)
- 
-     def get(self, section, option, *args, **kwargs):
--        """Extend SafeConfigParser to try project_section before section.
-+        """Extend ConfigParser to try project_section before section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         try:
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, "%s_%s" % (self._project_name, section), option,
-                 *args, **kwargs
-             )
-         except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, section, option, *args, **kwargs
-             )
-         return val
- 
-     def items(self, section, *args, **kwargs):
--        """Extend SafeConfigParser to add project_section to section.
-+        """Extend ConfigParser to add project_section to section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         project_items = []
-         has_project_section = False
-@@ -134,7 +135,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get items from the project section
-         try:
--            project_items = ConfigParser.SafeConfigParser.items(
-+            project_items = ConfigParser.ConfigParser.items(
-                 self, "%s_%s" % (self._project_name, section), *args, **kwargs
-             )
-             has_project_section = True
-@@ -143,7 +144,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get top-level items
-         try:
--            top_items = ConfigParser.SafeConfigParser.items(
-+            top_items = ConfigParser.ConfigParser.items(
-                 self, section, *args, **kwargs
-             )
-         except ConfigParser.NoSectionError:
-@@ -155,6 +156,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-         item_dict.update(project_items)
-         return {(item, val) for item, val in item_dict.items()}
- 
-+
- def ReadGitAliases(fname):
-     """Read a git alias file. This is in the form used by git:
- 
-@@ -170,7 +172,7 @@ def ReadGitAliases(fname):
-         print("Warning: Cannot find alias file '%s'" % fname)
-         return
- 
--    re_line = re.compile('alias\s+(\S+)\s+(.*)')
-+    re_line = re.compile(r'alias\s+(\S+)\s+(.*)')
-     for line in fd.readlines():
-         line = line.strip()
-         if not line or line[0] == '#':
-@@ -190,7 +192,8 @@ def ReadGitAliases(fname):
- 
-     fd.close()
- 
--def CreatePatmanConfigFile(gitutil, config_fname):
-+
-+def CreatePatmanConfigFile(config_fname):
-     """Creates a config file under $(HOME)/.patman if it can't find one.
- 
-     Args:
-@@ -200,12 +203,12 @@ def CreatePatmanConfigFile(gitutil, config_fname):
-         None
-     """
-     name = gitutil.get_default_user_name()
--    if name == None:
-+    if name is None:
-         name = input("Enter name: ")
- 
-     email = gitutil.get_default_user_email()
- 
--    if email == None:
-+    if email is None:
-         email = input("Enter email: ")
- 
-     try:
-@@ -220,7 +223,8 @@ me: %s <%s>
- [bounces]
- nxp = Zhikang Zhang <zhikang.zhang@nxp.com>
- ''' % (name, email), file=f)
--    f.close();
-+    f.close()
-+
- 
- def _UpdateDefaults(main_parser, config):
-     """Update the given OptionParser defaults based on config.
-@@ -242,8 +246,8 @@ def _UpdateDefaults(main_parser, config):
-     # Find all the parsers and subparsers
-     parsers = [main_parser]
-     parsers += [subparser for action in main_parser._actions
--                  if isinstance(action, argparse._SubParsersAction)
--                  for _, subparser in action.choices.items()]
-+                if isinstance(action, argparse._SubParsersAction)
-+                for _, subparser in action.choices.items()]
- 
-     # Collect the defaults from each parser
-     defaults = {}
-@@ -270,8 +274,9 @@ def _UpdateDefaults(main_parser, config):
-     # Set all the defaults and manually propagate them to subparsers
-     main_parser.set_defaults(**defaults)
-     for parser, pdefs in zip(parsers, parser_defaults):
--        parser.set_defaults(**{ k: v for k, v in defaults.items()
--                                    if k in pdefs })
-+        parser.set_defaults(**{k: v for k, v in defaults.items()
-+                               if k in pdefs})
-+
- 
- def _ReadAliasFile(fname):
-     """Read in the U-Boot git alias file if it exists.
-@@ -298,6 +303,7 @@ def _ReadAliasFile(fname):
-         if bad_line:
-             print(bad_line)
- 
-+
- def _ReadBouncesFile(fname):
-     """Read in the bounces file if it exists
- 
-@@ -311,6 +317,7 @@ def _ReadBouncesFile(fname):
-                     continue
-                 bounces.add(line.strip())
- 
-+
- def GetItems(config, section):
-     """Get the items from a section of the config.
- 
-@@ -323,31 +330,50 @@ def GetItems(config, section):
-     """
-     try:
-         return config.items(section)
--    except ConfigParser.NoSectionError as e:
-+    except ConfigParser.NoSectionError:
-         return []
--    except:
--        raise
- 
--def Setup(gitutil, parser, project_name, config_fname=''):
-+
-+def Setup(parser, project_name, config_fname=None):
-     """Set up the settings module by reading config files.
- 
-+    Unless `config_fname` is specified, a `.patman` config file local
-+    to the git repository is consulted, followed by the global
-+    `$HOME/.patman`. If none exists, the later is created. Values
-+    defined in the local config file take precedence over those
-+    defined in the global one.
-+
-     Args:
--        parser:         The parser to update
-+        parser:         The parser to update.
-         project_name:   Name of project that we're working on; we'll look
-             for sections named "project_section" as well.
--        config_fname:   Config filename to read ('' for default)
-+        config_fname:   Config filename to read.  An error is raised if it
-+            does not exist.
-     """
-     # First read the git alias file if available
-     _ReadAliasFile('doc/git-mailrc')
-     config = _ProjectConfigParser(project_name)
--    if config_fname == '':
-+
-+    if config_fname and not os.path.exists(config_fname):
-+        raise Exception(f'provided {config_fname} does not exist')
-+
-+    if not config_fname:
-         config_fname = '%s/.patman' % os.getenv('HOME')
-+    has_config = os.path.exists(config_fname)
-+
-+    git_local_config_fname = os.path.join(gitutil.get_top_level(), '.patman')
-+    has_git_local_config = os.path.exists(git_local_config_fname)
- 
--    if not os.path.exists(config_fname):
--        print("No config file found ~/.patman\nCreating one...\n")
--        CreatePatmanConfigFile(gitutil, config_fname)
-+    # Read the git local config last, so that its values override
-+    # those of the global config, if any.
-+    if has_config:
-+        config.read(config_fname)
-+    if has_git_local_config:
-+        config.read(git_local_config_fname)
- 
--    config.read(config_fname)
-+    if not (has_config or has_git_local_config):
-+        print("No config file found.\nCreating ~/.patman...\n")
-+        CreatePatmanConfigFile(config_fname)
- 
-     for name, value in GetItems(config, 'alias'):
-         alias[name] = value.split(',')
-@@ -358,6 +384,7 @@ def Setup(gitutil, parser, project_name, config_fname=''):
- 
-     _UpdateDefaults(parser, config)
- 
-+
- # These are the aliases we understand, indexed by alias. Each member is a list.
- alias = {}
- bounces = set()
-diff --git a/tools/patman/setup.py b/tools/patman/setup.py
-index 5643bf1503..2ff791da0f 100644
---- a/tools/patman/setup.py
-+++ b/tools/patman/setup.py
-@@ -7,6 +7,6 @@ setup(name='patman',
-       scripts=['patman'],
-       packages=['patman'],
-       package_dir={'patman': ''},
--      package_data={'patman': ['README']},
-+      package_data={'patman': ['README.rst']},
-       classifiers=['Environment :: Console',
-                    'Topic :: Software Development'])
-diff --git a/tools/patman/test_settings.py b/tools/patman/test_settings.py
-new file mode 100644
-index 0000000000..c768a2fc64
---- /dev/null
-+++ b/tools/patman/test_settings.py
-@@ -0,0 +1,67 @@
-+# SPDX-License-Identifier: GPL-2.0+
-+#
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
-+#
-+
-+import argparse
-+import contextlib
-+import os
-+import sys
-+import tempfile
-+
-+from patman import settings
-+from patman import tools
-+
-+
-+@contextlib.contextmanager
-+def empty_git_repository():
-+    with tempfile.TemporaryDirectory() as tmpdir:
-+        os.chdir(tmpdir)
-+        tools.run('git', 'init', raise_on_error=True)
-+        yield tmpdir
-+
-+
-+@contextlib.contextmanager
-+def cleared_command_line_args():
-+    old_value = sys.argv[:]
-+    sys.argv = [sys.argv[0]]
-+    try:
-+        yield
-+    finally:
-+        sys.argv = old_value
-+
-+
-+def test_git_local_config():
-+    # Clearing the command line arguments is required, otherwise
-+    # arguments passed to the test running such as in 'pytest -k
-+    # filter' would be processed by _UpdateDefaults and fail.
-+    with cleared_command_line_args():
-+        with empty_git_repository():
-+            with tempfile.NamedTemporaryFile() as global_config:
-+                global_config.write(b'[settings]\n'
-+                                    b'project=u-boot\n')
-+                global_config.flush()
-+                parser = argparse.ArgumentParser()
-+                parser.add_argument('-p', '--project', default='unknown')
-+                subparsers = parser.add_subparsers(dest='cmd')
-+                send = subparsers.add_parser('send')
-+                send.add_argument('--no-check', action='store_false',
-+                                  dest='check_patch', default=True)
-+
-+                # Test "global" config is used.
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'u-boot'
-+                send_args, _ = send.parse_known_args([])
-+                assert send_args.check_patch
-+
-+                # Test local config can shadow it.
-+                with open('.patman', 'w', buffering=1) as f:
-+                    f.write('[settings]\n'
-+                            'project: guix-patches\n'
-+                            'check_patch: False\n')
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'guix-patches'
-+                send_args, _ = send.parse_known_args([])
-+                assert not send_args.check_patch
diff --git a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
index a5b92e3e8f..858f42efe7 100644
--- a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
+++ b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
@@ -5,12 +5,12 @@ Index: u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
 ===================================================================
 --- u-boot-2021.07~rc4+dfsg.orig/include/configs/sifive-unmatched.h
 +++ u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
-@@ -62,6 +62,8 @@
+@@ -55,6 +55,8 @@
  	"name=system,size=-,bootable,type=${type_guid_gpt_system};"
  
- #define CONFIG_EXTRA_ENV_SETTINGS \
+ #define CFG_EXTRA_ENV_SETTINGS \
 +	"fdt_high=0xffffffffffffffff\0" \
 +	"initrd_high=0xffffffffffffffff\0" \
  	"kernel_addr_r=0x84000000\0" \
- 	"fdt_addr_r=0x88000000\0" \
- 	"scriptaddr=0x88100000\0" \
+ 	"kernel_comp_addr_r=0x88000000\0" \
+ 	"kernel_comp_size=0x4000000\0" \
-- 
2.39.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] WIP update u-boot to 2023.07-rc5
  2023-07-05  1:10     ` Vagrant Cascadian
@ 2023-07-05  1:13       ` Vagrant Cascadian
  2023-07-05  2:50         ` [bug#64149] WIP update u-boot to 2023.07-rc6 Vagrant Cascadian
  0 siblings, 1 reply; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-05  1:13 UTC (permalink / raw)
  To: 64149; +Cc: ludo, efraim

[-- Attachment #1: Type: text/plain, Size: 2384 bytes --]

On 2023-07-04, Vagrant Cascadian wrote:
> On 2023-07-04, Vagrant Cascadian wrote:
>> On 2023-07-02, Vagrant Cascadian wrote:
>>> On 2023-06-18, Vagrant Cascadian wrote:
>>>> Builds most of the u-boot-* packages successfully, notable issues are
>>>> with u-boot-tools failing to build
>>
>> u-boot-tools needs some updates to the patch disabling openssl
>> support...
>
> Still needed, although I find it strange that we are running the u-boot
> testsuite with the u-boot-tools package... as it mostly runs tests for
> the u-boot-sandbox targets rather than the tools... seems much more
> appropriate for the...  u-boot-sandbox package? :)
>
> At any rate, whereever the tests are run from, it appears to also need
> the python-filelock package as an input, as well as patching out
> CONFIG_*_SIGNATURE and/or related variables... still poking at that.

More specifically:

+make O=/tmp/guix-build-u-boot-tools-2023.07-rc6.drv-0/u-boot-2023.07-rc6/build-sandbox_vpl -s -j4
../scripts/dtc-version.sh: line 18: which: command not found
In file included from ../tools/imagetool.h:24,
                 from ../tools/aisimage.c:7:
../include/image.h:1397:12: fatal error: openssl/evp.h: No such file or directory
 1397 | #  include <openssl/evp.h>
      |            ^~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.host:112: tools/aisimage.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from ../tools/imagetool.h:24,
                 from ../tools/atmelimage.c:7:
../include/image.h:1397:12: fatal error: openssl/evp.h: No such file or directory
 1397 | #  include <openssl/evp.h>
      |            ^~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.host:112: tools/atmelimage.o] Error 1
In file included from ../tools/imagetool.h:24,
                 from ../tools/fit_common.c:20:
../include/image.h:1397:12: fatal error: openssl/evp.h: No such file or directory
 1397 | #  include <openssl/evp.h>
      |            ^~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.host:112: tools/fit_common.o] Error 1
In file included from ../tools/imagetool.h:24,
                 from ../tools/fit_image.c:16:
../include/image.h:1397:12: fatal error: openssl/evp.h: No such file or directory
 1397 | #  include <openssl/evp.h>
      |            ^~~~~~~~~~~~~~~
compilation terminated.

live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] WIP update u-boot to 2023.07-rc6
  2023-07-05  1:13       ` Vagrant Cascadian
@ 2023-07-05  2:50         ` Vagrant Cascadian
  2023-07-06 17:50           ` Vagrant Cascadian
  2023-07-08  4:23           ` [bug#64149] WIP update u-boot to 2023.07-rc4 Maxim Cournoyer
  0 siblings, 2 replies; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-05  2:50 UTC (permalink / raw)
  To: 64149; +Cc: ludo, efraim


[-- Attachment #1.1: Type: text/plain, Size: 1600 bytes --]

On 2023-07-04, Vagrant Cascadian wrote:
> On 2023-07-04, Vagrant Cascadian wrote:
>> On 2023-07-04, Vagrant Cascadian wrote:
>>> On 2023-07-02, Vagrant Cascadian wrote:
>>>> On 2023-06-18, Vagrant Cascadian wrote:
>>>>> Builds most of the u-boot-* packages successfully, notable issues are
>>>>> with u-boot-tools failing to build
>>>
>>> u-boot-tools needs some updates to the patch disabling openssl
>>> support...
...
>> At any rate, whereever the tests are run from, it appears to also need
>> the python-filelock package as an input, as well as patching out
>> CONFIG_*_SIGNATURE and/or related variables... still poking at that.

Figured it out! The sandbox_vpl_defconfig target did not define the
CONFIG_FIT_SIGNATURE, which was used as a reference point to inject the
openssl disablement, and so was not getting the values we wanted to add
in the configuration.

Attached patch which gets everything building again!

Still have not boot-tested anything.

The one thing I would probably prefer is to split this into one package
per line, but I tried to aim for a smaller diff:

-       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
+       (prepend python-coverage python-filelock python-pycryptodomex
+python-pytest python-pytest-xdist sdl2)))

Though, apparently I have the worst of both worlds, split across two
lines and not indented correctly! Easy enough to fix with the next
iteration...


I still think it is probably best to wait till the 2023.07 release to
actually push to master... but hopefully this resolves most of the
hardest work!


live well,
  vagrant

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0002-gnu-u-boot-Update-to-2023.07-rc6.patch --]
[-- Type: text/x-diff, Size: 64746 bytes --]

From d734cc541f920963e8cf8d68061d5329c9712d00 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Sun, 2 Jul 2023 18:20:39 -0700
Subject: [PATCH 2/2] gnu: u-boot: Update to 2023.07-rc6.

* gnu/packages/patches/u-boot-infodocs-target.patch: Remove file.
* gnu/packages/patches/u-boot-patman-guix-integration.patch: Remove file.
* gnu/local.mk: Remove patches.
* gnu/packages/patches/u-boot-allow-disabling-openssl.patch: Refresh.
* gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch: Refresh.
* gnu/packages/bootloaders.scm (u-boot): Update to 2023.07-rc6.
[native-inputs]: Add python-pyelftools.
[source]: Remove patches.
(u-boot-tools)[phases]: Update substitution for python3-coverage.
Adjust 'patch to catch more openssl incompatibilities.
[native-inputs]: Add python-filelock and python-pytest-xdist.
(make-u-boot-sunxi64-package): Set SCP environment variable.
(u-boot-sifive-unleashed): Update to use opensbi.
(u-boot-puma-rk3399)[inputs]: Add arm-trusted-firmware-rk3399 to
package-inputs instead of native-inputs.
(u-boot-rockpro64-rk3399)[phases]: Add 'disable-spl-fit-signature.
---
 gnu/local.mk                                  |    2 -
 gnu/packages/bootloaders.scm                  |   46 +-
 .../u-boot-allow-disabling-openssl.patch      |   13 +-
 .../patches/u-boot-infodocs-target.patch      |   84 --
 .../u-boot-patman-guix-integration.patch      | 1244 -----------------
 ...boot-sifive-prevent-reloc-initrd-fdt.patch |    8 +-
 6 files changed, 46 insertions(+), 1351 deletions(-)
 delete mode 100644 gnu/packages/patches/u-boot-infodocs-target.patch
 delete mode 100644 gnu/packages/patches/u-boot-patman-guix-integration.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 6470f1abd4..fe46cd58f2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1997,8 +1997,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
-  %D%/packages/patches/u-boot-infodocs-target.patch		\
-  %D%/packages/patches/u-boot-patman-guix-integration.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index a9685a9ef9..446dc8fc97 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -648,23 +648,21 @@ (define %u-boot-rk3399-enable-emmc-phy-patch
 (define u-boot
   (package
     (name "u-boot")
-    (version "2022.10")
+    (version "2023.07-rc6")
     (source (origin
               (patches
                (list %u-boot-rockchip-inno-usb-patch
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
                      %u-boot-rk3399-enable-emmc-phy-patch
-                     (search-patch "u-boot-fix-build-python-3.10.patch")
-                     (search-patch "u-boot-infodocs-target.patch")
-                     (search-patch "u-boot-patman-guix-integration.patch")))
+                     (search-patch "u-boot-fix-build-python-3.10.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
                     "u-boot-" version ".tar.bz2"))
               (sha256
                (base32
-                "1y5x8vxdgsqdqlsvq01mn8lmw53fqairkhvhhjx83hjva0m4id2h"))))
+                "1dgvr228imbhzq7vzr8iialijl3k4mhjdirjrm6hsy6qbm6jyj5r"))))
     (build-system  gnu-build-system)
     (native-inputs
      (list bison
@@ -676,6 +674,7 @@ (define u-boot
            perl
            pkg-config                   ;for 'make menuconfig'
            python
+           python-pyelftools
            swig
            (list util-linux "lib")))
     (home-page "https://www.denx.de/wiki/U-Boot/")
@@ -726,7 +725,8 @@ (define-public u-boot-tools
     (name "u-boot-tools")
     (native-inputs
      (modify-inputs (package-native-inputs u-boot)
-       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
+       (prepend python-coverage python-filelock python-pycryptodomex
+python-pytest python-pytest-xdist sdl2)))
     (arguments
      `(#:make-flags '("HOSTCC=gcc")
        #:test-target "tcheck"
@@ -739,7 +739,7 @@ (define-public u-boot-tools
                (("/bin/false") (which "false")))
              (substitute* "tools/dtoc/fdt_util.py"
                (("'cc'") "'gcc'"))
-             (substitute* "tools/patman/test_util.py"
+             (substitute* "tools/u_boot_pylib/test_util.py"
                ;; python3-coverage is simply called coverage in guix.
                (("python3-coverage") "coverage")
 
@@ -778,6 +778,9 @@ (define-public u-boot-tools
                            ;; details.
                            (("CONFIG_FIT_SIGNATURE=y")
                             "CONFIG_FIT_SIGNATURE=n\nCONFIG_UT_LIB_ASN1=n\nCONFIG_TOOLS_LIBCRYPTO=n")
+                           ;; Catch instances of implied CONFIG_FIG_SIGNATURE with VPL targets
+                           (("CONFIG_SANDBOX_VPL=y")
+                            "CONFIG_SANDBOX_VPL=y\nCONFIG_FIT_SIGNATURE=n\nCONFIG_VPL_FIT_SIGNATURE=n\nCONFIG_TOOLS_LIBCRYPTO=n")
                            ;; This test requires a sound system, which is un-used
                            ;; in u-boot-tools.
                            (("CONFIG_SOUND=y") "CONFIG_SOUND=n")))
@@ -1009,6 +1012,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
           #~(modify-phases #$phases
               (add-after 'unpack 'set-environment
                 (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
+                  (setenv "SCP" "/dev/null")
                   (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
       (inputs
        (modify-inputs (package-inputs base)
@@ -1104,7 +1109,7 @@ (define-public u-boot-puma-rk3399
               (delete 'strip)
               (delete 'validate-runpath)))))
       (inputs
-       (modify-inputs (package-native-inputs base)
+       (modify-inputs (package-inputs base)
          (append arm-trusted-firmware-rk3399))))))
 
 (define-public u-boot-qemu-arm
@@ -1170,7 +1175,20 @@ (define-public u-boot-sandbox
                 (append sdl2))))))
 
 (define-public u-boot-sifive-unleashed
-  (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu"))
+  (let ((base (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu")))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'set-environment
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (setenv "OPENSBI" (search-input-file inputs
+                                                       "fw_dynamic.bin"))))))))
+      (inputs
+       (modify-inputs (package-inputs base)
+         (append opensbi-generic))))))
 
 (define-public u-boot-sifive-unmatched
   (let ((base (make-u-boot-package "sifive_unmatched" "riscv64-linux-gnu")))
@@ -1230,7 +1248,8 @@ (define-public u-boot-rockpro64-rk3399
                                                "CONFIG_SATA_SIL=y"
                                                "CONFIG_SCSI=y"
                                                "CONFIG_SCSI_AHCI=y"
-                                               "CONFIG_DM_SCSI=y"))))
+                                               "CONFIG_DM_SCSI=y"
+                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
     (package
       (inherit base)
       (arguments
@@ -1240,6 +1259,13 @@ (define-public u-boot-rockpro64-rk3399
               (add-after 'unpack 'set-environment
                 (lambda* (#:key inputs #:allow-other-keys)
                   (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
+              ;; Disable SPL FIT signatures, due to GPLv2 and Openssl license
+              ;; incompatibilities
+              (add-after 'unpack 'disable-spl-fit-signature
+                (lambda _
+                  (substitute* "configs/rockpro64-rk3399_defconfig"
+                    (("CONFIG_SPL_FIT_SIGNATURE=y")
+                     "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
               (add-after 'unpack 'patch-header
                 (lambda _
                   (substitute* "include/config_distro_bootcmd.h"
diff --git a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
index 5f2856dbb4..5195a7a6f8 100644
--- a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
+++ b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
@@ -128,29 +128,28 @@ index 94b7685392..eec599b0ee 100644
  	datai = 0;
  	for (cfgi = 0; cfgi < cfgn; cfgi++) {
  		e = &image_cfg[cfgi];
-@@ -1552,9 +1568,11 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
+@@ -1624,10 +1640,12 @@ static void *image_create_v1(size_t *dataoff, struct image_tool_params *params,
  					      &datai, delay);
  	}
  
 +#if defined(CONFIG_KWB_SECURE)
- 	if (secure_hdr && add_secure_header_v1(params, ptr, payloadsz + headersz,
- 					       headersz, image, secure_hdr))
+ 	if (secure_hdr && add_secure_header_v1(params, ptr + *dataoff, payloadsz,
+ 					       image, headersz, secure_hdr))
  		return NULL;
 +#endif
  
- 	*imagesz = headersz;
+ 	/* Calculate and set the header checksum */
+ 	main_hdr->checksum = image_checksum8(main_hdr, headersz);
  
 --- a/tools/image-host.c
 +++ b/tools/image-host.c
-@@ -14,10 +14,12 @@
+@@ -14,8 +14,10 @@
  #include <image.h>
  #include <version.h>
  
 +#ifdef CONFIG_FIT_PRELOAD
  #include <openssl/pem.h>
  #include <openssl/evp.h>
- 
- #define IMAGE_PRE_LOAD_PATH                             "/image/pre-load/sig"
 +#endif
  
  /**
diff --git a/gnu/packages/patches/u-boot-infodocs-target.patch b/gnu/packages/patches/u-boot-infodocs-target.patch
deleted file mode 100644
index 5b21a99de3..0000000000
--- a/gnu/packages/patches/u-boot-infodocs-target.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-Upstream status: https://patchwork.ozlabs.org/project/uboot/list/?series=333259
-
-diff --git a/Makefile b/Makefile
-index de5746399a..597a8886c3 100644
---- a/Makefile
-+++ b/Makefile
-@@ -2372,7 +2372,7 @@ tcheck:
- # Documentation targets
- # ---------------------------------------------------------------------------
- DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
--	       linkcheckdocs dochelp refcheckdocs
-+	       linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
- PHONY += $(DOC_TARGETS)
- $(DOC_TARGETS): scripts_basic FORCE
- 	$(Q)$(MAKE) $(build)=doc $@
-diff --git a/doc/Makefile b/doc/Makefile
-index f5de65e927..d0904a9f99 100644
---- a/doc/Makefile
-+++ b/doc/Makefile
-@@ -69,6 +69,14 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
- htmldocs:
- 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
- 
-+texinfodocs:
-+	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,texinfo,$(var),texinfo,$(var)))
-+
-+# Note: the 'info' Make target is generated by sphinx itself when
-+# running the texinfodocs target defined above.
-+infodocs: texinfodocs
-+	$(MAKE) -C $(BUILDDIR)/texinfo info
-+
- linkcheckdocs:
- 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
- 
-@@ -109,6 +117,8 @@ cleandocs:
- dochelp:
- 	@echo  ' U-Boot documentation in different formats from ReST:'
- 	@echo  '  htmldocs        - HTML'
-+	@echo  '  texinfodocs     - Texinfo'
-+	@echo  '  infodocs        - Info'
- 	@echo  '  latexdocs       - LaTeX'
- 	@echo  '  pdfdocs         - PDF'
- 	@echo  '  epubdocs        - EPUB'
-diff --git a/doc/conf.py b/doc/conf.py
-index 62c8d31270..3db70f80c1 100644
---- a/doc/conf.py
-+++ b/doc/conf.py
-@@ -449,7 +449,7 @@ for fn in os.listdir('.'):
- # One entry per manual page. List of tuples
- # (source start file, name, description, authors, manual section).
- man_pages = [
--    (master_doc, 'dasuboot', 'The U-Boot Documentation',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-      [author], 1)
- ]
- 
-@@ -463,8 +463,8 @@ man_pages = [
- # (source start file, target name, title, author,
- #  dir menu entry, description, category)
- texinfo_documents = [
--    (master_doc, 'DasUBoot', 'The U-Boot Documentation',
--     author, 'DasUBoot', 'One line description of project.',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-+     author, 'U-Boot', 'Boot loader for embedded systems',
-      'Miscellaneous'),
- ]
- 
-diff --git a/doc/media/Makefile b/doc/media/Makefile
-index b9b43a34c3..9b32258696 100644
---- a/doc/media/Makefile
-+++ b/doc/media/Makefile
-@@ -22,10 +22,11 @@ $(BUILDDIR)/linker_lists.h.rst: ${API}/linker_lists.h ${PARSER} $(SRC_DIR)/linke
- 
- # Media build rules
- 
--.PHONY: all html epub xml latex
-+.PHONY: all html texinfo epub xml latex
- 
- all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
- html: all
-+texinfo: all
- epub: all
- xml: all
- latex: $(IMGPDF) all
diff --git a/gnu/packages/patches/u-boot-patman-guix-integration.patch b/gnu/packages/patches/u-boot-patman-guix-integration.patch
deleted file mode 100644
index 3472656c99..0000000000
--- a/gnu/packages/patches/u-boot-patman-guix-integration.patch
+++ /dev/null
@@ -1,1244 +0,0 @@
-These changes correspond to commits 9ff7500ace..3154de3dd6 already merged to
-the u-boot-dm custodian repo (at
-https://source.denx.de/u-boot/custodians/u-boot-dm/-/commits/next), scheduled
-to be pulled after the next release.
-
-diff --git a/tools/patman/__init__.py b/tools/patman/__init__.py
-index c9d3e35052..1b98ec7fee 100644
---- a/tools/patman/__init__.py
-+++ b/tools/patman/__init__.py
-@@ -1,6 +1,6 @@
- # SPDX-License-Identifier: GPL-2.0+
- 
- __all__ = ['checkpatch', 'command', 'commit', 'control', 'cros_subprocess',
--           'func_test', 'get_maintainer', 'gitutil', 'main', 'patchstream',
-+           'func_test', 'get_maintainer', 'gitutil', '__main__', 'patchstream',
-            'project', 'series', 'setup', 'settings', 'terminal',
-            'test_checkpatch', 'test_util', 'tools', 'tout']
-diff --git a/tools/patman/main.py b/tools/patman/__main__.py
-similarity index 89%
-rename from tools/patman/main.py
-rename to tools/patman/__main__.py
-index 8067a288ab..749e6348b6 100755
---- a/tools/patman/main.py
-+++ b/tools/patman/__main__.py
-@@ -7,6 +7,7 @@
- """See README for more information"""
- 
- from argparse import ArgumentParser
-+import importlib.resources
- import os
- import re
- import sys
-@@ -19,6 +20,7 @@ if __name__ == "__main__":
- 
- # Our modules
- from patman import control
-+from patman import func_test
- from patman import gitutil
- from patman import project
- from patman import settings
-@@ -53,7 +55,8 @@ parser.add_argument('-H', '--full-help', action='store_true', dest='full_help',
-                     default=False, help='Display the README file')
- 
- subparsers = parser.add_subparsers(dest='cmd')
--send = subparsers.add_parser('send')
-+send = subparsers.add_parser(
-+    'send', help='Format, check and email patches (default command)')
- send.add_argument('-i', '--ignore-errors', action='store_true',
-        dest='ignore_errors', default=False,
-        help='Send patches email even if patch errors are found')
-@@ -62,6 +65,12 @@ send.add_argument('-l', '--limit-cc', dest='limit', type=int, default=None,
- send.add_argument('-m', '--no-maintainers', action='store_false',
-        dest='add_maintainers', default=True,
-        help="Don't cc the file maintainers automatically")
-+send.add_argument(
-+    '--get-maintainer-script', dest='get_maintainer_script', type=str,
-+    action='store',
-+    default=os.path.join(gitutil.get_top_level(), 'scripts',
-+                         'get_maintainer.pl') + ' --norolestats',
-+    help='File name of the get_maintainer.pl (or compatible) script.')
- send.add_argument('-n', '--dry-run', action='store_true', dest='dry_run',
-        default=False, help="Do a dry run (create but don't email patches)")
- send.add_argument('-r', '--in-reply-to', type=str, action='store',
-@@ -94,9 +103,11 @@ send.add_argument('--smtp-server', type=str,
- 
- send.add_argument('patchfiles', nargs='*')
- 
--test_parser = subparsers.add_parser('test', help='Run tests')
--test_parser.add_argument('testname', type=str, default=None, nargs='?',
--                         help="Specify the test to run")
-+# Only add the 'test' action if the test data files are available.
-+if os.path.exists(func_test.TEST_DATA_DIR):
-+    test_parser = subparsers.add_parser('test', help='Run tests')
-+    test_parser.add_argument('testname', type=str, default=None, nargs='?',
-+                             help="Specify the test to run")
- 
- status = subparsers.add_parser('status',
-                                help='Check status of patches in patchwork')
-@@ -113,7 +124,7 @@ status.add_argument('-f', '--force', action='store_true',
- argv = sys.argv[1:]
- args, rest = parser.parse_known_args(argv)
- if hasattr(args, 'project'):
--    settings.Setup(gitutil, parser, args.project, '')
-+    settings.Setup(parser, args.project)
-     args, rest = parser.parse_known_args(argv)
- 
- # If we have a command, it is safe to parse all arguments
-@@ -160,11 +171,8 @@ elif args.cmd == 'send':
-         fd.close()
- 
-     elif args.full_help:
--        tools.print_full_help(
--            os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                         'README.rst')
--        )
--
-+        with importlib.resources.path('patman', 'README.rst') as readme:
-+            tools.print_full_help(str(readme))
-     else:
-         # If we are not processing tags, no need to warning about bad ones
-         if not args.process_tags:
-diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
-index d1b902dd96..012c0d895c 100644
---- a/tools/patman/checkpatch.py
-+++ b/tools/patman/checkpatch.py
-@@ -211,7 +211,7 @@ def check_patch(fname, verbose=False, show_types=False, use_tree=False):
-             stdout: Full output of checkpatch
-     """
-     chk = find_check_patch()
--    args = [chk]
-+    args = [chk, '--u-boot', '--strict']
-     if not use_tree:
-         args.append('--no-tree')
-     if show_types:
-diff --git a/tools/patman/control.py b/tools/patman/control.py
-index bf426cf7bc..38e98dab84 100644
---- a/tools/patman/control.py
-+++ b/tools/patman/control.py
-@@ -94,8 +94,8 @@ def check_patches(series, patch_files, run_checkpatch, verbose, use_tree):
- 
- 
- def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
--                  ignore_bad_tags, add_maintainers, limit, dry_run, in_reply_to,
--                  thread, smtp_server):
-+                  ignore_bad_tags, add_maintainers, get_maintainer_script, limit,
-+                  dry_run, in_reply_to, thread, smtp_server):
-     """Email patches to the recipients
- 
-     This emails out the patches and cover letter using 'git send-email'. Each
-@@ -123,6 +123,8 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         ignore_bad_tags (bool): True to just print a warning for unknown tags,
-             False to halt with an error
-         add_maintainers (bool): Run the get_maintainer.pl script for each patch
-+        get_maintainer_script (str): The script used to retrieve which
-+            maintainers to cc
-         limit (int): Limit on the number of people that can be cc'd on a single
-             patch or the cover letter (None if no limit)
-         dry_run (bool): Don't actually email the patches, just print out what
-@@ -134,7 +136,7 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         smtp_server (str): SMTP server to use to send patches (None for default)
-     """
-     cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags,
--                                add_maintainers, limit)
-+                                add_maintainers, limit, get_maintainer_script)
- 
-     # Email the patches out (giving the user time to check / cancel)
-     cmd = ''
-@@ -174,8 +176,8 @@ def send(args):
-     email_patches(
-         col, series, cover_fname, patch_files, args.process_tags,
-         its_a_go, args.ignore_bad_tags, args.add_maintainers,
--        args.limit, args.dry_run, args.in_reply_to, args.thread,
--        args.smtp_server)
-+        args.get_maintainer_script, args.limit, args.dry_run,
-+        args.in_reply_to, args.thread, args.smtp_server)
- 
- def patchwork_status(branch, count, start, end, dest_branch, force,
-                      show_comments, url):
-diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
-index 7b92bc67be..c25a47bdeb 100644
---- a/tools/patman/func_test.py
-+++ b/tools/patman/func_test.py
-@@ -6,7 +6,9 @@
- 
- """Functional tests for checking that patman behaves correctly"""
- 
-+import contextlib
- import os
-+import pathlib
- import re
- import shutil
- import sys
-@@ -28,6 +30,21 @@ from patman.test_util import capture_sys_output
- import pygit2
- from patman import status
- 
-+PATMAN_DIR = pathlib.Path(__file__).parent
-+TEST_DATA_DIR = PATMAN_DIR / 'test/'
-+
-+
-+@contextlib.contextmanager
-+def directory_excursion(directory):
-+    """Change directory to `directory` for a limited to the context block."""
-+    current = os.getcwd()
-+    try:
-+        os.chdir(directory)
-+        yield
-+    finally:
-+        os.chdir(current)
-+
-+
- class TestFunctional(unittest.TestCase):
-     """Functional tests for checking that patman behaves correctly"""
-     leb = (b'Lord Edmund Blackadd\xc3\xabr <weasel@blackadder.org>'.
-@@ -57,8 +74,7 @@ class TestFunctional(unittest.TestCase):
-         Returns:
-             str: Full path to file in the test directory
-         """
--        return os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                            'test', fname)
-+        return TEST_DATA_DIR / fname
- 
-     @classmethod
-     def _get_text(cls, fname):
-@@ -200,6 +216,8 @@ class TestFunctional(unittest.TestCase):
-         text = self._get_text('test01.txt')
-         series = patchstream.get_metadata_for_test(text)
-         cover_fname, args = self._create_patches_for_test(series)
-+        get_maintainer_script = str(pathlib.Path(__file__).parent.parent.parent
-+                                    / 'get_maintainer.pl') + ' --norolestats'
-         with capture_sys_output() as out:
-             patchstream.fix_patches(series, args)
-             if cover_fname and series.get('cover'):
-@@ -207,7 +225,7 @@ class TestFunctional(unittest.TestCase):
-             series.DoChecks()
-             cc_file = series.MakeCcFile(process_tags, cover_fname,
-                                         not ignore_bad_tags, add_maintainers,
--                                        None)
-+                                        None, get_maintainer_script)
-             cmd = gitutil.email_patches(
-                 series, cover_fname, args, dry_run, not ignore_bad_tags,
-                 cc_file, in_reply_to=in_reply_to, thread=None)
-@@ -502,6 +520,37 @@ complicated as possible''')
-         finally:
-             os.chdir(orig_dir)
- 
-+    def test_custom_get_maintainer_script(self):
-+        """Validate that a custom get_maintainer script gets used."""
-+        self.make_git_tree()
-+        with directory_excursion(self.gitdir):
-+            # Setup git.
-+            os.environ['GIT_CONFIG_GLOBAL'] = '/dev/null'
-+            os.environ['GIT_CONFIG_SYSTEM'] = '/dev/null'
-+            tools.run('git', 'config', 'user.name', 'Dummy')
-+            tools.run('git', 'config', 'user.email', 'dumdum@dummy.com')
-+            tools.run('git', 'branch', 'upstream')
-+            tools.run('git', 'branch', '--set-upstream-to=upstream')
-+            tools.run('git', 'add', '.')
-+            tools.run('git', 'commit', '-m', 'new commit')
-+
-+            # Setup patman configuration.
-+            with open('.patman', 'w', buffering=1) as f:
-+                f.write('[settings]\n'
-+                        'get_maintainer_script: dummy-script.sh\n'
-+                        'check_patch: False\n')
-+            with open('dummy-script.sh', 'w', buffering=1) as f:
-+                f.write('#!/usr/bin/env python\n'
-+                        'print("hello@there.com")\n')
-+            os.chmod('dummy-script.sh', 0x555)
-+
-+            # Finally, do the test
-+            with capture_sys_output():
-+                output = tools.run(PATMAN_DIR / 'patman', '--dry-run')
-+                # Assert the email address is part of the dry-run
-+                # output.
-+                self.assertIn('hello@there.com', output)
-+
-     def test_tags(self):
-         """Test collection of tags in a patchstream"""
-         text = '''This is a patch
-diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
-index e1d15ff6ab..f7011be1e4 100644
---- a/tools/patman/get_maintainer.py
-+++ b/tools/patman/get_maintainer.py
-@@ -1,48 +1,61 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2012 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- import os
-+import shlex
-+import shutil
- 
- from patman import command
-+from patman import gitutil
- 
--def find_get_maintainer(try_list):
--    """Look for the get_maintainer.pl script.
- 
--    Args:
--        try_list: List of directories to try for the get_maintainer.pl script
-+def find_get_maintainer(script_file_name):
-+    """Try to find where `script_file_name` is.
- 
--    Returns:
--        If the script is found we'll return a path to it; else None.
-+    It searches in PATH and falls back to a path relative to the top
-+    of the current git repository.
-     """
--    # Look in the list
--    for path in try_list:
--        fname = os.path.join(path, 'get_maintainer.pl')
--        if os.path.isfile(fname):
--            return fname
-+    get_maintainer = shutil.which(script_file_name)
-+    if get_maintainer:
-+        return get_maintainer
-+
-+    git_relative_script = os.path.join(gitutil.get_top_level(),
-+                                       script_file_name)
-+    if os.path.exists(git_relative_script):
-+        return git_relative_script
- 
--    return None
- 
--def get_maintainer(dir_list, fname, verbose=False):
--    """Run get_maintainer.pl on a file if we find it.
-+def get_maintainer(script_file_name, fname, verbose=False):
-+    """Run `script_file_name` on a file.
- 
--    We look for get_maintainer.pl in the 'scripts' directory at the top of
--    git.  If we find it we'll run it.  If we don't find get_maintainer.pl
--    then we fail silently.
-+    `script_file_name` should be a get_maintainer.pl-like script that
-+    takes a patch file name as an input and return the email addresses
-+    of the associated maintainers to standard output, one per line.
-+
-+    If `script_file_name` does not exist we fail silently.
- 
-     Args:
--        dir_list: List of directories to try for the get_maintainer.pl script
--        fname: Path to the patch file to run get_maintainer.pl on.
-+        script_file_name: The file name of the get_maintainer.pl script
-+            (or compatible).
-+        fname: File name of the patch to process with get_maintainer.pl.
- 
-     Returns:
-         A list of email addresses to CC to.
-     """
--    get_maintainer = find_get_maintainer(dir_list)
-+    # Expand `script_file_name` into a file name and its arguments, if
-+    # any.
-+    cmd_args = shlex.split(script_file_name)
-+    file_name = cmd_args[0]
-+    arguments = cmd_args[1:]
-+
-+    get_maintainer = find_get_maintainer(file_name)
-     if not get_maintainer:
-         if verbose:
-             print("WARNING: Couldn't find get_maintainer.pl")
-         return []
- 
--    stdout = command.output(get_maintainer, '--norolestats', fname)
-+    stdout = command.output(get_maintainer, *arguments, fname)
-     lines = stdout.splitlines()
--    return [ x.replace('"', '') for x in lines ]
-+    return [x.replace('"', '') for x in lines]
-diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
-index ceaf2ce150..5e742102c2 100644
---- a/tools/patman/gitutil.py
-+++ b/tools/patman/gitutil.py
-@@ -2,21 +2,19 @@
- # Copyright (c) 2011 The Chromium OS Authors.
- #
- 
--import re
- import os
--import subprocess
- import sys
- 
- from patman import command
- from patman import settings
- from patman import terminal
--from patman import tools
- 
- # True to use --no-decorate - we check this in setup()
- use_no_decorate = True
- 
-+
- def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
--           count=None):
-+            count=None):
-     """Create a command to perform a 'git log'
- 
-     Args:
-@@ -49,6 +47,7 @@ def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
-     cmd.append('--')
-     return cmd
- 
-+
- def count_commits_to_branch(branch):
-     """Returns number of commits between HEAD and the tracking branch.
- 
-@@ -68,13 +67,14 @@ def count_commits_to_branch(branch):
-         rev_range = '@{upstream}..'
-     pipe = [log_cmd(rev_range, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             oneline=True, raise_on_error=False)
-+                              oneline=True, raise_on_error=False)
-     if result.return_code:
-         raise ValueError('Failed to determine upstream: %s' %
-                          result.stderr.strip())
-     patch_count = len(result.stdout.splitlines())
-     return patch_count
- 
-+
- def name_revision(commit_hash):
-     """Gets the revision name for a commit
- 
-@@ -91,6 +91,7 @@ def name_revision(commit_hash):
-     name = stdout.split(' ')[1].strip()
-     return name
- 
-+
- def guess_upstream(git_dir, branch):
-     """Tries to guess the upstream for a branch
- 
-@@ -109,7 +110,7 @@ def guess_upstream(git_dir, branch):
-     """
-     pipe = [log_cmd(branch, git_dir=git_dir, oneline=True, count=100)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Branch '%s' not found" % branch
-     for line in result.stdout.splitlines()[1:]:
-@@ -121,6 +122,7 @@ def guess_upstream(git_dir, branch):
-             return name, "Guessing upstream as '%s'" % name
-     return None, "Cannot find a suitable upstream for branch '%s'" % branch
- 
-+
- def get_upstream(git_dir, branch):
-     """Returns the name of the upstream for a branch
- 
-@@ -135,10 +137,10 @@ def get_upstream(git_dir, branch):
-     """
-     try:
-         remote = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                       'branch.%s.remote' % branch)
-+                                         'branch.%s.remote' % branch)
-         merge = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                      'branch.%s.merge' % branch)
--    except:
-+                                        'branch.%s.merge' % branch)
-+    except Exception:
-         upstream, msg = guess_upstream(git_dir, branch)
-         return upstream, msg
- 
-@@ -149,7 +151,8 @@ def get_upstream(git_dir, branch):
-         return '%s/%s' % (remote, leaf), None
-     else:
-         raise ValueError("Cannot determine upstream branch for branch "
--                "'%s' remote='%s', merge='%s'" % (branch, remote, merge))
-+                         "'%s' remote='%s', merge='%s'"
-+                         % (branch, remote, merge))
- 
- 
- def get_range_in_branch(git_dir, branch, include_upstream=False):
-@@ -168,6 +171,7 @@ def get_range_in_branch(git_dir, branch, include_upstream=False):
-     rstr = '%s%s..%s' % (upstream, '~' if include_upstream else '', branch)
-     return rstr, msg
- 
-+
- def count_commits_in_range(git_dir, range_expr):
-     """Returns the number of commits in the given range.
- 
-@@ -180,12 +184,13 @@ def count_commits_in_range(git_dir, range_expr):
-     """
-     pipe = [log_cmd(range_expr, git_dir=git_dir, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Range '%s' not found or is invalid" % range_expr
-     patch_count = len(result.stdout.splitlines())
-     return patch_count, None
- 
-+
- def count_commits_in_branch(git_dir, branch, include_upstream=False):
-     """Returns the number of commits in the given branch.
- 
-@@ -201,6 +206,7 @@ def count_commits_in_branch(git_dir, branch, include_upstream=False):
-         return None, msg
-     return count_commits_in_range(git_dir, range_expr)
- 
-+
- def count_commits(commit_range):
-     """Returns the number of commits in the given range.
- 
-@@ -215,6 +221,7 @@ def count_commits(commit_range):
-     patch_count = int(stdout)
-     return patch_count
- 
-+
- def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-     """Checkout the selected commit for this build
- 
-@@ -231,10 +238,11 @@ def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-         pipe.append('-f')
-     pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, raise_on_error=False,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git checkout (%s): %s' % (pipe, result.stderr))
- 
-+
- def clone(git_dir, output_dir):
-     """Checkout the selected commit for this build
- 
-@@ -243,10 +251,11 @@ def clone(git_dir, output_dir):
-     """
-     pipe = ['git', 'clone', git_dir, '.']
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git clone: %s' % result.stderr)
- 
-+
- def fetch(git_dir=None, work_tree=None):
-     """Fetch from the origin repo
- 
-@@ -263,6 +272,7 @@ def fetch(git_dir=None, work_tree=None):
-     if result.return_code != 0:
-         raise OSError('git fetch: %s' % result.stderr)
- 
-+
- def check_worktree_is_available(git_dir):
-     """Check if git-worktree functionality is available
- 
-@@ -274,9 +284,10 @@ def check_worktree_is_available(git_dir):
-     """
-     pipe = ['git', '--git-dir', git_dir, 'worktree', 'list']
-     result = command.run_pipe([pipe], capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     return result.return_code == 0
- 
-+
- def add_worktree(git_dir, output_dir, commit_hash=None):
-     """Create and checkout a new git worktree for this build
- 
-@@ -290,10 +301,11 @@ def add_worktree(git_dir, output_dir, commit_hash=None):
-     if commit_hash:
-         pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git worktree add: %s' % result.stderr)
- 
-+
- def prune_worktrees(git_dir):
-     """Remove administrative files for deleted worktrees
- 
-@@ -305,7 +317,8 @@ def prune_worktrees(git_dir):
-     if result.return_code != 0:
-         raise OSError('git worktree prune: %s' % result.stderr)
- 
--def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-+
-+def create_patches(branch, start, count, ignore_binary, series, signoff=True):
-     """Create a series of patches from the top of the current branch.
- 
-     The patch files are written to the current directory using
-@@ -321,9 +334,7 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-         Filename of cover letter (None if none)
-         List of filenames of patch files
-     """
--    if series.get('version'):
--        version = '%s ' % series['version']
--    cmd = ['git', 'format-patch', '-M' ]
-+    cmd = ['git', 'format-patch', '-M']
-     if signoff:
-         cmd.append('--signoff')
-     if ignore_binary:
-@@ -341,9 +352,10 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
- 
-     # We have an extra file if there is a cover letter
-     if series.get('cover'):
--       return files[0], files[1:]
-+        return files[0], files[1:]
-     else:
--       return None, files
-+        return None, files
-+
- 
- def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-     """Build a list of email addresses based on an input list.
-@@ -385,40 +397,43 @@ def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-         raw += lookup_email(item, alias, warn_on_error=warn_on_error)
-     result = []
-     for item in raw:
--        if not item in result:
-+        if item not in result:
-             result.append(item)
-     if tag:
-         return ['%s %s%s%s' % (tag, quote, email, quote) for email in result]
-     return result
- 
-+
- def check_suppress_cc_config():
-     """Check if sendemail.suppresscc is configured correctly.
- 
-     Returns:
-         True if the option is configured correctly, False otherwise.
-     """
--    suppresscc = command.output_one_line('git', 'config', 'sendemail.suppresscc',
--                                       raise_on_error=False)
-+    suppresscc = command.output_one_line(
-+        'git', 'config', 'sendemail.suppresscc', raise_on_error=False)
- 
-     # Other settings should be fine.
-     if suppresscc == 'all' or suppresscc == 'cccmd':
-         col = terminal.Color()
- 
-         print((col.build(col.RED, "error") +
--            ": git config sendemail.suppresscc set to %s\n"  % (suppresscc)) +
--            "  patman needs --cc-cmd to be run to set the cc list.\n" +
--            "  Please run:\n" +
--            "    git config --unset sendemail.suppresscc\n" +
--            "  Or read the man page:\n" +
--            "    git send-email --help\n" +
--            "  and set an option that runs --cc-cmd\n")
-+               ": git config sendemail.suppresscc set to %s\n"
-+               % (suppresscc)) +
-+              "  patman needs --cc-cmd to be run to set the cc list.\n" +
-+              "  Please run:\n" +
-+              "    git config --unset sendemail.suppresscc\n" +
-+              "  Or read the man page:\n" +
-+              "    git send-email --help\n" +
-+              "  and set an option that runs --cc-cmd\n")
-         return False
- 
-     return True
- 
-+
- def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
--        self_only=False, alias=None, in_reply_to=None, thread=False,
--        smtp_server=None):
-+                  self_only=False, alias=None, in_reply_to=None, thread=False,
-+                  smtp_server=None, get_maintainer_script=None):
-     """Email a patch series.
- 
-     Args:
-@@ -435,6 +450,7 @@ def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
-         thread: True to add --thread to git send-email (make
-             all patches reply to cover-letter or first patch in series)
-         smtp_server: SMTP server to use to send patches
-+        get_maintainer_script: File name of script to get maintainers emails
- 
-     Returns:
-         Git command that was/would be run
-@@ -487,9 +503,10 @@ send --cc-cmd cc-fname" cover p1 p2'
-                   "git config sendemail.to u-boot@lists.denx.de")
-             return
-     cc = build_email_list(list(set(series.get('cc')) - set(series.get('to'))),
--                        '--cc', alias, warn_on_error)
-+                          '--cc', alias, warn_on_error)
-     if self_only:
--        to = build_email_list([os.getenv('USER')], '--to', alias, warn_on_error)
-+        to = build_email_list([os.getenv('USER')], '--to',
-+                              alias, warn_on_error)
-         cc = []
-     cmd = ['git', 'send-email', '--annotate']
-     if smtp_server:
-@@ -565,7 +582,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-     if not alias:
-         alias = settings.alias
-     lookup_name = lookup_name.strip()
--    if '@' in lookup_name: # Perhaps a real email address
-+    if '@' in lookup_name:      # Perhaps a real email address
-         return [lookup_name]
- 
-     lookup_name = lookup_name.lower()
-@@ -581,7 +598,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-             return out_list
- 
-     if lookup_name:
--        if not lookup_name in alias:
-+        if lookup_name not in alias:
-             msg = "Alias '%s' not found" % lookup_name
-             if warn_on_error:
-                 print(col.build(col.RED, msg))
-@@ -589,11 +606,12 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-         for item in alias[lookup_name]:
-             todo = lookup_email(item, alias, warn_on_error, level + 1)
-             for new_item in todo:
--                if not new_item in out_list:
-+                if new_item not in out_list:
-                     out_list.append(new_item)
- 
-     return out_list
- 
-+
- def get_top_level():
-     """Return name of top-level directory for this git repo.
- 
-@@ -608,6 +626,7 @@ def get_top_level():
-     """
-     return command.output_one_line('git', 'rev-parse', '--show-toplevel')
- 
-+
- def get_alias_file():
-     """Gets the name of the git alias file.
- 
-@@ -615,7 +634,7 @@ def get_alias_file():
-         Filename of git alias file, or None if none
-     """
-     fname = command.output_one_line('git', 'config', 'sendemail.aliasesfile',
--            raise_on_error=False)
-+                                    raise_on_error=False)
-     if not fname:
-         return None
- 
-@@ -625,6 +644,7 @@ def get_alias_file():
- 
-     return os.path.join(get_top_level(), fname)
- 
-+
- def get_default_user_name():
-     """Gets the user.name from .gitconfig file.
- 
-@@ -634,6 +654,7 @@ def get_default_user_name():
-     uname = command.output_one_line('git', 'config', '--global', 'user.name')
-     return uname
- 
-+
- def get_default_user_email():
-     """Gets the user.email from the global .gitconfig file.
- 
-@@ -643,17 +664,19 @@ def get_default_user_email():
-     uemail = command.output_one_line('git', 'config', '--global', 'user.email')
-     return uemail
- 
-+
- def get_default_subject_prefix():
-     """Gets the format.subjectprefix from local .git/config file.
- 
-     Returns:
-         Subject prefix found in local .git/config file, or None if none
-     """
--    sub_prefix = command.output_one_line('git', 'config', 'format.subjectprefix',
--                 raise_on_error=False)
-+    sub_prefix = command.output_one_line(
-+        'git', 'config', 'format.subjectprefix', raise_on_error=False)
- 
-     return sub_prefix
- 
-+
- def setup():
-     """Set up git utils, by reading the alias files."""
-     # Check for a git alias file also
-@@ -666,6 +689,7 @@ def setup():
-     use_no_decorate = (command.run_pipe([cmd], raise_on_error=False)
-                        .return_code == 0)
- 
-+
- def get_head():
-     """Get the hash of the current HEAD
- 
-@@ -674,6 +698,7 @@ def get_head():
-     """
-     return command.output_one_line('git', 'show', '-s', '--pretty=format:%H')
- 
-+
- if __name__ == "__main__":
-     import doctest
- 
-diff --git a/tools/patman/patman b/tools/patman/patman
-index 11a5d8e18a..5a427d1942 120000
---- a/tools/patman/patman
-+++ b/tools/patman/patman
-@@ -1 +1 @@
--main.py
-\ No newline at end of file
-+__main__.py
-\ No newline at end of file
-diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst
-index 8c5c9cc2cc..6113962fb4 100644
---- a/tools/patman/patman.rst
-+++ b/tools/patman/patman.rst
-@@ -1,6 +1,7 @@
- .. SPDX-License-Identifier: GPL-2.0+
- .. Copyright (c) 2011 The Chromium OS Authors
- .. Simon Glass <sjg@chromium.org>
-+.. Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- .. v1, v2, 19-Oct-11
- .. revised v3 24-Nov-11
- .. revised v4 Independence Day 2020, with Patchwork integration
-@@ -68,13 +69,28 @@ this once::
- 
-     git config sendemail.aliasesfile doc/git-mailrc
- 
--For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles figuring
--out where to send patches pretty well.
-+For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles
-+figuring out where to send patches pretty well. For other projects,
-+you may want to specify a different script to be run, for example via
-+a project-specific `.patman` file::
-+
-+    # .patman configuration file at the root of some project
-+
-+    [settings]
-+    get_maintainer_script: etc/teams.scm get-maintainer
-+
-+The `get_maintainer_script` option corresponds to the
-+`--get-maintainer-script` argument of the `send` command.  It is
-+looked relatively to the root of the current git repository, as well
-+as on PATH.  It can also be provided arguments, as shown above.  The
-+contract is that the script should accept a patch file name and return
-+a list of email addresses, one per line, like `get_maintainer.pl`
-+does.
- 
- During the first run patman creates a config file for you by taking the default
- user name and email address from the global .gitconfig file.
- 
--To add your own, create a file ~/.patman like this::
-+To add your own, create a file `~/.patman` like this::
- 
-     # patman alias file
- 
-@@ -85,6 +101,12 @@ To add your own, create a file ~/.patman like this::
-     wolfgang: Wolfgang Denk <wd@denx.de>
-     others: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net>
- 
-+As hinted above, Patman will also look for a `.patman` configuration
-+file at the root of the current project git repository, which makes it
-+possible to override the `project` settings variable or anything else
-+in a project-specific way. The values of this "local" configuration
-+file take precedence over those of the "global" one.
-+
- Aliases are recursive.
- 
- The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
-@@ -680,6 +702,16 @@ them:
- 
-     $ tools/patman/patman test
- 
-+Note that since the test suite depends on data files only available in
-+the git checkout, the `test` command is hidden unless `patman` is
-+invoked from the U-Boot git repository.
-+
-+Alternatively, you can run the test suite via Pytest:
-+
-+.. code-block:: bash
-+
-+    $ cd tools/patman && pytest
-+
- Error handling doesn't always produce friendly error messages - e.g.
- putting an incorrect tag in a commit may provide a confusing message.
- 
-diff --git a/tools/patman/pytest.ini b/tools/patman/pytest.ini
-new file mode 100644
-index 0000000000..df3eb518d0
---- /dev/null
-+++ b/tools/patman/pytest.ini
-@@ -0,0 +1,2 @@
-+[pytest]
-+addopts = --doctest-modules
-diff --git a/tools/patman/series.py b/tools/patman/series.py
-index 3075378ac1..2eeeef71dc 100644
---- a/tools/patman/series.py
-+++ b/tools/patman/series.py
-@@ -235,7 +235,7 @@ class Series(dict):
-             print(col.build(col.RED, str))
- 
-     def MakeCcFile(self, process_tags, cover_fname, warn_on_error,
--                   add_maintainers, limit):
-+                   add_maintainers, limit, get_maintainer_script):
-         """Make a cc file for us to use for per-commit Cc automation
- 
-         Also stores in self._generated_cc to make ShowActions() faster.
-@@ -249,6 +249,8 @@ class Series(dict):
-                 True/False to call the get_maintainers to CC maintainers
-                 List of maintainers to include (for testing)
-             limit: Limit the length of the Cc list (None if no limit)
-+            get_maintainer_script: The file name of the get_maintainer.pl
-+                script (or compatible).
-         Return:
-             Filename of temp file created
-         """
-@@ -267,8 +269,9 @@ class Series(dict):
-             if type(add_maintainers) == type(cc):
-                 cc += add_maintainers
-             elif add_maintainers:
--                dir_list = [os.path.join(gitutil.get_top_level(), 'scripts')]
--                cc += get_maintainer.get_maintainer(dir_list, commit.patch)
-+
-+                cc += get_maintainer.get_maintainer(get_maintainer_script,
-+                                                    commit.patch)
-             for x in set(cc) & set(settings.bounces):
-                 print(col.build(col.YELLOW, 'Skipping "%s"' % x))
-             cc = list(set(cc) - set(settings.bounces))
-diff --git a/tools/patman/settings.py b/tools/patman/settings.py
-index 903d6fcb0b..636983e32d 100644
---- a/tools/patman/settings.py
-+++ b/tools/patman/settings.py
-@@ -1,18 +1,18 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2011 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- try:
-     import configparser as ConfigParser
--except:
-+except Exception:
-     import ConfigParser
- 
- import argparse
- import os
- import re
- 
--from patman import command
--from patman import tools
-+from patman import gitutil
- 
- """Default settings per-project.
- 
-@@ -32,7 +32,8 @@ _default_settings = {
-     },
- }
- 
--class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-+
-+class _ProjectConfigParser(ConfigParser.ConfigParser):
-     """ConfigParser that handles projects.
- 
-     There are two main goals of this class:
-@@ -83,14 +84,14 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-     def __init__(self, project_name):
-         """Construct _ProjectConfigParser.
- 
--        In addition to standard SafeConfigParser initialization, this also loads
--        project defaults.
-+        In addition to standard ConfigParser initialization, this also
-+        loads project defaults.
- 
-         Args:
-             project_name: The name of the project.
-         """
-         self._project_name = project_name
--        ConfigParser.SafeConfigParser.__init__(self)
-+        ConfigParser.ConfigParser.__init__(self)
- 
-         # Update the project settings in the config based on
-         # the _default_settings global.
-@@ -102,31 +103,31 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-             self.set(project_settings, setting_name, setting_value)
- 
-     def get(self, section, option, *args, **kwargs):
--        """Extend SafeConfigParser to try project_section before section.
-+        """Extend ConfigParser to try project_section before section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         try:
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, "%s_%s" % (self._project_name, section), option,
-                 *args, **kwargs
-             )
-         except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, section, option, *args, **kwargs
-             )
-         return val
- 
-     def items(self, section, *args, **kwargs):
--        """Extend SafeConfigParser to add project_section to section.
-+        """Extend ConfigParser to add project_section to section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         project_items = []
-         has_project_section = False
-@@ -134,7 +135,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get items from the project section
-         try:
--            project_items = ConfigParser.SafeConfigParser.items(
-+            project_items = ConfigParser.ConfigParser.items(
-                 self, "%s_%s" % (self._project_name, section), *args, **kwargs
-             )
-             has_project_section = True
-@@ -143,7 +144,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get top-level items
-         try:
--            top_items = ConfigParser.SafeConfigParser.items(
-+            top_items = ConfigParser.ConfigParser.items(
-                 self, section, *args, **kwargs
-             )
-         except ConfigParser.NoSectionError:
-@@ -155,6 +156,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-         item_dict.update(project_items)
-         return {(item, val) for item, val in item_dict.items()}
- 
-+
- def ReadGitAliases(fname):
-     """Read a git alias file. This is in the form used by git:
- 
-@@ -170,7 +172,7 @@ def ReadGitAliases(fname):
-         print("Warning: Cannot find alias file '%s'" % fname)
-         return
- 
--    re_line = re.compile('alias\s+(\S+)\s+(.*)')
-+    re_line = re.compile(r'alias\s+(\S+)\s+(.*)')
-     for line in fd.readlines():
-         line = line.strip()
-         if not line or line[0] == '#':
-@@ -190,7 +192,8 @@ def ReadGitAliases(fname):
- 
-     fd.close()
- 
--def CreatePatmanConfigFile(gitutil, config_fname):
-+
-+def CreatePatmanConfigFile(config_fname):
-     """Creates a config file under $(HOME)/.patman if it can't find one.
- 
-     Args:
-@@ -200,12 +203,12 @@ def CreatePatmanConfigFile(gitutil, config_fname):
-         None
-     """
-     name = gitutil.get_default_user_name()
--    if name == None:
-+    if name is None:
-         name = input("Enter name: ")
- 
-     email = gitutil.get_default_user_email()
- 
--    if email == None:
-+    if email is None:
-         email = input("Enter email: ")
- 
-     try:
-@@ -220,7 +223,8 @@ me: %s <%s>
- [bounces]
- nxp = Zhikang Zhang <zhikang.zhang@nxp.com>
- ''' % (name, email), file=f)
--    f.close();
-+    f.close()
-+
- 
- def _UpdateDefaults(main_parser, config):
-     """Update the given OptionParser defaults based on config.
-@@ -242,8 +246,8 @@ def _UpdateDefaults(main_parser, config):
-     # Find all the parsers and subparsers
-     parsers = [main_parser]
-     parsers += [subparser for action in main_parser._actions
--                  if isinstance(action, argparse._SubParsersAction)
--                  for _, subparser in action.choices.items()]
-+                if isinstance(action, argparse._SubParsersAction)
-+                for _, subparser in action.choices.items()]
- 
-     # Collect the defaults from each parser
-     defaults = {}
-@@ -270,8 +274,9 @@ def _UpdateDefaults(main_parser, config):
-     # Set all the defaults and manually propagate them to subparsers
-     main_parser.set_defaults(**defaults)
-     for parser, pdefs in zip(parsers, parser_defaults):
--        parser.set_defaults(**{ k: v for k, v in defaults.items()
--                                    if k in pdefs })
-+        parser.set_defaults(**{k: v for k, v in defaults.items()
-+                               if k in pdefs})
-+
- 
- def _ReadAliasFile(fname):
-     """Read in the U-Boot git alias file if it exists.
-@@ -298,6 +303,7 @@ def _ReadAliasFile(fname):
-         if bad_line:
-             print(bad_line)
- 
-+
- def _ReadBouncesFile(fname):
-     """Read in the bounces file if it exists
- 
-@@ -311,6 +317,7 @@ def _ReadBouncesFile(fname):
-                     continue
-                 bounces.add(line.strip())
- 
-+
- def GetItems(config, section):
-     """Get the items from a section of the config.
- 
-@@ -323,31 +330,50 @@ def GetItems(config, section):
-     """
-     try:
-         return config.items(section)
--    except ConfigParser.NoSectionError as e:
-+    except ConfigParser.NoSectionError:
-         return []
--    except:
--        raise
- 
--def Setup(gitutil, parser, project_name, config_fname=''):
-+
-+def Setup(parser, project_name, config_fname=None):
-     """Set up the settings module by reading config files.
- 
-+    Unless `config_fname` is specified, a `.patman` config file local
-+    to the git repository is consulted, followed by the global
-+    `$HOME/.patman`. If none exists, the later is created. Values
-+    defined in the local config file take precedence over those
-+    defined in the global one.
-+
-     Args:
--        parser:         The parser to update
-+        parser:         The parser to update.
-         project_name:   Name of project that we're working on; we'll look
-             for sections named "project_section" as well.
--        config_fname:   Config filename to read ('' for default)
-+        config_fname:   Config filename to read.  An error is raised if it
-+            does not exist.
-     """
-     # First read the git alias file if available
-     _ReadAliasFile('doc/git-mailrc')
-     config = _ProjectConfigParser(project_name)
--    if config_fname == '':
-+
-+    if config_fname and not os.path.exists(config_fname):
-+        raise Exception(f'provided {config_fname} does not exist')
-+
-+    if not config_fname:
-         config_fname = '%s/.patman' % os.getenv('HOME')
-+    has_config = os.path.exists(config_fname)
-+
-+    git_local_config_fname = os.path.join(gitutil.get_top_level(), '.patman')
-+    has_git_local_config = os.path.exists(git_local_config_fname)
- 
--    if not os.path.exists(config_fname):
--        print("No config file found ~/.patman\nCreating one...\n")
--        CreatePatmanConfigFile(gitutil, config_fname)
-+    # Read the git local config last, so that its values override
-+    # those of the global config, if any.
-+    if has_config:
-+        config.read(config_fname)
-+    if has_git_local_config:
-+        config.read(git_local_config_fname)
- 
--    config.read(config_fname)
-+    if not (has_config or has_git_local_config):
-+        print("No config file found.\nCreating ~/.patman...\n")
-+        CreatePatmanConfigFile(config_fname)
- 
-     for name, value in GetItems(config, 'alias'):
-         alias[name] = value.split(',')
-@@ -358,6 +384,7 @@ def Setup(gitutil, parser, project_name, config_fname=''):
- 
-     _UpdateDefaults(parser, config)
- 
-+
- # These are the aliases we understand, indexed by alias. Each member is a list.
- alias = {}
- bounces = set()
-diff --git a/tools/patman/setup.py b/tools/patman/setup.py
-index 5643bf1503..2ff791da0f 100644
---- a/tools/patman/setup.py
-+++ b/tools/patman/setup.py
-@@ -7,6 +7,6 @@ setup(name='patman',
-       scripts=['patman'],
-       packages=['patman'],
-       package_dir={'patman': ''},
--      package_data={'patman': ['README']},
-+      package_data={'patman': ['README.rst']},
-       classifiers=['Environment :: Console',
-                    'Topic :: Software Development'])
-diff --git a/tools/patman/test_settings.py b/tools/patman/test_settings.py
-new file mode 100644
-index 0000000000..c768a2fc64
---- /dev/null
-+++ b/tools/patman/test_settings.py
-@@ -0,0 +1,67 @@
-+# SPDX-License-Identifier: GPL-2.0+
-+#
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
-+#
-+
-+import argparse
-+import contextlib
-+import os
-+import sys
-+import tempfile
-+
-+from patman import settings
-+from patman import tools
-+
-+
-+@contextlib.contextmanager
-+def empty_git_repository():
-+    with tempfile.TemporaryDirectory() as tmpdir:
-+        os.chdir(tmpdir)
-+        tools.run('git', 'init', raise_on_error=True)
-+        yield tmpdir
-+
-+
-+@contextlib.contextmanager
-+def cleared_command_line_args():
-+    old_value = sys.argv[:]
-+    sys.argv = [sys.argv[0]]
-+    try:
-+        yield
-+    finally:
-+        sys.argv = old_value
-+
-+
-+def test_git_local_config():
-+    # Clearing the command line arguments is required, otherwise
-+    # arguments passed to the test running such as in 'pytest -k
-+    # filter' would be processed by _UpdateDefaults and fail.
-+    with cleared_command_line_args():
-+        with empty_git_repository():
-+            with tempfile.NamedTemporaryFile() as global_config:
-+                global_config.write(b'[settings]\n'
-+                                    b'project=u-boot\n')
-+                global_config.flush()
-+                parser = argparse.ArgumentParser()
-+                parser.add_argument('-p', '--project', default='unknown')
-+                subparsers = parser.add_subparsers(dest='cmd')
-+                send = subparsers.add_parser('send')
-+                send.add_argument('--no-check', action='store_false',
-+                                  dest='check_patch', default=True)
-+
-+                # Test "global" config is used.
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'u-boot'
-+                send_args, _ = send.parse_known_args([])
-+                assert send_args.check_patch
-+
-+                # Test local config can shadow it.
-+                with open('.patman', 'w', buffering=1) as f:
-+                    f.write('[settings]\n'
-+                            'project: guix-patches\n'
-+                            'check_patch: False\n')
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'guix-patches'
-+                send_args, _ = send.parse_known_args([])
-+                assert not send_args.check_patch
diff --git a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
index a5b92e3e8f..858f42efe7 100644
--- a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
+++ b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
@@ -5,12 +5,12 @@ Index: u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
 ===================================================================
 --- u-boot-2021.07~rc4+dfsg.orig/include/configs/sifive-unmatched.h
 +++ u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
-@@ -62,6 +62,8 @@
+@@ -55,6 +55,8 @@
  	"name=system,size=-,bootable,type=${type_guid_gpt_system};"
  
- #define CONFIG_EXTRA_ENV_SETTINGS \
+ #define CFG_EXTRA_ENV_SETTINGS \
 +	"fdt_high=0xffffffffffffffff\0" \
 +	"initrd_high=0xffffffffffffffff\0" \
  	"kernel_addr_r=0x84000000\0" \
- 	"fdt_addr_r=0x88000000\0" \
- 	"scriptaddr=0x88100000\0" \
+ 	"kernel_comp_addr_r=0x88000000\0" \
+ 	"kernel_comp_size=0x4000000\0" \
-- 
2.39.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] WIP update u-boot to 2023.07-rc6
  2023-07-05  2:50         ` [bug#64149] WIP update u-boot to 2023.07-rc6 Vagrant Cascadian
@ 2023-07-06 17:50           ` Vagrant Cascadian
  2023-07-08  4:03             ` [bug#64149] [PATCH 0/2] Maxim Cournoyer
                               ` (2 more replies)
  2023-07-08  4:23           ` [bug#64149] WIP update u-boot to 2023.07-rc4 Maxim Cournoyer
  1 sibling, 3 replies; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-06 17:50 UTC (permalink / raw)
  To: 64149; +Cc: ludo, efraim, maxim.cournoyer

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

On 2023-07-04, Vagrant Cascadian wrote:
> Attached patch which gets everything building again!

Oops, did not test patman, and it is failing:

  https://data.qa.guix.gnu.org/gnu/store/xr69qjplhkpd4r6dxdb65yalzamsg2fi-patman-2023.07-rc6.drv

Not sure when I will have time to look at that...

Would be nice if I were able to do "guix refresh --list-dependent --inherits-from u-boot"
instead of manually figuring this out... or if it supported that out of
the box somehow...

live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 0/2]
  2023-07-06 17:50           ` Vagrant Cascadian
@ 2023-07-08  4:03             ` Maxim Cournoyer
  2023-07-08  4:03             ` [bug#64149] [PATCH 1/2] gnu: Add python-u-boot-pylib Maxim Cournoyer
  2023-07-08  4:03             ` [bug#64149] [PATCH 2/2] gnu: patman: Add python-u-boot-pylib to inputs Maxim Cournoyer
  2 siblings, 0 replies; 46+ messages in thread
From: Maxim Cournoyer @ 2023-07-08  4:03 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 64149, ludo, efraim, Maxim Cournoyer

Hi Vagrant,

I've fixed patman, to be applied on top of your u-boot update commit.
I'll now post some review comments.

Thanks,

Maxim Cournoyer (2):
  gnu: Add python-u-boot-pylib.
  gnu: patman: Add python-u-boot-pylib to inputs.

 gnu/local.mk                                  |  1 +
 gnu/packages/bootloaders.scm                  | 25 +++++++++++++++++--
 .../patches/u-boot-fix-u-boot-lib-build.patch | 24 ++++++++++++++++++
 3 files changed, 48 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch


base-commit: 14888e5b25202047cd467461a4032326fe9de344
prerequisite-patch-id: c2991e79f14f2a4b285e6a627fd850b8cafe8638
-- 
2.40.1





^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 1/2] gnu: Add python-u-boot-pylib.
  2023-07-06 17:50           ` Vagrant Cascadian
  2023-07-08  4:03             ` [bug#64149] [PATCH 0/2] Maxim Cournoyer
@ 2023-07-08  4:03             ` Maxim Cournoyer
  2023-07-08  4:03             ` [bug#64149] [PATCH 2/2] gnu: patman: Add python-u-boot-pylib to inputs Maxim Cournoyer
  2 siblings, 0 replies; 46+ messages in thread
From: Maxim Cournoyer @ 2023-07-08  4:03 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 64149, ludo, efraim, Maxim Cournoyer

* gnu/packages/bootloaders.scm (python-u-boot-pylib): New variable.
* gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/bootloaders.scm                  | 23 +++++++++++++++++-
 .../patches/u-boot-fix-u-boot-lib-build.patch | 24 +++++++++++++++++++
 3 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index bb13280dc7..c12b29447d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1996,6 +1996,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
+  %D%/packages/patches/u-boot-fix-u-boot-lib-build.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 3f04411f1b..c1a76ab90e 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -655,7 +655,8 @@ (define u-boot
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
                      %u-boot-rk3399-enable-emmc-phy-patch
-                     (search-patch "u-boot-fix-build-python-3.10.patch")))
+                     (search-patch "u-boot-fix-build-python-3.10.patch")
+                     (search-patch "u-boot-fix-u-boot-lib-build.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
@@ -831,6 +832,26 @@ (define-public u-boot-tools
                   "  This package provides board-independent tools "
                   "of U-Boot."))))
 
+(define-public python-u-boot-pylib
+  (package
+    (inherit u-boot)
+    (name "python-u-boot-pylib")
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _
+              (chdir "tools/u_boot_pylib")))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "./u_boot_pylib")))))))
+    (synopsis "U-Boot Python library")
+    (description "This package provides common Python code used by some of the
+commands part of the U-Boot project, such as Patman.")))
+
 ;;; This is packaged separately, as it can be used in other contexts than for
 ;;; U-Boot development.
 (define-public patman
diff --git a/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch b/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch
new file mode 100644
index 0000000000..233c437de6
--- /dev/null
+++ b/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch
@@ -0,0 +1,24 @@
+Submitted upstream (see:
+https://lists.denx.de/pipermail/u-boot/2023-July/521984.html)
+
+diff --git a/tools/u_boot_pylib/pyproject.toml b/tools/u_boot_pylib/pyproject.toml
+index 3f33caf6f8..037c5d629e 100644
+--- a/tools/u_boot_pylib/pyproject.toml
++++ b/tools/u_boot_pylib/pyproject.toml
+@@ -9,7 +9,7 @@ authors = [
+   { name="Simon Glass", email="sjg@chromium.org" },
+ ]
+ description = "U-Boot python library"
+-readme = "README.md"
++readme = "README.rst"
+ requires-python = ">=3.7"
+ classifiers = [
+     "Programming Language :: Python :: 3",
+@@ -20,3 +20,7 @@ classifiers = [
+ [project.urls]
+ "Homepage" = "https://u-boot.readthedocs.io"
+ "Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
++
++[tool.setuptools.packages.find]
++where = [".."]
++include = ["u_boot_pylib*"]
-- 
2.40.1





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 2/2] gnu: patman: Add python-u-boot-pylib to inputs.
  2023-07-06 17:50           ` Vagrant Cascadian
  2023-07-08  4:03             ` [bug#64149] [PATCH 0/2] Maxim Cournoyer
  2023-07-08  4:03             ` [bug#64149] [PATCH 1/2] gnu: Add python-u-boot-pylib Maxim Cournoyer
@ 2023-07-08  4:03             ` Maxim Cournoyer
  2023-07-08 23:21               ` Vagrant Cascadian
  2 siblings, 1 reply; 46+ messages in thread
From: Maxim Cournoyer @ 2023-07-08  4:03 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 64149, ludo, efraim, Maxim Cournoyer

* gnu/packages/bootloaders.scm (patman) [inputs]: Add python-u-boot-pylib.
---
 gnu/packages/bootloaders.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index c1a76ab90e..789248afeb 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -869,7 +869,7 @@ (define-public patman
           (add-after 'unpack 'chdir
             (lambda _
               (chdir "tools/patman"))))))
-    (inputs (list python-pygit2 python-requests))
+    (inputs (list python-pygit2 python-requests python-u-boot-pylib))
     (synopsis "Patch automation tool")
     (description "Patman is a patch automation script which:
 @itemize
-- 
2.40.1





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] WIP update u-boot to 2023.07-rc4
  2023-07-05  2:50         ` [bug#64149] WIP update u-boot to 2023.07-rc6 Vagrant Cascadian
  2023-07-06 17:50           ` Vagrant Cascadian
@ 2023-07-08  4:23           ` Maxim Cournoyer
  2023-07-08 21:36             ` Vagrant Cascadian
  1 sibling, 1 reply; 46+ messages in thread
From: Maxim Cournoyer @ 2023-07-08  4:23 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 64149, ludo, efraim

Hi Vagrant,

Some quick comments:

Vagrant Cascadian <vagrant@debian.org> writes:


[...]


> The one thing I would probably prefer is to split this into one package
> per line, but I tried to aim for a smaller diff:
>
> -       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
> +       (prepend python-coverage python-filelock python-pycryptodomex
> +python-pytest python-pytest-xdist sdl2)))

Odd indentation; please use something like:

          (prepend package1
                   package2
                   ...)
                   
> Though, apparently I have the worst of both worlds, split across two
> lines and not indented correctly! Easy enough to fix with the next
> iteration...
>
>
> I still think it is probably best to wait till the 2023.07 release to
> actually push to master... but hopefully this resolves most of the
> hardest work!

Haha!  I see you had the same comment yourself.

>
> live well,
>   vagrant
>
> From d734cc541f920963e8cf8d68061d5329c9712d00 Mon Sep 17 00:00:00 2001
> From: Vagrant Cascadian <vagrant@debian.org>
> Date: Sun, 2 Jul 2023 18:20:39 -0700
> Subject: [PATCH 2/2] gnu: u-boot: Update to 2023.07-rc6.
>
> * gnu/packages/patches/u-boot-infodocs-target.patch: Remove file.
> * gnu/packages/patches/u-boot-patman-guix-integration.patch: Remove
> file.

Nitpick: I'd use "Delete" here instead of "Remove".

> * gnu/local.mk: Remove patches.

Nitpick: I'd use "De-register" instead of remove.

> * gnu/packages/patches/u-boot-allow-disabling-openssl.patch: Refresh.
> * gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch: Refresh.
> * gnu/packages/bootloaders.scm (u-boot): Update to 2023.07-rc6.
> [native-inputs]: Add python-pyelftools.
> [source]: Remove patches.
> (u-boot-tools)[phases]: Update substitution for python3-coverage.
> Adjust 'patch to catch more openssl incompatibilities.
> [native-inputs]: Add python-filelock and python-pytest-xdist.
> (make-u-boot-sunxi64-package): Set SCP environment variable.
> (u-boot-sifive-unleashed): Update to use opensbi.
> (u-boot-puma-rk3399)[inputs]: Add arm-trusted-firmware-rk3399 to
> package-inputs instead of native-inputs.
> (u-boot-rockpro64-rk3399)[phases]: Add 'disable-spl-fit-signature.
> ---
>  gnu/local.mk                                  |    2 -
>  gnu/packages/bootloaders.scm                  |   46 +-
>  .../u-boot-allow-disabling-openssl.patch      |   13 +-
>  .../patches/u-boot-infodocs-target.patch      |   84 --
>  .../u-boot-patman-guix-integration.patch      | 1244 -----------------
>  ...boot-sifive-prevent-reloc-initrd-fdt.patch |    8 +-
>  6 files changed, 46 insertions(+), 1351 deletions(-)
>  delete mode 100644 gnu/packages/patches/u-boot-infodocs-target.patch
>  delete mode 100644 gnu/packages/patches/u-boot-patman-guix-integration.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 6470f1abd4..fe46cd58f2 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -1997,8 +1997,6 @@ dist_patch_DATA =						\
>    %D%/packages/patches/twinkle-bcg729.patch			\
>    %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
>    %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
> -  %D%/packages/patches/u-boot-infodocs-target.patch		\
> -  %D%/packages/patches/u-boot-patman-guix-integration.patch	\
>    %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
>    %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
>    %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
> diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
> index a9685a9ef9..446dc8fc97 100644
> --- a/gnu/packages/bootloaders.scm
> +++ b/gnu/packages/bootloaders.scm
> @@ -648,23 +648,21 @@ (define %u-boot-rk3399-enable-emmc-phy-patch
>  (define u-boot
>    (package
>      (name "u-boot")
> -    (version "2022.10")
> +    (version "2023.07-rc6")
>      (source (origin
>                (patches
>                 (list %u-boot-rockchip-inno-usb-patch
>                       %u-boot-allow-disabling-openssl-patch
>                       %u-boot-sifive-prevent-relocating-initrd-fdt
>                       %u-boot-rk3399-enable-emmc-phy-patch
> -                     (search-patch "u-boot-fix-build-python-3.10.patch")
> -                     (search-patch "u-boot-infodocs-target.patch")
> -                     (search-patch "u-boot-patman-guix-integration.patch")))
> +                     (search-patch "u-boot-fix-build-python-3.10.patch")))
>                (method url-fetch)
>                (uri (string-append
>                      "https://ftp.denx.de/pub/u-boot/"
>                      "u-boot-" version ".tar.bz2"))
>                (sha256
>                 (base32
> -                "1y5x8vxdgsqdqlsvq01mn8lmw53fqairkhvhhjx83hjva0m4id2h"))))
> +                "1dgvr228imbhzq7vzr8iialijl3k4mhjdirjrm6hsy6qbm6jyj5r"))))
>      (build-system  gnu-build-system)
>      (native-inputs
>       (list bison
> @@ -676,6 +674,7 @@ (define u-boot
>             perl
>             pkg-config                   ;for 'make menuconfig'
>             python
> +           python-pyelftools
>             swig
>             (list util-linux "lib")))
>      (home-page "https://www.denx.de/wiki/U-Boot/")
> @@ -726,7 +725,8 @@ (define-public u-boot-tools
>      (name "u-boot-tools")
>      (native-inputs
>       (modify-inputs (package-native-inputs u-boot)
> -       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
> +       (prepend python-coverage python-filelock python-pycryptodomex
> +python-pytest python-pytest-xdist sdl2)))
>      (arguments
>       `(#:make-flags '("HOSTCC=gcc")
>         #:test-target "tcheck"
> @@ -739,7 +739,7 @@ (define-public u-boot-tools
>                 (("/bin/false") (which "false")))
>               (substitute* "tools/dtoc/fdt_util.py"
>                 (("'cc'") "'gcc'"))
> -             (substitute* "tools/patman/test_util.py"
> +             (substitute* "tools/u_boot_pylib/test_util.py"
>                 ;; python3-coverage is simply called coverage in guix.
>                 (("python3-coverage") "coverage")
>  
> @@ -778,6 +778,9 @@ (define-public u-boot-tools
>                             ;; details.
>                             (("CONFIG_FIT_SIGNATURE=y")
>                              "CONFIG_FIT_SIGNATURE=n\nCONFIG_UT_LIB_ASN1=n\nCONFIG_TOOLS_LIBCRYPTO=n")
> +                           ;; Catch instances of implied CONFIG_FIG_SIGNATURE with VPL targets
> +                           (("CONFIG_SANDBOX_VPL=y")
> +                            "CONFIG_SANDBOX_VPL=y\nCONFIG_FIT_SIGNATURE=n\nCONFIG_VPL_FIT_SIGNATURE=n\nCONFIG_TOOLS_LIBCRYPTO=n")

I know it's already busted on the line above, but we can format this in
a more readable way by using something like:
                              "\
CONFIG1=y
CONFIG2=n
...\n"

>                             ;; This test requires a sound system, which is un-used
>                             ;; in u-boot-tools.
>                             (("CONFIG_SOUND=y") "CONFIG_SOUND=n")))
> @@ -1009,6 +1012,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
>            #~(modify-phases #$phases
>                (add-after 'unpack 'set-environment
>                  (lambda* (#:key native-inputs inputs #:allow-other-keys)
> +                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371

Trick to avoid busting the 80 characters per line limit: for links, you
can do (see: $link), which typically gets split like:

                     ;; blablabla (see:
                     ;; https://...)

> +                  (setenv "SCP" "/dev/null")
>                    (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
>        (inputs
>         (modify-inputs (package-inputs base)
> @@ -1104,7 +1109,7 @@ (define-public u-boot-puma-rk3399
>                (delete 'strip)
>                (delete 'validate-runpath)))))
>        (inputs
> -       (modify-inputs (package-native-inputs base)
> +       (modify-inputs (package-inputs base)
>           (append arm-trusted-firmware-rk3399))))))
>  
>  (define-public u-boot-qemu-arm
> @@ -1170,7 +1175,20 @@ (define-public u-boot-sandbox
>                  (append sdl2))))))
>  
>  (define-public u-boot-sifive-unleashed
> -  (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu"))
> +  (let ((base (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu")))
> +    (package
> +      (inherit base)
> +      (arguments
> +       (substitute-keyword-arguments (package-arguments base)
> +         ((#:phases phases)
> +          #~(modify-phases #$phases
> +              (add-after 'unpack 'set-environment
> +                (lambda* (#:key inputs #:allow-other-keys)
> +                  (setenv "OPENSBI" (search-input-file inputs
> +                                                       "fw_dynamic.bin"))))))))
> +      (inputs
> +       (modify-inputs (package-inputs base)
> +         (append opensbi-generic))))))
>  
>  (define-public u-boot-sifive-unmatched
>    (let ((base (make-u-boot-package "sifive_unmatched" "riscv64-linux-gnu")))
> @@ -1230,7 +1248,8 @@ (define-public u-boot-rockpro64-rk3399
>                                                 "CONFIG_SATA_SIL=y"
>                                                 "CONFIG_SCSI=y"
>                                                 "CONFIG_SCSI_AHCI=y"
> -                                               "CONFIG_DM_SCSI=y"))))
> +                                               "CONFIG_DM_SCSI=y"
> +                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>      (package
>        (inherit base)
>        (arguments
> @@ -1240,6 +1259,13 @@ (define-public u-boot-rockpro64-rk3399
>                (add-after 'unpack 'set-environment
>                  (lambda* (#:key inputs #:allow-other-keys)
>                    (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
> +              ;; Disable SPL FIT signatures, due to GPLv2 and Openssl license
> +              ;; incompatibilities
> +              (add-after 'unpack 'disable-spl-fit-signature
> +                (lambda _
> +                  (substitute* "configs/rockpro64-rk3399_defconfig"
> +                    (("CONFIG_SPL_FIT_SIGNATURE=y")
> +                     "# CONFIG_SPL_FIT_SIGNATURE is not set"))))

Is this really needed, given we use "# CONFIG_SPL_FIT_SIGNATURE is not
set" in #:configs above?

The rest LGTM, thank you!

-- 
Maxim




^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] WIP update u-boot to 2023.07-rc4
  2023-07-08  4:23           ` [bug#64149] WIP update u-boot to 2023.07-rc4 Maxim Cournoyer
@ 2023-07-08 21:36             ` Vagrant Cascadian
  2023-07-09  1:38               ` [bug#64149] [PATCH v2] bug#64149: WIP update u-boot to 2023.07-rc6 Vagrant Cascadian
  0 siblings, 1 reply; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-08 21:36 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 64149, ludo, efraim

[-- Attachment #1: Type: text/plain, Size: 5102 bytes --]

On 2023-07-08, Maxim Cournoyer wrote:
> Vagrant Cascadian <vagrant@debian.org> writes:
> [...]
>> The one thing I would probably prefer is to split this into one package
>> per line, but I tried to aim for a smaller diff:
>>
>> -       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
>> +       (prepend python-coverage python-filelock python-pycryptodomex
>> +python-pytest python-pytest-xdist sdl2)))
>
> Odd indentation; please use something like:
>
>           (prepend package1
>                    package2
>                    ...)

Yup, that is the aproach I would propose for the next and/or final
patch(es)!


>> From d734cc541f920963e8cf8d68061d5329c9712d00 Mon Sep 17 00:00:00 2001
>> From: Vagrant Cascadian <vagrant@debian.org>
>> Date: Sun, 2 Jul 2023 18:20:39 -0700
>> Subject: [PATCH 2/2] gnu: u-boot: Update to 2023.07-rc6.
>>
>> * gnu/packages/patches/u-boot-infodocs-target.patch: Remove file.
>> * gnu/packages/patches/u-boot-patman-guix-integration.patch: Remove
>> file.
>
> Nitpick: I'd use "Delete" here instead of "Remove".

Not my style, but not strongly opinionated either. :)

>> * gnu/local.mk: Remove patches.
>
> Nitpick: I'd use "De-register" instead of remove.

Even less my style, but also not strongly opinionated. :)


>> @@ -778,6 +778,9 @@ (define-public u-boot-tools
>>                             ;; details.
>>                             (("CONFIG_FIT_SIGNATURE=y")
>>                              "CONFIG_FIT_SIGNATURE=n\nCONFIG_UT_LIB_ASN1=n\nCONFIG_TOOLS_LIBCRYPTO=n")
>> +                           ;; Catch instances of implied CONFIG_FIG_SIGNATURE with VPL targets
>> +                           (("CONFIG_SANDBOX_VPL=y")
>> +                            "CONFIG_SANDBOX_VPL=y\nCONFIG_FIT_SIGNATURE=n\nCONFIG_VPL_FIT_SIGNATURE=n\nCONFIG_TOOLS_LIBCRYPTO=n")
>
> I know it's already busted on the line above, but we can format this in
> a more readable way by using something like:
>                               "\
> CONFIG1=y
> CONFIG2=n
> ...\n"

Will experiment with it, and if I can get it to work, also fix the
CONFIG_FIT_SIGNATURE stuff too.


>>                             ;; This test requires a sound system, which is un-used
>>                             ;; in u-boot-tools.
>>                             (("CONFIG_SOUND=y") "CONFIG_SOUND=n")))
>> @@ -1009,6 +1012,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
>>            #~(modify-phases #$phases
>>                (add-after 'unpack 'set-environment
>>                  (lambda* (#:key native-inputs inputs #:allow-other-keys)
>> +                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
>
> Trick to avoid busting the 80 characters per line limit: for links, you
> can do (see: $link), which typically gets split like:
>
>                      ;; blablabla (see:
>                      ;; https://...)
>
>> +                  (setenv "SCP" "/dev/null")

Yeah, that sounds good...

Although, now that "Add crust firmware for sunxi devices"
(https://issues.guix.gnu.org/48371) finally got merged, we will have to
fix this properly. :)


>> @@ -1230,7 +1248,8 @@ (define-public u-boot-rockpro64-rk3399
>>                                                 "CONFIG_SATA_SIL=y"
>>                                                 "CONFIG_SCSI=y"
>>                                                 "CONFIG_SCSI_AHCI=y"
>> -                                               "CONFIG_DM_SCSI=y"))))
>> +                                               "CONFIG_DM_SCSI=y"
>> +                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>>      (package
>>        (inherit base)
>>        (arguments
>> @@ -1240,6 +1259,13 @@ (define-public u-boot-rockpro64-rk3399
>>                (add-after 'unpack 'set-environment
>>                  (lambda* (#:key inputs #:allow-other-keys)
>>                    (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
>> +              ;; Disable SPL FIT signatures, due to GPLv2 and Openssl license
>> +              ;; incompatibilities
>> +              (add-after 'unpack 'disable-spl-fit-signature
>> +                (lambda _
>> +                  (substitute* "configs/rockpro64-rk3399_defconfig"
>> +                    (("CONFIG_SPL_FIT_SIGNATURE=y")
>> +                     "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>
> Is this really needed, given we use "# CONFIG_SPL_FIT_SIGNATURE is not
> set" in #:configs above?

Only having it in #:configs resulted in a build failure (e.g. there were
conflicting entries or something). Having it in both places seems better
as it ensures it does not accidentally get enabled somehow. But we
probably could drop the part in #:configs if we wanted ... or re-write
how #:configs works, though that would be more than I want to get into
right now! :)

> The rest LGTM, thank you!

Thanks for the review!

Will try and incorporate the above suggestions and the patman patches
and get another patch series ready for 2023.07-rc6, and then hopefully
monday the actual release of 2023.07...


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 2/2] gnu: patman: Add python-u-boot-pylib to inputs.
  2023-07-08  4:03             ` [bug#64149] [PATCH 2/2] gnu: patman: Add python-u-boot-pylib to inputs Maxim Cournoyer
@ 2023-07-08 23:21               ` Vagrant Cascadian
  2023-07-09  2:36                 ` Vagrant Cascadian
  2023-07-10  4:01                 ` Maxim Cournoyer
  0 siblings, 2 replies; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-08 23:21 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 64149, ludo, efraim, Maxim Cournoyer

[-- Attachment #1: Type: text/plain, Size: 2739 bytes --]

On 2023-07-08, Maxim Cournoyer wrote:
> * gnu/packages/bootloaders.scm (patman) [inputs]: Add python-u-boot-pylib.
> ---
>  gnu/packages/bootloaders.scm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
> index c1a76ab90e..789248afeb 100644
> --- a/gnu/packages/bootloaders.scm
> +++ b/gnu/packages/bootloaders.scm
> @@ -869,7 +869,7 @@ (define-public patman
>            (add-after 'unpack 'chdir
>              (lambda _
>                (chdir "tools/patman"))))))
> -    (inputs (list python-pygit2 python-requests))
> +    (inputs (list python-pygit2 python-requests python-u-boot-pylib))
>      (synopsis "Patch automation tool")
>      (description "Patman is a patch automation script which:
>  @itemize
> -- 
> 2.40.1

This was not sufficient to get patman building again:

starting phase `sanity-check'                                                                                                       validating 'patch-manager' /gnu/store/d22rsfa7pr8ff6ai1hp72qjljiyayzrx-patman-2023.07-rc6/lib/python3.10/site-packages
...checking requirements: OK                                                                                                        ...trying to load module patman: OK                                                                                                 ...trying to load endpoint console_scripts patman: ERROR:
Traceback (most recent call last):                                                                                                    File "/gnu/store/rlf99syqlc9kyf76rba3sbxsafszf017-python-u-boot-pylib-2023.07-rc6/lib/python3.10/site-packages/u_boot_pylib/command.py", line 95, in run_pipe
    last_pipe = cros_subprocess.Popen(cmd, cwd=cwd, **kwargs)                                                                         File "/gnu/store/rlf99syqlc9kyf76rba3sbxsafszf017-python-u-boot-pylib-2023.07-rc6/lib/python3.10/site-packages/u_boot_pylib/cros_subprocess.py", line 83, in __init__
    super(Popen, self).__init__(args, stdin=stdin,                                                                                    File "/gnu/store/kj6wzba6p192baizq99b489rs8bynpn7-python-3.10.7/lib/python3.10/subprocess.py", line 969, in __init__                  self._execute_child(args, executable, preexec_fn, close_fds,
  File "/gnu/store/kj6wzba6p192baizq99b489rs8bynpn7-python-3.10.7/lib/python3.10/subprocess.py", line 1845, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'git'                                                                       
live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v2] bug#64149: WIP update u-boot to 2023.07-rc6
  2023-07-08 21:36             ` Vagrant Cascadian
@ 2023-07-09  1:38               ` Vagrant Cascadian
  2023-07-09  1:47                 ` [bug#64149] [PATCH 1/5] gnu: arm-trusted-firmware: Update to 2.9 vagrant
  0 siblings, 1 reply; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-09  1:38 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 64149, ludo, efraim

[-- Attachment #1: Type: text/plain, Size: 5003 bytes --]

On 2023-07-08, Vagrant Cascadian wrote:
> On 2023-07-08, Maxim Cournoyer wrote:
>> Vagrant Cascadian <vagrant@debian.org> writes:
>> [...]
>>> The one thing I would probably prefer is to split this into one package
>>> per line, but I tried to aim for a smaller diff:
>>>
>>> -       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
>>> +       (prepend python-coverage python-filelock python-pycryptodomex
>>> +python-pytest python-pytest-xdist sdl2)))
>>
>> Odd indentation; please use something like:
>>
>>           (prepend package1
>>                    package2
>>                    ...)
>
> Yup, that is the aproach I would propose for the next and/or final
> patch(es)!

Included in the upcoming patch series.

>>> * gnu/packages/patches/u-boot-infodocs-target.patch: Remove file.
>>> * gnu/packages/patches/u-boot-patman-guix-integration.patch: Remove
>>> file.
>>
>> Nitpick: I'd use "Delete" here instead of "Remove".
>
> Not my style, but not strongly opinionated either. :)
>
>>> * gnu/local.mk: Remove patches.
>>
>> Nitpick: I'd use "De-register" instead of remove.
>
> Even less my style, but also not strongly opinionated. :)

And also included.

>>> @@ -778,6 +778,9 @@ (define-public u-boot-tools
>>>                             ;; details.
>>>                             (("CONFIG_FIT_SIGNATURE=y")
>>>                              "CONFIG_FIT_SIGNATURE=n\nCONFIG_UT_LIB_ASN1=n\nCONFIG_TOOLS_LIBCRYPTO=n")
>>> +                           ;; Catch instances of implied CONFIG_FIG_SIGNATURE with VPL targets
>>> +                           (("CONFIG_SANDBOX_VPL=y")
>>> +                            "CONFIG_SANDBOX_VPL=y\nCONFIG_FIT_SIGNATURE=n\nCONFIG_VPL_FIT_SIGNATURE=n\nCONFIG_TOOLS_LIBCRYPTO=n")
>>
>> I know it's already busted on the line above, but we can format this in
>> a more readable way by using something like:
>>                               "\
>> CONFIG1=y
>> CONFIG2=n
>> ...\n"

I did something somewhat like that, in a way that did not require using
\n at all, for both the CONFIG_FIT_SIGNATURE and CONFIG_SANDBOX_VPL
lines.


>>> @@ -1009,6 +1012,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
>>>            #~(modify-phases #$phases
>>>                (add-after 'unpack 'set-environment
>>>                  (lambda* (#:key native-inputs inputs #:allow-other-keys)
>>> +                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
>>
>> Trick to avoid busting the 80 characters per line limit: for links, you
>> can do (see: $link), which typically gets split like:
>>
>>                      ;; blablabla (see:
>>                      ;; https://...)
>>
>>> +                  (setenv "SCP" "/dev/null")
>
> Yeah, that sounds good...

Oops, forgot that... because...

> Although, now that "Add crust firmware for sunxi devices"
> (https://issues.guix.gnu.org/48371) finally got merged, we will have to
> fix this properly. :)

I made this work. :)


>>> @@ -1230,7 +1248,8 @@ (define-public u-boot-rockpro64-rk3399
>>>                                                 "CONFIG_SATA_SIL=y"
>>>                                                 "CONFIG_SCSI=y"
>>>                                                 "CONFIG_SCSI_AHCI=y"
>>> -                                               "CONFIG_DM_SCSI=y"))))
>>> +                                               "CONFIG_DM_SCSI=y"
>>> +                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>>>      (package
>>>        (inherit base)
>>>        (arguments
>>> @@ -1240,6 +1259,13 @@ (define-public u-boot-rockpro64-rk3399
>>>                (add-after 'unpack 'set-environment
>>>                  (lambda* (#:key inputs #:allow-other-keys)
>>>                    (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
>>> +              ;; Disable SPL FIT signatures, due to GPLv2 and Openssl license
>>> +              ;; incompatibilities
>>> +              (add-after 'unpack 'disable-spl-fit-signature
>>> +                (lambda _
>>> +                  (substitute* "configs/rockpro64-rk3399_defconfig"
>>> +                    (("CONFIG_SPL_FIT_SIGNATURE=y")
>>> +                     "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>>
>> Is this really needed, given we use "# CONFIG_SPL_FIT_SIGNATURE is not
>> set" in #:configs above?
>
> Only having it in #:configs resulted in a build failure (e.g. there were
> conflicting entries or something). Having it in both places seems better
> as it ensures it does not accidentally get enabled somehow. But we
> probably could drop the part in #:configs if we wanted ... or re-write
> how #:configs works, though that would be more than I want to get into
> right now! :)

I stuck with the above rationale and left it as it was...

I've included the patch updating arm-trusted-firmware to 2.9 from
https://issues.guix.gnu.org/64142 and the patches submitted regarding
patman, although as mentioned patman still needs some updates.


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 1/5] gnu: arm-trusted-firmware: Update to 2.9.
  2023-07-09  1:38               ` [bug#64149] [PATCH v2] bug#64149: WIP update u-boot to 2023.07-rc6 Vagrant Cascadian
@ 2023-07-09  1:47                 ` vagrant
  2023-07-09  1:47                   ` [bug#64149] [PATCH 2/5] gnu: u-boot: Update to 2023.07-rc6 vagrant
                                     ` (3 more replies)
  0 siblings, 4 replies; 46+ messages in thread
From: vagrant @ 2023-07-09  1:47 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Vagrant Cascadian <vagrant@debian.org>

* gnu/packages/firmware.scm (make-arm-trusted-firmware): Update to 2.9.
---
 gnu/packages/firmware.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 3dcc882e0c..0492dabeed 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1025,7 +1025,7 @@ (define* (make-arm-trusted-firmware platform
                                        (gnu-triplet->nix-system triplet))))))
     (package
       (name (string-append "arm-trusted-firmware-" platform))
-      (version "2.8")
+      (version "2.9")
       (source
        (origin
          (method git-fetch)
@@ -1036,7 +1036,7 @@ (define* (make-arm-trusted-firmware platform
          (file-name (git-file-name "arm-trusted-firmware" version))
          (sha256
           (base32
-           "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3"))
+           "16fjbn1zck0d8b554h8lk1svqqn0zlawvrlkjxry9l71s9h4vd0p"))
          (snippet
           #~(begin
               (use-modules (guix build utils))

base-commit: 2986ba899f5ee374008c501e26fb653147ed7891
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 2/5] gnu: u-boot: Update to 2023.07-rc6.
  2023-07-09  1:47                 ` [bug#64149] [PATCH 1/5] gnu: arm-trusted-firmware: Update to 2.9 vagrant
@ 2023-07-09  1:47                   ` vagrant
  2023-07-10 19:35                     ` Vagrant Cascadian
  2023-07-09  1:47                   ` [bug#64149] [PATCH 3/5] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts vagrant
                                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 46+ messages in thread
From: vagrant @ 2023-07-09  1:47 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Vagrant Cascadian <vagrant@debian.org>

* gnu/packages/patches/u-boot-infodocs-target.patch: Delete file.
* gnu/packages/patches/u-boot-patman-guix-integration.patch: Delete file.
* gnu/local.mk: De-register patches.
* gnu/packages/patches/u-boot-allow-disabling-openssl.patch: Refresh.
* gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch: Refresh.
* gnu/packages/bootloaders.scm (u-boot): Update to 2023.07-rc6.
[native-inputs]: Add python-pyelftools.
[source]: Remove patches.
(u-boot-tools)[phases]: Update substitution for python3-coverage.
Adjust 'patch to catch more openssl incompatibilities.
Split lines in 'patch phase.
[native-inputs]: Add python-filelock and python-pytest-xdist.
(make-u-boot-sunxi64-package): Set SCP environment variable.
(u-boot-sifive-unleashed): Update to use opensbi.
(u-boot-puma-rk3399)[inputs]: Add arm-trusted-firmware-rk3399 to
package-inputs instead of native-inputs.
(u-boot-rockpro64-rk3399)[phases]: Add 'disable-spl-fit-signature.
---
 gnu/local.mk                                  |    2 -
 gnu/packages/bootloaders.scm                  |   57 +-
 .../u-boot-allow-disabling-openssl.patch      |   13 +-
 .../patches/u-boot-infodocs-target.patch      |   84 --
 .../u-boot-patman-guix-integration.patch      | 1244 -----------------
 ...boot-sifive-prevent-reloc-initrd-fdt.patch |    8 +-
 6 files changed, 56 insertions(+), 1352 deletions(-)
 delete mode 100644 gnu/packages/patches/u-boot-infodocs-target.patch
 delete mode 100644 gnu/packages/patches/u-boot-patman-guix-integration.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index fa6f76e790..bb13280dc7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1996,8 +1996,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
-  %D%/packages/patches/u-boot-infodocs-target.patch		\
-  %D%/packages/patches/u-boot-patman-guix-integration.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 01fd1093ff..8be5303a74 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -648,23 +648,21 @@ (define %u-boot-rk3399-enable-emmc-phy-patch
 (define u-boot
   (package
     (name "u-boot")
-    (version "2022.10")
+    (version "2023.07-rc6")
     (source (origin
               (patches
                (list %u-boot-rockchip-inno-usb-patch
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
                      %u-boot-rk3399-enable-emmc-phy-patch
-                     (search-patch "u-boot-fix-build-python-3.10.patch")
-                     (search-patch "u-boot-infodocs-target.patch")
-                     (search-patch "u-boot-patman-guix-integration.patch")))
+                     (search-patch "u-boot-fix-build-python-3.10.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
                     "u-boot-" version ".tar.bz2"))
               (sha256
                (base32
-                "1y5x8vxdgsqdqlsvq01mn8lmw53fqairkhvhhjx83hjva0m4id2h"))))
+                "1dgvr228imbhzq7vzr8iialijl3k4mhjdirjrm6hsy6qbm6jyj5r"))))
     (build-system gnu-build-system)
     (native-inputs
      (list bison
@@ -676,6 +674,7 @@ (define u-boot
            perl
            pkg-config                   ;for 'make menuconfig'
            python
+           python-pyelftools
            swig
            (list util-linux "lib")))
     (home-page "https://www.denx.de/wiki/U-Boot/")
@@ -726,7 +725,12 @@ (define-public u-boot-tools
     (name "u-boot-tools")
     (native-inputs
      (modify-inputs (package-native-inputs u-boot)
-       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
+       (prepend python-coverage
+                python-filelock
+                python-pycryptodomex
+                python-pytest
+                python-pytest-xdist
+                sdl2)))
     (arguments
      `(#:make-flags '("HOSTCC=gcc")
        #:test-target "tcheck"
@@ -739,7 +743,7 @@ (define-public u-boot-tools
                (("/bin/false") (which "false")))
              (substitute* "tools/dtoc/fdt_util.py"
                (("'cc'") "'gcc'"))
-             (substitute* "tools/patman/test_util.py"
+             (substitute* "tools/u_boot_pylib/test_util.py"
                ;; python3-coverage is simply called coverage in guix.
                (("python3-coverage") "coverage")
 
@@ -777,7 +781,15 @@ (define-public u-boot-tools
                            ;; See https://bugs.gnu.org/34717 for
                            ;; details.
                            (("CONFIG_FIT_SIGNATURE=y")
-                            "CONFIG_FIT_SIGNATURE=n\nCONFIG_UT_LIB_ASN1=n\nCONFIG_TOOLS_LIBCRYPTO=n")
+                            "CONFIG_FIT_SIGNATURE=n
+CONFIG_UT_LIB_ASN1=n
+CONFIG_TOOLS_LIBCRYPTO=n")
+                           ;; Catch instances of implied CONFIG_FIG_SIGNATURE with VPL targets
+                           (("CONFIG_SANDBOX_VPL=y")
+                            "CONFIG_SANDBOX_VPL=y
+CONFIG_FIT_SIGNATURE=n
+CONFIG_VPL_FIT_SIGNATURE=n
+CONFIG_TOOLS_LIBCRYPTO=n")
                            ;; This test requires a sound system, which is un-used
                            ;; in u-boot-tools.
                            (("CONFIG_SOUND=y") "CONFIG_SOUND=n")))
@@ -1009,6 +1021,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
           #~(modify-phases #$phases
               (add-after 'unpack 'set-environment
                 (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
+                  (setenv "SCP" "/dev/null")
                   (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
       (inputs
        (modify-inputs (package-inputs base)
@@ -1104,7 +1118,7 @@ (define-public u-boot-puma-rk3399
               (delete 'strip)
               (delete 'validate-runpath)))))
       (inputs
-       (modify-inputs (package-native-inputs base)
+       (modify-inputs (package-inputs base)
          (append arm-trusted-firmware-rk3399))))))
 
 (define-public u-boot-qemu-arm
@@ -1170,7 +1184,20 @@ (define-public u-boot-sandbox
                 (append sdl2))))))
 
 (define-public u-boot-sifive-unleashed
-  (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu"))
+  (let ((base (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu")))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'set-environment
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (setenv "OPENSBI" (search-input-file inputs
+                                                       "fw_dynamic.bin"))))))))
+      (inputs
+       (modify-inputs (package-inputs base)
+         (append opensbi-generic))))))
 
 (define-public u-boot-sifive-unmatched
   (let ((base (make-u-boot-package "sifive_unmatched" "riscv64-linux-gnu")))
@@ -1230,7 +1257,8 @@ (define-public u-boot-rockpro64-rk3399
                                                "CONFIG_SATA_SIL=y"
                                                "CONFIG_SCSI=y"
                                                "CONFIG_SCSI_AHCI=y"
-                                               "CONFIG_DM_SCSI=y"))))
+                                               "CONFIG_DM_SCSI=y"
+                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
     (package
       (inherit base)
       (arguments
@@ -1240,6 +1268,13 @@ (define-public u-boot-rockpro64-rk3399
               (add-after 'unpack 'set-environment
                 (lambda* (#:key inputs #:allow-other-keys)
                   (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
+              ;; Disable SPL FIT signatures, due to GPLv2 and Openssl license
+              ;; incompatibilities
+              (add-after 'unpack 'disable-spl-fit-signature
+                (lambda _
+                  (substitute* "configs/rockpro64-rk3399_defconfig"
+                    (("CONFIG_SPL_FIT_SIGNATURE=y")
+                     "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
               (add-after 'unpack 'patch-header
                 (lambda _
                   (substitute* "include/config_distro_bootcmd.h"
diff --git a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
index 5f2856dbb4..5195a7a6f8 100644
--- a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
+++ b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
@@ -128,29 +128,28 @@ index 94b7685392..eec599b0ee 100644
  	datai = 0;
  	for (cfgi = 0; cfgi < cfgn; cfgi++) {
  		e = &image_cfg[cfgi];
-@@ -1552,9 +1568,11 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
+@@ -1624,10 +1640,12 @@ static void *image_create_v1(size_t *dataoff, struct image_tool_params *params,
  					      &datai, delay);
  	}
  
 +#if defined(CONFIG_KWB_SECURE)
- 	if (secure_hdr && add_secure_header_v1(params, ptr, payloadsz + headersz,
- 					       headersz, image, secure_hdr))
+ 	if (secure_hdr && add_secure_header_v1(params, ptr + *dataoff, payloadsz,
+ 					       image, headersz, secure_hdr))
  		return NULL;
 +#endif
  
- 	*imagesz = headersz;
+ 	/* Calculate and set the header checksum */
+ 	main_hdr->checksum = image_checksum8(main_hdr, headersz);
  
 --- a/tools/image-host.c
 +++ b/tools/image-host.c
-@@ -14,10 +14,12 @@
+@@ -14,8 +14,10 @@
  #include <image.h>
  #include <version.h>
  
 +#ifdef CONFIG_FIT_PRELOAD
  #include <openssl/pem.h>
  #include <openssl/evp.h>
- 
- #define IMAGE_PRE_LOAD_PATH                             "/image/pre-load/sig"
 +#endif
  
  /**
diff --git a/gnu/packages/patches/u-boot-infodocs-target.patch b/gnu/packages/patches/u-boot-infodocs-target.patch
deleted file mode 100644
index 5b21a99de3..0000000000
--- a/gnu/packages/patches/u-boot-infodocs-target.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-Upstream status: https://patchwork.ozlabs.org/project/uboot/list/?series=333259
-
-diff --git a/Makefile b/Makefile
-index de5746399a..597a8886c3 100644
---- a/Makefile
-+++ b/Makefile
-@@ -2372,7 +2372,7 @@ tcheck:
- # Documentation targets
- # ---------------------------------------------------------------------------
- DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
--	       linkcheckdocs dochelp refcheckdocs
-+	       linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
- PHONY += $(DOC_TARGETS)
- $(DOC_TARGETS): scripts_basic FORCE
- 	$(Q)$(MAKE) $(build)=doc $@
-diff --git a/doc/Makefile b/doc/Makefile
-index f5de65e927..d0904a9f99 100644
---- a/doc/Makefile
-+++ b/doc/Makefile
-@@ -69,6 +69,14 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
- htmldocs:
- 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
- 
-+texinfodocs:
-+	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,texinfo,$(var),texinfo,$(var)))
-+
-+# Note: the 'info' Make target is generated by sphinx itself when
-+# running the texinfodocs target defined above.
-+infodocs: texinfodocs
-+	$(MAKE) -C $(BUILDDIR)/texinfo info
-+
- linkcheckdocs:
- 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
- 
-@@ -109,6 +117,8 @@ cleandocs:
- dochelp:
- 	@echo  ' U-Boot documentation in different formats from ReST:'
- 	@echo  '  htmldocs        - HTML'
-+	@echo  '  texinfodocs     - Texinfo'
-+	@echo  '  infodocs        - Info'
- 	@echo  '  latexdocs       - LaTeX'
- 	@echo  '  pdfdocs         - PDF'
- 	@echo  '  epubdocs        - EPUB'
-diff --git a/doc/conf.py b/doc/conf.py
-index 62c8d31270..3db70f80c1 100644
---- a/doc/conf.py
-+++ b/doc/conf.py
-@@ -449,7 +449,7 @@ for fn in os.listdir('.'):
- # One entry per manual page. List of tuples
- # (source start file, name, description, authors, manual section).
- man_pages = [
--    (master_doc, 'dasuboot', 'The U-Boot Documentation',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-      [author], 1)
- ]
- 
-@@ -463,8 +463,8 @@ man_pages = [
- # (source start file, target name, title, author,
- #  dir menu entry, description, category)
- texinfo_documents = [
--    (master_doc, 'DasUBoot', 'The U-Boot Documentation',
--     author, 'DasUBoot', 'One line description of project.',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-+     author, 'U-Boot', 'Boot loader for embedded systems',
-      'Miscellaneous'),
- ]
- 
-diff --git a/doc/media/Makefile b/doc/media/Makefile
-index b9b43a34c3..9b32258696 100644
---- a/doc/media/Makefile
-+++ b/doc/media/Makefile
-@@ -22,10 +22,11 @@ $(BUILDDIR)/linker_lists.h.rst: ${API}/linker_lists.h ${PARSER} $(SRC_DIR)/linke
- 
- # Media build rules
- 
--.PHONY: all html epub xml latex
-+.PHONY: all html texinfo epub xml latex
- 
- all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
- html: all
-+texinfo: all
- epub: all
- xml: all
- latex: $(IMGPDF) all
diff --git a/gnu/packages/patches/u-boot-patman-guix-integration.patch b/gnu/packages/patches/u-boot-patman-guix-integration.patch
deleted file mode 100644
index 3472656c99..0000000000
--- a/gnu/packages/patches/u-boot-patman-guix-integration.patch
+++ /dev/null
@@ -1,1244 +0,0 @@
-These changes correspond to commits 9ff7500ace..3154de3dd6 already merged to
-the u-boot-dm custodian repo (at
-https://source.denx.de/u-boot/custodians/u-boot-dm/-/commits/next), scheduled
-to be pulled after the next release.
-
-diff --git a/tools/patman/__init__.py b/tools/patman/__init__.py
-index c9d3e35052..1b98ec7fee 100644
---- a/tools/patman/__init__.py
-+++ b/tools/patman/__init__.py
-@@ -1,6 +1,6 @@
- # SPDX-License-Identifier: GPL-2.0+
- 
- __all__ = ['checkpatch', 'command', 'commit', 'control', 'cros_subprocess',
--           'func_test', 'get_maintainer', 'gitutil', 'main', 'patchstream',
-+           'func_test', 'get_maintainer', 'gitutil', '__main__', 'patchstream',
-            'project', 'series', 'setup', 'settings', 'terminal',
-            'test_checkpatch', 'test_util', 'tools', 'tout']
-diff --git a/tools/patman/main.py b/tools/patman/__main__.py
-similarity index 89%
-rename from tools/patman/main.py
-rename to tools/patman/__main__.py
-index 8067a288ab..749e6348b6 100755
---- a/tools/patman/main.py
-+++ b/tools/patman/__main__.py
-@@ -7,6 +7,7 @@
- """See README for more information"""
- 
- from argparse import ArgumentParser
-+import importlib.resources
- import os
- import re
- import sys
-@@ -19,6 +20,7 @@ if __name__ == "__main__":
- 
- # Our modules
- from patman import control
-+from patman import func_test
- from patman import gitutil
- from patman import project
- from patman import settings
-@@ -53,7 +55,8 @@ parser.add_argument('-H', '--full-help', action='store_true', dest='full_help',
-                     default=False, help='Display the README file')
- 
- subparsers = parser.add_subparsers(dest='cmd')
--send = subparsers.add_parser('send')
-+send = subparsers.add_parser(
-+    'send', help='Format, check and email patches (default command)')
- send.add_argument('-i', '--ignore-errors', action='store_true',
-        dest='ignore_errors', default=False,
-        help='Send patches email even if patch errors are found')
-@@ -62,6 +65,12 @@ send.add_argument('-l', '--limit-cc', dest='limit', type=int, default=None,
- send.add_argument('-m', '--no-maintainers', action='store_false',
-        dest='add_maintainers', default=True,
-        help="Don't cc the file maintainers automatically")
-+send.add_argument(
-+    '--get-maintainer-script', dest='get_maintainer_script', type=str,
-+    action='store',
-+    default=os.path.join(gitutil.get_top_level(), 'scripts',
-+                         'get_maintainer.pl') + ' --norolestats',
-+    help='File name of the get_maintainer.pl (or compatible) script.')
- send.add_argument('-n', '--dry-run', action='store_true', dest='dry_run',
-        default=False, help="Do a dry run (create but don't email patches)")
- send.add_argument('-r', '--in-reply-to', type=str, action='store',
-@@ -94,9 +103,11 @@ send.add_argument('--smtp-server', type=str,
- 
- send.add_argument('patchfiles', nargs='*')
- 
--test_parser = subparsers.add_parser('test', help='Run tests')
--test_parser.add_argument('testname', type=str, default=None, nargs='?',
--                         help="Specify the test to run")
-+# Only add the 'test' action if the test data files are available.
-+if os.path.exists(func_test.TEST_DATA_DIR):
-+    test_parser = subparsers.add_parser('test', help='Run tests')
-+    test_parser.add_argument('testname', type=str, default=None, nargs='?',
-+                             help="Specify the test to run")
- 
- status = subparsers.add_parser('status',
-                                help='Check status of patches in patchwork')
-@@ -113,7 +124,7 @@ status.add_argument('-f', '--force', action='store_true',
- argv = sys.argv[1:]
- args, rest = parser.parse_known_args(argv)
- if hasattr(args, 'project'):
--    settings.Setup(gitutil, parser, args.project, '')
-+    settings.Setup(parser, args.project)
-     args, rest = parser.parse_known_args(argv)
- 
- # If we have a command, it is safe to parse all arguments
-@@ -160,11 +171,8 @@ elif args.cmd == 'send':
-         fd.close()
- 
-     elif args.full_help:
--        tools.print_full_help(
--            os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                         'README.rst')
--        )
--
-+        with importlib.resources.path('patman', 'README.rst') as readme:
-+            tools.print_full_help(str(readme))
-     else:
-         # If we are not processing tags, no need to warning about bad ones
-         if not args.process_tags:
-diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
-index d1b902dd96..012c0d895c 100644
---- a/tools/patman/checkpatch.py
-+++ b/tools/patman/checkpatch.py
-@@ -211,7 +211,7 @@ def check_patch(fname, verbose=False, show_types=False, use_tree=False):
-             stdout: Full output of checkpatch
-     """
-     chk = find_check_patch()
--    args = [chk]
-+    args = [chk, '--u-boot', '--strict']
-     if not use_tree:
-         args.append('--no-tree')
-     if show_types:
-diff --git a/tools/patman/control.py b/tools/patman/control.py
-index bf426cf7bc..38e98dab84 100644
---- a/tools/patman/control.py
-+++ b/tools/patman/control.py
-@@ -94,8 +94,8 @@ def check_patches(series, patch_files, run_checkpatch, verbose, use_tree):
- 
- 
- def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
--                  ignore_bad_tags, add_maintainers, limit, dry_run, in_reply_to,
--                  thread, smtp_server):
-+                  ignore_bad_tags, add_maintainers, get_maintainer_script, limit,
-+                  dry_run, in_reply_to, thread, smtp_server):
-     """Email patches to the recipients
- 
-     This emails out the patches and cover letter using 'git send-email'. Each
-@@ -123,6 +123,8 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         ignore_bad_tags (bool): True to just print a warning for unknown tags,
-             False to halt with an error
-         add_maintainers (bool): Run the get_maintainer.pl script for each patch
-+        get_maintainer_script (str): The script used to retrieve which
-+            maintainers to cc
-         limit (int): Limit on the number of people that can be cc'd on a single
-             patch or the cover letter (None if no limit)
-         dry_run (bool): Don't actually email the patches, just print out what
-@@ -134,7 +136,7 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         smtp_server (str): SMTP server to use to send patches (None for default)
-     """
-     cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags,
--                                add_maintainers, limit)
-+                                add_maintainers, limit, get_maintainer_script)
- 
-     # Email the patches out (giving the user time to check / cancel)
-     cmd = ''
-@@ -174,8 +176,8 @@ def send(args):
-     email_patches(
-         col, series, cover_fname, patch_files, args.process_tags,
-         its_a_go, args.ignore_bad_tags, args.add_maintainers,
--        args.limit, args.dry_run, args.in_reply_to, args.thread,
--        args.smtp_server)
-+        args.get_maintainer_script, args.limit, args.dry_run,
-+        args.in_reply_to, args.thread, args.smtp_server)
- 
- def patchwork_status(branch, count, start, end, dest_branch, force,
-                      show_comments, url):
-diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
-index 7b92bc67be..c25a47bdeb 100644
---- a/tools/patman/func_test.py
-+++ b/tools/patman/func_test.py
-@@ -6,7 +6,9 @@
- 
- """Functional tests for checking that patman behaves correctly"""
- 
-+import contextlib
- import os
-+import pathlib
- import re
- import shutil
- import sys
-@@ -28,6 +30,21 @@ from patman.test_util import capture_sys_output
- import pygit2
- from patman import status
- 
-+PATMAN_DIR = pathlib.Path(__file__).parent
-+TEST_DATA_DIR = PATMAN_DIR / 'test/'
-+
-+
-+@contextlib.contextmanager
-+def directory_excursion(directory):
-+    """Change directory to `directory` for a limited to the context block."""
-+    current = os.getcwd()
-+    try:
-+        os.chdir(directory)
-+        yield
-+    finally:
-+        os.chdir(current)
-+
-+
- class TestFunctional(unittest.TestCase):
-     """Functional tests for checking that patman behaves correctly"""
-     leb = (b'Lord Edmund Blackadd\xc3\xabr <weasel@blackadder.org>'.
-@@ -57,8 +74,7 @@ class TestFunctional(unittest.TestCase):
-         Returns:
-             str: Full path to file in the test directory
-         """
--        return os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                            'test', fname)
-+        return TEST_DATA_DIR / fname
- 
-     @classmethod
-     def _get_text(cls, fname):
-@@ -200,6 +216,8 @@ class TestFunctional(unittest.TestCase):
-         text = self._get_text('test01.txt')
-         series = patchstream.get_metadata_for_test(text)
-         cover_fname, args = self._create_patches_for_test(series)
-+        get_maintainer_script = str(pathlib.Path(__file__).parent.parent.parent
-+                                    / 'get_maintainer.pl') + ' --norolestats'
-         with capture_sys_output() as out:
-             patchstream.fix_patches(series, args)
-             if cover_fname and series.get('cover'):
-@@ -207,7 +225,7 @@ class TestFunctional(unittest.TestCase):
-             series.DoChecks()
-             cc_file = series.MakeCcFile(process_tags, cover_fname,
-                                         not ignore_bad_tags, add_maintainers,
--                                        None)
-+                                        None, get_maintainer_script)
-             cmd = gitutil.email_patches(
-                 series, cover_fname, args, dry_run, not ignore_bad_tags,
-                 cc_file, in_reply_to=in_reply_to, thread=None)
-@@ -502,6 +520,37 @@ complicated as possible''')
-         finally:
-             os.chdir(orig_dir)
- 
-+    def test_custom_get_maintainer_script(self):
-+        """Validate that a custom get_maintainer script gets used."""
-+        self.make_git_tree()
-+        with directory_excursion(self.gitdir):
-+            # Setup git.
-+            os.environ['GIT_CONFIG_GLOBAL'] = '/dev/null'
-+            os.environ['GIT_CONFIG_SYSTEM'] = '/dev/null'
-+            tools.run('git', 'config', 'user.name', 'Dummy')
-+            tools.run('git', 'config', 'user.email', 'dumdum@dummy.com')
-+            tools.run('git', 'branch', 'upstream')
-+            tools.run('git', 'branch', '--set-upstream-to=upstream')
-+            tools.run('git', 'add', '.')
-+            tools.run('git', 'commit', '-m', 'new commit')
-+
-+            # Setup patman configuration.
-+            with open('.patman', 'w', buffering=1) as f:
-+                f.write('[settings]\n'
-+                        'get_maintainer_script: dummy-script.sh\n'
-+                        'check_patch: False\n')
-+            with open('dummy-script.sh', 'w', buffering=1) as f:
-+                f.write('#!/usr/bin/env python\n'
-+                        'print("hello@there.com")\n')
-+            os.chmod('dummy-script.sh', 0x555)
-+
-+            # Finally, do the test
-+            with capture_sys_output():
-+                output = tools.run(PATMAN_DIR / 'patman', '--dry-run')
-+                # Assert the email address is part of the dry-run
-+                # output.
-+                self.assertIn('hello@there.com', output)
-+
-     def test_tags(self):
-         """Test collection of tags in a patchstream"""
-         text = '''This is a patch
-diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
-index e1d15ff6ab..f7011be1e4 100644
---- a/tools/patman/get_maintainer.py
-+++ b/tools/patman/get_maintainer.py
-@@ -1,48 +1,61 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2012 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- import os
-+import shlex
-+import shutil
- 
- from patman import command
-+from patman import gitutil
- 
--def find_get_maintainer(try_list):
--    """Look for the get_maintainer.pl script.
- 
--    Args:
--        try_list: List of directories to try for the get_maintainer.pl script
-+def find_get_maintainer(script_file_name):
-+    """Try to find where `script_file_name` is.
- 
--    Returns:
--        If the script is found we'll return a path to it; else None.
-+    It searches in PATH and falls back to a path relative to the top
-+    of the current git repository.
-     """
--    # Look in the list
--    for path in try_list:
--        fname = os.path.join(path, 'get_maintainer.pl')
--        if os.path.isfile(fname):
--            return fname
-+    get_maintainer = shutil.which(script_file_name)
-+    if get_maintainer:
-+        return get_maintainer
-+
-+    git_relative_script = os.path.join(gitutil.get_top_level(),
-+                                       script_file_name)
-+    if os.path.exists(git_relative_script):
-+        return git_relative_script
- 
--    return None
- 
--def get_maintainer(dir_list, fname, verbose=False):
--    """Run get_maintainer.pl on a file if we find it.
-+def get_maintainer(script_file_name, fname, verbose=False):
-+    """Run `script_file_name` on a file.
- 
--    We look for get_maintainer.pl in the 'scripts' directory at the top of
--    git.  If we find it we'll run it.  If we don't find get_maintainer.pl
--    then we fail silently.
-+    `script_file_name` should be a get_maintainer.pl-like script that
-+    takes a patch file name as an input and return the email addresses
-+    of the associated maintainers to standard output, one per line.
-+
-+    If `script_file_name` does not exist we fail silently.
- 
-     Args:
--        dir_list: List of directories to try for the get_maintainer.pl script
--        fname: Path to the patch file to run get_maintainer.pl on.
-+        script_file_name: The file name of the get_maintainer.pl script
-+            (or compatible).
-+        fname: File name of the patch to process with get_maintainer.pl.
- 
-     Returns:
-         A list of email addresses to CC to.
-     """
--    get_maintainer = find_get_maintainer(dir_list)
-+    # Expand `script_file_name` into a file name and its arguments, if
-+    # any.
-+    cmd_args = shlex.split(script_file_name)
-+    file_name = cmd_args[0]
-+    arguments = cmd_args[1:]
-+
-+    get_maintainer = find_get_maintainer(file_name)
-     if not get_maintainer:
-         if verbose:
-             print("WARNING: Couldn't find get_maintainer.pl")
-         return []
- 
--    stdout = command.output(get_maintainer, '--norolestats', fname)
-+    stdout = command.output(get_maintainer, *arguments, fname)
-     lines = stdout.splitlines()
--    return [ x.replace('"', '') for x in lines ]
-+    return [x.replace('"', '') for x in lines]
-diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
-index ceaf2ce150..5e742102c2 100644
---- a/tools/patman/gitutil.py
-+++ b/tools/patman/gitutil.py
-@@ -2,21 +2,19 @@
- # Copyright (c) 2011 The Chromium OS Authors.
- #
- 
--import re
- import os
--import subprocess
- import sys
- 
- from patman import command
- from patman import settings
- from patman import terminal
--from patman import tools
- 
- # True to use --no-decorate - we check this in setup()
- use_no_decorate = True
- 
-+
- def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
--           count=None):
-+            count=None):
-     """Create a command to perform a 'git log'
- 
-     Args:
-@@ -49,6 +47,7 @@ def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
-     cmd.append('--')
-     return cmd
- 
-+
- def count_commits_to_branch(branch):
-     """Returns number of commits between HEAD and the tracking branch.
- 
-@@ -68,13 +67,14 @@ def count_commits_to_branch(branch):
-         rev_range = '@{upstream}..'
-     pipe = [log_cmd(rev_range, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             oneline=True, raise_on_error=False)
-+                              oneline=True, raise_on_error=False)
-     if result.return_code:
-         raise ValueError('Failed to determine upstream: %s' %
-                          result.stderr.strip())
-     patch_count = len(result.stdout.splitlines())
-     return patch_count
- 
-+
- def name_revision(commit_hash):
-     """Gets the revision name for a commit
- 
-@@ -91,6 +91,7 @@ def name_revision(commit_hash):
-     name = stdout.split(' ')[1].strip()
-     return name
- 
-+
- def guess_upstream(git_dir, branch):
-     """Tries to guess the upstream for a branch
- 
-@@ -109,7 +110,7 @@ def guess_upstream(git_dir, branch):
-     """
-     pipe = [log_cmd(branch, git_dir=git_dir, oneline=True, count=100)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Branch '%s' not found" % branch
-     for line in result.stdout.splitlines()[1:]:
-@@ -121,6 +122,7 @@ def guess_upstream(git_dir, branch):
-             return name, "Guessing upstream as '%s'" % name
-     return None, "Cannot find a suitable upstream for branch '%s'" % branch
- 
-+
- def get_upstream(git_dir, branch):
-     """Returns the name of the upstream for a branch
- 
-@@ -135,10 +137,10 @@ def get_upstream(git_dir, branch):
-     """
-     try:
-         remote = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                       'branch.%s.remote' % branch)
-+                                         'branch.%s.remote' % branch)
-         merge = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                      'branch.%s.merge' % branch)
--    except:
-+                                        'branch.%s.merge' % branch)
-+    except Exception:
-         upstream, msg = guess_upstream(git_dir, branch)
-         return upstream, msg
- 
-@@ -149,7 +151,8 @@ def get_upstream(git_dir, branch):
-         return '%s/%s' % (remote, leaf), None
-     else:
-         raise ValueError("Cannot determine upstream branch for branch "
--                "'%s' remote='%s', merge='%s'" % (branch, remote, merge))
-+                         "'%s' remote='%s', merge='%s'"
-+                         % (branch, remote, merge))
- 
- 
- def get_range_in_branch(git_dir, branch, include_upstream=False):
-@@ -168,6 +171,7 @@ def get_range_in_branch(git_dir, branch, include_upstream=False):
-     rstr = '%s%s..%s' % (upstream, '~' if include_upstream else '', branch)
-     return rstr, msg
- 
-+
- def count_commits_in_range(git_dir, range_expr):
-     """Returns the number of commits in the given range.
- 
-@@ -180,12 +184,13 @@ def count_commits_in_range(git_dir, range_expr):
-     """
-     pipe = [log_cmd(range_expr, git_dir=git_dir, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Range '%s' not found or is invalid" % range_expr
-     patch_count = len(result.stdout.splitlines())
-     return patch_count, None
- 
-+
- def count_commits_in_branch(git_dir, branch, include_upstream=False):
-     """Returns the number of commits in the given branch.
- 
-@@ -201,6 +206,7 @@ def count_commits_in_branch(git_dir, branch, include_upstream=False):
-         return None, msg
-     return count_commits_in_range(git_dir, range_expr)
- 
-+
- def count_commits(commit_range):
-     """Returns the number of commits in the given range.
- 
-@@ -215,6 +221,7 @@ def count_commits(commit_range):
-     patch_count = int(stdout)
-     return patch_count
- 
-+
- def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-     """Checkout the selected commit for this build
- 
-@@ -231,10 +238,11 @@ def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-         pipe.append('-f')
-     pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, raise_on_error=False,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git checkout (%s): %s' % (pipe, result.stderr))
- 
-+
- def clone(git_dir, output_dir):
-     """Checkout the selected commit for this build
- 
-@@ -243,10 +251,11 @@ def clone(git_dir, output_dir):
-     """
-     pipe = ['git', 'clone', git_dir, '.']
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git clone: %s' % result.stderr)
- 
-+
- def fetch(git_dir=None, work_tree=None):
-     """Fetch from the origin repo
- 
-@@ -263,6 +272,7 @@ def fetch(git_dir=None, work_tree=None):
-     if result.return_code != 0:
-         raise OSError('git fetch: %s' % result.stderr)
- 
-+
- def check_worktree_is_available(git_dir):
-     """Check if git-worktree functionality is available
- 
-@@ -274,9 +284,10 @@ def check_worktree_is_available(git_dir):
-     """
-     pipe = ['git', '--git-dir', git_dir, 'worktree', 'list']
-     result = command.run_pipe([pipe], capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     return result.return_code == 0
- 
-+
- def add_worktree(git_dir, output_dir, commit_hash=None):
-     """Create and checkout a new git worktree for this build
- 
-@@ -290,10 +301,11 @@ def add_worktree(git_dir, output_dir, commit_hash=None):
-     if commit_hash:
-         pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git worktree add: %s' % result.stderr)
- 
-+
- def prune_worktrees(git_dir):
-     """Remove administrative files for deleted worktrees
- 
-@@ -305,7 +317,8 @@ def prune_worktrees(git_dir):
-     if result.return_code != 0:
-         raise OSError('git worktree prune: %s' % result.stderr)
- 
--def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-+
-+def create_patches(branch, start, count, ignore_binary, series, signoff=True):
-     """Create a series of patches from the top of the current branch.
- 
-     The patch files are written to the current directory using
-@@ -321,9 +334,7 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-         Filename of cover letter (None if none)
-         List of filenames of patch files
-     """
--    if series.get('version'):
--        version = '%s ' % series['version']
--    cmd = ['git', 'format-patch', '-M' ]
-+    cmd = ['git', 'format-patch', '-M']
-     if signoff:
-         cmd.append('--signoff')
-     if ignore_binary:
-@@ -341,9 +352,10 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
- 
-     # We have an extra file if there is a cover letter
-     if series.get('cover'):
--       return files[0], files[1:]
-+        return files[0], files[1:]
-     else:
--       return None, files
-+        return None, files
-+
- 
- def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-     """Build a list of email addresses based on an input list.
-@@ -385,40 +397,43 @@ def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-         raw += lookup_email(item, alias, warn_on_error=warn_on_error)
-     result = []
-     for item in raw:
--        if not item in result:
-+        if item not in result:
-             result.append(item)
-     if tag:
-         return ['%s %s%s%s' % (tag, quote, email, quote) for email in result]
-     return result
- 
-+
- def check_suppress_cc_config():
-     """Check if sendemail.suppresscc is configured correctly.
- 
-     Returns:
-         True if the option is configured correctly, False otherwise.
-     """
--    suppresscc = command.output_one_line('git', 'config', 'sendemail.suppresscc',
--                                       raise_on_error=False)
-+    suppresscc = command.output_one_line(
-+        'git', 'config', 'sendemail.suppresscc', raise_on_error=False)
- 
-     # Other settings should be fine.
-     if suppresscc == 'all' or suppresscc == 'cccmd':
-         col = terminal.Color()
- 
-         print((col.build(col.RED, "error") +
--            ": git config sendemail.suppresscc set to %s\n"  % (suppresscc)) +
--            "  patman needs --cc-cmd to be run to set the cc list.\n" +
--            "  Please run:\n" +
--            "    git config --unset sendemail.suppresscc\n" +
--            "  Or read the man page:\n" +
--            "    git send-email --help\n" +
--            "  and set an option that runs --cc-cmd\n")
-+               ": git config sendemail.suppresscc set to %s\n"
-+               % (suppresscc)) +
-+              "  patman needs --cc-cmd to be run to set the cc list.\n" +
-+              "  Please run:\n" +
-+              "    git config --unset sendemail.suppresscc\n" +
-+              "  Or read the man page:\n" +
-+              "    git send-email --help\n" +
-+              "  and set an option that runs --cc-cmd\n")
-         return False
- 
-     return True
- 
-+
- def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
--        self_only=False, alias=None, in_reply_to=None, thread=False,
--        smtp_server=None):
-+                  self_only=False, alias=None, in_reply_to=None, thread=False,
-+                  smtp_server=None, get_maintainer_script=None):
-     """Email a patch series.
- 
-     Args:
-@@ -435,6 +450,7 @@ def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
-         thread: True to add --thread to git send-email (make
-             all patches reply to cover-letter or first patch in series)
-         smtp_server: SMTP server to use to send patches
-+        get_maintainer_script: File name of script to get maintainers emails
- 
-     Returns:
-         Git command that was/would be run
-@@ -487,9 +503,10 @@ send --cc-cmd cc-fname" cover p1 p2'
-                   "git config sendemail.to u-boot@lists.denx.de")
-             return
-     cc = build_email_list(list(set(series.get('cc')) - set(series.get('to'))),
--                        '--cc', alias, warn_on_error)
-+                          '--cc', alias, warn_on_error)
-     if self_only:
--        to = build_email_list([os.getenv('USER')], '--to', alias, warn_on_error)
-+        to = build_email_list([os.getenv('USER')], '--to',
-+                              alias, warn_on_error)
-         cc = []
-     cmd = ['git', 'send-email', '--annotate']
-     if smtp_server:
-@@ -565,7 +582,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-     if not alias:
-         alias = settings.alias
-     lookup_name = lookup_name.strip()
--    if '@' in lookup_name: # Perhaps a real email address
-+    if '@' in lookup_name:      # Perhaps a real email address
-         return [lookup_name]
- 
-     lookup_name = lookup_name.lower()
-@@ -581,7 +598,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-             return out_list
- 
-     if lookup_name:
--        if not lookup_name in alias:
-+        if lookup_name not in alias:
-             msg = "Alias '%s' not found" % lookup_name
-             if warn_on_error:
-                 print(col.build(col.RED, msg))
-@@ -589,11 +606,12 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-         for item in alias[lookup_name]:
-             todo = lookup_email(item, alias, warn_on_error, level + 1)
-             for new_item in todo:
--                if not new_item in out_list:
-+                if new_item not in out_list:
-                     out_list.append(new_item)
- 
-     return out_list
- 
-+
- def get_top_level():
-     """Return name of top-level directory for this git repo.
- 
-@@ -608,6 +626,7 @@ def get_top_level():
-     """
-     return command.output_one_line('git', 'rev-parse', '--show-toplevel')
- 
-+
- def get_alias_file():
-     """Gets the name of the git alias file.
- 
-@@ -615,7 +634,7 @@ def get_alias_file():
-         Filename of git alias file, or None if none
-     """
-     fname = command.output_one_line('git', 'config', 'sendemail.aliasesfile',
--            raise_on_error=False)
-+                                    raise_on_error=False)
-     if not fname:
-         return None
- 
-@@ -625,6 +644,7 @@ def get_alias_file():
- 
-     return os.path.join(get_top_level(), fname)
- 
-+
- def get_default_user_name():
-     """Gets the user.name from .gitconfig file.
- 
-@@ -634,6 +654,7 @@ def get_default_user_name():
-     uname = command.output_one_line('git', 'config', '--global', 'user.name')
-     return uname
- 
-+
- def get_default_user_email():
-     """Gets the user.email from the global .gitconfig file.
- 
-@@ -643,17 +664,19 @@ def get_default_user_email():
-     uemail = command.output_one_line('git', 'config', '--global', 'user.email')
-     return uemail
- 
-+
- def get_default_subject_prefix():
-     """Gets the format.subjectprefix from local .git/config file.
- 
-     Returns:
-         Subject prefix found in local .git/config file, or None if none
-     """
--    sub_prefix = command.output_one_line('git', 'config', 'format.subjectprefix',
--                 raise_on_error=False)
-+    sub_prefix = command.output_one_line(
-+        'git', 'config', 'format.subjectprefix', raise_on_error=False)
- 
-     return sub_prefix
- 
-+
- def setup():
-     """Set up git utils, by reading the alias files."""
-     # Check for a git alias file also
-@@ -666,6 +689,7 @@ def setup():
-     use_no_decorate = (command.run_pipe([cmd], raise_on_error=False)
-                        .return_code == 0)
- 
-+
- def get_head():
-     """Get the hash of the current HEAD
- 
-@@ -674,6 +698,7 @@ def get_head():
-     """
-     return command.output_one_line('git', 'show', '-s', '--pretty=format:%H')
- 
-+
- if __name__ == "__main__":
-     import doctest
- 
-diff --git a/tools/patman/patman b/tools/patman/patman
-index 11a5d8e18a..5a427d1942 120000
---- a/tools/patman/patman
-+++ b/tools/patman/patman
-@@ -1 +1 @@
--main.py
-\ No newline at end of file
-+__main__.py
-\ No newline at end of file
-diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst
-index 8c5c9cc2cc..6113962fb4 100644
---- a/tools/patman/patman.rst
-+++ b/tools/patman/patman.rst
-@@ -1,6 +1,7 @@
- .. SPDX-License-Identifier: GPL-2.0+
- .. Copyright (c) 2011 The Chromium OS Authors
- .. Simon Glass <sjg@chromium.org>
-+.. Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- .. v1, v2, 19-Oct-11
- .. revised v3 24-Nov-11
- .. revised v4 Independence Day 2020, with Patchwork integration
-@@ -68,13 +69,28 @@ this once::
- 
-     git config sendemail.aliasesfile doc/git-mailrc
- 
--For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles figuring
--out where to send patches pretty well.
-+For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles
-+figuring out where to send patches pretty well. For other projects,
-+you may want to specify a different script to be run, for example via
-+a project-specific `.patman` file::
-+
-+    # .patman configuration file at the root of some project
-+
-+    [settings]
-+    get_maintainer_script: etc/teams.scm get-maintainer
-+
-+The `get_maintainer_script` option corresponds to the
-+`--get-maintainer-script` argument of the `send` command.  It is
-+looked relatively to the root of the current git repository, as well
-+as on PATH.  It can also be provided arguments, as shown above.  The
-+contract is that the script should accept a patch file name and return
-+a list of email addresses, one per line, like `get_maintainer.pl`
-+does.
- 
- During the first run patman creates a config file for you by taking the default
- user name and email address from the global .gitconfig file.
- 
--To add your own, create a file ~/.patman like this::
-+To add your own, create a file `~/.patman` like this::
- 
-     # patman alias file
- 
-@@ -85,6 +101,12 @@ To add your own, create a file ~/.patman like this::
-     wolfgang: Wolfgang Denk <wd@denx.de>
-     others: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net>
- 
-+As hinted above, Patman will also look for a `.patman` configuration
-+file at the root of the current project git repository, which makes it
-+possible to override the `project` settings variable or anything else
-+in a project-specific way. The values of this "local" configuration
-+file take precedence over those of the "global" one.
-+
- Aliases are recursive.
- 
- The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
-@@ -680,6 +702,16 @@ them:
- 
-     $ tools/patman/patman test
- 
-+Note that since the test suite depends on data files only available in
-+the git checkout, the `test` command is hidden unless `patman` is
-+invoked from the U-Boot git repository.
-+
-+Alternatively, you can run the test suite via Pytest:
-+
-+.. code-block:: bash
-+
-+    $ cd tools/patman && pytest
-+
- Error handling doesn't always produce friendly error messages - e.g.
- putting an incorrect tag in a commit may provide a confusing message.
- 
-diff --git a/tools/patman/pytest.ini b/tools/patman/pytest.ini
-new file mode 100644
-index 0000000000..df3eb518d0
---- /dev/null
-+++ b/tools/patman/pytest.ini
-@@ -0,0 +1,2 @@
-+[pytest]
-+addopts = --doctest-modules
-diff --git a/tools/patman/series.py b/tools/patman/series.py
-index 3075378ac1..2eeeef71dc 100644
---- a/tools/patman/series.py
-+++ b/tools/patman/series.py
-@@ -235,7 +235,7 @@ class Series(dict):
-             print(col.build(col.RED, str))
- 
-     def MakeCcFile(self, process_tags, cover_fname, warn_on_error,
--                   add_maintainers, limit):
-+                   add_maintainers, limit, get_maintainer_script):
-         """Make a cc file for us to use for per-commit Cc automation
- 
-         Also stores in self._generated_cc to make ShowActions() faster.
-@@ -249,6 +249,8 @@ class Series(dict):
-                 True/False to call the get_maintainers to CC maintainers
-                 List of maintainers to include (for testing)
-             limit: Limit the length of the Cc list (None if no limit)
-+            get_maintainer_script: The file name of the get_maintainer.pl
-+                script (or compatible).
-         Return:
-             Filename of temp file created
-         """
-@@ -267,8 +269,9 @@ class Series(dict):
-             if type(add_maintainers) == type(cc):
-                 cc += add_maintainers
-             elif add_maintainers:
--                dir_list = [os.path.join(gitutil.get_top_level(), 'scripts')]
--                cc += get_maintainer.get_maintainer(dir_list, commit.patch)
-+
-+                cc += get_maintainer.get_maintainer(get_maintainer_script,
-+                                                    commit.patch)
-             for x in set(cc) & set(settings.bounces):
-                 print(col.build(col.YELLOW, 'Skipping "%s"' % x))
-             cc = list(set(cc) - set(settings.bounces))
-diff --git a/tools/patman/settings.py b/tools/patman/settings.py
-index 903d6fcb0b..636983e32d 100644
---- a/tools/patman/settings.py
-+++ b/tools/patman/settings.py
-@@ -1,18 +1,18 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2011 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- try:
-     import configparser as ConfigParser
--except:
-+except Exception:
-     import ConfigParser
- 
- import argparse
- import os
- import re
- 
--from patman import command
--from patman import tools
-+from patman import gitutil
- 
- """Default settings per-project.
- 
-@@ -32,7 +32,8 @@ _default_settings = {
-     },
- }
- 
--class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-+
-+class _ProjectConfigParser(ConfigParser.ConfigParser):
-     """ConfigParser that handles projects.
- 
-     There are two main goals of this class:
-@@ -83,14 +84,14 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-     def __init__(self, project_name):
-         """Construct _ProjectConfigParser.
- 
--        In addition to standard SafeConfigParser initialization, this also loads
--        project defaults.
-+        In addition to standard ConfigParser initialization, this also
-+        loads project defaults.
- 
-         Args:
-             project_name: The name of the project.
-         """
-         self._project_name = project_name
--        ConfigParser.SafeConfigParser.__init__(self)
-+        ConfigParser.ConfigParser.__init__(self)
- 
-         # Update the project settings in the config based on
-         # the _default_settings global.
-@@ -102,31 +103,31 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-             self.set(project_settings, setting_name, setting_value)
- 
-     def get(self, section, option, *args, **kwargs):
--        """Extend SafeConfigParser to try project_section before section.
-+        """Extend ConfigParser to try project_section before section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         try:
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, "%s_%s" % (self._project_name, section), option,
-                 *args, **kwargs
-             )
-         except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, section, option, *args, **kwargs
-             )
-         return val
- 
-     def items(self, section, *args, **kwargs):
--        """Extend SafeConfigParser to add project_section to section.
-+        """Extend ConfigParser to add project_section to section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         project_items = []
-         has_project_section = False
-@@ -134,7 +135,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get items from the project section
-         try:
--            project_items = ConfigParser.SafeConfigParser.items(
-+            project_items = ConfigParser.ConfigParser.items(
-                 self, "%s_%s" % (self._project_name, section), *args, **kwargs
-             )
-             has_project_section = True
-@@ -143,7 +144,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get top-level items
-         try:
--            top_items = ConfigParser.SafeConfigParser.items(
-+            top_items = ConfigParser.ConfigParser.items(
-                 self, section, *args, **kwargs
-             )
-         except ConfigParser.NoSectionError:
-@@ -155,6 +156,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-         item_dict.update(project_items)
-         return {(item, val) for item, val in item_dict.items()}
- 
-+
- def ReadGitAliases(fname):
-     """Read a git alias file. This is in the form used by git:
- 
-@@ -170,7 +172,7 @@ def ReadGitAliases(fname):
-         print("Warning: Cannot find alias file '%s'" % fname)
-         return
- 
--    re_line = re.compile('alias\s+(\S+)\s+(.*)')
-+    re_line = re.compile(r'alias\s+(\S+)\s+(.*)')
-     for line in fd.readlines():
-         line = line.strip()
-         if not line or line[0] == '#':
-@@ -190,7 +192,8 @@ def ReadGitAliases(fname):
- 
-     fd.close()
- 
--def CreatePatmanConfigFile(gitutil, config_fname):
-+
-+def CreatePatmanConfigFile(config_fname):
-     """Creates a config file under $(HOME)/.patman if it can't find one.
- 
-     Args:
-@@ -200,12 +203,12 @@ def CreatePatmanConfigFile(gitutil, config_fname):
-         None
-     """
-     name = gitutil.get_default_user_name()
--    if name == None:
-+    if name is None:
-         name = input("Enter name: ")
- 
-     email = gitutil.get_default_user_email()
- 
--    if email == None:
-+    if email is None:
-         email = input("Enter email: ")
- 
-     try:
-@@ -220,7 +223,8 @@ me: %s <%s>
- [bounces]
- nxp = Zhikang Zhang <zhikang.zhang@nxp.com>
- ''' % (name, email), file=f)
--    f.close();
-+    f.close()
-+
- 
- def _UpdateDefaults(main_parser, config):
-     """Update the given OptionParser defaults based on config.
-@@ -242,8 +246,8 @@ def _UpdateDefaults(main_parser, config):
-     # Find all the parsers and subparsers
-     parsers = [main_parser]
-     parsers += [subparser for action in main_parser._actions
--                  if isinstance(action, argparse._SubParsersAction)
--                  for _, subparser in action.choices.items()]
-+                if isinstance(action, argparse._SubParsersAction)
-+                for _, subparser in action.choices.items()]
- 
-     # Collect the defaults from each parser
-     defaults = {}
-@@ -270,8 +274,9 @@ def _UpdateDefaults(main_parser, config):
-     # Set all the defaults and manually propagate them to subparsers
-     main_parser.set_defaults(**defaults)
-     for parser, pdefs in zip(parsers, parser_defaults):
--        parser.set_defaults(**{ k: v for k, v in defaults.items()
--                                    if k in pdefs })
-+        parser.set_defaults(**{k: v for k, v in defaults.items()
-+                               if k in pdefs})
-+
- 
- def _ReadAliasFile(fname):
-     """Read in the U-Boot git alias file if it exists.
-@@ -298,6 +303,7 @@ def _ReadAliasFile(fname):
-         if bad_line:
-             print(bad_line)
- 
-+
- def _ReadBouncesFile(fname):
-     """Read in the bounces file if it exists
- 
-@@ -311,6 +317,7 @@ def _ReadBouncesFile(fname):
-                     continue
-                 bounces.add(line.strip())
- 
-+
- def GetItems(config, section):
-     """Get the items from a section of the config.
- 
-@@ -323,31 +330,50 @@ def GetItems(config, section):
-     """
-     try:
-         return config.items(section)
--    except ConfigParser.NoSectionError as e:
-+    except ConfigParser.NoSectionError:
-         return []
--    except:
--        raise
- 
--def Setup(gitutil, parser, project_name, config_fname=''):
-+
-+def Setup(parser, project_name, config_fname=None):
-     """Set up the settings module by reading config files.
- 
-+    Unless `config_fname` is specified, a `.patman` config file local
-+    to the git repository is consulted, followed by the global
-+    `$HOME/.patman`. If none exists, the later is created. Values
-+    defined in the local config file take precedence over those
-+    defined in the global one.
-+
-     Args:
--        parser:         The parser to update
-+        parser:         The parser to update.
-         project_name:   Name of project that we're working on; we'll look
-             for sections named "project_section" as well.
--        config_fname:   Config filename to read ('' for default)
-+        config_fname:   Config filename to read.  An error is raised if it
-+            does not exist.
-     """
-     # First read the git alias file if available
-     _ReadAliasFile('doc/git-mailrc')
-     config = _ProjectConfigParser(project_name)
--    if config_fname == '':
-+
-+    if config_fname and not os.path.exists(config_fname):
-+        raise Exception(f'provided {config_fname} does not exist')
-+
-+    if not config_fname:
-         config_fname = '%s/.patman' % os.getenv('HOME')
-+    has_config = os.path.exists(config_fname)
-+
-+    git_local_config_fname = os.path.join(gitutil.get_top_level(), '.patman')
-+    has_git_local_config = os.path.exists(git_local_config_fname)
- 
--    if not os.path.exists(config_fname):
--        print("No config file found ~/.patman\nCreating one...\n")
--        CreatePatmanConfigFile(gitutil, config_fname)
-+    # Read the git local config last, so that its values override
-+    # those of the global config, if any.
-+    if has_config:
-+        config.read(config_fname)
-+    if has_git_local_config:
-+        config.read(git_local_config_fname)
- 
--    config.read(config_fname)
-+    if not (has_config or has_git_local_config):
-+        print("No config file found.\nCreating ~/.patman...\n")
-+        CreatePatmanConfigFile(config_fname)
- 
-     for name, value in GetItems(config, 'alias'):
-         alias[name] = value.split(',')
-@@ -358,6 +384,7 @@ def Setup(gitutil, parser, project_name, config_fname=''):
- 
-     _UpdateDefaults(parser, config)
- 
-+
- # These are the aliases we understand, indexed by alias. Each member is a list.
- alias = {}
- bounces = set()
-diff --git a/tools/patman/setup.py b/tools/patman/setup.py
-index 5643bf1503..2ff791da0f 100644
---- a/tools/patman/setup.py
-+++ b/tools/patman/setup.py
-@@ -7,6 +7,6 @@ setup(name='patman',
-       scripts=['patman'],
-       packages=['patman'],
-       package_dir={'patman': ''},
--      package_data={'patman': ['README']},
-+      package_data={'patman': ['README.rst']},
-       classifiers=['Environment :: Console',
-                    'Topic :: Software Development'])
-diff --git a/tools/patman/test_settings.py b/tools/patman/test_settings.py
-new file mode 100644
-index 0000000000..c768a2fc64
---- /dev/null
-+++ b/tools/patman/test_settings.py
-@@ -0,0 +1,67 @@
-+# SPDX-License-Identifier: GPL-2.0+
-+#
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
-+#
-+
-+import argparse
-+import contextlib
-+import os
-+import sys
-+import tempfile
-+
-+from patman import settings
-+from patman import tools
-+
-+
-+@contextlib.contextmanager
-+def empty_git_repository():
-+    with tempfile.TemporaryDirectory() as tmpdir:
-+        os.chdir(tmpdir)
-+        tools.run('git', 'init', raise_on_error=True)
-+        yield tmpdir
-+
-+
-+@contextlib.contextmanager
-+def cleared_command_line_args():
-+    old_value = sys.argv[:]
-+    sys.argv = [sys.argv[0]]
-+    try:
-+        yield
-+    finally:
-+        sys.argv = old_value
-+
-+
-+def test_git_local_config():
-+    # Clearing the command line arguments is required, otherwise
-+    # arguments passed to the test running such as in 'pytest -k
-+    # filter' would be processed by _UpdateDefaults and fail.
-+    with cleared_command_line_args():
-+        with empty_git_repository():
-+            with tempfile.NamedTemporaryFile() as global_config:
-+                global_config.write(b'[settings]\n'
-+                                    b'project=u-boot\n')
-+                global_config.flush()
-+                parser = argparse.ArgumentParser()
-+                parser.add_argument('-p', '--project', default='unknown')
-+                subparsers = parser.add_subparsers(dest='cmd')
-+                send = subparsers.add_parser('send')
-+                send.add_argument('--no-check', action='store_false',
-+                                  dest='check_patch', default=True)
-+
-+                # Test "global" config is used.
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'u-boot'
-+                send_args, _ = send.parse_known_args([])
-+                assert send_args.check_patch
-+
-+                # Test local config can shadow it.
-+                with open('.patman', 'w', buffering=1) as f:
-+                    f.write('[settings]\n'
-+                            'project: guix-patches\n'
-+                            'check_patch: False\n')
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'guix-patches'
-+                send_args, _ = send.parse_known_args([])
-+                assert not send_args.check_patch
diff --git a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
index a5b92e3e8f..858f42efe7 100644
--- a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
+++ b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
@@ -5,12 +5,12 @@ Index: u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
 ===================================================================
 --- u-boot-2021.07~rc4+dfsg.orig/include/configs/sifive-unmatched.h
 +++ u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
-@@ -62,6 +62,8 @@
+@@ -55,6 +55,8 @@
  	"name=system,size=-,bootable,type=${type_guid_gpt_system};"
  
- #define CONFIG_EXTRA_ENV_SETTINGS \
+ #define CFG_EXTRA_ENV_SETTINGS \
 +	"fdt_high=0xffffffffffffffff\0" \
 +	"initrd_high=0xffffffffffffffff\0" \
  	"kernel_addr_r=0x84000000\0" \
- 	"fdt_addr_r=0x88000000\0" \
- 	"scriptaddr=0x88100000\0" \
+ 	"kernel_comp_addr_r=0x88000000\0" \
+ 	"kernel_comp_size=0x4000000\0" \
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 3/5] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts.
  2023-07-09  1:47                 ` [bug#64149] [PATCH 1/5] gnu: arm-trusted-firmware: Update to 2.9 vagrant
  2023-07-09  1:47                   ` [bug#64149] [PATCH 2/5] gnu: u-boot: Update to 2023.07-rc6 vagrant
@ 2023-07-09  1:47                   ` vagrant
  2023-07-09  1:47                   ` [bug#64149] [PATCH 4/5] gnu: Add python-u-boot-pylib vagrant
  2023-07-09  1:47                   ` [bug#64149] [PATCH 5/5] gnu: patman: Add python-u-boot-pylib to inputs vagrant
  3 siblings, 0 replies; 46+ messages in thread
From: vagrant @ 2023-07-09  1:47 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Vagrant Cascadian <vagrant@debian.org>

* gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package): Take argument
  for System Control Processor (SCP) firmware.
  [native-inputs]: Add SCP firmware.
  [phases]: Adjust 'set-environment to also set SCP variable.
  (u-boot-pine64-plus, u-boot-pine64-lts, u-boot-pinebook): Pass appropriate
  crust firmware as the SCP firmware.
---
 gnu/packages/bootloaders.scm | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 8be5303a74..18f6398692 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1009,7 +1009,7 @@ (define-public u-boot-am335x-boneblack
 (define-public u-boot-am335x-evm
   (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"))
 
-(define*-public (make-u-boot-sunxi64-package board triplet
+(define*-public (make-u-boot-sunxi64-package board triplet scpfirmware
                                              #:key defconfig configs)
   (let ((base (make-u-boot-package
                board triplet #:defconfig defconfig #:configs configs)))
@@ -1021,22 +1021,24 @@ (define*-public (make-u-boot-sunxi64-package board triplet
           #~(modify-phases #$phases
               (add-after 'unpack 'set-environment
                 (lambda* (#:key native-inputs inputs #:allow-other-keys)
-                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
-                  (setenv "SCP" "/dev/null")
+                  (setenv "SCP" (search-input-file native-inputs "libexec/scp.bin"))
                   (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
+      (native-inputs
+       (modify-inputs (package-native-inputs base)
+         (append scpfirmware)))
       (inputs
        (modify-inputs (package-inputs base)
          (append arm-trusted-firmware-sun50i-a64))))))
 
 (define-public u-boot-pine64-plus
-  (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
+  (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu" crust-pine64-plus))
 
 (define-public u-boot-pine64-lts
-  (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu"))
+  (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu" crust-pine64-plus))
 
 (define-public u-boot-pinebook
   (make-u-boot-sunxi64-package
-   "pinebook" "aarch64-linux-gnu"
+   "pinebook" "aarch64-linux-gnu" crust-pinebook
    ;; Fix regression with LCD video output introduced in 2020.01
    ;; https://patchwork.ozlabs.org/patch/1225130/
    #:configs '("CONFIG_VIDEO_BPP32=y")))
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 4/5] gnu: Add python-u-boot-pylib.
  2023-07-09  1:47                 ` [bug#64149] [PATCH 1/5] gnu: arm-trusted-firmware: Update to 2.9 vagrant
  2023-07-09  1:47                   ` [bug#64149] [PATCH 2/5] gnu: u-boot: Update to 2023.07-rc6 vagrant
  2023-07-09  1:47                   ` [bug#64149] [PATCH 3/5] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts vagrant
@ 2023-07-09  1:47                   ` vagrant
  2023-07-09  1:47                   ` [bug#64149] [PATCH 5/5] gnu: patman: Add python-u-boot-pylib to inputs vagrant
  3 siblings, 0 replies; 46+ messages in thread
From: vagrant @ 2023-07-09  1:47 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Maxim Cournoyer <maxim.cournoyer@gmail.com>

* gnu/packages/bootloaders.scm (python-u-boot-pylib): New variable.
* gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/bootloaders.scm                  | 23 +++++++++++++++++-
 .../patches/u-boot-fix-u-boot-lib-build.patch | 24 +++++++++++++++++++
 3 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index bb13280dc7..c12b29447d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1996,6 +1996,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
+  %D%/packages/patches/u-boot-fix-u-boot-lib-build.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 18f6398692..827894e447 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -655,7 +655,8 @@ (define u-boot
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
                      %u-boot-rk3399-enable-emmc-phy-patch
-                     (search-patch "u-boot-fix-build-python-3.10.patch")))
+                     (search-patch "u-boot-fix-build-python-3.10.patch")
+                     (search-patch "u-boot-fix-u-boot-lib-build.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
@@ -840,6 +841,26 @@ (define-public u-boot-tools
                   "  This package provides board-independent tools "
                   "of U-Boot."))))
 
+(define-public python-u-boot-pylib
+  (package
+    (inherit u-boot)
+    (name "python-u-boot-pylib")
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _
+              (chdir "tools/u_boot_pylib")))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "./u_boot_pylib")))))))
+    (synopsis "U-Boot Python library")
+    (description "This package provides common Python code used by some of the
+commands part of the U-Boot project, such as Patman.")))
+
 ;;; This is packaged separately, as it can be used in other contexts than for
 ;;; U-Boot development.
 (define-public patman
diff --git a/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch b/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch
new file mode 100644
index 0000000000..233c437de6
--- /dev/null
+++ b/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch
@@ -0,0 +1,24 @@
+Submitted upstream (see:
+https://lists.denx.de/pipermail/u-boot/2023-July/521984.html)
+
+diff --git a/tools/u_boot_pylib/pyproject.toml b/tools/u_boot_pylib/pyproject.toml
+index 3f33caf6f8..037c5d629e 100644
+--- a/tools/u_boot_pylib/pyproject.toml
++++ b/tools/u_boot_pylib/pyproject.toml
+@@ -9,7 +9,7 @@ authors = [
+   { name="Simon Glass", email="sjg@chromium.org" },
+ ]
+ description = "U-Boot python library"
+-readme = "README.md"
++readme = "README.rst"
+ requires-python = ">=3.7"
+ classifiers = [
+     "Programming Language :: Python :: 3",
+@@ -20,3 +20,7 @@ classifiers = [
+ [project.urls]
+ "Homepage" = "https://u-boot.readthedocs.io"
+ "Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
++
++[tool.setuptools.packages.find]
++where = [".."]
++include = ["u_boot_pylib*"]
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 5/5] gnu: patman: Add python-u-boot-pylib to inputs.
  2023-07-09  1:47                 ` [bug#64149] [PATCH 1/5] gnu: arm-trusted-firmware: Update to 2.9 vagrant
                                     ` (2 preceding siblings ...)
  2023-07-09  1:47                   ` [bug#64149] [PATCH 4/5] gnu: Add python-u-boot-pylib vagrant
@ 2023-07-09  1:47                   ` vagrant
  2023-07-10 19:39                     ` Vagrant Cascadian
  3 siblings, 1 reply; 46+ messages in thread
From: vagrant @ 2023-07-09  1:47 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Maxim Cournoyer <maxim.cournoyer@gmail.com>

* gnu/packages/bootloaders.scm (patman) [inputs]: Add python-u-boot-pylib.
---
 gnu/packages/bootloaders.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 827894e447..9098b2a8e2 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -878,7 +878,7 @@ (define-public patman
           (add-after 'unpack 'chdir
             (lambda _
               (chdir "tools/patman"))))))
-    (inputs (list python-pygit2 python-requests))
+    (inputs (list python-pygit2 python-requests python-u-boot-pylib))
     (synopsis "Patch automation tool")
     (description "Patman is a patch automation script which:
 @itemize
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 2/2] gnu: patman: Add python-u-boot-pylib to inputs.
  2023-07-08 23:21               ` Vagrant Cascadian
@ 2023-07-09  2:36                 ` Vagrant Cascadian
  2023-07-10  4:01                 ` Maxim Cournoyer
  1 sibling, 0 replies; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-09  2:36 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 64149, ludo, efraim, Maxim Cournoyer

[-- Attachment #1: Type: text/plain, Size: 3807 bytes --]

On 2023-07-08, Vagrant Cascadian wrote:
> On 2023-07-08, Maxim Cournoyer wrote:
> starting phase `sanity-check'                                                                                                       validating 'patch-manager' /gnu/store/d22rsfa7pr8ff6ai1hp72qjljiyayzrx-patman-2023.07-rc6/lib/python3.10/site-packages
> ...checking requirements: OK                                                                                                        ...trying to load module patman: OK                                                                                                 ...trying to load endpoint console_scripts patman: ERROR:
> Traceback (most recent call last):                                                                                                    File "/gnu/store/rlf99syqlc9kyf76rba3sbxsafszf017-python-u-boot-pylib-2023.07-rc6/lib/python3.10/site-packages/u_boot_pylib/command.py", line 95, in run_pipe
>     last_pipe = cros_subprocess.Popen(cmd, cwd=cwd, **kwargs)                                                                         File "/gnu/store/rlf99syqlc9kyf76rba3sbxsafszf017-python-u-boot-pylib-2023.07-rc6/lib/python3.10/site-packages/u_boot_pylib/cros_subprocess.py", line 83, in __init__
>     super(Popen, self).__init__(args, stdin=stdin,                                                                                    File "/gnu/store/kj6wzba6p192baizq99b489rs8bynpn7-python-3.10.7/lib/python3.10/subprocess.py", line 969, in __init__                  self._execute_child(args, executable, preexec_fn, close_fds,
>   File "/gnu/store/kj6wzba6p192baizq99b489rs8bynpn7-python-3.10.7/lib/python3.10/subprocess.py", line 1845, in _execute_child
>     raise child_exception_type(errno_num, err_msg, err_filename)
> FileNotFoundError: [Errno 2] No such file or directory: 'git'

Adding git to inputs or native inputs avoided that part... but still
ends with an error:

...trying to load endpoint console_scripts patman: ERROR:
Traceback (most recent call last):
  File "/gnu/store/iqsjkp55pcx5bfcp2jm9yj5rlx9a0whd-sanity-check.py", line 89, in <module>
    ep.load()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2471
, in load
    return self.resolve()
  File "/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2477
, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/gnu/store/v76an72qxvclc5qy46bddin3rcljka2f-patman-2023.07-rc6/lib/python3.10/site-packages/patman/__main__.py", line 47, in
 <module>
    parser.add_argument('-p', '--project', default=project.detect_project(),
  File "/gnu/store/v76an72qxvclc5qy46bddin3rcljka2f-patman-2023.07-rc6/lib/python3.10/site-packages/patman/project.py", line 19, in
detect_project
    top_level = gitutil.get_top_level()
  File "/gnu/store/v76an72qxvclc5qy46bddin3rcljka2f-patman-2023.07-rc6/lib/python3.10/site-packages/patman/gitutil.py", line 627, in
 get_top_level
    return command.output_one_line('git', 'rev-parse', '--show-toplevel')
  File "/gnu/store/rlf99syqlc9kyf76rba3sbxsafszf017-python-u-boot-pylib-2023.07-rc6/lib/python3.10/site-packages/u_boot_pylib/comman
d.py", line 128, in output_one_line
    result = run_pipe([cmd], capture=True, oneline=True,
  File "/gnu/store/rlf99syqlc9kyf76rba3sbxsafszf017-python-u-boot-pylib-2023.07-rc6/lib/python3.10/site-packages/u_boot_pylib/comman
d.py", line 112, in run_pipe
    raise Exception("Error running '%s'" % user_pipestr)
Exception: Error running 'git rev-parse --show-toplevel'
error: in phase 'sanity-check': uncaught exception:


It seems to be running git on some repository that presumably does not
exist?


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 2/2] gnu: patman: Add python-u-boot-pylib to inputs.
  2023-07-08 23:21               ` Vagrant Cascadian
  2023-07-09  2:36                 ` Vagrant Cascadian
@ 2023-07-10  4:01                 ` Maxim Cournoyer
  1 sibling, 0 replies; 46+ messages in thread
From: Maxim Cournoyer @ 2023-07-10  4:01 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 64149, ludo, efraim

Hi Vagrant,

Vagrant Cascadian <vagrant@debian.org> writes:

> On 2023-07-08, Maxim Cournoyer wrote:
>> * gnu/packages/bootloaders.scm (patman) [inputs]: Add python-u-boot-pylib.
>> ---
>>  gnu/packages/bootloaders.scm | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
>> index c1a76ab90e..789248afeb 100644
>> --- a/gnu/packages/bootloaders.scm
>> +++ b/gnu/packages/bootloaders.scm
>> @@ -869,7 +869,7 @@ (define-public patman
>>            (add-after 'unpack 'chdir
>>              (lambda _
>>                (chdir "tools/patman"))))))
>> -    (inputs (list python-pygit2 python-requests))
>> +    (inputs (list python-pygit2 python-requests python-u-boot-pylib))
>>      (synopsis "Patch automation tool")
>>      (description "Patman is a patch automation script which:
>>  @itemize
>> -- 
>> 2.40.1
>
> This was not sufficient to get patman building again:

Oh, indeed, seems I hadn't gone to that point in my testing.

> starting phase `sanity-check'                                                                                                       validating 'patch-manager' /gnu/store/d22rsfa7pr8ff6ai1hp72qjljiyayzrx-patman-2023.07-rc6/lib/python3.10/site-packages
> ...checking requirements: OK                                                                                                        ...trying to load module patman: OK                                                                                                 ...trying to load endpoint console_scripts patman: ERROR:
> Traceback (most recent call last):                                                                                                    File "/gnu/store/rlf99syqlc9kyf76rba3sbxsafszf017-python-u-boot-pylib-2023.07-rc6/lib/python3.10/site-packages/u_boot_pylib/command.py", line 95, in run_pipe
>     last_pipe = cros_subprocess.Popen(cmd, cwd=cwd, **kwargs)                                                                         File "/gnu/store/rlf99syqlc9kyf76rba3sbxsafszf017-python-u-boot-pylib-2023.07-rc6/lib/python3.10/site-packages/u_boot_pylib/cros_subprocess.py", line 83, in __init__
>     super(Popen, self).__init__(args, stdin=stdin,                                                                                    File "/gnu/store/kj6wzba6p192baizq99b489rs8bynpn7-python-3.10.7/lib/python3.10/subprocess.py", line 969, in __init__                  self._execute_child(args, executable, preexec_fn, close_fds,
>   File "/gnu/store/kj6wzba6p192baizq99b489rs8bynpn7-python-3.10.7/lib/python3.10/subprocess.py", line 1845, in _execute_child
>     raise child_exception_type(errno_num, err_msg, err_filename)
> FileNotFoundError: [Errno 2] No such file or directory: 'git'                                                                       
I've made a patch to patman so that it falls back to use the current
working directory when git or its metadata is unavailable, but I still
got this error in the sanity-check phase:

--8<---------------cut here---------------start------------->8---
phase `check' succeeded after 0.0 seconds
starting phase `sanity-check'
usage: iqsjkp55pcx5bfcp2jm9yj5rlx9a0whd-sanity-check.py [-h] [-b BRANCH]
                                                        [-c COUNT] [-e END]
                                                        [-D] [-p PROJECT]
                                                        [-P PATCHWORK_URL]
                                                        [-s START] [-v] [-H]
                                                        {send,status} ...
iqsjkp55pcx5bfcp2jm9yj5rlx9a0whd-sanity-check.py: error: argument cmd: invalid choice: '/gnu/store/caxygz92s8zf7lk7a58d2yr873hzx46w-patman-2023.07-rc6/lib/python3.10/site-packages' (choose from 'send', 'status')
validating 'patch-manager' /gnu/store/caxygz92s8zf7lk7a58d2yr873hzx46w-patman-2023.07-rc6/lib/python3.10/site-packages
...checking requirements: OK
...trying to load module patman: OK
...trying to load endpoint console_scripts patman: failed to retrieve top level via git; using CWD
failed to retrieve top level via git; using CWD
error: in phase 'sanity-check': uncaught exception:
%exception #<&invoke-error program: "python" arguments: ("/gnu/store/iqsjkp55pcx5bfcp2jm9yj5rlx9a0whd-sanity-check.py" "/gnu/store/caxygz92s8zf7lk7a58d2yr873hzx46w-patman-2023.07-rc6/lib/python3.10/site-packages") exit-status: 2 term-signal: #f stop-signal: #f> 
phase `sanity-check' failed after 0.2 seconds
--8<---------------cut here---------------end--------------->8---

Perhaps for the time being deleting that phase with an explanatory
comment would be the best course of action.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 2/5] gnu: u-boot: Update to 2023.07-rc6.
  2023-07-09  1:47                   ` [bug#64149] [PATCH 2/5] gnu: u-boot: Update to 2023.07-rc6 vagrant
@ 2023-07-10 19:35                     ` Vagrant Cascadian
  0 siblings, 0 replies; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-10 19:35 UTC (permalink / raw)
  To: 64149; +Cc: ludo, efraim, maxim.cournoyer

[-- Attachment #1: Type: text/plain, Size: 664 bytes --]

On 2023-07-08, vagrant@debian.org wrote:
> --- a/gnu/packages/bootloaders.scm
> +++ b/gnu/packages/bootloaders.scm
> @@ -648,23 +648,21 @@ (define %u-boot-rk3399-enable-emmc-phy-patch
>  (define u-boot
>    (package
>      (name "u-boot")
> -    (version "2022.10")
> +    (version "2023.07-rc6")

And 2023.07 is out!


>                (sha256
>                 (base32
> -                "1y5x8vxdgsqdqlsvq01mn8lmw53fqairkhvhhjx83hjva0m4id2h"))))
> +                "1dgvr228imbhzq7vzr8iialijl3k4mhjdirjrm6hsy6qbm6jyj5r"))))

With the hash 002375xvmalqdy4gkvpc3aq91g12gwmq7rjmqgdiqwxfcss23s8j

All still built fine for me except patman...


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH 5/5] gnu: patman: Add python-u-boot-pylib to inputs.
  2023-07-09  1:47                   ` [bug#64149] [PATCH 5/5] gnu: patman: Add python-u-boot-pylib to inputs vagrant
@ 2023-07-10 19:39                     ` Vagrant Cascadian
  0 siblings, 0 replies; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-10 19:39 UTC (permalink / raw)
  To: 64149; +Cc: ludo, efraim, maxim.cournoyer

[-- Attachment #1: Type: text/plain, Size: 619 bytes --]

On 2023-07-08, vagrant@debian.org wrote:
> From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
>
> * gnu/packages/bootloaders.scm (patman) [inputs]: Add python-u-boot-pylib.

So I did successfully build with 'sanity-check removed.

I tried creating a little git playground for patman to run the patman
self-tests with, but 'sanity-check ended up in some other directory and
still failed.

Even "patman --help" spits out this ugly traceback if it is not run from
inside a working git directory...

Soo.... maybe deleting 'sanity-check is the way to go here? Not sure
what else we would be missing...

live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 0/6] Update u-boot to 2023.07.02
  2023-06-18  8:49 [bug#64149] WIP update u-boot to 2023.07-rc4 Vagrant Cascadian
  2023-07-03  1:26 ` [bug#64149] WIP update u-boot to 2023.07-rc5 Vagrant Cascadian
@ 2023-07-12 14:49 ` Vagrant Cascadian
  2023-07-12 14:52   ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 vagrant
  2023-07-13 13:52   ` [bug#64149] Update u-boot to 2023.07.02 Vagrant Cascadian
  2023-07-20  1:44 ` [bug#64149] [PATCH v4 0/5] Update U-boot " vagrant
  2 siblings, 2 replies; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-12 14:49 UTC (permalink / raw)
  To: 64149; +Cc: ludo, efraim, maxim.cournoyer

[-- Attachment #1: Type: text/plain, Size: 1268 bytes --]

Changes since v2:

* Update to 2023.07.02.
* Drop sanity-check phase for patman build.

Maxim Cournoyer (2):
  gnu: Add python-u-boot-pylib.
  gnu: patman: Add python-u-boot-pylib to inputs.

Vagrant Cascadian (4):
  gnu: arm-trusted-firmware: Update to 2.9.
  gnu: u-boot: Update to 2023.07.02.
  gnu: u-boot: Add crust firmware to pinebook, pine64_plus and
    pine64-lts.
  (patman)[phases]: Remove 'sanity-check.

 gnu/local.mk                                  |    3 +-
 gnu/packages/bootloaders.scm                  |   91 +-
 gnu/packages/firmware.scm                     |    4 +-
 .../u-boot-allow-disabling-openssl.patch      |   13 +-
 .../patches/u-boot-fix-u-boot-lib-build.patch |   24 +
 .../patches/u-boot-infodocs-target.patch      |   84 --
 .../u-boot-patman-guix-integration.patch      | 1244 -----------------
 ...boot-sifive-prevent-reloc-initrd-fdt.patch |    8 +-
 8 files changed, 113 insertions(+), 1358 deletions(-)
 create mode 100644 gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch
 delete mode 100644 gnu/packages/patches/u-boot-infodocs-target.patch
 delete mode 100644 gnu/packages/patches/u-boot-patman-guix-integration.patch


base-commit: 713d3952e4872ed025e3068d0ece759c780b2f6d
-- 
2.39.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9.
  2023-07-12 14:49 ` [bug#64149] [PATCH v3 0/6] Update u-boot to 2023.07.02 Vagrant Cascadian
@ 2023-07-12 14:52   ` vagrant
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 2/6] gnu: u-boot: Update to 2023.07.02 vagrant
                       ` (5 more replies)
  2023-07-13 13:52   ` [bug#64149] Update u-boot to 2023.07.02 Vagrant Cascadian
  1 sibling, 6 replies; 46+ messages in thread
From: vagrant @ 2023-07-12 14:52 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Vagrant Cascadian <vagrant@debian.org>

* gnu/packages/firmware.scm (make-arm-trusted-firmware): Update to 2.9.
---
 gnu/packages/firmware.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 3dcc882e0c..0492dabeed 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1025,7 +1025,7 @@ (define* (make-arm-trusted-firmware platform
                                        (gnu-triplet->nix-system triplet))))))
     (package
       (name (string-append "arm-trusted-firmware-" platform))
-      (version "2.8")
+      (version "2.9")
       (source
        (origin
          (method git-fetch)
@@ -1036,7 +1036,7 @@ (define* (make-arm-trusted-firmware platform
          (file-name (git-file-name "arm-trusted-firmware" version))
          (sha256
           (base32
-           "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3"))
+           "16fjbn1zck0d8b554h8lk1svqqn0zlawvrlkjxry9l71s9h4vd0p"))
          (snippet
           #~(begin
               (use-modules (guix build utils))
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 2/6] gnu: u-boot: Update to 2023.07.02.
  2023-07-12 14:52   ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 vagrant
@ 2023-07-12 14:52     ` vagrant
  2023-07-15  2:42       ` Maxim Cournoyer
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 3/6] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts vagrant
                       ` (4 subsequent siblings)
  5 siblings, 1 reply; 46+ messages in thread
From: vagrant @ 2023-07-12 14:52 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Vagrant Cascadian <vagrant@debian.org>

* gnu/packages/patches/u-boot-infodocs-target.patch: Delete file.
* gnu/packages/patches/u-boot-patman-guix-integration.patch: Delete file.
* gnu/local.mk: De-register patches.
* gnu/packages/patches/u-boot-allow-disabling-openssl.patch: Refresh.
* gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch: Refresh.
* gnu/packages/bootloaders.scm (u-boot): Update to 2023.07.02.
[native-inputs]: Add python-pyelftools.
[source]: Remove patches.
(u-boot-tools)[phases]: Update substitution for python3-coverage.
Adjust 'patch to catch more openssl incompatibilities.
Split lines in 'patch phase.
[native-inputs]: Add python-filelock and python-pytest-xdist.
(make-u-boot-sunxi64-package): Set SCP environment variable.
(u-boot-sifive-unleashed): Update to use opensbi.
(u-boot-puma-rk3399)[inputs]: Add arm-trusted-firmware-rk3399 to
package-inputs instead of native-inputs.
(u-boot-rockpro64-rk3399)[phases]: Add 'disable-spl-fit-signature.
---
 gnu/local.mk                                  |    2 -
 gnu/packages/bootloaders.scm                  |   57 +-
 .../u-boot-allow-disabling-openssl.patch      |   13 +-
 .../patches/u-boot-infodocs-target.patch      |   84 --
 .../u-boot-patman-guix-integration.patch      | 1244 -----------------
 ...boot-sifive-prevent-reloc-initrd-fdt.patch |    8 +-
 6 files changed, 56 insertions(+), 1352 deletions(-)
 delete mode 100644 gnu/packages/patches/u-boot-infodocs-target.patch
 delete mode 100644 gnu/packages/patches/u-boot-patman-guix-integration.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index c817c9c926..0e0087b6aa 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1999,8 +1999,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
-  %D%/packages/patches/u-boot-infodocs-target.patch		\
-  %D%/packages/patches/u-boot-patman-guix-integration.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 01fd1093ff..d1633b2b70 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -648,23 +648,21 @@ (define %u-boot-rk3399-enable-emmc-phy-patch
 (define u-boot
   (package
     (name "u-boot")
-    (version "2022.10")
+    (version "2023.07.02")
     (source (origin
               (patches
                (list %u-boot-rockchip-inno-usb-patch
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
                      %u-boot-rk3399-enable-emmc-phy-patch
-                     (search-patch "u-boot-fix-build-python-3.10.patch")
-                     (search-patch "u-boot-infodocs-target.patch")
-                     (search-patch "u-boot-patman-guix-integration.patch")))
+                     (search-patch "u-boot-fix-build-python-3.10.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
                     "u-boot-" version ".tar.bz2"))
               (sha256
                (base32
-                "1y5x8vxdgsqdqlsvq01mn8lmw53fqairkhvhhjx83hjva0m4id2h"))))
+                "1m91w3fpywllkwm000dqsw3294j0szs1lz6qbgwv1aql3ic4hskb"))))
     (build-system gnu-build-system)
     (native-inputs
      (list bison
@@ -676,6 +674,7 @@ (define u-boot
            perl
            pkg-config                   ;for 'make menuconfig'
            python
+           python-pyelftools
            swig
            (list util-linux "lib")))
     (home-page "https://www.denx.de/wiki/U-Boot/")
@@ -726,7 +725,12 @@ (define-public u-boot-tools
     (name "u-boot-tools")
     (native-inputs
      (modify-inputs (package-native-inputs u-boot)
-       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
+       (prepend python-coverage
+                python-filelock
+                python-pycryptodomex
+                python-pytest
+                python-pytest-xdist
+                sdl2)))
     (arguments
      `(#:make-flags '("HOSTCC=gcc")
        #:test-target "tcheck"
@@ -739,7 +743,7 @@ (define-public u-boot-tools
                (("/bin/false") (which "false")))
              (substitute* "tools/dtoc/fdt_util.py"
                (("'cc'") "'gcc'"))
-             (substitute* "tools/patman/test_util.py"
+             (substitute* "tools/u_boot_pylib/test_util.py"
                ;; python3-coverage is simply called coverage in guix.
                (("python3-coverage") "coverage")
 
@@ -777,7 +781,15 @@ (define-public u-boot-tools
                            ;; See https://bugs.gnu.org/34717 for
                            ;; details.
                            (("CONFIG_FIT_SIGNATURE=y")
-                            "CONFIG_FIT_SIGNATURE=n\nCONFIG_UT_LIB_ASN1=n\nCONFIG_TOOLS_LIBCRYPTO=n")
+                            "CONFIG_FIT_SIGNATURE=n
+CONFIG_UT_LIB_ASN1=n
+CONFIG_TOOLS_LIBCRYPTO=n")
+                           ;; Catch instances of implied CONFIG_FIG_SIGNATURE with VPL targets
+                           (("CONFIG_SANDBOX_VPL=y")
+                            "CONFIG_SANDBOX_VPL=y
+CONFIG_FIT_SIGNATURE=n
+CONFIG_VPL_FIT_SIGNATURE=n
+CONFIG_TOOLS_LIBCRYPTO=n")
                            ;; This test requires a sound system, which is un-used
                            ;; in u-boot-tools.
                            (("CONFIG_SOUND=y") "CONFIG_SOUND=n")))
@@ -1009,6 +1021,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
           #~(modify-phases #$phases
               (add-after 'unpack 'set-environment
                 (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
+                  (setenv "SCP" "/dev/null")
                   (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
       (inputs
        (modify-inputs (package-inputs base)
@@ -1104,7 +1118,7 @@ (define-public u-boot-puma-rk3399
               (delete 'strip)
               (delete 'validate-runpath)))))
       (inputs
-       (modify-inputs (package-native-inputs base)
+       (modify-inputs (package-inputs base)
          (append arm-trusted-firmware-rk3399))))))
 
 (define-public u-boot-qemu-arm
@@ -1170,7 +1184,20 @@ (define-public u-boot-sandbox
                 (append sdl2))))))
 
 (define-public u-boot-sifive-unleashed
-  (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu"))
+  (let ((base (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu")))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'set-environment
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (setenv "OPENSBI" (search-input-file inputs
+                                                       "fw_dynamic.bin"))))))))
+      (inputs
+       (modify-inputs (package-inputs base)
+         (append opensbi-generic))))))
 
 (define-public u-boot-sifive-unmatched
   (let ((base (make-u-boot-package "sifive_unmatched" "riscv64-linux-gnu")))
@@ -1230,7 +1257,8 @@ (define-public u-boot-rockpro64-rk3399
                                                "CONFIG_SATA_SIL=y"
                                                "CONFIG_SCSI=y"
                                                "CONFIG_SCSI_AHCI=y"
-                                               "CONFIG_DM_SCSI=y"))))
+                                               "CONFIG_DM_SCSI=y"
+                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
     (package
       (inherit base)
       (arguments
@@ -1240,6 +1268,13 @@ (define-public u-boot-rockpro64-rk3399
               (add-after 'unpack 'set-environment
                 (lambda* (#:key inputs #:allow-other-keys)
                   (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
+              ;; Disable SPL FIT signatures, due to GPLv2 and Openssl license
+              ;; incompatibilities
+              (add-after 'unpack 'disable-spl-fit-signature
+                (lambda _
+                  (substitute* "configs/rockpro64-rk3399_defconfig"
+                    (("CONFIG_SPL_FIT_SIGNATURE=y")
+                     "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
               (add-after 'unpack 'patch-header
                 (lambda _
                   (substitute* "include/config_distro_bootcmd.h"
diff --git a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
index 5f2856dbb4..5195a7a6f8 100644
--- a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
+++ b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
@@ -128,29 +128,28 @@ index 94b7685392..eec599b0ee 100644
  	datai = 0;
  	for (cfgi = 0; cfgi < cfgn; cfgi++) {
  		e = &image_cfg[cfgi];
-@@ -1552,9 +1568,11 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
+@@ -1624,10 +1640,12 @@ static void *image_create_v1(size_t *dataoff, struct image_tool_params *params,
  					      &datai, delay);
  	}
  
 +#if defined(CONFIG_KWB_SECURE)
- 	if (secure_hdr && add_secure_header_v1(params, ptr, payloadsz + headersz,
- 					       headersz, image, secure_hdr))
+ 	if (secure_hdr && add_secure_header_v1(params, ptr + *dataoff, payloadsz,
+ 					       image, headersz, secure_hdr))
  		return NULL;
 +#endif
  
- 	*imagesz = headersz;
+ 	/* Calculate and set the header checksum */
+ 	main_hdr->checksum = image_checksum8(main_hdr, headersz);
  
 --- a/tools/image-host.c
 +++ b/tools/image-host.c
-@@ -14,10 +14,12 @@
+@@ -14,8 +14,10 @@
  #include <image.h>
  #include <version.h>
  
 +#ifdef CONFIG_FIT_PRELOAD
  #include <openssl/pem.h>
  #include <openssl/evp.h>
- 
- #define IMAGE_PRE_LOAD_PATH                             "/image/pre-load/sig"
 +#endif
  
  /**
diff --git a/gnu/packages/patches/u-boot-infodocs-target.patch b/gnu/packages/patches/u-boot-infodocs-target.patch
deleted file mode 100644
index 5b21a99de3..0000000000
--- a/gnu/packages/patches/u-boot-infodocs-target.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-Upstream status: https://patchwork.ozlabs.org/project/uboot/list/?series=333259
-
-diff --git a/Makefile b/Makefile
-index de5746399a..597a8886c3 100644
---- a/Makefile
-+++ b/Makefile
-@@ -2372,7 +2372,7 @@ tcheck:
- # Documentation targets
- # ---------------------------------------------------------------------------
- DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
--	       linkcheckdocs dochelp refcheckdocs
-+	       linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
- PHONY += $(DOC_TARGETS)
- $(DOC_TARGETS): scripts_basic FORCE
- 	$(Q)$(MAKE) $(build)=doc $@
-diff --git a/doc/Makefile b/doc/Makefile
-index f5de65e927..d0904a9f99 100644
---- a/doc/Makefile
-+++ b/doc/Makefile
-@@ -69,6 +69,14 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
- htmldocs:
- 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
- 
-+texinfodocs:
-+	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,texinfo,$(var),texinfo,$(var)))
-+
-+# Note: the 'info' Make target is generated by sphinx itself when
-+# running the texinfodocs target defined above.
-+infodocs: texinfodocs
-+	$(MAKE) -C $(BUILDDIR)/texinfo info
-+
- linkcheckdocs:
- 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
- 
-@@ -109,6 +117,8 @@ cleandocs:
- dochelp:
- 	@echo  ' U-Boot documentation in different formats from ReST:'
- 	@echo  '  htmldocs        - HTML'
-+	@echo  '  texinfodocs     - Texinfo'
-+	@echo  '  infodocs        - Info'
- 	@echo  '  latexdocs       - LaTeX'
- 	@echo  '  pdfdocs         - PDF'
- 	@echo  '  epubdocs        - EPUB'
-diff --git a/doc/conf.py b/doc/conf.py
-index 62c8d31270..3db70f80c1 100644
---- a/doc/conf.py
-+++ b/doc/conf.py
-@@ -449,7 +449,7 @@ for fn in os.listdir('.'):
- # One entry per manual page. List of tuples
- # (source start file, name, description, authors, manual section).
- man_pages = [
--    (master_doc, 'dasuboot', 'The U-Boot Documentation',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-      [author], 1)
- ]
- 
-@@ -463,8 +463,8 @@ man_pages = [
- # (source start file, target name, title, author,
- #  dir menu entry, description, category)
- texinfo_documents = [
--    (master_doc, 'DasUBoot', 'The U-Boot Documentation',
--     author, 'DasUBoot', 'One line description of project.',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-+     author, 'U-Boot', 'Boot loader for embedded systems',
-      'Miscellaneous'),
- ]
- 
-diff --git a/doc/media/Makefile b/doc/media/Makefile
-index b9b43a34c3..9b32258696 100644
---- a/doc/media/Makefile
-+++ b/doc/media/Makefile
-@@ -22,10 +22,11 @@ $(BUILDDIR)/linker_lists.h.rst: ${API}/linker_lists.h ${PARSER} $(SRC_DIR)/linke
- 
- # Media build rules
- 
--.PHONY: all html epub xml latex
-+.PHONY: all html texinfo epub xml latex
- 
- all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
- html: all
-+texinfo: all
- epub: all
- xml: all
- latex: $(IMGPDF) all
diff --git a/gnu/packages/patches/u-boot-patman-guix-integration.patch b/gnu/packages/patches/u-boot-patman-guix-integration.patch
deleted file mode 100644
index 3472656c99..0000000000
--- a/gnu/packages/patches/u-boot-patman-guix-integration.patch
+++ /dev/null
@@ -1,1244 +0,0 @@
-These changes correspond to commits 9ff7500ace..3154de3dd6 already merged to
-the u-boot-dm custodian repo (at
-https://source.denx.de/u-boot/custodians/u-boot-dm/-/commits/next), scheduled
-to be pulled after the next release.
-
-diff --git a/tools/patman/__init__.py b/tools/patman/__init__.py
-index c9d3e35052..1b98ec7fee 100644
---- a/tools/patman/__init__.py
-+++ b/tools/patman/__init__.py
-@@ -1,6 +1,6 @@
- # SPDX-License-Identifier: GPL-2.0+
- 
- __all__ = ['checkpatch', 'command', 'commit', 'control', 'cros_subprocess',
--           'func_test', 'get_maintainer', 'gitutil', 'main', 'patchstream',
-+           'func_test', 'get_maintainer', 'gitutil', '__main__', 'patchstream',
-            'project', 'series', 'setup', 'settings', 'terminal',
-            'test_checkpatch', 'test_util', 'tools', 'tout']
-diff --git a/tools/patman/main.py b/tools/patman/__main__.py
-similarity index 89%
-rename from tools/patman/main.py
-rename to tools/patman/__main__.py
-index 8067a288ab..749e6348b6 100755
---- a/tools/patman/main.py
-+++ b/tools/patman/__main__.py
-@@ -7,6 +7,7 @@
- """See README for more information"""
- 
- from argparse import ArgumentParser
-+import importlib.resources
- import os
- import re
- import sys
-@@ -19,6 +20,7 @@ if __name__ == "__main__":
- 
- # Our modules
- from patman import control
-+from patman import func_test
- from patman import gitutil
- from patman import project
- from patman import settings
-@@ -53,7 +55,8 @@ parser.add_argument('-H', '--full-help', action='store_true', dest='full_help',
-                     default=False, help='Display the README file')
- 
- subparsers = parser.add_subparsers(dest='cmd')
--send = subparsers.add_parser('send')
-+send = subparsers.add_parser(
-+    'send', help='Format, check and email patches (default command)')
- send.add_argument('-i', '--ignore-errors', action='store_true',
-        dest='ignore_errors', default=False,
-        help='Send patches email even if patch errors are found')
-@@ -62,6 +65,12 @@ send.add_argument('-l', '--limit-cc', dest='limit', type=int, default=None,
- send.add_argument('-m', '--no-maintainers', action='store_false',
-        dest='add_maintainers', default=True,
-        help="Don't cc the file maintainers automatically")
-+send.add_argument(
-+    '--get-maintainer-script', dest='get_maintainer_script', type=str,
-+    action='store',
-+    default=os.path.join(gitutil.get_top_level(), 'scripts',
-+                         'get_maintainer.pl') + ' --norolestats',
-+    help='File name of the get_maintainer.pl (or compatible) script.')
- send.add_argument('-n', '--dry-run', action='store_true', dest='dry_run',
-        default=False, help="Do a dry run (create but don't email patches)")
- send.add_argument('-r', '--in-reply-to', type=str, action='store',
-@@ -94,9 +103,11 @@ send.add_argument('--smtp-server', type=str,
- 
- send.add_argument('patchfiles', nargs='*')
- 
--test_parser = subparsers.add_parser('test', help='Run tests')
--test_parser.add_argument('testname', type=str, default=None, nargs='?',
--                         help="Specify the test to run")
-+# Only add the 'test' action if the test data files are available.
-+if os.path.exists(func_test.TEST_DATA_DIR):
-+    test_parser = subparsers.add_parser('test', help='Run tests')
-+    test_parser.add_argument('testname', type=str, default=None, nargs='?',
-+                             help="Specify the test to run")
- 
- status = subparsers.add_parser('status',
-                                help='Check status of patches in patchwork')
-@@ -113,7 +124,7 @@ status.add_argument('-f', '--force', action='store_true',
- argv = sys.argv[1:]
- args, rest = parser.parse_known_args(argv)
- if hasattr(args, 'project'):
--    settings.Setup(gitutil, parser, args.project, '')
-+    settings.Setup(parser, args.project)
-     args, rest = parser.parse_known_args(argv)
- 
- # If we have a command, it is safe to parse all arguments
-@@ -160,11 +171,8 @@ elif args.cmd == 'send':
-         fd.close()
- 
-     elif args.full_help:
--        tools.print_full_help(
--            os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                         'README.rst')
--        )
--
-+        with importlib.resources.path('patman', 'README.rst') as readme:
-+            tools.print_full_help(str(readme))
-     else:
-         # If we are not processing tags, no need to warning about bad ones
-         if not args.process_tags:
-diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
-index d1b902dd96..012c0d895c 100644
---- a/tools/patman/checkpatch.py
-+++ b/tools/patman/checkpatch.py
-@@ -211,7 +211,7 @@ def check_patch(fname, verbose=False, show_types=False, use_tree=False):
-             stdout: Full output of checkpatch
-     """
-     chk = find_check_patch()
--    args = [chk]
-+    args = [chk, '--u-boot', '--strict']
-     if not use_tree:
-         args.append('--no-tree')
-     if show_types:
-diff --git a/tools/patman/control.py b/tools/patman/control.py
-index bf426cf7bc..38e98dab84 100644
---- a/tools/patman/control.py
-+++ b/tools/patman/control.py
-@@ -94,8 +94,8 @@ def check_patches(series, patch_files, run_checkpatch, verbose, use_tree):
- 
- 
- def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
--                  ignore_bad_tags, add_maintainers, limit, dry_run, in_reply_to,
--                  thread, smtp_server):
-+                  ignore_bad_tags, add_maintainers, get_maintainer_script, limit,
-+                  dry_run, in_reply_to, thread, smtp_server):
-     """Email patches to the recipients
- 
-     This emails out the patches and cover letter using 'git send-email'. Each
-@@ -123,6 +123,8 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         ignore_bad_tags (bool): True to just print a warning for unknown tags,
-             False to halt with an error
-         add_maintainers (bool): Run the get_maintainer.pl script for each patch
-+        get_maintainer_script (str): The script used to retrieve which
-+            maintainers to cc
-         limit (int): Limit on the number of people that can be cc'd on a single
-             patch or the cover letter (None if no limit)
-         dry_run (bool): Don't actually email the patches, just print out what
-@@ -134,7 +136,7 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         smtp_server (str): SMTP server to use to send patches (None for default)
-     """
-     cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags,
--                                add_maintainers, limit)
-+                                add_maintainers, limit, get_maintainer_script)
- 
-     # Email the patches out (giving the user time to check / cancel)
-     cmd = ''
-@@ -174,8 +176,8 @@ def send(args):
-     email_patches(
-         col, series, cover_fname, patch_files, args.process_tags,
-         its_a_go, args.ignore_bad_tags, args.add_maintainers,
--        args.limit, args.dry_run, args.in_reply_to, args.thread,
--        args.smtp_server)
-+        args.get_maintainer_script, args.limit, args.dry_run,
-+        args.in_reply_to, args.thread, args.smtp_server)
- 
- def patchwork_status(branch, count, start, end, dest_branch, force,
-                      show_comments, url):
-diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
-index 7b92bc67be..c25a47bdeb 100644
---- a/tools/patman/func_test.py
-+++ b/tools/patman/func_test.py
-@@ -6,7 +6,9 @@
- 
- """Functional tests for checking that patman behaves correctly"""
- 
-+import contextlib
- import os
-+import pathlib
- import re
- import shutil
- import sys
-@@ -28,6 +30,21 @@ from patman.test_util import capture_sys_output
- import pygit2
- from patman import status
- 
-+PATMAN_DIR = pathlib.Path(__file__).parent
-+TEST_DATA_DIR = PATMAN_DIR / 'test/'
-+
-+
-+@contextlib.contextmanager
-+def directory_excursion(directory):
-+    """Change directory to `directory` for a limited to the context block."""
-+    current = os.getcwd()
-+    try:
-+        os.chdir(directory)
-+        yield
-+    finally:
-+        os.chdir(current)
-+
-+
- class TestFunctional(unittest.TestCase):
-     """Functional tests for checking that patman behaves correctly"""
-     leb = (b'Lord Edmund Blackadd\xc3\xabr <weasel@blackadder.org>'.
-@@ -57,8 +74,7 @@ class TestFunctional(unittest.TestCase):
-         Returns:
-             str: Full path to file in the test directory
-         """
--        return os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                            'test', fname)
-+        return TEST_DATA_DIR / fname
- 
-     @classmethod
-     def _get_text(cls, fname):
-@@ -200,6 +216,8 @@ class TestFunctional(unittest.TestCase):
-         text = self._get_text('test01.txt')
-         series = patchstream.get_metadata_for_test(text)
-         cover_fname, args = self._create_patches_for_test(series)
-+        get_maintainer_script = str(pathlib.Path(__file__).parent.parent.parent
-+                                    / 'get_maintainer.pl') + ' --norolestats'
-         with capture_sys_output() as out:
-             patchstream.fix_patches(series, args)
-             if cover_fname and series.get('cover'):
-@@ -207,7 +225,7 @@ class TestFunctional(unittest.TestCase):
-             series.DoChecks()
-             cc_file = series.MakeCcFile(process_tags, cover_fname,
-                                         not ignore_bad_tags, add_maintainers,
--                                        None)
-+                                        None, get_maintainer_script)
-             cmd = gitutil.email_patches(
-                 series, cover_fname, args, dry_run, not ignore_bad_tags,
-                 cc_file, in_reply_to=in_reply_to, thread=None)
-@@ -502,6 +520,37 @@ complicated as possible''')
-         finally:
-             os.chdir(orig_dir)
- 
-+    def test_custom_get_maintainer_script(self):
-+        """Validate that a custom get_maintainer script gets used."""
-+        self.make_git_tree()
-+        with directory_excursion(self.gitdir):
-+            # Setup git.
-+            os.environ['GIT_CONFIG_GLOBAL'] = '/dev/null'
-+            os.environ['GIT_CONFIG_SYSTEM'] = '/dev/null'
-+            tools.run('git', 'config', 'user.name', 'Dummy')
-+            tools.run('git', 'config', 'user.email', 'dumdum@dummy.com')
-+            tools.run('git', 'branch', 'upstream')
-+            tools.run('git', 'branch', '--set-upstream-to=upstream')
-+            tools.run('git', 'add', '.')
-+            tools.run('git', 'commit', '-m', 'new commit')
-+
-+            # Setup patman configuration.
-+            with open('.patman', 'w', buffering=1) as f:
-+                f.write('[settings]\n'
-+                        'get_maintainer_script: dummy-script.sh\n'
-+                        'check_patch: False\n')
-+            with open('dummy-script.sh', 'w', buffering=1) as f:
-+                f.write('#!/usr/bin/env python\n'
-+                        'print("hello@there.com")\n')
-+            os.chmod('dummy-script.sh', 0x555)
-+
-+            # Finally, do the test
-+            with capture_sys_output():
-+                output = tools.run(PATMAN_DIR / 'patman', '--dry-run')
-+                # Assert the email address is part of the dry-run
-+                # output.
-+                self.assertIn('hello@there.com', output)
-+
-     def test_tags(self):
-         """Test collection of tags in a patchstream"""
-         text = '''This is a patch
-diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
-index e1d15ff6ab..f7011be1e4 100644
---- a/tools/patman/get_maintainer.py
-+++ b/tools/patman/get_maintainer.py
-@@ -1,48 +1,61 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2012 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- import os
-+import shlex
-+import shutil
- 
- from patman import command
-+from patman import gitutil
- 
--def find_get_maintainer(try_list):
--    """Look for the get_maintainer.pl script.
- 
--    Args:
--        try_list: List of directories to try for the get_maintainer.pl script
-+def find_get_maintainer(script_file_name):
-+    """Try to find where `script_file_name` is.
- 
--    Returns:
--        If the script is found we'll return a path to it; else None.
-+    It searches in PATH and falls back to a path relative to the top
-+    of the current git repository.
-     """
--    # Look in the list
--    for path in try_list:
--        fname = os.path.join(path, 'get_maintainer.pl')
--        if os.path.isfile(fname):
--            return fname
-+    get_maintainer = shutil.which(script_file_name)
-+    if get_maintainer:
-+        return get_maintainer
-+
-+    git_relative_script = os.path.join(gitutil.get_top_level(),
-+                                       script_file_name)
-+    if os.path.exists(git_relative_script):
-+        return git_relative_script
- 
--    return None
- 
--def get_maintainer(dir_list, fname, verbose=False):
--    """Run get_maintainer.pl on a file if we find it.
-+def get_maintainer(script_file_name, fname, verbose=False):
-+    """Run `script_file_name` on a file.
- 
--    We look for get_maintainer.pl in the 'scripts' directory at the top of
--    git.  If we find it we'll run it.  If we don't find get_maintainer.pl
--    then we fail silently.
-+    `script_file_name` should be a get_maintainer.pl-like script that
-+    takes a patch file name as an input and return the email addresses
-+    of the associated maintainers to standard output, one per line.
-+
-+    If `script_file_name` does not exist we fail silently.
- 
-     Args:
--        dir_list: List of directories to try for the get_maintainer.pl script
--        fname: Path to the patch file to run get_maintainer.pl on.
-+        script_file_name: The file name of the get_maintainer.pl script
-+            (or compatible).
-+        fname: File name of the patch to process with get_maintainer.pl.
- 
-     Returns:
-         A list of email addresses to CC to.
-     """
--    get_maintainer = find_get_maintainer(dir_list)
-+    # Expand `script_file_name` into a file name and its arguments, if
-+    # any.
-+    cmd_args = shlex.split(script_file_name)
-+    file_name = cmd_args[0]
-+    arguments = cmd_args[1:]
-+
-+    get_maintainer = find_get_maintainer(file_name)
-     if not get_maintainer:
-         if verbose:
-             print("WARNING: Couldn't find get_maintainer.pl")
-         return []
- 
--    stdout = command.output(get_maintainer, '--norolestats', fname)
-+    stdout = command.output(get_maintainer, *arguments, fname)
-     lines = stdout.splitlines()
--    return [ x.replace('"', '') for x in lines ]
-+    return [x.replace('"', '') for x in lines]
-diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
-index ceaf2ce150..5e742102c2 100644
---- a/tools/patman/gitutil.py
-+++ b/tools/patman/gitutil.py
-@@ -2,21 +2,19 @@
- # Copyright (c) 2011 The Chromium OS Authors.
- #
- 
--import re
- import os
--import subprocess
- import sys
- 
- from patman import command
- from patman import settings
- from patman import terminal
--from patman import tools
- 
- # True to use --no-decorate - we check this in setup()
- use_no_decorate = True
- 
-+
- def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
--           count=None):
-+            count=None):
-     """Create a command to perform a 'git log'
- 
-     Args:
-@@ -49,6 +47,7 @@ def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
-     cmd.append('--')
-     return cmd
- 
-+
- def count_commits_to_branch(branch):
-     """Returns number of commits between HEAD and the tracking branch.
- 
-@@ -68,13 +67,14 @@ def count_commits_to_branch(branch):
-         rev_range = '@{upstream}..'
-     pipe = [log_cmd(rev_range, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             oneline=True, raise_on_error=False)
-+                              oneline=True, raise_on_error=False)
-     if result.return_code:
-         raise ValueError('Failed to determine upstream: %s' %
-                          result.stderr.strip())
-     patch_count = len(result.stdout.splitlines())
-     return patch_count
- 
-+
- def name_revision(commit_hash):
-     """Gets the revision name for a commit
- 
-@@ -91,6 +91,7 @@ def name_revision(commit_hash):
-     name = stdout.split(' ')[1].strip()
-     return name
- 
-+
- def guess_upstream(git_dir, branch):
-     """Tries to guess the upstream for a branch
- 
-@@ -109,7 +110,7 @@ def guess_upstream(git_dir, branch):
-     """
-     pipe = [log_cmd(branch, git_dir=git_dir, oneline=True, count=100)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Branch '%s' not found" % branch
-     for line in result.stdout.splitlines()[1:]:
-@@ -121,6 +122,7 @@ def guess_upstream(git_dir, branch):
-             return name, "Guessing upstream as '%s'" % name
-     return None, "Cannot find a suitable upstream for branch '%s'" % branch
- 
-+
- def get_upstream(git_dir, branch):
-     """Returns the name of the upstream for a branch
- 
-@@ -135,10 +137,10 @@ def get_upstream(git_dir, branch):
-     """
-     try:
-         remote = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                       'branch.%s.remote' % branch)
-+                                         'branch.%s.remote' % branch)
-         merge = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                      'branch.%s.merge' % branch)
--    except:
-+                                        'branch.%s.merge' % branch)
-+    except Exception:
-         upstream, msg = guess_upstream(git_dir, branch)
-         return upstream, msg
- 
-@@ -149,7 +151,8 @@ def get_upstream(git_dir, branch):
-         return '%s/%s' % (remote, leaf), None
-     else:
-         raise ValueError("Cannot determine upstream branch for branch "
--                "'%s' remote='%s', merge='%s'" % (branch, remote, merge))
-+                         "'%s' remote='%s', merge='%s'"
-+                         % (branch, remote, merge))
- 
- 
- def get_range_in_branch(git_dir, branch, include_upstream=False):
-@@ -168,6 +171,7 @@ def get_range_in_branch(git_dir, branch, include_upstream=False):
-     rstr = '%s%s..%s' % (upstream, '~' if include_upstream else '', branch)
-     return rstr, msg
- 
-+
- def count_commits_in_range(git_dir, range_expr):
-     """Returns the number of commits in the given range.
- 
-@@ -180,12 +184,13 @@ def count_commits_in_range(git_dir, range_expr):
-     """
-     pipe = [log_cmd(range_expr, git_dir=git_dir, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Range '%s' not found or is invalid" % range_expr
-     patch_count = len(result.stdout.splitlines())
-     return patch_count, None
- 
-+
- def count_commits_in_branch(git_dir, branch, include_upstream=False):
-     """Returns the number of commits in the given branch.
- 
-@@ -201,6 +206,7 @@ def count_commits_in_branch(git_dir, branch, include_upstream=False):
-         return None, msg
-     return count_commits_in_range(git_dir, range_expr)
- 
-+
- def count_commits(commit_range):
-     """Returns the number of commits in the given range.
- 
-@@ -215,6 +221,7 @@ def count_commits(commit_range):
-     patch_count = int(stdout)
-     return patch_count
- 
-+
- def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-     """Checkout the selected commit for this build
- 
-@@ -231,10 +238,11 @@ def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-         pipe.append('-f')
-     pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, raise_on_error=False,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git checkout (%s): %s' % (pipe, result.stderr))
- 
-+
- def clone(git_dir, output_dir):
-     """Checkout the selected commit for this build
- 
-@@ -243,10 +251,11 @@ def clone(git_dir, output_dir):
-     """
-     pipe = ['git', 'clone', git_dir, '.']
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git clone: %s' % result.stderr)
- 
-+
- def fetch(git_dir=None, work_tree=None):
-     """Fetch from the origin repo
- 
-@@ -263,6 +272,7 @@ def fetch(git_dir=None, work_tree=None):
-     if result.return_code != 0:
-         raise OSError('git fetch: %s' % result.stderr)
- 
-+
- def check_worktree_is_available(git_dir):
-     """Check if git-worktree functionality is available
- 
-@@ -274,9 +284,10 @@ def check_worktree_is_available(git_dir):
-     """
-     pipe = ['git', '--git-dir', git_dir, 'worktree', 'list']
-     result = command.run_pipe([pipe], capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     return result.return_code == 0
- 
-+
- def add_worktree(git_dir, output_dir, commit_hash=None):
-     """Create and checkout a new git worktree for this build
- 
-@@ -290,10 +301,11 @@ def add_worktree(git_dir, output_dir, commit_hash=None):
-     if commit_hash:
-         pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git worktree add: %s' % result.stderr)
- 
-+
- def prune_worktrees(git_dir):
-     """Remove administrative files for deleted worktrees
- 
-@@ -305,7 +317,8 @@ def prune_worktrees(git_dir):
-     if result.return_code != 0:
-         raise OSError('git worktree prune: %s' % result.stderr)
- 
--def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-+
-+def create_patches(branch, start, count, ignore_binary, series, signoff=True):
-     """Create a series of patches from the top of the current branch.
- 
-     The patch files are written to the current directory using
-@@ -321,9 +334,7 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-         Filename of cover letter (None if none)
-         List of filenames of patch files
-     """
--    if series.get('version'):
--        version = '%s ' % series['version']
--    cmd = ['git', 'format-patch', '-M' ]
-+    cmd = ['git', 'format-patch', '-M']
-     if signoff:
-         cmd.append('--signoff')
-     if ignore_binary:
-@@ -341,9 +352,10 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
- 
-     # We have an extra file if there is a cover letter
-     if series.get('cover'):
--       return files[0], files[1:]
-+        return files[0], files[1:]
-     else:
--       return None, files
-+        return None, files
-+
- 
- def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-     """Build a list of email addresses based on an input list.
-@@ -385,40 +397,43 @@ def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-         raw += lookup_email(item, alias, warn_on_error=warn_on_error)
-     result = []
-     for item in raw:
--        if not item in result:
-+        if item not in result:
-             result.append(item)
-     if tag:
-         return ['%s %s%s%s' % (tag, quote, email, quote) for email in result]
-     return result
- 
-+
- def check_suppress_cc_config():
-     """Check if sendemail.suppresscc is configured correctly.
- 
-     Returns:
-         True if the option is configured correctly, False otherwise.
-     """
--    suppresscc = command.output_one_line('git', 'config', 'sendemail.suppresscc',
--                                       raise_on_error=False)
-+    suppresscc = command.output_one_line(
-+        'git', 'config', 'sendemail.suppresscc', raise_on_error=False)
- 
-     # Other settings should be fine.
-     if suppresscc == 'all' or suppresscc == 'cccmd':
-         col = terminal.Color()
- 
-         print((col.build(col.RED, "error") +
--            ": git config sendemail.suppresscc set to %s\n"  % (suppresscc)) +
--            "  patman needs --cc-cmd to be run to set the cc list.\n" +
--            "  Please run:\n" +
--            "    git config --unset sendemail.suppresscc\n" +
--            "  Or read the man page:\n" +
--            "    git send-email --help\n" +
--            "  and set an option that runs --cc-cmd\n")
-+               ": git config sendemail.suppresscc set to %s\n"
-+               % (suppresscc)) +
-+              "  patman needs --cc-cmd to be run to set the cc list.\n" +
-+              "  Please run:\n" +
-+              "    git config --unset sendemail.suppresscc\n" +
-+              "  Or read the man page:\n" +
-+              "    git send-email --help\n" +
-+              "  and set an option that runs --cc-cmd\n")
-         return False
- 
-     return True
- 
-+
- def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
--        self_only=False, alias=None, in_reply_to=None, thread=False,
--        smtp_server=None):
-+                  self_only=False, alias=None, in_reply_to=None, thread=False,
-+                  smtp_server=None, get_maintainer_script=None):
-     """Email a patch series.
- 
-     Args:
-@@ -435,6 +450,7 @@ def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
-         thread: True to add --thread to git send-email (make
-             all patches reply to cover-letter or first patch in series)
-         smtp_server: SMTP server to use to send patches
-+        get_maintainer_script: File name of script to get maintainers emails
- 
-     Returns:
-         Git command that was/would be run
-@@ -487,9 +503,10 @@ send --cc-cmd cc-fname" cover p1 p2'
-                   "git config sendemail.to u-boot@lists.denx.de")
-             return
-     cc = build_email_list(list(set(series.get('cc')) - set(series.get('to'))),
--                        '--cc', alias, warn_on_error)
-+                          '--cc', alias, warn_on_error)
-     if self_only:
--        to = build_email_list([os.getenv('USER')], '--to', alias, warn_on_error)
-+        to = build_email_list([os.getenv('USER')], '--to',
-+                              alias, warn_on_error)
-         cc = []
-     cmd = ['git', 'send-email', '--annotate']
-     if smtp_server:
-@@ -565,7 +582,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-     if not alias:
-         alias = settings.alias
-     lookup_name = lookup_name.strip()
--    if '@' in lookup_name: # Perhaps a real email address
-+    if '@' in lookup_name:      # Perhaps a real email address
-         return [lookup_name]
- 
-     lookup_name = lookup_name.lower()
-@@ -581,7 +598,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-             return out_list
- 
-     if lookup_name:
--        if not lookup_name in alias:
-+        if lookup_name not in alias:
-             msg = "Alias '%s' not found" % lookup_name
-             if warn_on_error:
-                 print(col.build(col.RED, msg))
-@@ -589,11 +606,12 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-         for item in alias[lookup_name]:
-             todo = lookup_email(item, alias, warn_on_error, level + 1)
-             for new_item in todo:
--                if not new_item in out_list:
-+                if new_item not in out_list:
-                     out_list.append(new_item)
- 
-     return out_list
- 
-+
- def get_top_level():
-     """Return name of top-level directory for this git repo.
- 
-@@ -608,6 +626,7 @@ def get_top_level():
-     """
-     return command.output_one_line('git', 'rev-parse', '--show-toplevel')
- 
-+
- def get_alias_file():
-     """Gets the name of the git alias file.
- 
-@@ -615,7 +634,7 @@ def get_alias_file():
-         Filename of git alias file, or None if none
-     """
-     fname = command.output_one_line('git', 'config', 'sendemail.aliasesfile',
--            raise_on_error=False)
-+                                    raise_on_error=False)
-     if not fname:
-         return None
- 
-@@ -625,6 +644,7 @@ def get_alias_file():
- 
-     return os.path.join(get_top_level(), fname)
- 
-+
- def get_default_user_name():
-     """Gets the user.name from .gitconfig file.
- 
-@@ -634,6 +654,7 @@ def get_default_user_name():
-     uname = command.output_one_line('git', 'config', '--global', 'user.name')
-     return uname
- 
-+
- def get_default_user_email():
-     """Gets the user.email from the global .gitconfig file.
- 
-@@ -643,17 +664,19 @@ def get_default_user_email():
-     uemail = command.output_one_line('git', 'config', '--global', 'user.email')
-     return uemail
- 
-+
- def get_default_subject_prefix():
-     """Gets the format.subjectprefix from local .git/config file.
- 
-     Returns:
-         Subject prefix found in local .git/config file, or None if none
-     """
--    sub_prefix = command.output_one_line('git', 'config', 'format.subjectprefix',
--                 raise_on_error=False)
-+    sub_prefix = command.output_one_line(
-+        'git', 'config', 'format.subjectprefix', raise_on_error=False)
- 
-     return sub_prefix
- 
-+
- def setup():
-     """Set up git utils, by reading the alias files."""
-     # Check for a git alias file also
-@@ -666,6 +689,7 @@ def setup():
-     use_no_decorate = (command.run_pipe([cmd], raise_on_error=False)
-                        .return_code == 0)
- 
-+
- def get_head():
-     """Get the hash of the current HEAD
- 
-@@ -674,6 +698,7 @@ def get_head():
-     """
-     return command.output_one_line('git', 'show', '-s', '--pretty=format:%H')
- 
-+
- if __name__ == "__main__":
-     import doctest
- 
-diff --git a/tools/patman/patman b/tools/patman/patman
-index 11a5d8e18a..5a427d1942 120000
---- a/tools/patman/patman
-+++ b/tools/patman/patman
-@@ -1 +1 @@
--main.py
-\ No newline at end of file
-+__main__.py
-\ No newline at end of file
-diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst
-index 8c5c9cc2cc..6113962fb4 100644
---- a/tools/patman/patman.rst
-+++ b/tools/patman/patman.rst
-@@ -1,6 +1,7 @@
- .. SPDX-License-Identifier: GPL-2.0+
- .. Copyright (c) 2011 The Chromium OS Authors
- .. Simon Glass <sjg@chromium.org>
-+.. Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- .. v1, v2, 19-Oct-11
- .. revised v3 24-Nov-11
- .. revised v4 Independence Day 2020, with Patchwork integration
-@@ -68,13 +69,28 @@ this once::
- 
-     git config sendemail.aliasesfile doc/git-mailrc
- 
--For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles figuring
--out where to send patches pretty well.
-+For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles
-+figuring out where to send patches pretty well. For other projects,
-+you may want to specify a different script to be run, for example via
-+a project-specific `.patman` file::
-+
-+    # .patman configuration file at the root of some project
-+
-+    [settings]
-+    get_maintainer_script: etc/teams.scm get-maintainer
-+
-+The `get_maintainer_script` option corresponds to the
-+`--get-maintainer-script` argument of the `send` command.  It is
-+looked relatively to the root of the current git repository, as well
-+as on PATH.  It can also be provided arguments, as shown above.  The
-+contract is that the script should accept a patch file name and return
-+a list of email addresses, one per line, like `get_maintainer.pl`
-+does.
- 
- During the first run patman creates a config file for you by taking the default
- user name and email address from the global .gitconfig file.
- 
--To add your own, create a file ~/.patman like this::
-+To add your own, create a file `~/.patman` like this::
- 
-     # patman alias file
- 
-@@ -85,6 +101,12 @@ To add your own, create a file ~/.patman like this::
-     wolfgang: Wolfgang Denk <wd@denx.de>
-     others: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net>
- 
-+As hinted above, Patman will also look for a `.patman` configuration
-+file at the root of the current project git repository, which makes it
-+possible to override the `project` settings variable or anything else
-+in a project-specific way. The values of this "local" configuration
-+file take precedence over those of the "global" one.
-+
- Aliases are recursive.
- 
- The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
-@@ -680,6 +702,16 @@ them:
- 
-     $ tools/patman/patman test
- 
-+Note that since the test suite depends on data files only available in
-+the git checkout, the `test` command is hidden unless `patman` is
-+invoked from the U-Boot git repository.
-+
-+Alternatively, you can run the test suite via Pytest:
-+
-+.. code-block:: bash
-+
-+    $ cd tools/patman && pytest
-+
- Error handling doesn't always produce friendly error messages - e.g.
- putting an incorrect tag in a commit may provide a confusing message.
- 
-diff --git a/tools/patman/pytest.ini b/tools/patman/pytest.ini
-new file mode 100644
-index 0000000000..df3eb518d0
---- /dev/null
-+++ b/tools/patman/pytest.ini
-@@ -0,0 +1,2 @@
-+[pytest]
-+addopts = --doctest-modules
-diff --git a/tools/patman/series.py b/tools/patman/series.py
-index 3075378ac1..2eeeef71dc 100644
---- a/tools/patman/series.py
-+++ b/tools/patman/series.py
-@@ -235,7 +235,7 @@ class Series(dict):
-             print(col.build(col.RED, str))
- 
-     def MakeCcFile(self, process_tags, cover_fname, warn_on_error,
--                   add_maintainers, limit):
-+                   add_maintainers, limit, get_maintainer_script):
-         """Make a cc file for us to use for per-commit Cc automation
- 
-         Also stores in self._generated_cc to make ShowActions() faster.
-@@ -249,6 +249,8 @@ class Series(dict):
-                 True/False to call the get_maintainers to CC maintainers
-                 List of maintainers to include (for testing)
-             limit: Limit the length of the Cc list (None if no limit)
-+            get_maintainer_script: The file name of the get_maintainer.pl
-+                script (or compatible).
-         Return:
-             Filename of temp file created
-         """
-@@ -267,8 +269,9 @@ class Series(dict):
-             if type(add_maintainers) == type(cc):
-                 cc += add_maintainers
-             elif add_maintainers:
--                dir_list = [os.path.join(gitutil.get_top_level(), 'scripts')]
--                cc += get_maintainer.get_maintainer(dir_list, commit.patch)
-+
-+                cc += get_maintainer.get_maintainer(get_maintainer_script,
-+                                                    commit.patch)
-             for x in set(cc) & set(settings.bounces):
-                 print(col.build(col.YELLOW, 'Skipping "%s"' % x))
-             cc = list(set(cc) - set(settings.bounces))
-diff --git a/tools/patman/settings.py b/tools/patman/settings.py
-index 903d6fcb0b..636983e32d 100644
---- a/tools/patman/settings.py
-+++ b/tools/patman/settings.py
-@@ -1,18 +1,18 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2011 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- try:
-     import configparser as ConfigParser
--except:
-+except Exception:
-     import ConfigParser
- 
- import argparse
- import os
- import re
- 
--from patman import command
--from patman import tools
-+from patman import gitutil
- 
- """Default settings per-project.
- 
-@@ -32,7 +32,8 @@ _default_settings = {
-     },
- }
- 
--class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-+
-+class _ProjectConfigParser(ConfigParser.ConfigParser):
-     """ConfigParser that handles projects.
- 
-     There are two main goals of this class:
-@@ -83,14 +84,14 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-     def __init__(self, project_name):
-         """Construct _ProjectConfigParser.
- 
--        In addition to standard SafeConfigParser initialization, this also loads
--        project defaults.
-+        In addition to standard ConfigParser initialization, this also
-+        loads project defaults.
- 
-         Args:
-             project_name: The name of the project.
-         """
-         self._project_name = project_name
--        ConfigParser.SafeConfigParser.__init__(self)
-+        ConfigParser.ConfigParser.__init__(self)
- 
-         # Update the project settings in the config based on
-         # the _default_settings global.
-@@ -102,31 +103,31 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-             self.set(project_settings, setting_name, setting_value)
- 
-     def get(self, section, option, *args, **kwargs):
--        """Extend SafeConfigParser to try project_section before section.
-+        """Extend ConfigParser to try project_section before section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         try:
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, "%s_%s" % (self._project_name, section), option,
-                 *args, **kwargs
-             )
-         except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, section, option, *args, **kwargs
-             )
-         return val
- 
-     def items(self, section, *args, **kwargs):
--        """Extend SafeConfigParser to add project_section to section.
-+        """Extend ConfigParser to add project_section to section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         project_items = []
-         has_project_section = False
-@@ -134,7 +135,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get items from the project section
-         try:
--            project_items = ConfigParser.SafeConfigParser.items(
-+            project_items = ConfigParser.ConfigParser.items(
-                 self, "%s_%s" % (self._project_name, section), *args, **kwargs
-             )
-             has_project_section = True
-@@ -143,7 +144,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get top-level items
-         try:
--            top_items = ConfigParser.SafeConfigParser.items(
-+            top_items = ConfigParser.ConfigParser.items(
-                 self, section, *args, **kwargs
-             )
-         except ConfigParser.NoSectionError:
-@@ -155,6 +156,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-         item_dict.update(project_items)
-         return {(item, val) for item, val in item_dict.items()}
- 
-+
- def ReadGitAliases(fname):
-     """Read a git alias file. This is in the form used by git:
- 
-@@ -170,7 +172,7 @@ def ReadGitAliases(fname):
-         print("Warning: Cannot find alias file '%s'" % fname)
-         return
- 
--    re_line = re.compile('alias\s+(\S+)\s+(.*)')
-+    re_line = re.compile(r'alias\s+(\S+)\s+(.*)')
-     for line in fd.readlines():
-         line = line.strip()
-         if not line or line[0] == '#':
-@@ -190,7 +192,8 @@ def ReadGitAliases(fname):
- 
-     fd.close()
- 
--def CreatePatmanConfigFile(gitutil, config_fname):
-+
-+def CreatePatmanConfigFile(config_fname):
-     """Creates a config file under $(HOME)/.patman if it can't find one.
- 
-     Args:
-@@ -200,12 +203,12 @@ def CreatePatmanConfigFile(gitutil, config_fname):
-         None
-     """
-     name = gitutil.get_default_user_name()
--    if name == None:
-+    if name is None:
-         name = input("Enter name: ")
- 
-     email = gitutil.get_default_user_email()
- 
--    if email == None:
-+    if email is None:
-         email = input("Enter email: ")
- 
-     try:
-@@ -220,7 +223,8 @@ me: %s <%s>
- [bounces]
- nxp = Zhikang Zhang <zhikang.zhang@nxp.com>
- ''' % (name, email), file=f)
--    f.close();
-+    f.close()
-+
- 
- def _UpdateDefaults(main_parser, config):
-     """Update the given OptionParser defaults based on config.
-@@ -242,8 +246,8 @@ def _UpdateDefaults(main_parser, config):
-     # Find all the parsers and subparsers
-     parsers = [main_parser]
-     parsers += [subparser for action in main_parser._actions
--                  if isinstance(action, argparse._SubParsersAction)
--                  for _, subparser in action.choices.items()]
-+                if isinstance(action, argparse._SubParsersAction)
-+                for _, subparser in action.choices.items()]
- 
-     # Collect the defaults from each parser
-     defaults = {}
-@@ -270,8 +274,9 @@ def _UpdateDefaults(main_parser, config):
-     # Set all the defaults and manually propagate them to subparsers
-     main_parser.set_defaults(**defaults)
-     for parser, pdefs in zip(parsers, parser_defaults):
--        parser.set_defaults(**{ k: v for k, v in defaults.items()
--                                    if k in pdefs })
-+        parser.set_defaults(**{k: v for k, v in defaults.items()
-+                               if k in pdefs})
-+
- 
- def _ReadAliasFile(fname):
-     """Read in the U-Boot git alias file if it exists.
-@@ -298,6 +303,7 @@ def _ReadAliasFile(fname):
-         if bad_line:
-             print(bad_line)
- 
-+
- def _ReadBouncesFile(fname):
-     """Read in the bounces file if it exists
- 
-@@ -311,6 +317,7 @@ def _ReadBouncesFile(fname):
-                     continue
-                 bounces.add(line.strip())
- 
-+
- def GetItems(config, section):
-     """Get the items from a section of the config.
- 
-@@ -323,31 +330,50 @@ def GetItems(config, section):
-     """
-     try:
-         return config.items(section)
--    except ConfigParser.NoSectionError as e:
-+    except ConfigParser.NoSectionError:
-         return []
--    except:
--        raise
- 
--def Setup(gitutil, parser, project_name, config_fname=''):
-+
-+def Setup(parser, project_name, config_fname=None):
-     """Set up the settings module by reading config files.
- 
-+    Unless `config_fname` is specified, a `.patman` config file local
-+    to the git repository is consulted, followed by the global
-+    `$HOME/.patman`. If none exists, the later is created. Values
-+    defined in the local config file take precedence over those
-+    defined in the global one.
-+
-     Args:
--        parser:         The parser to update
-+        parser:         The parser to update.
-         project_name:   Name of project that we're working on; we'll look
-             for sections named "project_section" as well.
--        config_fname:   Config filename to read ('' for default)
-+        config_fname:   Config filename to read.  An error is raised if it
-+            does not exist.
-     """
-     # First read the git alias file if available
-     _ReadAliasFile('doc/git-mailrc')
-     config = _ProjectConfigParser(project_name)
--    if config_fname == '':
-+
-+    if config_fname and not os.path.exists(config_fname):
-+        raise Exception(f'provided {config_fname} does not exist')
-+
-+    if not config_fname:
-         config_fname = '%s/.patman' % os.getenv('HOME')
-+    has_config = os.path.exists(config_fname)
-+
-+    git_local_config_fname = os.path.join(gitutil.get_top_level(), '.patman')
-+    has_git_local_config = os.path.exists(git_local_config_fname)
- 
--    if not os.path.exists(config_fname):
--        print("No config file found ~/.patman\nCreating one...\n")
--        CreatePatmanConfigFile(gitutil, config_fname)
-+    # Read the git local config last, so that its values override
-+    # those of the global config, if any.
-+    if has_config:
-+        config.read(config_fname)
-+    if has_git_local_config:
-+        config.read(git_local_config_fname)
- 
--    config.read(config_fname)
-+    if not (has_config or has_git_local_config):
-+        print("No config file found.\nCreating ~/.patman...\n")
-+        CreatePatmanConfigFile(config_fname)
- 
-     for name, value in GetItems(config, 'alias'):
-         alias[name] = value.split(',')
-@@ -358,6 +384,7 @@ def Setup(gitutil, parser, project_name, config_fname=''):
- 
-     _UpdateDefaults(parser, config)
- 
-+
- # These are the aliases we understand, indexed by alias. Each member is a list.
- alias = {}
- bounces = set()
-diff --git a/tools/patman/setup.py b/tools/patman/setup.py
-index 5643bf1503..2ff791da0f 100644
---- a/tools/patman/setup.py
-+++ b/tools/patman/setup.py
-@@ -7,6 +7,6 @@ setup(name='patman',
-       scripts=['patman'],
-       packages=['patman'],
-       package_dir={'patman': ''},
--      package_data={'patman': ['README']},
-+      package_data={'patman': ['README.rst']},
-       classifiers=['Environment :: Console',
-                    'Topic :: Software Development'])
-diff --git a/tools/patman/test_settings.py b/tools/patman/test_settings.py
-new file mode 100644
-index 0000000000..c768a2fc64
---- /dev/null
-+++ b/tools/patman/test_settings.py
-@@ -0,0 +1,67 @@
-+# SPDX-License-Identifier: GPL-2.0+
-+#
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
-+#
-+
-+import argparse
-+import contextlib
-+import os
-+import sys
-+import tempfile
-+
-+from patman import settings
-+from patman import tools
-+
-+
-+@contextlib.contextmanager
-+def empty_git_repository():
-+    with tempfile.TemporaryDirectory() as tmpdir:
-+        os.chdir(tmpdir)
-+        tools.run('git', 'init', raise_on_error=True)
-+        yield tmpdir
-+
-+
-+@contextlib.contextmanager
-+def cleared_command_line_args():
-+    old_value = sys.argv[:]
-+    sys.argv = [sys.argv[0]]
-+    try:
-+        yield
-+    finally:
-+        sys.argv = old_value
-+
-+
-+def test_git_local_config():
-+    # Clearing the command line arguments is required, otherwise
-+    # arguments passed to the test running such as in 'pytest -k
-+    # filter' would be processed by _UpdateDefaults and fail.
-+    with cleared_command_line_args():
-+        with empty_git_repository():
-+            with tempfile.NamedTemporaryFile() as global_config:
-+                global_config.write(b'[settings]\n'
-+                                    b'project=u-boot\n')
-+                global_config.flush()
-+                parser = argparse.ArgumentParser()
-+                parser.add_argument('-p', '--project', default='unknown')
-+                subparsers = parser.add_subparsers(dest='cmd')
-+                send = subparsers.add_parser('send')
-+                send.add_argument('--no-check', action='store_false',
-+                                  dest='check_patch', default=True)
-+
-+                # Test "global" config is used.
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'u-boot'
-+                send_args, _ = send.parse_known_args([])
-+                assert send_args.check_patch
-+
-+                # Test local config can shadow it.
-+                with open('.patman', 'w', buffering=1) as f:
-+                    f.write('[settings]\n'
-+                            'project: guix-patches\n'
-+                            'check_patch: False\n')
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'guix-patches'
-+                send_args, _ = send.parse_known_args([])
-+                assert not send_args.check_patch
diff --git a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
index a5b92e3e8f..858f42efe7 100644
--- a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
+++ b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
@@ -5,12 +5,12 @@ Index: u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
 ===================================================================
 --- u-boot-2021.07~rc4+dfsg.orig/include/configs/sifive-unmatched.h
 +++ u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
-@@ -62,6 +62,8 @@
+@@ -55,6 +55,8 @@
  	"name=system,size=-,bootable,type=${type_guid_gpt_system};"
  
- #define CONFIG_EXTRA_ENV_SETTINGS \
+ #define CFG_EXTRA_ENV_SETTINGS \
 +	"fdt_high=0xffffffffffffffff\0" \
 +	"initrd_high=0xffffffffffffffff\0" \
  	"kernel_addr_r=0x84000000\0" \
- 	"fdt_addr_r=0x88000000\0" \
- 	"scriptaddr=0x88100000\0" \
+ 	"kernel_comp_addr_r=0x88000000\0" \
+ 	"kernel_comp_size=0x4000000\0" \
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 3/6] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts.
  2023-07-12 14:52   ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 vagrant
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 2/6] gnu: u-boot: Update to 2023.07.02 vagrant
@ 2023-07-12 14:52     ` vagrant
  2023-07-15  2:46       ` Maxim Cournoyer
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 4/6] gnu: Add python-u-boot-pylib vagrant
                       ` (3 subsequent siblings)
  5 siblings, 1 reply; 46+ messages in thread
From: vagrant @ 2023-07-12 14:52 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Vagrant Cascadian <vagrant@debian.org>

* gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package): Take argument
  for System Control Processor (SCP) firmware.
  [native-inputs]: Add SCP firmware.
  [phases]: Adjust 'set-environment to also set SCP variable.
  (u-boot-pine64-plus, u-boot-pine64-lts, u-boot-pinebook): Pass appropriate
  crust firmware as the SCP firmware.
---
 gnu/packages/bootloaders.scm | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index d1633b2b70..afea47b457 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1009,7 +1009,7 @@ (define-public u-boot-am335x-boneblack
 (define-public u-boot-am335x-evm
   (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"))
 
-(define*-public (make-u-boot-sunxi64-package board triplet
+(define*-public (make-u-boot-sunxi64-package board triplet scpfirmware
                                              #:key defconfig configs)
   (let ((base (make-u-boot-package
                board triplet #:defconfig defconfig #:configs configs)))
@@ -1021,22 +1021,24 @@ (define*-public (make-u-boot-sunxi64-package board triplet
           #~(modify-phases #$phases
               (add-after 'unpack 'set-environment
                 (lambda* (#:key native-inputs inputs #:allow-other-keys)
-                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
-                  (setenv "SCP" "/dev/null")
+                  (setenv "SCP" (search-input-file native-inputs "libexec/scp.bin"))
                   (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
+      (native-inputs
+       (modify-inputs (package-native-inputs base)
+         (append scpfirmware)))
       (inputs
        (modify-inputs (package-inputs base)
          (append arm-trusted-firmware-sun50i-a64))))))
 
 (define-public u-boot-pine64-plus
-  (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
+  (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu" crust-pine64-plus))
 
 (define-public u-boot-pine64-lts
-  (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu"))
+  (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu" crust-pine64-plus))
 
 (define-public u-boot-pinebook
   (make-u-boot-sunxi64-package
-   "pinebook" "aarch64-linux-gnu"
+   "pinebook" "aarch64-linux-gnu" crust-pinebook
    ;; Fix regression with LCD video output introduced in 2020.01
    ;; https://patchwork.ozlabs.org/patch/1225130/
    #:configs '("CONFIG_VIDEO_BPP32=y")))
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 4/6] gnu: Add python-u-boot-pylib.
  2023-07-12 14:52   ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 vagrant
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 2/6] gnu: u-boot: Update to 2023.07.02 vagrant
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 3/6] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts vagrant
@ 2023-07-12 14:52     ` vagrant
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 5/6] gnu: patman: Add python-u-boot-pylib to inputs vagrant
                       ` (2 subsequent siblings)
  5 siblings, 0 replies; 46+ messages in thread
From: vagrant @ 2023-07-12 14:52 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Maxim Cournoyer <maxim.cournoyer@gmail.com>

* gnu/packages/bootloaders.scm (python-u-boot-pylib): New variable.
* gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/bootloaders.scm                  | 23 +++++++++++++++++-
 .../patches/u-boot-fix-u-boot-lib-build.patch | 24 +++++++++++++++++++
 3 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 0e0087b6aa..151f38c60f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1999,6 +1999,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
+  %D%/packages/patches/u-boot-fix-u-boot-lib-build.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index afea47b457..704d607b79 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -655,7 +655,8 @@ (define u-boot
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
                      %u-boot-rk3399-enable-emmc-phy-patch
-                     (search-patch "u-boot-fix-build-python-3.10.patch")))
+                     (search-patch "u-boot-fix-build-python-3.10.patch")
+                     (search-patch "u-boot-fix-u-boot-lib-build.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
@@ -840,6 +841,26 @@ (define-public u-boot-tools
                   "  This package provides board-independent tools "
                   "of U-Boot."))))
 
+(define-public python-u-boot-pylib
+  (package
+    (inherit u-boot)
+    (name "python-u-boot-pylib")
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _
+              (chdir "tools/u_boot_pylib")))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "./u_boot_pylib")))))))
+    (synopsis "U-Boot Python library")
+    (description "This package provides common Python code used by some of the
+commands part of the U-Boot project, such as Patman.")))
+
 ;;; This is packaged separately, as it can be used in other contexts than for
 ;;; U-Boot development.
 (define-public patman
diff --git a/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch b/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch
new file mode 100644
index 0000000000..233c437de6
--- /dev/null
+++ b/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch
@@ -0,0 +1,24 @@
+Submitted upstream (see:
+https://lists.denx.de/pipermail/u-boot/2023-July/521984.html)
+
+diff --git a/tools/u_boot_pylib/pyproject.toml b/tools/u_boot_pylib/pyproject.toml
+index 3f33caf6f8..037c5d629e 100644
+--- a/tools/u_boot_pylib/pyproject.toml
++++ b/tools/u_boot_pylib/pyproject.toml
+@@ -9,7 +9,7 @@ authors = [
+   { name="Simon Glass", email="sjg@chromium.org" },
+ ]
+ description = "U-Boot python library"
+-readme = "README.md"
++readme = "README.rst"
+ requires-python = ">=3.7"
+ classifiers = [
+     "Programming Language :: Python :: 3",
+@@ -20,3 +20,7 @@ classifiers = [
+ [project.urls]
+ "Homepage" = "https://u-boot.readthedocs.io"
+ "Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
++
++[tool.setuptools.packages.find]
++where = [".."]
++include = ["u_boot_pylib*"]
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 5/6] gnu: patman: Add python-u-boot-pylib to inputs.
  2023-07-12 14:52   ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 vagrant
                       ` (2 preceding siblings ...)
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 4/6] gnu: Add python-u-boot-pylib vagrant
@ 2023-07-12 14:52     ` vagrant
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 6/6] (patman)[phases]: Remove 'sanity-check vagrant
  2023-07-15  2:31     ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 Maxim Cournoyer
  5 siblings, 0 replies; 46+ messages in thread
From: vagrant @ 2023-07-12 14:52 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Maxim Cournoyer <maxim.cournoyer@gmail.com>

* gnu/packages/bootloaders.scm (patman) [inputs]: Add python-u-boot-pylib.
---
 gnu/packages/bootloaders.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 704d607b79..f9abef49d6 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -878,7 +878,7 @@ (define-public patman
           (add-after 'unpack 'chdir
             (lambda _
               (chdir "tools/patman"))))))
-    (inputs (list python-pygit2 python-requests))
+    (inputs (list python-pygit2 python-requests python-u-boot-pylib))
     (synopsis "Patch automation tool")
     (description "Patman is a patch automation script which:
 @itemize
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 6/6] (patman)[phases]: Remove 'sanity-check.
  2023-07-12 14:52   ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 vagrant
                       ` (3 preceding siblings ...)
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 5/6] gnu: patman: Add python-u-boot-pylib to inputs vagrant
@ 2023-07-12 14:52     ` vagrant
  2023-07-15  2:51       ` Maxim Cournoyer
  2023-07-15  2:31     ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 Maxim Cournoyer
  5 siblings, 1 reply; 46+ messages in thread
From: vagrant @ 2023-07-12 14:52 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Vagrant Cascadian <vagrant@debian.org>

---
 gnu/packages/bootloaders.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index f9abef49d6..3c1402ae58 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -875,6 +875,9 @@ (define-public patman
       #:tests? #f
       #:phases
       #~(modify-phases %standard-phases
+          ;; Patman fails to run during 'sanity-check phase, as it needs to be
+          ;; run within a git directory.
+          (delete 'sanity-check)
           (add-after 'unpack 'chdir
             (lambda _
               (chdir "tools/patman"))))))
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] Update u-boot to 2023.07.02
  2023-07-12 14:49 ` [bug#64149] [PATCH v3 0/6] Update u-boot to 2023.07.02 Vagrant Cascadian
  2023-07-12 14:52   ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 vagrant
@ 2023-07-13 13:52   ` Vagrant Cascadian
  1 sibling, 0 replies; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-13 13:52 UTC (permalink / raw)
  To: control; +Cc: 64149

[-- Attachment #1: Type: text/plain, Size: 42 bytes --]

retitle 64149 Update u-boot to 2023.07.02

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9.
  2023-07-12 14:52   ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 vagrant
                       ` (4 preceding siblings ...)
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 6/6] (patman)[phases]: Remove 'sanity-check vagrant
@ 2023-07-15  2:31     ` Maxim Cournoyer
  5 siblings, 0 replies; 46+ messages in thread
From: Maxim Cournoyer @ 2023-07-15  2:31 UTC (permalink / raw)
  To: vagrant; +Cc: 64149, ludo, efraim

Hi,

vagrant@debian.org writes:

> From: Vagrant Cascadian <vagrant@debian.org>
>
> * gnu/packages/firmware.scm (make-arm-trusted-firmware): Update to 2.9.
> ---
>  gnu/packages/firmware.scm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
> index 3dcc882e0c..0492dabeed 100644
> --- a/gnu/packages/firmware.scm
> +++ b/gnu/packages/firmware.scm
> @@ -1025,7 +1025,7 @@ (define* (make-arm-trusted-firmware platform
>                                         (gnu-triplet->nix-system triplet))))))
>      (package
>        (name (string-append "arm-trusted-firmware-" platform))
> -      (version "2.8")
> +      (version "2.9")
>        (source
>         (origin
>           (method git-fetch)
> @@ -1036,7 +1036,7 @@ (define* (make-arm-trusted-firmware platform
>           (file-name (git-file-name "arm-trusted-firmware" version))
>           (sha256
>            (base32
> -           "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3"))
> +           "16fjbn1zck0d8b554h8lk1svqqn0zlawvrlkjxry9l71s9h4vd0p"))
>           (snippet
>            #~(begin
>                (use-modules (guix build utils))

This one LGTM.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 2/6] gnu: u-boot: Update to 2023.07.02.
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 2/6] gnu: u-boot: Update to 2023.07.02 vagrant
@ 2023-07-15  2:42       ` Maxim Cournoyer
  2023-07-15  4:51         ` Vagrant Cascadian
  0 siblings, 1 reply; 46+ messages in thread
From: Maxim Cournoyer @ 2023-07-15  2:42 UTC (permalink / raw)
  To: vagrant; +Cc: 64149, ludo, efraim

Hello,

vagrant@debian.org writes:

> From: Vagrant Cascadian <vagrant@debian.org>
>
> * gnu/packages/patches/u-boot-infodocs-target.patch: Delete file.
> * gnu/packages/patches/u-boot-patman-guix-integration.patch: Delete file.
> * gnu/local.mk: De-register patches.
> * gnu/packages/patches/u-boot-allow-disabling-openssl.patch: Refresh.
> * gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch: Refresh.
> * gnu/packages/bootloaders.scm (u-boot): Update to 2023.07.02.
> [native-inputs]: Add python-pyelftools.
> [source]: Remove patches.
> (u-boot-tools)[phases]: Update substitution for python3-coverage.
> Adjust 'patch to catch more openssl incompatibilities.
> Split lines in 'patch phase.
> [native-inputs]: Add python-filelock and python-pytest-xdist.
> (make-u-boot-sunxi64-package): Set SCP environment variable.
> (u-boot-sifive-unleashed): Update to use opensbi.
> (u-boot-puma-rk3399)[inputs]: Add arm-trusted-firmware-rk3399 to
> package-inputs instead of native-inputs.
> (u-boot-rockpro64-rk3399)[phases]: Add 'disable-spl-fit-signature.
> ---
>  gnu/local.mk                                  |    2 -
>  gnu/packages/bootloaders.scm                  |   57 +-
>  .../u-boot-allow-disabling-openssl.patch      |   13 +-
>  .../patches/u-boot-infodocs-target.patch      |   84 --
>  .../u-boot-patman-guix-integration.patch      | 1244 -----------------
>  ...boot-sifive-prevent-reloc-initrd-fdt.patch |    8 +-
>  6 files changed, 56 insertions(+), 1352 deletions(-)
>  delete mode 100644 gnu/packages/patches/u-boot-infodocs-target.patch
>  delete mode 100644 gnu/packages/patches/u-boot-patman-guix-integration.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index c817c9c926..0e0087b6aa 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -1999,8 +1999,6 @@ dist_patch_DATA =						\
>    %D%/packages/patches/twinkle-bcg729.patch			\
>    %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
>    %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
> -  %D%/packages/patches/u-boot-infodocs-target.patch		\
> -  %D%/packages/patches/u-boot-patman-guix-integration.patch	\
>    %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
>    %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
>    %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
> diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
> index 01fd1093ff..d1633b2b70 100644
> --- a/gnu/packages/bootloaders.scm
> +++ b/gnu/packages/bootloaders.scm
> @@ -648,23 +648,21 @@ (define %u-boot-rk3399-enable-emmc-phy-patch
>  (define u-boot
>    (package
>      (name "u-boot")
> -    (version "2022.10")
> +    (version "2023.07.02")
>      (source (origin
>                (patches
>                 (list %u-boot-rockchip-inno-usb-patch
>                       %u-boot-allow-disabling-openssl-patch
>                       %u-boot-sifive-prevent-relocating-initrd-fdt
>                       %u-boot-rk3399-enable-emmc-phy-patch
> -                     (search-patch "u-boot-fix-build-python-3.10.patch")
> -                     (search-patch "u-boot-infodocs-target.patch")
> -                     (search-patch "u-boot-patman-guix-integration.patch")))
> +                     (search-patch "u-boot-fix-build-python-3.10.patch")))
>                (method url-fetch)
>                (uri (string-append
>                      "https://ftp.denx.de/pub/u-boot/"
>                      "u-boot-" version ".tar.bz2"))
>                (sha256
>                 (base32
> -                "1y5x8vxdgsqdqlsvq01mn8lmw53fqairkhvhhjx83hjva0m4id2h"))))
> +                "1m91w3fpywllkwm000dqsw3294j0szs1lz6qbgwv1aql3ic4hskb"))))
>      (build-system gnu-build-system)
>      (native-inputs
>       (list bison
> @@ -676,6 +674,7 @@ (define u-boot
>             perl
>             pkg-config                   ;for 'make menuconfig'
>             python
> +           python-pyelftools
>             swig
>             (list util-linux "lib")))
>      (home-page "https://www.denx.de/wiki/U-Boot/")
> @@ -726,7 +725,12 @@ (define-public u-boot-tools
>      (name "u-boot-tools")
>      (native-inputs
>       (modify-inputs (package-native-inputs u-boot)
> -       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
> +       (prepend python-coverage
> +                python-filelock
> +                python-pycryptodomex
> +                python-pytest
> +                python-pytest-xdist

Maybe worth checking: Is pytest invoked with the '-n' (number->string
(parallel-job-count)); otherwise xdist doesn't provide any benefit.

> +                sdl2)))
>      (arguments
>       `(#:make-flags '("HOSTCC=gcc")
>         #:test-target "tcheck"
> @@ -739,7 +743,7 @@ (define-public u-boot-tools
>                 (("/bin/false") (which "false")))
>               (substitute* "tools/dtoc/fdt_util.py"
>                 (("'cc'") "'gcc'"))
> -             (substitute* "tools/patman/test_util.py"
> +             (substitute* "tools/u_boot_pylib/test_util.py"
>                 ;; python3-coverage is simply called coverage in guix.
>                 (("python3-coverage") "coverage")
>  
> @@ -777,7 +781,15 @@ (define-public u-boot-tools
>                             ;; See https://bugs.gnu.org/34717 for
>                             ;; details.
>                             (("CONFIG_FIT_SIGNATURE=y")
> -                            "CONFIG_FIT_SIGNATURE=n\nCONFIG_UT_LIB_ASN1=n\nCONFIG_TOOLS_LIBCRYPTO=n")
> +                            "CONFIG_FIT_SIGNATURE=n
> +CONFIG_UT_LIB_ASN1=n
> +CONFIG_TOOLS_LIBCRYPTO=n")
> +                           ;; Catch instances of implied CONFIG_FIG_SIGNATURE with VPL targets
> +                           (("CONFIG_SANDBOX_VPL=y")
> +                            "CONFIG_SANDBOX_VPL=y
> +CONFIG_FIT_SIGNATURE=n
> +CONFIG_VPL_FIT_SIGNATURE=n
> +CONFIG_TOOLS_LIBCRYPTO=n")

Thanks, this reads better.

>                             ;; This test requires a sound system, which is un-used
>                             ;; in u-boot-tools.
>                             (("CONFIG_SOUND=y") "CONFIG_SOUND=n")))
> @@ -1009,6 +1021,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
>            #~(modify-phases #$phases
>                (add-after 'unpack 'set-environment
>                  (lambda* (#:key native-inputs inputs #:allow-other-keys)
> +                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
> +                  (setenv "SCP" "/dev/null")

I think I've seen this gets added in a later commit.  Any reason why it
can't be added here?

>                    (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
>        (inputs
>         (modify-inputs (package-inputs base)
> @@ -1104,7 +1118,7 @@ (define-public u-boot-puma-rk3399
>                (delete 'strip)
>                (delete 'validate-runpath)))))
>        (inputs
> -       (modify-inputs (package-native-inputs base)
> +       (modify-inputs (package-inputs base)
>           (append arm-trusted-firmware-rk3399))))))
>  
>  (define-public u-boot-qemu-arm
> @@ -1170,7 +1184,20 @@ (define-public u-boot-sandbox
>                  (append sdl2))))))
>  
>  (define-public u-boot-sifive-unleashed
> -  (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu"))
> +  (let ((base (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu")))
> +    (package
> +      (inherit base)
> +      (arguments
> +       (substitute-keyword-arguments (package-arguments base)
> +         ((#:phases phases)
> +          #~(modify-phases #$phases
> +              (add-after 'unpack 'set-environment
> +                (lambda* (#:key inputs #:allow-other-keys)
> +                  (setenv "OPENSBI" (search-input-file inputs
> +                                                       "fw_dynamic.bin"))))))))
> +      (inputs
> +       (modify-inputs (package-inputs base)
> +         (append opensbi-generic))))))
>  
>  (define-public u-boot-sifive-unmatched
>    (let ((base (make-u-boot-package "sifive_unmatched" "riscv64-linux-gnu")))
> @@ -1230,7 +1257,8 @@ (define-public u-boot-rockpro64-rk3399
>                                                 "CONFIG_SATA_SIL=y"
>                                                 "CONFIG_SCSI=y"
>                                                 "CONFIG_SCSI_AHCI=y"
> -                                               "CONFIG_DM_SCSI=y"))))
> +                                               "CONFIG_DM_SCSI=y"
> +                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>      (package
>        (inherit base)
>        (arguments
> @@ -1240,6 +1268,13 @@ (define-public u-boot-rockpro64-rk3399
>                (add-after 'unpack 'set-environment
>                  (lambda* (#:key inputs #:allow-other-keys)
>                    (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
> +              ;; Disable SPL FIT signatures, due to GPLv2 and Openssl license
> +              ;; incompatibilities
> +              (add-after 'unpack 'disable-spl-fit-signature
> +                (lambda _
> +                  (substitute* "configs/rockpro64-rk3399_defconfig"
> +                    (("CONFIG_SPL_FIT_SIGNATURE=y")
> +                     "# CONFIG_SPL_FIT_SIGNATURE is not set"))))

Are you sure this really disables SPL_FIT_SIGNATURE?  The #:configs
arguments goes through 'verify-config', which ensures an unset value
doesn't get pulled as a dependency of other options, if I recall
correctly.

The rest LGTM.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 3/6] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts.
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 3/6] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts vagrant
@ 2023-07-15  2:46       ` Maxim Cournoyer
  0 siblings, 0 replies; 46+ messages in thread
From: Maxim Cournoyer @ 2023-07-15  2:46 UTC (permalink / raw)
  To: vagrant; +Cc: 64149, ludo, efraim

Hi,

vagrant@debian.org writes:

> From: Vagrant Cascadian <vagrant@debian.org>
>
> * gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package): Take argument
>   for System Control Processor (SCP) firmware.
>   [native-inputs]: Add SCP firmware.
>   [phases]: Adjust 'set-environment to also set SCP variable.
>   (u-boot-pine64-plus, u-boot-pine64-lts, u-boot-pinebook): Pass appropriate
>   crust firmware as the SCP firmware.

Nitpick: extraneous hanging indent in ChangeLog-style commit message.

> ---
>  gnu/packages/bootloaders.scm | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
> index d1633b2b70..afea47b457 100644
> --- a/gnu/packages/bootloaders.scm
> +++ b/gnu/packages/bootloaders.scm
> @@ -1009,7 +1009,7 @@ (define-public u-boot-am335x-boneblack
>  (define-public u-boot-am335x-evm
>    (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"))
>  
> -(define*-public (make-u-boot-sunxi64-package board triplet
> +(define*-public (make-u-boot-sunxi64-package board triplet scpfirmware
>                                               #:key defconfig configs)

I'd name the argument 'scp-firmware'.

>    (let ((base (make-u-boot-package
>                 board triplet #:defconfig defconfig #:configs configs)))
> @@ -1021,22 +1021,24 @@ (define*-public (make-u-boot-sunxi64-package board triplet
>            #~(modify-phases #$phases
>                (add-after 'unpack 'set-environment
>                  (lambda* (#:key native-inputs inputs #:allow-other-keys)
> -                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
> -                  (setenv "SCP" "/dev/null")
> +                  (setenv "SCP" (search-input-file native-inputs "libexec/scp.bin"))
>                    (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
> +      (native-inputs
> +       (modify-inputs (package-native-inputs base)
> +         (append scpfirmware)))
>        (inputs
>         (modify-inputs (package-inputs base)
>           (append arm-trusted-firmware-sun50i-a64))))))
>  
>  (define-public u-boot-pine64-plus
> -  (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
> +  (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu" crust-pine64-plus))
>  
>  (define-public u-boot-pine64-lts
> -  (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu"))
> +  (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu" crust-pine64-plus))
>  
>  (define-public u-boot-pinebook
>    (make-u-boot-sunxi64-package
> -   "pinebook" "aarch64-linux-gnu"
> +   "pinebook" "aarch64-linux-gnu" crust-pinebook
>     ;; Fix regression with LCD video output introduced in 2020.01
>     ;; https://patchwork.ozlabs.org/patch/1225130/
>     #:configs '("CONFIG_VIDEO_BPP32=y")))

nitpick: Please break lines touched larger than 80 characters.  The rest
LGTM!

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 6/6] (patman)[phases]: Remove 'sanity-check.
  2023-07-12 14:52     ` [bug#64149] [PATCH v3 6/6] (patman)[phases]: Remove 'sanity-check vagrant
@ 2023-07-15  2:51       ` Maxim Cournoyer
  0 siblings, 0 replies; 46+ messages in thread
From: Maxim Cournoyer @ 2023-07-15  2:51 UTC (permalink / raw)
  To: vagrant; +Cc: 64149, ludo, efraim

Hello,

vagrant@debian.org writes:

> From: Vagrant Cascadian <vagrant@debian.org>
>
> ---
>  gnu/packages/bootloaders.scm | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
> index f9abef49d6..3c1402ae58 100644
> --- a/gnu/packages/bootloaders.scm
> +++ b/gnu/packages/bootloaders.scm
> @@ -875,6 +875,9 @@ (define-public patman
>        #:tests? #f
>        #:phases
>        #~(modify-phases %standard-phases
> +          ;; Patman fails to run during 'sanity-check phase, as it needs to be
> +          ;; run within a git directory.
> +          (delete 'sanity-check)
>            (add-after 'unpack 'chdir
>              (lambda _
>                (chdir "tools/patman"))))))

LGTM.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 2/6] gnu: u-boot: Update to 2023.07.02.
  2023-07-15  2:42       ` Maxim Cournoyer
@ 2023-07-15  4:51         ` Vagrant Cascadian
  2023-07-16  3:04           ` Maxim Cournoyer
  0 siblings, 1 reply; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-15  4:51 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 64149, ludo, efraim

[-- Attachment #1: Type: text/plain, Size: 3513 bytes --]

On 2023-07-14, Maxim Cournoyer wrote:
> vagrant@debian.org writes:
>> @@ -726,7 +725,12 @@ (define-public u-boot-tools
>>      (name "u-boot-tools")
>>      (native-inputs
>>       (modify-inputs (package-native-inputs u-boot)
>> -       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
>> +       (prepend python-coverage
>> +                python-filelock
>> +                python-pycryptodomex
>> +                python-pytest
>> +                python-pytest-xdist
>
> Maybe worth checking: Is pytest invoked with the '-n' (number->string
> (parallel-job-count)); otherwise xdist doesn't provide any benefit.

Whether it is actually used is or not is one thing... but as
implemented, it fails to build without it... :)


>>                             ;; This test requires a sound system, which is un-used
>>                             ;; in u-boot-tools.
>>                             (("CONFIG_SOUND=y") "CONFIG_SOUND=n")))
>> @@ -1009,6 +1021,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
>>            #~(modify-phases #$phases
>>                (add-after 'unpack 'set-environment
>>                  (lambda* (#:key native-inputs inputs #:allow-other-keys)
>> +                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
>> +                  (setenv "SCP" "/dev/null")
>
> I think I've seen this gets added in a later commit.  Any reason why it
> can't be added here?

Sure, the later commit coud be squashed into this one if desired. The
initial patch was implemented before crust-firmware-* was merged, and so
this initial workaround was necessary...


>> @@ -1230,7 +1257,8 @@ (define-public u-boot-rockpro64-rk3399
>>                                                 "CONFIG_SATA_SIL=y"
>>                                                 "CONFIG_SCSI=y"
>>                                                 "CONFIG_SCSI_AHCI=y"
>> -                                               "CONFIG_DM_SCSI=y"))))
>> +                                               "CONFIG_DM_SCSI=y"
>> +                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>>      (package
>>        (inherit base)
>>        (arguments
>> @@ -1240,6 +1268,13 @@ (define-public u-boot-rockpro64-rk3399
>>                (add-after 'unpack 'set-environment
>>                  (lambda* (#:key inputs #:allow-other-keys)
>>                    (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
>> +              ;; Disable SPL FIT signatures, due to GPLv2 and Openssl license
>> +              ;; incompatibilities
>> +              (add-after 'unpack 'disable-spl-fit-signature
>> +                (lambda _
>> +                  (substitute* "configs/rockpro64-rk3399_defconfig"
>> +                    (("CONFIG_SPL_FIT_SIGNATURE=y")
>> +                     "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>
> Are you sure this really disables SPL_FIT_SIGNATURE?  The #:configs
> arguments goes through 'verify-config', which ensures an unset value
> doesn't get pulled as a dependency of other options, if I recall
> correctly.

Without this, it spits out a nasty error, I think because
CONFIG_SPL_FIT_SIGNATURE is effectively defined multiple times
(e.g. "=y" in the defconfig, and "# ... is not set" in the additional
guix options?) and maybe verify-config fails in that situation?  Sorry I
don't have the error handy, but it was easy enough to trigger by
dropping the 'disable-spl-fit-signature phase.


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 2/6] gnu: u-boot: Update to 2023.07.02.
  2023-07-15  4:51         ` Vagrant Cascadian
@ 2023-07-16  3:04           ` Maxim Cournoyer
  2023-07-16  4:04             ` Vagrant Cascadian
  0 siblings, 1 reply; 46+ messages in thread
From: Maxim Cournoyer @ 2023-07-16  3:04 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 64149, ludo, efraim

Hi,

Vagrant Cascadian <vagrant@debian.org> writes:

> On 2023-07-14, Maxim Cournoyer wrote:
>> vagrant@debian.org writes:
>>> @@ -726,7 +725,12 @@ (define-public u-boot-tools
>>>      (name "u-boot-tools")
>>>      (native-inputs
>>>       (modify-inputs (package-native-inputs u-boot)
>>> -       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
>>> +       (prepend python-coverage
>>> +                python-filelock
>>> +                python-pycryptodomex
>>> +                python-pytest
>>> +                python-pytest-xdist
>>
>> Maybe worth checking: Is pytest invoked with the '-n' (number->string
>> (parallel-job-count)); otherwise xdist doesn't provide any benefit.
>
> Whether it is actually used is or not is one thing... but as
> implemented, it fails to build without it... :)

OK :-).

>
>>>                             ;; This test requires a sound system, which is un-used
>>>                             ;; in u-boot-tools.
>>>                             (("CONFIG_SOUND=y") "CONFIG_SOUND=n")))
>>> @@ -1009,6 +1021,8 @@ (define*-public (make-u-boot-sunxi64-package board triplet
>>>            #~(modify-phases #$phases
>>>                (add-after 'unpack 'set-environment
>>>                  (lambda* (#:key native-inputs inputs #:allow-other-keys)
>>> +                  ;; Avoid dependency on crust-firmware https://issues.guix.gnu.org/48371
>>> +                  (setenv "SCP" "/dev/null")
>>
>> I think I've seen this gets added in a later commit.  Any reason why it
>> can't be added here?
>
> Sure, the later commit coud be squashed into this one if desired. The
> initial patch was implemented before crust-firmware-* was merged, and so
> this initial workaround was necessary...

Don't bother; it was a bit weird two things changed in the same series,
but it keeps concerns a bit more separated, so it's fine as is.

>
>>> @@ -1230,7 +1257,8 @@ (define-public u-boot-rockpro64-rk3399
>>>                                                 "CONFIG_SATA_SIL=y"
>>>                                                 "CONFIG_SCSI=y"
>>>                                                 "CONFIG_SCSI_AHCI=y"
>>> -                                               "CONFIG_DM_SCSI=y"))))
>>> +                                               "CONFIG_DM_SCSI=y"
>>> +                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>>>      (package
>>>        (inherit base)
>>>        (arguments
>>> @@ -1240,6 +1268,13 @@ (define-public u-boot-rockpro64-rk3399
>>>                (add-after 'unpack 'set-environment
>>>                  (lambda* (#:key inputs #:allow-other-keys)
>>>                    (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
>>> +              ;; Disable SPL FIT signatures, due to GPLv2 and Openssl license
>>> +              ;; incompatibilities
>>> +              (add-after 'unpack 'disable-spl-fit-signature
>>> +                (lambda _
>>> +                  (substitute* "configs/rockpro64-rk3399_defconfig"
>>> +                    (("CONFIG_SPL_FIT_SIGNATURE=y")
>>> +                     "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>>
>> Are you sure this really disables SPL_FIT_SIGNATURE?  The #:configs
>> arguments goes through 'verify-config', which ensures an unset value
>> doesn't get pulled as a dependency of other options, if I recall
>> correctly.
>
> Without this, it spits out a nasty error, I think because
> CONFIG_SPL_FIT_SIGNATURE is effectively defined multiple times
> (e.g. "=y" in the defconfig, and "# ... is not set" in the additional
> guix options?) and maybe verify-config fails in that situation?  Sorry I
> don't have the error handy, but it was easy enough to trigger by
> dropping the 'disable-spl-fit-signature phase.

Hm.  In my experience this means some other option is pulling in (by
means of kconfig dependency resolution) the CONFIG_SPL_FIT_SIGNATURE
option and would need to also be disabled.  When faced with this problem
I usually end up navigating the 'make menuconfig' kconfig interface and
inspecting dependencies for the option at hand.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v3 2/6] gnu: u-boot: Update to 2023.07.02.
  2023-07-16  3:04           ` Maxim Cournoyer
@ 2023-07-16  4:04             ` Vagrant Cascadian
  0 siblings, 0 replies; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-16  4:04 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 64149, ludo, efraim

[-- Attachment #1: Type: text/plain, Size: 2766 bytes --]

On 2023-07-15, Maxim Cournoyer wrote:
> Vagrant Cascadian <vagrant@debian.org> writes:
>> On 2023-07-14, Maxim Cournoyer wrote:
>>> vagrant@debian.org writes:
>>>> @@ -1230,7 +1257,8 @@ (define-public u-boot-rockpro64-rk3399
>>>>                                                 "CONFIG_SATA_SIL=y"
>>>>                                                 "CONFIG_SCSI=y"
>>>>                                                 "CONFIG_SCSI_AHCI=y"
>>>> -                                               "CONFIG_DM_SCSI=y"))))
>>>> +                                               "CONFIG_DM_SCSI=y"
>>>> +                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>>>>      (package
>>>>        (inherit base)
>>>>        (arguments
>>>> @@ -1240,6 +1268,13 @@ (define-public u-boot-rockpro64-rk3399
>>>>                (add-after 'unpack 'set-environment
>>>>                  (lambda* (#:key inputs #:allow-other-keys)
>>>>                    (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
>>>> +              ;; Disable SPL FIT signatures, due to GPLv2 and Openssl license
>>>> +              ;; incompatibilities
>>>> +              (add-after 'unpack 'disable-spl-fit-signature
>>>> +                (lambda _
>>>> +                  (substitute* "configs/rockpro64-rk3399_defconfig"
>>>> +                    (("CONFIG_SPL_FIT_SIGNATURE=y")
>>>> +                     "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
>>>
>>> Are you sure this really disables SPL_FIT_SIGNATURE?  The #:configs
>>> arguments goes through 'verify-config', which ensures an unset value
>>> doesn't get pulled as a dependency of other options, if I recall
>>> correctly.
>>
>> Without this, it spits out a nasty error, I think because
>> CONFIG_SPL_FIT_SIGNATURE is effectively defined multiple times
>> (e.g. "=y" in the defconfig, and "# ... is not set" in the additional
>> guix options?) and maybe verify-config fails in that situation?  Sorry I
>> don't have the error handy, but it was easy enough to trigger by
>> dropping the 'disable-spl-fit-signature phase.
>
> Hm.  In my experience this means some other option is pulling in (by
> means of kconfig dependency resolution) the CONFIG_SPL_FIT_SIGNATURE
> option and would need to also be disabled.  When faced with this problem
> I usually end up navigating the 'make menuconfig' kconfig interface and
> inspecting dependencies for the option at hand.

Only modifying the config in 'disable-spl-fit-signature works alone, if
I recall correctly, but I left in the the stuff with verify-config to
have an extra safety check. Without adding openssl to one of the inputs,
the build should fail regardless, so maybe only including the
'disable-spl-fit-signature is sufficient.


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v4 0/5] Update U-boot to 2023.07.02.
  2023-06-18  8:49 [bug#64149] WIP update u-boot to 2023.07-rc4 Vagrant Cascadian
  2023-07-03  1:26 ` [bug#64149] WIP update u-boot to 2023.07-rc5 Vagrant Cascadian
  2023-07-12 14:49 ` [bug#64149] [PATCH v3 0/6] Update u-boot to 2023.07.02 Vagrant Cascadian
@ 2023-07-20  1:44 ` vagrant
  2023-07-20  1:44   ` [bug#64149] [PATCH v4 1/5] gnu: arm-trusted-firmware: Update to 2.9 vagrant
                     ` (5 more replies)
  2 siblings, 6 replies; 46+ messages in thread
From: vagrant @ 2023-07-20  1:44 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Vagrant Cascadian <vagrant@debian.org>

I *think* I have resolved all mentioned issues so far.

This series keeps arm-trusted-firmware-imx8mq at 2.8, as it no longer builds.

It turns out using the #:config to disable CONFIG_SPL_FIT_SIGNATURE is working
after all, so only used that one.

Maxim Cournoyer (2):
  gnu: Add python-u-boot-pylib.
  gnu: patman: Add python-u-boot-pylib to inputs.

Vagrant Cascadian (3):
  gnu: arm-trusted-firmware: Update to 2.9.
  gnu: u-boot: Update to 2023.07.02.
  gnu: u-boot: Add crust firmware to pinebook, pine64_plus and
    pine64-lts.

 gnu/local.mk                                  |    3 +-
 gnu/packages/bootloaders.scm                  |   91 +-
 gnu/packages/firmware.scm                     |   20 +-
 .../u-boot-allow-disabling-openssl.patch      |   13 +-
 .../patches/u-boot-fix-u-boot-lib-build.patch |   24 +
 .../patches/u-boot-infodocs-target.patch      |   84 --
 .../u-boot-patman-guix-integration.patch      | 1244 -----------------
 ...boot-sifive-prevent-reloc-initrd-fdt.patch |    8 +-
 8 files changed, 129 insertions(+), 1358 deletions(-)
 create mode 100644 gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch
 delete mode 100644 gnu/packages/patches/u-boot-infodocs-target.patch
 delete mode 100644 gnu/packages/patches/u-boot-patman-guix-integration.patch


base-commit: 283969d0c527aa41e65bb4f5c2a7fa3baf86c49a
-- 
2.39.2





^ permalink raw reply	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v4 1/5] gnu: arm-trusted-firmware: Update to 2.9.
  2023-07-20  1:44 ` [bug#64149] [PATCH v4 0/5] Update U-boot " vagrant
@ 2023-07-20  1:44   ` vagrant
  2023-07-20  1:44   ` [bug#64149] [PATCH v4 2/5] gnu: u-boot: Update to 2023.07.02 vagrant
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 46+ messages in thread
From: vagrant @ 2023-07-20  1:44 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Vagrant Cascadian <vagrant@debian.org>

* gnu/packages/firmware.scm (make-arm-trusted-firmware): Update to 2.9.
(arm-trusted-firmware-imx8mq): Keep at version 2.8.
---
 gnu/packages/firmware.scm | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index d6ce893120..35d3100ac6 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1025,7 +1025,7 @@ (define* (make-arm-trusted-firmware platform
                                        (gnu-triplet->nix-system triplet))))))
     (package
       (name (string-append "arm-trusted-firmware-" platform))
-      (version "2.8")
+      (version "2.9")
       (source
        (origin
          (method git-fetch)
@@ -1036,7 +1036,7 @@ (define* (make-arm-trusted-firmware platform
          (file-name (git-file-name "arm-trusted-firmware" version))
          (sha256
           (base32
-           "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3"))
+           "16fjbn1zck0d8b554h8lk1svqqn0zlawvrlkjxry9l71s9h4vd0p"))
          (snippet
           #~(begin
               (use-modules (guix build utils))
@@ -1104,6 +1104,22 @@ (define-public arm-trusted-firmware-imx8mq
   (let ((base (make-arm-trusted-firmware "imx8mq")))
     (package
       (inherit base)
+      ;; Newer versions do not build and are essentially not supported
+      ;; upstream.
+      ;; XXX: explore using NXP maintained branch
+      ;; https://github.com/nxp-imx/imx-atf
+      (version "2.8")
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               ;; There are only GitHub generated release snapshots.
+               (url "https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/")
+               (commit (string-append "v" version))))
+         (file-name (git-file-name "arm-trusted-firmware" version))
+         (sha256
+          (base32
+           "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3"))))
       (arguments
        (substitute-keyword-arguments (package-arguments base)
          ((#:make-flags flags ''())
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v4 2/5] gnu: u-boot: Update to 2023.07.02.
  2023-07-20  1:44 ` [bug#64149] [PATCH v4 0/5] Update U-boot " vagrant
  2023-07-20  1:44   ` [bug#64149] [PATCH v4 1/5] gnu: arm-trusted-firmware: Update to 2.9 vagrant
@ 2023-07-20  1:44   ` vagrant
  2023-07-20  1:44   ` [bug#64149] [PATCH v4 3/5] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts vagrant
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 46+ messages in thread
From: vagrant @ 2023-07-20  1:44 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Vagrant Cascadian <vagrant@debian.org>

* gnu/packages/patches/u-boot-infodocs-target.patch: Delete file.
* gnu/packages/patches/u-boot-patman-guix-integration.patch: Delete file.
* gnu/local.mk: De-register patches.
* gnu/packages/patches/u-boot-allow-disabling-openssl.patch: Refresh.
* gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch: Refresh.
* gnu/packages/bootloaders.scm (u-boot): Update to 2023.07.02.
[native-inputs]: Add python-pyelftools.
[source]: Remove patches.
(u-boot-tools)[phases]: Update substitution for python3-coverage.
Adjust 'patch to catch more openssl incompatibilities.
Split lines in 'patch phase.
[native-inputs]: Add python-filelock and python-pytest-xdist.
(make-u-boot-sunxi64-package): Set SCP environment variable.
(u-boot-sifive-unleashed): Update to use opensbi.
(u-boot-puma-rk3399)[inputs]: Add arm-trusted-firmware-rk3399 to
package-inputs instead of native-inputs.
(u-boot-rockpro64-rk3399): Disable CONFIG_SPL_FIT_SIGNATURE in config.
---
 gnu/local.mk                                  |    2 -
 gnu/packages/bootloaders.scm                  |   55 +-
 .../u-boot-allow-disabling-openssl.patch      |   13 +-
 .../patches/u-boot-infodocs-target.patch      |   84 --
 .../u-boot-patman-guix-integration.patch      | 1244 -----------------
 ...boot-sifive-prevent-reloc-initrd-fdt.patch |    8 +-
 6 files changed, 54 insertions(+), 1352 deletions(-)
 delete mode 100644 gnu/packages/patches/u-boot-infodocs-target.patch
 delete mode 100644 gnu/packages/patches/u-boot-patman-guix-integration.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index f2ef72c10a..cdce2666e5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2005,8 +2005,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
-  %D%/packages/patches/u-boot-infodocs-target.patch		\
-  %D%/packages/patches/u-boot-patman-guix-integration.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 01fd1093ff..966f1787f8 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -648,23 +648,21 @@ (define %u-boot-rk3399-enable-emmc-phy-patch
 (define u-boot
   (package
     (name "u-boot")
-    (version "2022.10")
+    (version "2023.07.02")
     (source (origin
               (patches
                (list %u-boot-rockchip-inno-usb-patch
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
                      %u-boot-rk3399-enable-emmc-phy-patch
-                     (search-patch "u-boot-fix-build-python-3.10.patch")
-                     (search-patch "u-boot-infodocs-target.patch")
-                     (search-patch "u-boot-patman-guix-integration.patch")))
+                     (search-patch "u-boot-fix-build-python-3.10.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
                     "u-boot-" version ".tar.bz2"))
               (sha256
                (base32
-                "1y5x8vxdgsqdqlsvq01mn8lmw53fqairkhvhhjx83hjva0m4id2h"))))
+                "1m91w3fpywllkwm000dqsw3294j0szs1lz6qbgwv1aql3ic4hskb"))))
     (build-system gnu-build-system)
     (native-inputs
      (list bison
@@ -676,6 +674,7 @@ (define u-boot
            perl
            pkg-config                   ;for 'make menuconfig'
            python
+           python-pyelftools
            swig
            (list util-linux "lib")))
     (home-page "https://www.denx.de/wiki/U-Boot/")
@@ -726,7 +725,12 @@ (define-public u-boot-tools
     (name "u-boot-tools")
     (native-inputs
      (modify-inputs (package-native-inputs u-boot)
-       (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
+       (prepend python-coverage
+                python-filelock
+                python-pycryptodomex
+                python-pytest
+                python-pytest-xdist
+                sdl2)))
     (arguments
      `(#:make-flags '("HOSTCC=gcc")
        #:test-target "tcheck"
@@ -739,7 +743,7 @@ (define-public u-boot-tools
                (("/bin/false") (which "false")))
              (substitute* "tools/dtoc/fdt_util.py"
                (("'cc'") "'gcc'"))
-             (substitute* "tools/patman/test_util.py"
+             (substitute* "tools/u_boot_pylib/test_util.py"
                ;; python3-coverage is simply called coverage in guix.
                (("python3-coverage") "coverage")
 
@@ -777,7 +781,16 @@ (define-public u-boot-tools
                            ;; See https://bugs.gnu.org/34717 for
                            ;; details.
                            (("CONFIG_FIT_SIGNATURE=y")
-                            "CONFIG_FIT_SIGNATURE=n\nCONFIG_UT_LIB_ASN1=n\nCONFIG_TOOLS_LIBCRYPTO=n")
+                            "CONFIG_FIT_SIGNATURE=n
+CONFIG_UT_LIB_ASN1=n
+CONFIG_TOOLS_LIBCRYPTO=n")
+                           ;; Catch instances of implied CONFIG_FIG_SIGNATURE
+                           ;; with VPL targets
+                           (("CONFIG_SANDBOX_VPL=y")
+                            "CONFIG_SANDBOX_VPL=y
+CONFIG_FIT_SIGNATURE=n
+CONFIG_VPL_FIT_SIGNATURE=n
+CONFIG_TOOLS_LIBCRYPTO=n")
                            ;; This test requires a sound system, which is un-used
                            ;; in u-boot-tools.
                            (("CONFIG_SOUND=y") "CONFIG_SOUND=n")))
@@ -1009,6 +1022,9 @@ (define*-public (make-u-boot-sunxi64-package board triplet
           #~(modify-phases #$phases
               (add-after 'unpack 'set-environment
                 (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                  ;; Avoid dependency on crust-firmware
+                  ;; https://issues.guix.gnu.org/48371
+                  (setenv "SCP" "/dev/null")
                   (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
       (inputs
        (modify-inputs (package-inputs base)
@@ -1104,7 +1120,7 @@ (define-public u-boot-puma-rk3399
               (delete 'strip)
               (delete 'validate-runpath)))))
       (inputs
-       (modify-inputs (package-native-inputs base)
+       (modify-inputs (package-inputs base)
          (append arm-trusted-firmware-rk3399))))))
 
 (define-public u-boot-qemu-arm
@@ -1170,7 +1186,20 @@ (define-public u-boot-sandbox
                 (append sdl2))))))
 
 (define-public u-boot-sifive-unleashed
-  (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu"))
+  (let ((base (make-u-boot-package "sifive_unleashed" "riscv64-linux-gnu")))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'set-environment
+                (lambda* (#:key inputs #:allow-other-keys)
+                  (setenv "OPENSBI" (search-input-file inputs
+                                                       "fw_dynamic.bin"))))))))
+      (inputs
+       (modify-inputs (package-inputs base)
+         (append opensbi-generic))))))
 
 (define-public u-boot-sifive-unmatched
   (let ((base (make-u-boot-package "sifive_unmatched" "riscv64-linux-gnu")))
@@ -1230,7 +1259,11 @@ (define-public u-boot-rockpro64-rk3399
                                                "CONFIG_SATA_SIL=y"
                                                "CONFIG_SCSI=y"
                                                "CONFIG_SCSI_AHCI=y"
-                                               "CONFIG_DM_SCSI=y"))))
+                                               "CONFIG_DM_SCSI=y"
+                                               ;; Disable SPL FIT signatures,
+                                               ;; due to GPLv2 and Openssl
+                                               ;; license incompatibilities
+                                               "# CONFIG_SPL_FIT_SIGNATURE is not set"))))
     (package
       (inherit base)
       (arguments
diff --git a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
index 5f2856dbb4..5195a7a6f8 100644
--- a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
+++ b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
@@ -128,29 +128,28 @@ index 94b7685392..eec599b0ee 100644
  	datai = 0;
  	for (cfgi = 0; cfgi < cfgn; cfgi++) {
  		e = &image_cfg[cfgi];
-@@ -1552,9 +1568,11 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
+@@ -1624,10 +1640,12 @@ static void *image_create_v1(size_t *dataoff, struct image_tool_params *params,
  					      &datai, delay);
  	}
  
 +#if defined(CONFIG_KWB_SECURE)
- 	if (secure_hdr && add_secure_header_v1(params, ptr, payloadsz + headersz,
- 					       headersz, image, secure_hdr))
+ 	if (secure_hdr && add_secure_header_v1(params, ptr + *dataoff, payloadsz,
+ 					       image, headersz, secure_hdr))
  		return NULL;
 +#endif
  
- 	*imagesz = headersz;
+ 	/* Calculate and set the header checksum */
+ 	main_hdr->checksum = image_checksum8(main_hdr, headersz);
  
 --- a/tools/image-host.c
 +++ b/tools/image-host.c
-@@ -14,10 +14,12 @@
+@@ -14,8 +14,10 @@
  #include <image.h>
  #include <version.h>
  
 +#ifdef CONFIG_FIT_PRELOAD
  #include <openssl/pem.h>
  #include <openssl/evp.h>
- 
- #define IMAGE_PRE_LOAD_PATH                             "/image/pre-load/sig"
 +#endif
  
  /**
diff --git a/gnu/packages/patches/u-boot-infodocs-target.patch b/gnu/packages/patches/u-boot-infodocs-target.patch
deleted file mode 100644
index 5b21a99de3..0000000000
--- a/gnu/packages/patches/u-boot-infodocs-target.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-Upstream status: https://patchwork.ozlabs.org/project/uboot/list/?series=333259
-
-diff --git a/Makefile b/Makefile
-index de5746399a..597a8886c3 100644
---- a/Makefile
-+++ b/Makefile
-@@ -2372,7 +2372,7 @@ tcheck:
- # Documentation targets
- # ---------------------------------------------------------------------------
- DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
--	       linkcheckdocs dochelp refcheckdocs
-+	       linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
- PHONY += $(DOC_TARGETS)
- $(DOC_TARGETS): scripts_basic FORCE
- 	$(Q)$(MAKE) $(build)=doc $@
-diff --git a/doc/Makefile b/doc/Makefile
-index f5de65e927..d0904a9f99 100644
---- a/doc/Makefile
-+++ b/doc/Makefile
-@@ -69,6 +69,14 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
- htmldocs:
- 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
- 
-+texinfodocs:
-+	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,texinfo,$(var),texinfo,$(var)))
-+
-+# Note: the 'info' Make target is generated by sphinx itself when
-+# running the texinfodocs target defined above.
-+infodocs: texinfodocs
-+	$(MAKE) -C $(BUILDDIR)/texinfo info
-+
- linkcheckdocs:
- 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
- 
-@@ -109,6 +117,8 @@ cleandocs:
- dochelp:
- 	@echo  ' U-Boot documentation in different formats from ReST:'
- 	@echo  '  htmldocs        - HTML'
-+	@echo  '  texinfodocs     - Texinfo'
-+	@echo  '  infodocs        - Info'
- 	@echo  '  latexdocs       - LaTeX'
- 	@echo  '  pdfdocs         - PDF'
- 	@echo  '  epubdocs        - EPUB'
-diff --git a/doc/conf.py b/doc/conf.py
-index 62c8d31270..3db70f80c1 100644
---- a/doc/conf.py
-+++ b/doc/conf.py
-@@ -449,7 +449,7 @@ for fn in os.listdir('.'):
- # One entry per manual page. List of tuples
- # (source start file, name, description, authors, manual section).
- man_pages = [
--    (master_doc, 'dasuboot', 'The U-Boot Documentation',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-      [author], 1)
- ]
- 
-@@ -463,8 +463,8 @@ man_pages = [
- # (source start file, target name, title, author,
- #  dir menu entry, description, category)
- texinfo_documents = [
--    (master_doc, 'DasUBoot', 'The U-Boot Documentation',
--     author, 'DasUBoot', 'One line description of project.',
-+    (master_doc, 'u-boot', 'The U-Boot Documentation',
-+     author, 'U-Boot', 'Boot loader for embedded systems',
-      'Miscellaneous'),
- ]
- 
-diff --git a/doc/media/Makefile b/doc/media/Makefile
-index b9b43a34c3..9b32258696 100644
---- a/doc/media/Makefile
-+++ b/doc/media/Makefile
-@@ -22,10 +22,11 @@ $(BUILDDIR)/linker_lists.h.rst: ${API}/linker_lists.h ${PARSER} $(SRC_DIR)/linke
- 
- # Media build rules
- 
--.PHONY: all html epub xml latex
-+.PHONY: all html texinfo epub xml latex
- 
- all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
- html: all
-+texinfo: all
- epub: all
- xml: all
- latex: $(IMGPDF) all
diff --git a/gnu/packages/patches/u-boot-patman-guix-integration.patch b/gnu/packages/patches/u-boot-patman-guix-integration.patch
deleted file mode 100644
index 3472656c99..0000000000
--- a/gnu/packages/patches/u-boot-patman-guix-integration.patch
+++ /dev/null
@@ -1,1244 +0,0 @@
-These changes correspond to commits 9ff7500ace..3154de3dd6 already merged to
-the u-boot-dm custodian repo (at
-https://source.denx.de/u-boot/custodians/u-boot-dm/-/commits/next), scheduled
-to be pulled after the next release.
-
-diff --git a/tools/patman/__init__.py b/tools/patman/__init__.py
-index c9d3e35052..1b98ec7fee 100644
---- a/tools/patman/__init__.py
-+++ b/tools/patman/__init__.py
-@@ -1,6 +1,6 @@
- # SPDX-License-Identifier: GPL-2.0+
- 
- __all__ = ['checkpatch', 'command', 'commit', 'control', 'cros_subprocess',
--           'func_test', 'get_maintainer', 'gitutil', 'main', 'patchstream',
-+           'func_test', 'get_maintainer', 'gitutil', '__main__', 'patchstream',
-            'project', 'series', 'setup', 'settings', 'terminal',
-            'test_checkpatch', 'test_util', 'tools', 'tout']
-diff --git a/tools/patman/main.py b/tools/patman/__main__.py
-similarity index 89%
-rename from tools/patman/main.py
-rename to tools/patman/__main__.py
-index 8067a288ab..749e6348b6 100755
---- a/tools/patman/main.py
-+++ b/tools/patman/__main__.py
-@@ -7,6 +7,7 @@
- """See README for more information"""
- 
- from argparse import ArgumentParser
-+import importlib.resources
- import os
- import re
- import sys
-@@ -19,6 +20,7 @@ if __name__ == "__main__":
- 
- # Our modules
- from patman import control
-+from patman import func_test
- from patman import gitutil
- from patman import project
- from patman import settings
-@@ -53,7 +55,8 @@ parser.add_argument('-H', '--full-help', action='store_true', dest='full_help',
-                     default=False, help='Display the README file')
- 
- subparsers = parser.add_subparsers(dest='cmd')
--send = subparsers.add_parser('send')
-+send = subparsers.add_parser(
-+    'send', help='Format, check and email patches (default command)')
- send.add_argument('-i', '--ignore-errors', action='store_true',
-        dest='ignore_errors', default=False,
-        help='Send patches email even if patch errors are found')
-@@ -62,6 +65,12 @@ send.add_argument('-l', '--limit-cc', dest='limit', type=int, default=None,
- send.add_argument('-m', '--no-maintainers', action='store_false',
-        dest='add_maintainers', default=True,
-        help="Don't cc the file maintainers automatically")
-+send.add_argument(
-+    '--get-maintainer-script', dest='get_maintainer_script', type=str,
-+    action='store',
-+    default=os.path.join(gitutil.get_top_level(), 'scripts',
-+                         'get_maintainer.pl') + ' --norolestats',
-+    help='File name of the get_maintainer.pl (or compatible) script.')
- send.add_argument('-n', '--dry-run', action='store_true', dest='dry_run',
-        default=False, help="Do a dry run (create but don't email patches)")
- send.add_argument('-r', '--in-reply-to', type=str, action='store',
-@@ -94,9 +103,11 @@ send.add_argument('--smtp-server', type=str,
- 
- send.add_argument('patchfiles', nargs='*')
- 
--test_parser = subparsers.add_parser('test', help='Run tests')
--test_parser.add_argument('testname', type=str, default=None, nargs='?',
--                         help="Specify the test to run")
-+# Only add the 'test' action if the test data files are available.
-+if os.path.exists(func_test.TEST_DATA_DIR):
-+    test_parser = subparsers.add_parser('test', help='Run tests')
-+    test_parser.add_argument('testname', type=str, default=None, nargs='?',
-+                             help="Specify the test to run")
- 
- status = subparsers.add_parser('status',
-                                help='Check status of patches in patchwork')
-@@ -113,7 +124,7 @@ status.add_argument('-f', '--force', action='store_true',
- argv = sys.argv[1:]
- args, rest = parser.parse_known_args(argv)
- if hasattr(args, 'project'):
--    settings.Setup(gitutil, parser, args.project, '')
-+    settings.Setup(parser, args.project)
-     args, rest = parser.parse_known_args(argv)
- 
- # If we have a command, it is safe to parse all arguments
-@@ -160,11 +171,8 @@ elif args.cmd == 'send':
-         fd.close()
- 
-     elif args.full_help:
--        tools.print_full_help(
--            os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                         'README.rst')
--        )
--
-+        with importlib.resources.path('patman', 'README.rst') as readme:
-+            tools.print_full_help(str(readme))
-     else:
-         # If we are not processing tags, no need to warning about bad ones
-         if not args.process_tags:
-diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
-index d1b902dd96..012c0d895c 100644
---- a/tools/patman/checkpatch.py
-+++ b/tools/patman/checkpatch.py
-@@ -211,7 +211,7 @@ def check_patch(fname, verbose=False, show_types=False, use_tree=False):
-             stdout: Full output of checkpatch
-     """
-     chk = find_check_patch()
--    args = [chk]
-+    args = [chk, '--u-boot', '--strict']
-     if not use_tree:
-         args.append('--no-tree')
-     if show_types:
-diff --git a/tools/patman/control.py b/tools/patman/control.py
-index bf426cf7bc..38e98dab84 100644
---- a/tools/patman/control.py
-+++ b/tools/patman/control.py
-@@ -94,8 +94,8 @@ def check_patches(series, patch_files, run_checkpatch, verbose, use_tree):
- 
- 
- def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
--                  ignore_bad_tags, add_maintainers, limit, dry_run, in_reply_to,
--                  thread, smtp_server):
-+                  ignore_bad_tags, add_maintainers, get_maintainer_script, limit,
-+                  dry_run, in_reply_to, thread, smtp_server):
-     """Email patches to the recipients
- 
-     This emails out the patches and cover letter using 'git send-email'. Each
-@@ -123,6 +123,8 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         ignore_bad_tags (bool): True to just print a warning for unknown tags,
-             False to halt with an error
-         add_maintainers (bool): Run the get_maintainer.pl script for each patch
-+        get_maintainer_script (str): The script used to retrieve which
-+            maintainers to cc
-         limit (int): Limit on the number of people that can be cc'd on a single
-             patch or the cover letter (None if no limit)
-         dry_run (bool): Don't actually email the patches, just print out what
-@@ -134,7 +136,7 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
-         smtp_server (str): SMTP server to use to send patches (None for default)
-     """
-     cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags,
--                                add_maintainers, limit)
-+                                add_maintainers, limit, get_maintainer_script)
- 
-     # Email the patches out (giving the user time to check / cancel)
-     cmd = ''
-@@ -174,8 +176,8 @@ def send(args):
-     email_patches(
-         col, series, cover_fname, patch_files, args.process_tags,
-         its_a_go, args.ignore_bad_tags, args.add_maintainers,
--        args.limit, args.dry_run, args.in_reply_to, args.thread,
--        args.smtp_server)
-+        args.get_maintainer_script, args.limit, args.dry_run,
-+        args.in_reply_to, args.thread, args.smtp_server)
- 
- def patchwork_status(branch, count, start, end, dest_branch, force,
-                      show_comments, url):
-diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
-index 7b92bc67be..c25a47bdeb 100644
---- a/tools/patman/func_test.py
-+++ b/tools/patman/func_test.py
-@@ -6,7 +6,9 @@
- 
- """Functional tests for checking that patman behaves correctly"""
- 
-+import contextlib
- import os
-+import pathlib
- import re
- import shutil
- import sys
-@@ -28,6 +30,21 @@ from patman.test_util import capture_sys_output
- import pygit2
- from patman import status
- 
-+PATMAN_DIR = pathlib.Path(__file__).parent
-+TEST_DATA_DIR = PATMAN_DIR / 'test/'
-+
-+
-+@contextlib.contextmanager
-+def directory_excursion(directory):
-+    """Change directory to `directory` for a limited to the context block."""
-+    current = os.getcwd()
-+    try:
-+        os.chdir(directory)
-+        yield
-+    finally:
-+        os.chdir(current)
-+
-+
- class TestFunctional(unittest.TestCase):
-     """Functional tests for checking that patman behaves correctly"""
-     leb = (b'Lord Edmund Blackadd\xc3\xabr <weasel@blackadder.org>'.
-@@ -57,8 +74,7 @@ class TestFunctional(unittest.TestCase):
-         Returns:
-             str: Full path to file in the test directory
-         """
--        return os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
--                            'test', fname)
-+        return TEST_DATA_DIR / fname
- 
-     @classmethod
-     def _get_text(cls, fname):
-@@ -200,6 +216,8 @@ class TestFunctional(unittest.TestCase):
-         text = self._get_text('test01.txt')
-         series = patchstream.get_metadata_for_test(text)
-         cover_fname, args = self._create_patches_for_test(series)
-+        get_maintainer_script = str(pathlib.Path(__file__).parent.parent.parent
-+                                    / 'get_maintainer.pl') + ' --norolestats'
-         with capture_sys_output() as out:
-             patchstream.fix_patches(series, args)
-             if cover_fname and series.get('cover'):
-@@ -207,7 +225,7 @@ class TestFunctional(unittest.TestCase):
-             series.DoChecks()
-             cc_file = series.MakeCcFile(process_tags, cover_fname,
-                                         not ignore_bad_tags, add_maintainers,
--                                        None)
-+                                        None, get_maintainer_script)
-             cmd = gitutil.email_patches(
-                 series, cover_fname, args, dry_run, not ignore_bad_tags,
-                 cc_file, in_reply_to=in_reply_to, thread=None)
-@@ -502,6 +520,37 @@ complicated as possible''')
-         finally:
-             os.chdir(orig_dir)
- 
-+    def test_custom_get_maintainer_script(self):
-+        """Validate that a custom get_maintainer script gets used."""
-+        self.make_git_tree()
-+        with directory_excursion(self.gitdir):
-+            # Setup git.
-+            os.environ['GIT_CONFIG_GLOBAL'] = '/dev/null'
-+            os.environ['GIT_CONFIG_SYSTEM'] = '/dev/null'
-+            tools.run('git', 'config', 'user.name', 'Dummy')
-+            tools.run('git', 'config', 'user.email', 'dumdum@dummy.com')
-+            tools.run('git', 'branch', 'upstream')
-+            tools.run('git', 'branch', '--set-upstream-to=upstream')
-+            tools.run('git', 'add', '.')
-+            tools.run('git', 'commit', '-m', 'new commit')
-+
-+            # Setup patman configuration.
-+            with open('.patman', 'w', buffering=1) as f:
-+                f.write('[settings]\n'
-+                        'get_maintainer_script: dummy-script.sh\n'
-+                        'check_patch: False\n')
-+            with open('dummy-script.sh', 'w', buffering=1) as f:
-+                f.write('#!/usr/bin/env python\n'
-+                        'print("hello@there.com")\n')
-+            os.chmod('dummy-script.sh', 0x555)
-+
-+            # Finally, do the test
-+            with capture_sys_output():
-+                output = tools.run(PATMAN_DIR / 'patman', '--dry-run')
-+                # Assert the email address is part of the dry-run
-+                # output.
-+                self.assertIn('hello@there.com', output)
-+
-     def test_tags(self):
-         """Test collection of tags in a patchstream"""
-         text = '''This is a patch
-diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
-index e1d15ff6ab..f7011be1e4 100644
---- a/tools/patman/get_maintainer.py
-+++ b/tools/patman/get_maintainer.py
-@@ -1,48 +1,61 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2012 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- import os
-+import shlex
-+import shutil
- 
- from patman import command
-+from patman import gitutil
- 
--def find_get_maintainer(try_list):
--    """Look for the get_maintainer.pl script.
- 
--    Args:
--        try_list: List of directories to try for the get_maintainer.pl script
-+def find_get_maintainer(script_file_name):
-+    """Try to find where `script_file_name` is.
- 
--    Returns:
--        If the script is found we'll return a path to it; else None.
-+    It searches in PATH and falls back to a path relative to the top
-+    of the current git repository.
-     """
--    # Look in the list
--    for path in try_list:
--        fname = os.path.join(path, 'get_maintainer.pl')
--        if os.path.isfile(fname):
--            return fname
-+    get_maintainer = shutil.which(script_file_name)
-+    if get_maintainer:
-+        return get_maintainer
-+
-+    git_relative_script = os.path.join(gitutil.get_top_level(),
-+                                       script_file_name)
-+    if os.path.exists(git_relative_script):
-+        return git_relative_script
- 
--    return None
- 
--def get_maintainer(dir_list, fname, verbose=False):
--    """Run get_maintainer.pl on a file if we find it.
-+def get_maintainer(script_file_name, fname, verbose=False):
-+    """Run `script_file_name` on a file.
- 
--    We look for get_maintainer.pl in the 'scripts' directory at the top of
--    git.  If we find it we'll run it.  If we don't find get_maintainer.pl
--    then we fail silently.
-+    `script_file_name` should be a get_maintainer.pl-like script that
-+    takes a patch file name as an input and return the email addresses
-+    of the associated maintainers to standard output, one per line.
-+
-+    If `script_file_name` does not exist we fail silently.
- 
-     Args:
--        dir_list: List of directories to try for the get_maintainer.pl script
--        fname: Path to the patch file to run get_maintainer.pl on.
-+        script_file_name: The file name of the get_maintainer.pl script
-+            (or compatible).
-+        fname: File name of the patch to process with get_maintainer.pl.
- 
-     Returns:
-         A list of email addresses to CC to.
-     """
--    get_maintainer = find_get_maintainer(dir_list)
-+    # Expand `script_file_name` into a file name and its arguments, if
-+    # any.
-+    cmd_args = shlex.split(script_file_name)
-+    file_name = cmd_args[0]
-+    arguments = cmd_args[1:]
-+
-+    get_maintainer = find_get_maintainer(file_name)
-     if not get_maintainer:
-         if verbose:
-             print("WARNING: Couldn't find get_maintainer.pl")
-         return []
- 
--    stdout = command.output(get_maintainer, '--norolestats', fname)
-+    stdout = command.output(get_maintainer, *arguments, fname)
-     lines = stdout.splitlines()
--    return [ x.replace('"', '') for x in lines ]
-+    return [x.replace('"', '') for x in lines]
-diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
-index ceaf2ce150..5e742102c2 100644
---- a/tools/patman/gitutil.py
-+++ b/tools/patman/gitutil.py
-@@ -2,21 +2,19 @@
- # Copyright (c) 2011 The Chromium OS Authors.
- #
- 
--import re
- import os
--import subprocess
- import sys
- 
- from patman import command
- from patman import settings
- from patman import terminal
--from patman import tools
- 
- # True to use --no-decorate - we check this in setup()
- use_no_decorate = True
- 
-+
- def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
--           count=None):
-+            count=None):
-     """Create a command to perform a 'git log'
- 
-     Args:
-@@ -49,6 +47,7 @@ def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False,
-     cmd.append('--')
-     return cmd
- 
-+
- def count_commits_to_branch(branch):
-     """Returns number of commits between HEAD and the tracking branch.
- 
-@@ -68,13 +67,14 @@ def count_commits_to_branch(branch):
-         rev_range = '@{upstream}..'
-     pipe = [log_cmd(rev_range, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             oneline=True, raise_on_error=False)
-+                              oneline=True, raise_on_error=False)
-     if result.return_code:
-         raise ValueError('Failed to determine upstream: %s' %
-                          result.stderr.strip())
-     patch_count = len(result.stdout.splitlines())
-     return patch_count
- 
-+
- def name_revision(commit_hash):
-     """Gets the revision name for a commit
- 
-@@ -91,6 +91,7 @@ def name_revision(commit_hash):
-     name = stdout.split(' ')[1].strip()
-     return name
- 
-+
- def guess_upstream(git_dir, branch):
-     """Tries to guess the upstream for a branch
- 
-@@ -109,7 +110,7 @@ def guess_upstream(git_dir, branch):
-     """
-     pipe = [log_cmd(branch, git_dir=git_dir, oneline=True, count=100)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Branch '%s' not found" % branch
-     for line in result.stdout.splitlines()[1:]:
-@@ -121,6 +122,7 @@ def guess_upstream(git_dir, branch):
-             return name, "Guessing upstream as '%s'" % name
-     return None, "Cannot find a suitable upstream for branch '%s'" % branch
- 
-+
- def get_upstream(git_dir, branch):
-     """Returns the name of the upstream for a branch
- 
-@@ -135,10 +137,10 @@ def get_upstream(git_dir, branch):
-     """
-     try:
-         remote = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                       'branch.%s.remote' % branch)
-+                                         'branch.%s.remote' % branch)
-         merge = command.output_one_line('git', '--git-dir', git_dir, 'config',
--                                      'branch.%s.merge' % branch)
--    except:
-+                                        'branch.%s.merge' % branch)
-+    except Exception:
-         upstream, msg = guess_upstream(git_dir, branch)
-         return upstream, msg
- 
-@@ -149,7 +151,8 @@ def get_upstream(git_dir, branch):
-         return '%s/%s' % (remote, leaf), None
-     else:
-         raise ValueError("Cannot determine upstream branch for branch "
--                "'%s' remote='%s', merge='%s'" % (branch, remote, merge))
-+                         "'%s' remote='%s', merge='%s'"
-+                         % (branch, remote, merge))
- 
- 
- def get_range_in_branch(git_dir, branch, include_upstream=False):
-@@ -168,6 +171,7 @@ def get_range_in_branch(git_dir, branch, include_upstream=False):
-     rstr = '%s%s..%s' % (upstream, '~' if include_upstream else '', branch)
-     return rstr, msg
- 
-+
- def count_commits_in_range(git_dir, range_expr):
-     """Returns the number of commits in the given range.
- 
-@@ -180,12 +184,13 @@ def count_commits_in_range(git_dir, range_expr):
-     """
-     pipe = [log_cmd(range_expr, git_dir=git_dir, oneline=True)]
-     result = command.run_pipe(pipe, capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     if result.return_code:
-         return None, "Range '%s' not found or is invalid" % range_expr
-     patch_count = len(result.stdout.splitlines())
-     return patch_count, None
- 
-+
- def count_commits_in_branch(git_dir, branch, include_upstream=False):
-     """Returns the number of commits in the given branch.
- 
-@@ -201,6 +206,7 @@ def count_commits_in_branch(git_dir, branch, include_upstream=False):
-         return None, msg
-     return count_commits_in_range(git_dir, range_expr)
- 
-+
- def count_commits(commit_range):
-     """Returns the number of commits in the given range.
- 
-@@ -215,6 +221,7 @@ def count_commits(commit_range):
-     patch_count = int(stdout)
-     return patch_count
- 
-+
- def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-     """Checkout the selected commit for this build
- 
-@@ -231,10 +238,11 @@ def checkout(commit_hash, git_dir=None, work_tree=None, force=False):
-         pipe.append('-f')
-     pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, raise_on_error=False,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git checkout (%s): %s' % (pipe, result.stderr))
- 
-+
- def clone(git_dir, output_dir):
-     """Checkout the selected commit for this build
- 
-@@ -243,10 +251,11 @@ def clone(git_dir, output_dir):
-     """
-     pipe = ['git', 'clone', git_dir, '.']
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git clone: %s' % result.stderr)
- 
-+
- def fetch(git_dir=None, work_tree=None):
-     """Fetch from the origin repo
- 
-@@ -263,6 +272,7 @@ def fetch(git_dir=None, work_tree=None):
-     if result.return_code != 0:
-         raise OSError('git fetch: %s' % result.stderr)
- 
-+
- def check_worktree_is_available(git_dir):
-     """Check if git-worktree functionality is available
- 
-@@ -274,9 +284,10 @@ def check_worktree_is_available(git_dir):
-     """
-     pipe = ['git', '--git-dir', git_dir, 'worktree', 'list']
-     result = command.run_pipe([pipe], capture=True, capture_stderr=True,
--                             raise_on_error=False)
-+                              raise_on_error=False)
-     return result.return_code == 0
- 
-+
- def add_worktree(git_dir, output_dir, commit_hash=None):
-     """Create and checkout a new git worktree for this build
- 
-@@ -290,10 +301,11 @@ def add_worktree(git_dir, output_dir, commit_hash=None):
-     if commit_hash:
-         pipe.append(commit_hash)
-     result = command.run_pipe([pipe], capture=True, cwd=output_dir,
--                             capture_stderr=True)
-+                              capture_stderr=True)
-     if result.return_code != 0:
-         raise OSError('git worktree add: %s' % result.stderr)
- 
-+
- def prune_worktrees(git_dir):
-     """Remove administrative files for deleted worktrees
- 
-@@ -305,7 +317,8 @@ def prune_worktrees(git_dir):
-     if result.return_code != 0:
-         raise OSError('git worktree prune: %s' % result.stderr)
- 
--def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-+
-+def create_patches(branch, start, count, ignore_binary, series, signoff=True):
-     """Create a series of patches from the top of the current branch.
- 
-     The patch files are written to the current directory using
-@@ -321,9 +334,7 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
-         Filename of cover letter (None if none)
-         List of filenames of patch files
-     """
--    if series.get('version'):
--        version = '%s ' % series['version']
--    cmd = ['git', 'format-patch', '-M' ]
-+    cmd = ['git', 'format-patch', '-M']
-     if signoff:
-         cmd.append('--signoff')
-     if ignore_binary:
-@@ -341,9 +352,10 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True):
- 
-     # We have an extra file if there is a cover letter
-     if series.get('cover'):
--       return files[0], files[1:]
-+        return files[0], files[1:]
-     else:
--       return None, files
-+        return None, files
-+
- 
- def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-     """Build a list of email addresses based on an input list.
-@@ -385,40 +397,43 @@ def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
-         raw += lookup_email(item, alias, warn_on_error=warn_on_error)
-     result = []
-     for item in raw:
--        if not item in result:
-+        if item not in result:
-             result.append(item)
-     if tag:
-         return ['%s %s%s%s' % (tag, quote, email, quote) for email in result]
-     return result
- 
-+
- def check_suppress_cc_config():
-     """Check if sendemail.suppresscc is configured correctly.
- 
-     Returns:
-         True if the option is configured correctly, False otherwise.
-     """
--    suppresscc = command.output_one_line('git', 'config', 'sendemail.suppresscc',
--                                       raise_on_error=False)
-+    suppresscc = command.output_one_line(
-+        'git', 'config', 'sendemail.suppresscc', raise_on_error=False)
- 
-     # Other settings should be fine.
-     if suppresscc == 'all' or suppresscc == 'cccmd':
-         col = terminal.Color()
- 
-         print((col.build(col.RED, "error") +
--            ": git config sendemail.suppresscc set to %s\n"  % (suppresscc)) +
--            "  patman needs --cc-cmd to be run to set the cc list.\n" +
--            "  Please run:\n" +
--            "    git config --unset sendemail.suppresscc\n" +
--            "  Or read the man page:\n" +
--            "    git send-email --help\n" +
--            "  and set an option that runs --cc-cmd\n")
-+               ": git config sendemail.suppresscc set to %s\n"
-+               % (suppresscc)) +
-+              "  patman needs --cc-cmd to be run to set the cc list.\n" +
-+              "  Please run:\n" +
-+              "    git config --unset sendemail.suppresscc\n" +
-+              "  Or read the man page:\n" +
-+              "    git send-email --help\n" +
-+              "  and set an option that runs --cc-cmd\n")
-         return False
- 
-     return True
- 
-+
- def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
--        self_only=False, alias=None, in_reply_to=None, thread=False,
--        smtp_server=None):
-+                  self_only=False, alias=None, in_reply_to=None, thread=False,
-+                  smtp_server=None, get_maintainer_script=None):
-     """Email a patch series.
- 
-     Args:
-@@ -435,6 +450,7 @@ def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
-         thread: True to add --thread to git send-email (make
-             all patches reply to cover-letter or first patch in series)
-         smtp_server: SMTP server to use to send patches
-+        get_maintainer_script: File name of script to get maintainers emails
- 
-     Returns:
-         Git command that was/would be run
-@@ -487,9 +503,10 @@ send --cc-cmd cc-fname" cover p1 p2'
-                   "git config sendemail.to u-boot@lists.denx.de")
-             return
-     cc = build_email_list(list(set(series.get('cc')) - set(series.get('to'))),
--                        '--cc', alias, warn_on_error)
-+                          '--cc', alias, warn_on_error)
-     if self_only:
--        to = build_email_list([os.getenv('USER')], '--to', alias, warn_on_error)
-+        to = build_email_list([os.getenv('USER')], '--to',
-+                              alias, warn_on_error)
-         cc = []
-     cmd = ['git', 'send-email', '--annotate']
-     if smtp_server:
-@@ -565,7 +582,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-     if not alias:
-         alias = settings.alias
-     lookup_name = lookup_name.strip()
--    if '@' in lookup_name: # Perhaps a real email address
-+    if '@' in lookup_name:      # Perhaps a real email address
-         return [lookup_name]
- 
-     lookup_name = lookup_name.lower()
-@@ -581,7 +598,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-             return out_list
- 
-     if lookup_name:
--        if not lookup_name in alias:
-+        if lookup_name not in alias:
-             msg = "Alias '%s' not found" % lookup_name
-             if warn_on_error:
-                 print(col.build(col.RED, msg))
-@@ -589,11 +606,12 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
-         for item in alias[lookup_name]:
-             todo = lookup_email(item, alias, warn_on_error, level + 1)
-             for new_item in todo:
--                if not new_item in out_list:
-+                if new_item not in out_list:
-                     out_list.append(new_item)
- 
-     return out_list
- 
-+
- def get_top_level():
-     """Return name of top-level directory for this git repo.
- 
-@@ -608,6 +626,7 @@ def get_top_level():
-     """
-     return command.output_one_line('git', 'rev-parse', '--show-toplevel')
- 
-+
- def get_alias_file():
-     """Gets the name of the git alias file.
- 
-@@ -615,7 +634,7 @@ def get_alias_file():
-         Filename of git alias file, or None if none
-     """
-     fname = command.output_one_line('git', 'config', 'sendemail.aliasesfile',
--            raise_on_error=False)
-+                                    raise_on_error=False)
-     if not fname:
-         return None
- 
-@@ -625,6 +644,7 @@ def get_alias_file():
- 
-     return os.path.join(get_top_level(), fname)
- 
-+
- def get_default_user_name():
-     """Gets the user.name from .gitconfig file.
- 
-@@ -634,6 +654,7 @@ def get_default_user_name():
-     uname = command.output_one_line('git', 'config', '--global', 'user.name')
-     return uname
- 
-+
- def get_default_user_email():
-     """Gets the user.email from the global .gitconfig file.
- 
-@@ -643,17 +664,19 @@ def get_default_user_email():
-     uemail = command.output_one_line('git', 'config', '--global', 'user.email')
-     return uemail
- 
-+
- def get_default_subject_prefix():
-     """Gets the format.subjectprefix from local .git/config file.
- 
-     Returns:
-         Subject prefix found in local .git/config file, or None if none
-     """
--    sub_prefix = command.output_one_line('git', 'config', 'format.subjectprefix',
--                 raise_on_error=False)
-+    sub_prefix = command.output_one_line(
-+        'git', 'config', 'format.subjectprefix', raise_on_error=False)
- 
-     return sub_prefix
- 
-+
- def setup():
-     """Set up git utils, by reading the alias files."""
-     # Check for a git alias file also
-@@ -666,6 +689,7 @@ def setup():
-     use_no_decorate = (command.run_pipe([cmd], raise_on_error=False)
-                        .return_code == 0)
- 
-+
- def get_head():
-     """Get the hash of the current HEAD
- 
-@@ -674,6 +698,7 @@ def get_head():
-     """
-     return command.output_one_line('git', 'show', '-s', '--pretty=format:%H')
- 
-+
- if __name__ == "__main__":
-     import doctest
- 
-diff --git a/tools/patman/patman b/tools/patman/patman
-index 11a5d8e18a..5a427d1942 120000
---- a/tools/patman/patman
-+++ b/tools/patman/patman
-@@ -1 +1 @@
--main.py
-\ No newline at end of file
-+__main__.py
-\ No newline at end of file
-diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst
-index 8c5c9cc2cc..6113962fb4 100644
---- a/tools/patman/patman.rst
-+++ b/tools/patman/patman.rst
-@@ -1,6 +1,7 @@
- .. SPDX-License-Identifier: GPL-2.0+
- .. Copyright (c) 2011 The Chromium OS Authors
- .. Simon Glass <sjg@chromium.org>
-+.. Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- .. v1, v2, 19-Oct-11
- .. revised v3 24-Nov-11
- .. revised v4 Independence Day 2020, with Patchwork integration
-@@ -68,13 +69,28 @@ this once::
- 
-     git config sendemail.aliasesfile doc/git-mailrc
- 
--For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles figuring
--out where to send patches pretty well.
-+For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles
-+figuring out where to send patches pretty well. For other projects,
-+you may want to specify a different script to be run, for example via
-+a project-specific `.patman` file::
-+
-+    # .patman configuration file at the root of some project
-+
-+    [settings]
-+    get_maintainer_script: etc/teams.scm get-maintainer
-+
-+The `get_maintainer_script` option corresponds to the
-+`--get-maintainer-script` argument of the `send` command.  It is
-+looked relatively to the root of the current git repository, as well
-+as on PATH.  It can also be provided arguments, as shown above.  The
-+contract is that the script should accept a patch file name and return
-+a list of email addresses, one per line, like `get_maintainer.pl`
-+does.
- 
- During the first run patman creates a config file for you by taking the default
- user name and email address from the global .gitconfig file.
- 
--To add your own, create a file ~/.patman like this::
-+To add your own, create a file `~/.patman` like this::
- 
-     # patman alias file
- 
-@@ -85,6 +101,12 @@ To add your own, create a file ~/.patman like this::
-     wolfgang: Wolfgang Denk <wd@denx.de>
-     others: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net>
- 
-+As hinted above, Patman will also look for a `.patman` configuration
-+file at the root of the current project git repository, which makes it
-+possible to override the `project` settings variable or anything else
-+in a project-specific way. The values of this "local" configuration
-+file take precedence over those of the "global" one.
-+
- Aliases are recursive.
- 
- The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
-@@ -680,6 +702,16 @@ them:
- 
-     $ tools/patman/patman test
- 
-+Note that since the test suite depends on data files only available in
-+the git checkout, the `test` command is hidden unless `patman` is
-+invoked from the U-Boot git repository.
-+
-+Alternatively, you can run the test suite via Pytest:
-+
-+.. code-block:: bash
-+
-+    $ cd tools/patman && pytest
-+
- Error handling doesn't always produce friendly error messages - e.g.
- putting an incorrect tag in a commit may provide a confusing message.
- 
-diff --git a/tools/patman/pytest.ini b/tools/patman/pytest.ini
-new file mode 100644
-index 0000000000..df3eb518d0
---- /dev/null
-+++ b/tools/patman/pytest.ini
-@@ -0,0 +1,2 @@
-+[pytest]
-+addopts = --doctest-modules
-diff --git a/tools/patman/series.py b/tools/patman/series.py
-index 3075378ac1..2eeeef71dc 100644
---- a/tools/patman/series.py
-+++ b/tools/patman/series.py
-@@ -235,7 +235,7 @@ class Series(dict):
-             print(col.build(col.RED, str))
- 
-     def MakeCcFile(self, process_tags, cover_fname, warn_on_error,
--                   add_maintainers, limit):
-+                   add_maintainers, limit, get_maintainer_script):
-         """Make a cc file for us to use for per-commit Cc automation
- 
-         Also stores in self._generated_cc to make ShowActions() faster.
-@@ -249,6 +249,8 @@ class Series(dict):
-                 True/False to call the get_maintainers to CC maintainers
-                 List of maintainers to include (for testing)
-             limit: Limit the length of the Cc list (None if no limit)
-+            get_maintainer_script: The file name of the get_maintainer.pl
-+                script (or compatible).
-         Return:
-             Filename of temp file created
-         """
-@@ -267,8 +269,9 @@ class Series(dict):
-             if type(add_maintainers) == type(cc):
-                 cc += add_maintainers
-             elif add_maintainers:
--                dir_list = [os.path.join(gitutil.get_top_level(), 'scripts')]
--                cc += get_maintainer.get_maintainer(dir_list, commit.patch)
-+
-+                cc += get_maintainer.get_maintainer(get_maintainer_script,
-+                                                    commit.patch)
-             for x in set(cc) & set(settings.bounces):
-                 print(col.build(col.YELLOW, 'Skipping "%s"' % x))
-             cc = list(set(cc) - set(settings.bounces))
-diff --git a/tools/patman/settings.py b/tools/patman/settings.py
-index 903d6fcb0b..636983e32d 100644
---- a/tools/patman/settings.py
-+++ b/tools/patman/settings.py
-@@ -1,18 +1,18 @@
- # SPDX-License-Identifier: GPL-2.0+
- # Copyright (c) 2011 The Chromium OS Authors.
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
- #
- 
- try:
-     import configparser as ConfigParser
--except:
-+except Exception:
-     import ConfigParser
- 
- import argparse
- import os
- import re
- 
--from patman import command
--from patman import tools
-+from patman import gitutil
- 
- """Default settings per-project.
- 
-@@ -32,7 +32,8 @@ _default_settings = {
-     },
- }
- 
--class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-+
-+class _ProjectConfigParser(ConfigParser.ConfigParser):
-     """ConfigParser that handles projects.
- 
-     There are two main goals of this class:
-@@ -83,14 +84,14 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-     def __init__(self, project_name):
-         """Construct _ProjectConfigParser.
- 
--        In addition to standard SafeConfigParser initialization, this also loads
--        project defaults.
-+        In addition to standard ConfigParser initialization, this also
-+        loads project defaults.
- 
-         Args:
-             project_name: The name of the project.
-         """
-         self._project_name = project_name
--        ConfigParser.SafeConfigParser.__init__(self)
-+        ConfigParser.ConfigParser.__init__(self)
- 
-         # Update the project settings in the config based on
-         # the _default_settings global.
-@@ -102,31 +103,31 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-             self.set(project_settings, setting_name, setting_value)
- 
-     def get(self, section, option, *args, **kwargs):
--        """Extend SafeConfigParser to try project_section before section.
-+        """Extend ConfigParser to try project_section before section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         try:
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, "%s_%s" % (self._project_name, section), option,
-                 *args, **kwargs
-             )
-         except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
--            val = ConfigParser.SafeConfigParser.get(
-+            val = ConfigParser.ConfigParser.get(
-                 self, section, option, *args, **kwargs
-             )
-         return val
- 
-     def items(self, section, *args, **kwargs):
--        """Extend SafeConfigParser to add project_section to section.
-+        """Extend ConfigParser to add project_section to section.
- 
-         Args:
--            See SafeConfigParser.
-+            See ConfigParser.
-         Returns:
--            See SafeConfigParser.
-+            See ConfigParser.
-         """
-         project_items = []
-         has_project_section = False
-@@ -134,7 +135,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get items from the project section
-         try:
--            project_items = ConfigParser.SafeConfigParser.items(
-+            project_items = ConfigParser.ConfigParser.items(
-                 self, "%s_%s" % (self._project_name, section), *args, **kwargs
-             )
-             has_project_section = True
-@@ -143,7 +144,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- 
-         # Get top-level items
-         try:
--            top_items = ConfigParser.SafeConfigParser.items(
-+            top_items = ConfigParser.ConfigParser.items(
-                 self, section, *args, **kwargs
-             )
-         except ConfigParser.NoSectionError:
-@@ -155,6 +156,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
-         item_dict.update(project_items)
-         return {(item, val) for item, val in item_dict.items()}
- 
-+
- def ReadGitAliases(fname):
-     """Read a git alias file. This is in the form used by git:
- 
-@@ -170,7 +172,7 @@ def ReadGitAliases(fname):
-         print("Warning: Cannot find alias file '%s'" % fname)
-         return
- 
--    re_line = re.compile('alias\s+(\S+)\s+(.*)')
-+    re_line = re.compile(r'alias\s+(\S+)\s+(.*)')
-     for line in fd.readlines():
-         line = line.strip()
-         if not line or line[0] == '#':
-@@ -190,7 +192,8 @@ def ReadGitAliases(fname):
- 
-     fd.close()
- 
--def CreatePatmanConfigFile(gitutil, config_fname):
-+
-+def CreatePatmanConfigFile(config_fname):
-     """Creates a config file under $(HOME)/.patman if it can't find one.
- 
-     Args:
-@@ -200,12 +203,12 @@ def CreatePatmanConfigFile(gitutil, config_fname):
-         None
-     """
-     name = gitutil.get_default_user_name()
--    if name == None:
-+    if name is None:
-         name = input("Enter name: ")
- 
-     email = gitutil.get_default_user_email()
- 
--    if email == None:
-+    if email is None:
-         email = input("Enter email: ")
- 
-     try:
-@@ -220,7 +223,8 @@ me: %s <%s>
- [bounces]
- nxp = Zhikang Zhang <zhikang.zhang@nxp.com>
- ''' % (name, email), file=f)
--    f.close();
-+    f.close()
-+
- 
- def _UpdateDefaults(main_parser, config):
-     """Update the given OptionParser defaults based on config.
-@@ -242,8 +246,8 @@ def _UpdateDefaults(main_parser, config):
-     # Find all the parsers and subparsers
-     parsers = [main_parser]
-     parsers += [subparser for action in main_parser._actions
--                  if isinstance(action, argparse._SubParsersAction)
--                  for _, subparser in action.choices.items()]
-+                if isinstance(action, argparse._SubParsersAction)
-+                for _, subparser in action.choices.items()]
- 
-     # Collect the defaults from each parser
-     defaults = {}
-@@ -270,8 +274,9 @@ def _UpdateDefaults(main_parser, config):
-     # Set all the defaults and manually propagate them to subparsers
-     main_parser.set_defaults(**defaults)
-     for parser, pdefs in zip(parsers, parser_defaults):
--        parser.set_defaults(**{ k: v for k, v in defaults.items()
--                                    if k in pdefs })
-+        parser.set_defaults(**{k: v for k, v in defaults.items()
-+                               if k in pdefs})
-+
- 
- def _ReadAliasFile(fname):
-     """Read in the U-Boot git alias file if it exists.
-@@ -298,6 +303,7 @@ def _ReadAliasFile(fname):
-         if bad_line:
-             print(bad_line)
- 
-+
- def _ReadBouncesFile(fname):
-     """Read in the bounces file if it exists
- 
-@@ -311,6 +317,7 @@ def _ReadBouncesFile(fname):
-                     continue
-                 bounces.add(line.strip())
- 
-+
- def GetItems(config, section):
-     """Get the items from a section of the config.
- 
-@@ -323,31 +330,50 @@ def GetItems(config, section):
-     """
-     try:
-         return config.items(section)
--    except ConfigParser.NoSectionError as e:
-+    except ConfigParser.NoSectionError:
-         return []
--    except:
--        raise
- 
--def Setup(gitutil, parser, project_name, config_fname=''):
-+
-+def Setup(parser, project_name, config_fname=None):
-     """Set up the settings module by reading config files.
- 
-+    Unless `config_fname` is specified, a `.patman` config file local
-+    to the git repository is consulted, followed by the global
-+    `$HOME/.patman`. If none exists, the later is created. Values
-+    defined in the local config file take precedence over those
-+    defined in the global one.
-+
-     Args:
--        parser:         The parser to update
-+        parser:         The parser to update.
-         project_name:   Name of project that we're working on; we'll look
-             for sections named "project_section" as well.
--        config_fname:   Config filename to read ('' for default)
-+        config_fname:   Config filename to read.  An error is raised if it
-+            does not exist.
-     """
-     # First read the git alias file if available
-     _ReadAliasFile('doc/git-mailrc')
-     config = _ProjectConfigParser(project_name)
--    if config_fname == '':
-+
-+    if config_fname and not os.path.exists(config_fname):
-+        raise Exception(f'provided {config_fname} does not exist')
-+
-+    if not config_fname:
-         config_fname = '%s/.patman' % os.getenv('HOME')
-+    has_config = os.path.exists(config_fname)
-+
-+    git_local_config_fname = os.path.join(gitutil.get_top_level(), '.patman')
-+    has_git_local_config = os.path.exists(git_local_config_fname)
- 
--    if not os.path.exists(config_fname):
--        print("No config file found ~/.patman\nCreating one...\n")
--        CreatePatmanConfigFile(gitutil, config_fname)
-+    # Read the git local config last, so that its values override
-+    # those of the global config, if any.
-+    if has_config:
-+        config.read(config_fname)
-+    if has_git_local_config:
-+        config.read(git_local_config_fname)
- 
--    config.read(config_fname)
-+    if not (has_config or has_git_local_config):
-+        print("No config file found.\nCreating ~/.patman...\n")
-+        CreatePatmanConfigFile(config_fname)
- 
-     for name, value in GetItems(config, 'alias'):
-         alias[name] = value.split(',')
-@@ -358,6 +384,7 @@ def Setup(gitutil, parser, project_name, config_fname=''):
- 
-     _UpdateDefaults(parser, config)
- 
-+
- # These are the aliases we understand, indexed by alias. Each member is a list.
- alias = {}
- bounces = set()
-diff --git a/tools/patman/setup.py b/tools/patman/setup.py
-index 5643bf1503..2ff791da0f 100644
---- a/tools/patman/setup.py
-+++ b/tools/patman/setup.py
-@@ -7,6 +7,6 @@ setup(name='patman',
-       scripts=['patman'],
-       packages=['patman'],
-       package_dir={'patman': ''},
--      package_data={'patman': ['README']},
-+      package_data={'patman': ['README.rst']},
-       classifiers=['Environment :: Console',
-                    'Topic :: Software Development'])
-diff --git a/tools/patman/test_settings.py b/tools/patman/test_settings.py
-new file mode 100644
-index 0000000000..c768a2fc64
---- /dev/null
-+++ b/tools/patman/test_settings.py
-@@ -0,0 +1,67 @@
-+# SPDX-License-Identifier: GPL-2.0+
-+#
-+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
-+#
-+
-+import argparse
-+import contextlib
-+import os
-+import sys
-+import tempfile
-+
-+from patman import settings
-+from patman import tools
-+
-+
-+@contextlib.contextmanager
-+def empty_git_repository():
-+    with tempfile.TemporaryDirectory() as tmpdir:
-+        os.chdir(tmpdir)
-+        tools.run('git', 'init', raise_on_error=True)
-+        yield tmpdir
-+
-+
-+@contextlib.contextmanager
-+def cleared_command_line_args():
-+    old_value = sys.argv[:]
-+    sys.argv = [sys.argv[0]]
-+    try:
-+        yield
-+    finally:
-+        sys.argv = old_value
-+
-+
-+def test_git_local_config():
-+    # Clearing the command line arguments is required, otherwise
-+    # arguments passed to the test running such as in 'pytest -k
-+    # filter' would be processed by _UpdateDefaults and fail.
-+    with cleared_command_line_args():
-+        with empty_git_repository():
-+            with tempfile.NamedTemporaryFile() as global_config:
-+                global_config.write(b'[settings]\n'
-+                                    b'project=u-boot\n')
-+                global_config.flush()
-+                parser = argparse.ArgumentParser()
-+                parser.add_argument('-p', '--project', default='unknown')
-+                subparsers = parser.add_subparsers(dest='cmd')
-+                send = subparsers.add_parser('send')
-+                send.add_argument('--no-check', action='store_false',
-+                                  dest='check_patch', default=True)
-+
-+                # Test "global" config is used.
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'u-boot'
-+                send_args, _ = send.parse_known_args([])
-+                assert send_args.check_patch
-+
-+                # Test local config can shadow it.
-+                with open('.patman', 'w', buffering=1) as f:
-+                    f.write('[settings]\n'
-+                            'project: guix-patches\n'
-+                            'check_patch: False\n')
-+                settings.Setup(parser, 'unknown', global_config.name)
-+                args, _ = parser.parse_known_args([])
-+                assert args.project == 'guix-patches'
-+                send_args, _ = send.parse_known_args([])
-+                assert not send_args.check_patch
diff --git a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
index a5b92e3e8f..858f42efe7 100644
--- a/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
+++ b/gnu/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch
@@ -5,12 +5,12 @@ Index: u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
 ===================================================================
 --- u-boot-2021.07~rc4+dfsg.orig/include/configs/sifive-unmatched.h
 +++ u-boot-2021.07~rc4+dfsg/include/configs/sifive-unmatched.h
-@@ -62,6 +62,8 @@
+@@ -55,6 +55,8 @@
  	"name=system,size=-,bootable,type=${type_guid_gpt_system};"
  
- #define CONFIG_EXTRA_ENV_SETTINGS \
+ #define CFG_EXTRA_ENV_SETTINGS \
 +	"fdt_high=0xffffffffffffffff\0" \
 +	"initrd_high=0xffffffffffffffff\0" \
  	"kernel_addr_r=0x84000000\0" \
- 	"fdt_addr_r=0x88000000\0" \
- 	"scriptaddr=0x88100000\0" \
+ 	"kernel_comp_addr_r=0x88000000\0" \
+ 	"kernel_comp_size=0x4000000\0" \
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v4 3/5] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts.
  2023-07-20  1:44 ` [bug#64149] [PATCH v4 0/5] Update U-boot " vagrant
  2023-07-20  1:44   ` [bug#64149] [PATCH v4 1/5] gnu: arm-trusted-firmware: Update to 2.9 vagrant
  2023-07-20  1:44   ` [bug#64149] [PATCH v4 2/5] gnu: u-boot: Update to 2023.07.02 vagrant
@ 2023-07-20  1:44   ` vagrant
  2023-07-20  1:44   ` [bug#64149] [PATCH v4 4/5] gnu: Add python-u-boot-pylib vagrant
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 46+ messages in thread
From: vagrant @ 2023-07-20  1:44 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Vagrant Cascadian <vagrant@debian.org>

* gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package): Take argument
for System Control Processor (SCP) firmware.
[native-inputs]: Add SCP firmware.
[phases]: Adjust 'set-environment to also set SCP variable.
(u-boot-pine64-plus, u-boot-pine64-lts, u-boot-pinebook): Pass appropriate
crust firmware as the SCP firmware.
---
 gnu/packages/bootloaders.scm | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 966f1787f8..ea69fc890b 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1010,7 +1010,7 @@ (define-public u-boot-am335x-boneblack
 (define-public u-boot-am335x-evm
   (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"))
 
-(define*-public (make-u-boot-sunxi64-package board triplet
+(define*-public (make-u-boot-sunxi64-package board triplet scp-firmware
                                              #:key defconfig configs)
   (let ((base (make-u-boot-package
                board triplet #:defconfig defconfig #:configs configs)))
@@ -1022,23 +1022,27 @@ (define*-public (make-u-boot-sunxi64-package board triplet
           #~(modify-phases #$phases
               (add-after 'unpack 'set-environment
                 (lambda* (#:key native-inputs inputs #:allow-other-keys)
-                  ;; Avoid dependency on crust-firmware
-                  ;; https://issues.guix.gnu.org/48371
-                  (setenv "SCP" "/dev/null")
+                  (setenv "SCP" (search-input-file
+                                 native-inputs "libexec/scp.bin"))
                   (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
+      (native-inputs
+       (modify-inputs (package-native-inputs base)
+         (append scp-firmware)))
       (inputs
        (modify-inputs (package-inputs base)
          (append arm-trusted-firmware-sun50i-a64))))))
 
 (define-public u-boot-pine64-plus
-  (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
+  (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"
+                               crust-pine64-plus))
 
 (define-public u-boot-pine64-lts
-  (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu"))
+  (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu"
+                               crust-pine64-plus))
 
 (define-public u-boot-pinebook
   (make-u-boot-sunxi64-package
-   "pinebook" "aarch64-linux-gnu"
+   "pinebook" "aarch64-linux-gnu" crust-pinebook
    ;; Fix regression with LCD video output introduced in 2020.01
    ;; https://patchwork.ozlabs.org/patch/1225130/
    #:configs '("CONFIG_VIDEO_BPP32=y")))
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v4 4/5] gnu: Add python-u-boot-pylib.
  2023-07-20  1:44 ` [bug#64149] [PATCH v4 0/5] Update U-boot " vagrant
                     ` (2 preceding siblings ...)
  2023-07-20  1:44   ` [bug#64149] [PATCH v4 3/5] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts vagrant
@ 2023-07-20  1:44   ` vagrant
  2023-07-20  1:44   ` [bug#64149] [PATCH v4 5/5] gnu: patman: Add python-u-boot-pylib to inputs vagrant
  2023-07-20  3:37   ` [bug#64149] [PATCH v4 0/5] Update U-boot to 2023.07.02 Maxim Cournoyer
  5 siblings, 0 replies; 46+ messages in thread
From: vagrant @ 2023-07-20  1:44 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Maxim Cournoyer <maxim.cournoyer@gmail.com>

* gnu/packages/bootloaders.scm (python-u-boot-pylib): New variable.
* gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/bootloaders.scm                  | 23 +++++++++++++++++-
 .../patches/u-boot-fix-u-boot-lib-build.patch | 24 +++++++++++++++++++
 3 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index cdce2666e5..ad31e8d2de 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2005,6 +2005,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/twinkle-bcg729.patch			\
   %D%/packages/patches/u-boot-allow-disabling-openssl.patch	\
   %D%/packages/patches/u-boot-fix-build-python-3.10.patch	\
+  %D%/packages/patches/u-boot-fix-u-boot-lib-build.patch	\
   %D%/packages/patches/u-boot-nintendo-nes-serial.patch		\
   %D%/packages/patches/u-boot-rockchip-inno-usb.patch		\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index ea69fc890b..8afb2c3293 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -655,7 +655,8 @@ (define u-boot
                      %u-boot-allow-disabling-openssl-patch
                      %u-boot-sifive-prevent-relocating-initrd-fdt
                      %u-boot-rk3399-enable-emmc-phy-patch
-                     (search-patch "u-boot-fix-build-python-3.10.patch")))
+                     (search-patch "u-boot-fix-build-python-3.10.patch")
+                     (search-patch "u-boot-fix-u-boot-lib-build.patch")))
               (method url-fetch)
               (uri (string-append
                     "https://ftp.denx.de/pub/u-boot/"
@@ -841,6 +842,26 @@ (define-public u-boot-tools
                   "  This package provides board-independent tools "
                   "of U-Boot."))))
 
+(define-public python-u-boot-pylib
+  (package
+    (inherit u-boot)
+    (name "python-u-boot-pylib")
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _
+              (chdir "tools/u_boot_pylib")))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "./u_boot_pylib")))))))
+    (synopsis "U-Boot Python library")
+    (description "This package provides common Python code used by some of the
+commands part of the U-Boot project, such as Patman.")))
+
 ;;; This is packaged separately, as it can be used in other contexts than for
 ;;; U-Boot development.
 (define-public patman
diff --git a/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch b/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch
new file mode 100644
index 0000000000..233c437de6
--- /dev/null
+++ b/gnu/packages/patches/u-boot-fix-u-boot-lib-build.patch
@@ -0,0 +1,24 @@
+Submitted upstream (see:
+https://lists.denx.de/pipermail/u-boot/2023-July/521984.html)
+
+diff --git a/tools/u_boot_pylib/pyproject.toml b/tools/u_boot_pylib/pyproject.toml
+index 3f33caf6f8..037c5d629e 100644
+--- a/tools/u_boot_pylib/pyproject.toml
++++ b/tools/u_boot_pylib/pyproject.toml
+@@ -9,7 +9,7 @@ authors = [
+   { name="Simon Glass", email="sjg@chromium.org" },
+ ]
+ description = "U-Boot python library"
+-readme = "README.md"
++readme = "README.rst"
+ requires-python = ">=3.7"
+ classifiers = [
+     "Programming Language :: Python :: 3",
+@@ -20,3 +20,7 @@ classifiers = [
+ [project.urls]
+ "Homepage" = "https://u-boot.readthedocs.io"
+ "Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
++
++[tool.setuptools.packages.find]
++where = [".."]
++include = ["u_boot_pylib*"]
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v4 5/5] gnu: patman: Add python-u-boot-pylib to inputs.
  2023-07-20  1:44 ` [bug#64149] [PATCH v4 0/5] Update U-boot " vagrant
                     ` (3 preceding siblings ...)
  2023-07-20  1:44   ` [bug#64149] [PATCH v4 4/5] gnu: Add python-u-boot-pylib vagrant
@ 2023-07-20  1:44   ` vagrant
  2023-07-20  3:37   ` [bug#64149] [PATCH v4 0/5] Update U-boot to 2023.07.02 Maxim Cournoyer
  5 siblings, 0 replies; 46+ messages in thread
From: vagrant @ 2023-07-20  1:44 UTC (permalink / raw)
  To: 64149; +Cc: vagrant, ludo, efraim, maxim.cournoyer

From: Maxim Cournoyer <maxim.cournoyer@gmail.com>

* gnu/packages/bootloaders.scm (patman) [inputs]: Add python-u-boot-pylib.
[phases]: Remove 'sanity-check.
---
 gnu/packages/bootloaders.scm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 8afb2c3293..30ef673f7d 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -876,10 +876,13 @@ (define-public patman
       #:tests? #f
       #:phases
       #~(modify-phases %standard-phases
+          ;; Patman fails to run during 'sanity-check phase, as it needs to be
+          ;; run within a git directory.
+          (delete 'sanity-check)
           (add-after 'unpack 'chdir
             (lambda _
               (chdir "tools/patman"))))))
-    (inputs (list python-pygit2 python-requests))
+    (inputs (list python-pygit2 python-requests python-u-boot-pylib))
     (synopsis "Patch automation tool")
     (description "Patman is a patch automation script which:
 @itemize
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [bug#64149] [PATCH v4 0/5] Update U-boot to 2023.07.02.
  2023-07-20  1:44 ` [bug#64149] [PATCH v4 0/5] Update U-boot " vagrant
                     ` (4 preceding siblings ...)
  2023-07-20  1:44   ` [bug#64149] [PATCH v4 5/5] gnu: patman: Add python-u-boot-pylib to inputs vagrant
@ 2023-07-20  3:37   ` Maxim Cournoyer
  2023-07-20  6:01     ` bug#64142: Update U-boot to 2023.07.02, arm-trusted-firmware to 2.9 Vagrant Cascadian
  5 siblings, 1 reply; 46+ messages in thread
From: Maxim Cournoyer @ 2023-07-20  3:37 UTC (permalink / raw)
  To: vagrant; +Cc: 64149, ludo, efraim

Hello,

vagrant@debian.org writes:

> From: Vagrant Cascadian <vagrant@debian.org>
>
> I *think* I have resolved all mentioned issues so far.
>
> This series keeps arm-trusted-firmware-imx8mq at 2.8, as it no longer builds.
>
> It turns out using the #:config to disable CONFIG_SPL_FIT_SIGNATURE is working
> after all, so only used that one.

Great!

I haven't been able to apply this series locally, but I've had a glimpse
and it LGTM.  Feel free to push it!

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 46+ messages in thread

* bug#64142: Update U-boot to 2023.07.02, arm-trusted-firmware to 2.9
  2023-07-20  3:37   ` [bug#64149] [PATCH v4 0/5] Update U-boot to 2023.07.02 Maxim Cournoyer
@ 2023-07-20  6:01     ` Vagrant Cascadian
  0 siblings, 0 replies; 46+ messages in thread
From: Vagrant Cascadian @ 2023-07-20  6:01 UTC (permalink / raw)
  To: Maxim Cournoyer
  Cc: 64149-done, jonathan.brielmaier, ludo, efraim, 64142-done, marius,
	phodina

[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]

On 2023-07-19, Maxim Cournoyer wrote:
> vagrant@debian.org writes:
>> From: Vagrant Cascadian <vagrant@debian.org>
>>
>> I *think* I have resolved all mentioned issues so far.
>>
>> This series keeps arm-trusted-firmware-imx8mq at 2.8, as it no longer builds.
>>
>> It turns out using the #:config to disable CONFIG_SPL_FIT_SIGNATURE is working
>> after all, so only used that one.
>
> Great!
>
> I haven't been able to apply this series locally, but I've had a glimpse
> and it LGTM.  Feel free to push it!

Thanks for the review!

Pushed as:

cf1216d8763adf3c5e9d79d7abd2c5ecc8861d60 gnu: patman: Add python-u-boot-pylib to inputs.
ffbcc113df02293e1676310dbf3bfb23df8cae10 gnu: Add python-u-boot-pylib.
ed5dc3a25d858a394bb7db937a51d866c3cdc6ed gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts.
b0d47d9e18e52ff7935aebe6ab37e702f58101be gnu: u-boot: Update to 2023.07.02.
d6a53849935f8584e1df57faa79c18c23fbb2aa1 gnu: arm-trusted-firmware: Update to 2.9.


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2023-07-20  6:02 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-18  8:49 [bug#64149] WIP update u-boot to 2023.07-rc4 Vagrant Cascadian
2023-07-03  1:26 ` [bug#64149] WIP update u-boot to 2023.07-rc5 Vagrant Cascadian
2023-07-04 22:59   ` Vagrant Cascadian
2023-07-05  1:10     ` Vagrant Cascadian
2023-07-05  1:13       ` Vagrant Cascadian
2023-07-05  2:50         ` [bug#64149] WIP update u-boot to 2023.07-rc6 Vagrant Cascadian
2023-07-06 17:50           ` Vagrant Cascadian
2023-07-08  4:03             ` [bug#64149] [PATCH 0/2] Maxim Cournoyer
2023-07-08  4:03             ` [bug#64149] [PATCH 1/2] gnu: Add python-u-boot-pylib Maxim Cournoyer
2023-07-08  4:03             ` [bug#64149] [PATCH 2/2] gnu: patman: Add python-u-boot-pylib to inputs Maxim Cournoyer
2023-07-08 23:21               ` Vagrant Cascadian
2023-07-09  2:36                 ` Vagrant Cascadian
2023-07-10  4:01                 ` Maxim Cournoyer
2023-07-08  4:23           ` [bug#64149] WIP update u-boot to 2023.07-rc4 Maxim Cournoyer
2023-07-08 21:36             ` Vagrant Cascadian
2023-07-09  1:38               ` [bug#64149] [PATCH v2] bug#64149: WIP update u-boot to 2023.07-rc6 Vagrant Cascadian
2023-07-09  1:47                 ` [bug#64149] [PATCH 1/5] gnu: arm-trusted-firmware: Update to 2.9 vagrant
2023-07-09  1:47                   ` [bug#64149] [PATCH 2/5] gnu: u-boot: Update to 2023.07-rc6 vagrant
2023-07-10 19:35                     ` Vagrant Cascadian
2023-07-09  1:47                   ` [bug#64149] [PATCH 3/5] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts vagrant
2023-07-09  1:47                   ` [bug#64149] [PATCH 4/5] gnu: Add python-u-boot-pylib vagrant
2023-07-09  1:47                   ` [bug#64149] [PATCH 5/5] gnu: patman: Add python-u-boot-pylib to inputs vagrant
2023-07-10 19:39                     ` Vagrant Cascadian
2023-07-12 14:49 ` [bug#64149] [PATCH v3 0/6] Update u-boot to 2023.07.02 Vagrant Cascadian
2023-07-12 14:52   ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 vagrant
2023-07-12 14:52     ` [bug#64149] [PATCH v3 2/6] gnu: u-boot: Update to 2023.07.02 vagrant
2023-07-15  2:42       ` Maxim Cournoyer
2023-07-15  4:51         ` Vagrant Cascadian
2023-07-16  3:04           ` Maxim Cournoyer
2023-07-16  4:04             ` Vagrant Cascadian
2023-07-12 14:52     ` [bug#64149] [PATCH v3 3/6] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts vagrant
2023-07-15  2:46       ` Maxim Cournoyer
2023-07-12 14:52     ` [bug#64149] [PATCH v3 4/6] gnu: Add python-u-boot-pylib vagrant
2023-07-12 14:52     ` [bug#64149] [PATCH v3 5/6] gnu: patman: Add python-u-boot-pylib to inputs vagrant
2023-07-12 14:52     ` [bug#64149] [PATCH v3 6/6] (patman)[phases]: Remove 'sanity-check vagrant
2023-07-15  2:51       ` Maxim Cournoyer
2023-07-15  2:31     ` [bug#64149] [PATCH v3 1/6] gnu: arm-trusted-firmware: Update to 2.9 Maxim Cournoyer
2023-07-13 13:52   ` [bug#64149] Update u-boot to 2023.07.02 Vagrant Cascadian
2023-07-20  1:44 ` [bug#64149] [PATCH v4 0/5] Update U-boot " vagrant
2023-07-20  1:44   ` [bug#64149] [PATCH v4 1/5] gnu: arm-trusted-firmware: Update to 2.9 vagrant
2023-07-20  1:44   ` [bug#64149] [PATCH v4 2/5] gnu: u-boot: Update to 2023.07.02 vagrant
2023-07-20  1:44   ` [bug#64149] [PATCH v4 3/5] gnu: u-boot: Add crust firmware to pinebook, pine64_plus and pine64-lts vagrant
2023-07-20  1:44   ` [bug#64149] [PATCH v4 4/5] gnu: Add python-u-boot-pylib vagrant
2023-07-20  1:44   ` [bug#64149] [PATCH v4 5/5] gnu: patman: Add python-u-boot-pylib to inputs vagrant
2023-07-20  3:37   ` [bug#64149] [PATCH v4 0/5] Update U-boot to 2023.07.02 Maxim Cournoyer
2023-07-20  6:01     ` bug#64142: Update U-boot to 2023.07.02, arm-trusted-firmware to 2.9 Vagrant Cascadian

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.