Skip to contentSkip to conversation

Add support for building Snagboot

PATCH Applied Thomas Petazzoni via buildroot 2 participants 18 messages Oct 18, 2025 – Nov 17, 2025

lore
Share & tools
lore
#0 lore raw

cover Add support for building Snagboot

Hello,

Snagboot <https://github.com/bootlin/snagboot/> is an open-source and platform-agnostic tool to recover and reflash embedded platforms, replacing vendor-specific tools by a single unified tool.

This patch series aims at allowing to build Snagboot for the host as part of a Buildroot build, so that a Buildroot user can use Snagboot after the build to recover/reflash an embedded platform.

Snagboot requires a number of dependencies, which is why we are adding python-crccheck, python-fs and python-pyfatfs as new packages, and also enabling host variants for the existing python-tftpy, python-pyusb, python-xmodem and python-appdirs packages.

Since we're adding so many host Python packages, we thought it would be a good idea to test them, but our runtime testing infrastructure wasn't really convenient to test host packages. The first two patches therefore propose some improvements to the testing infrastructure, which are then use by the remaining patches to make sure we at least minimally test that host Python packages work.

Let me know what you think!

Thomas

Thomas Petazzoni (11):
support/testing/infra: improve run_cmd_on_host() to show stdout/stderr support/testing/infra/basetest.py: add BRHostPkgTest class package/python-crccheck: new package support/testing/tests/package/test_python_serial.py: new test case package/python-tftpy: add host variant package/python-pyusb: enable host variant package/python-xmodem: add host variant package/python-appdirs: add host variant package/python-fs: new package
package/python-pyfatfs: new package
package/snagboot: new package

 DEVELOPERS                                    | 11 ++++
 package/Config.in.host                        |  1 +
 package/python-appdirs/python-appdirs.mk      |  1 +
 package/python-crccheck/python-crccheck.hash  |  4 ++
 package/python-crccheck/python-crccheck.mk    | 15 ++++++
 package/python-fs/python-fs.hash              |  5 ++
 package/python-fs/python-fs.mk                | 15 ++++++
 ...oject.toml-relax-version-constraints.patch | 45 ++++++++++++++++
 package/python-pyfatfs/python-pyfatfs.hash    |  4 ++
 package/python-pyfatfs/python-pyfatfs.mk      | 17 ++++++
 package/python-pyusb/python-pyusb.mk          |  2 +
 package/python-tftpy/python-tftpy.mk          |  1 +
 package/python-xmodem/python-xmodem.mk        |  1 +
 package/snagboot/Config.in.host               |  8 +++
 package/snagboot/snagboot.hash                |  3 ++
 package/snagboot/snagboot.mk                  | 29 ++++++++++
 support/testing/infra/__init__.py             | 19 +++++--
 support/testing/infra/basetest.py             | 22 ++++++++
 .../tests/package/test_python_crccheck.py     | 10 ++++
 .../testing/tests/package/test_python_fs.py   |  9 ++++
 .../tests/package/test_python_pyfatfs.py      | 53 +++++++++++++++++++
 .../tests/package/test_python_pyusb.py        |  9 ++++
 .../tests/package/test_python_serial.py       | 12 +++++
 .../tests/package/test_python_tftpy.py        |  9 ++++
 .../tests/package/test_python_xmodem.py       |  9 ++++
 .../testing/tests/package/test_snagboot.py    | 16 ++++++
 26 files changed, 325 insertions(+), 5 deletions(-)
 create mode 100644 package/python-crccheck/python-crccheck.hash
 create mode 100644 package/python-crccheck/python-crccheck.mk
 create mode 100644 package/python-fs/python-fs.hash
 create mode 100644 package/python-fs/python-fs.mk
 create mode 100644 package/python-pyfatfs/0001-pyproject.toml-relax-version-constraints.patch
 create mode 100644 package/python-pyfatfs/python-pyfatfs.hash
 create mode 100644 package/python-pyfatfs/python-pyfatfs.mk
 create mode 100644 package/snagboot/Config.in.host
 create mode 100644 package/snagboot/snagboot.hash
 create mode 100644 package/snagboot/snagboot.mk
 create mode 100644 support/testing/tests/package/test_python_crccheck.py
 create mode 100644 support/testing/tests/package/test_python_fs.py
 create mode 100644 support/testing/tests/package/test_python_pyfatfs.py
 create mode 100644 support/testing/tests/package/test_python_pyusb.py
 create mode 100644 support/testing/tests/package/test_python_serial.py
 create mode 100644 support/testing/tests/package/test_python_xmodem.py
 create mode 100644 support/testing/tests/package/test_snagboot.py
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/11 support/testing/infra: improve run_cmd_on_host() to show stdout/stderr

When run_cmd_on_host() runs a command that fails, we only get an exception with no details to debug what happened. Let's improve that by catching the exception, and printing the command output. This requires redirecting stderr to stdout (instead of /dev/null) and asking to get the output in text format.

---
 support/testing/infra/__init__.py | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
support/testing/infra/__init__.py +14 -5
index 1f003f24c6..52308395a3 100644
@@ -59,11 +59,20 @@ def download(dldir, filename):
 
 def run_cmd_on_host(builddir, cmd):
     """Call subprocess.check_output and return the text output."""
-    out = subprocess.check_output(cmd,
-                                  stderr=open(os.devnull, "w"),
-                                  cwd=builddir,
-                                  env={"LANG": "C"},
-                                  universal_newlines=True)
+    try:
+        out = subprocess.check_output(cmd,
+                                      cwd=builddir,
+                                      env={"LANG": "C"},
+                                      stderr=subprocess.STDOUT,
+                                      text=True,
+                                      universal_newlines=True)
+    except subprocess.CalledProcessError as e:
+        print(f"Command failed with return code {e.returncode}")
+        print("=== STDOUT/STDERR ===")
+        print(e.output)
+        print("=====================")
+        raise
+
     return out
 
 
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 01/11] support/testing/infra: improve run_cmd_on_host() to show stdout/stderr

Quoted 7 lines · Thomas Petazzoni via buildroot

When run_cmd_on_host() runs a command that fails, we only get an exception with no details to debug what happened. Let's improve that by catching the exception, and printing the command output. This requires redirecting stderr to stdout (instead of /dev/null) and asking to get the output in text format.

Series applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Re: [Buildroot] [PATCH 01/11] support/testing/infra: improve run_cmd_on_host() to show stdout/stderr

In reply to Thomas Petazzoni via buildroot
Quoted 7 lines · Thomas Petazzoni via buildroot

When run_cmd_on_host() runs a command that fails, we only get an exception with no details to debug what happened. Let's improve that by catching the exception, and printing the command output. This requires redirecting stderr to stdout (instead of /dev/null) and asking to get the output in text format.

Applied to 2025.02.x and 2025.08.x, thanks.

Regards,
Arnout

Quoted 24 lines
---
  support/testing/infra/__init__.py | 19 ++++++++++++++-----
  1 file changed, 14 insertions(+), 5 deletions(-)
support/testing/infra/__init__.py +7 -5
index 1f003f24c6..52308395a3 100644
@@ -59,11 +59,20 @@ def download(dldir, filename):
 
  def run_cmd_on_host(builddir, cmd):
      """Call subprocess.check_output and return the text output."""
-    out = subprocess.check_output(cmd,
-                                  stderr=open(os.devnull, "w"),
-                                  cwd=builddir,
-                                  env={"LANG": "C"},
-                                  universal_newlines=True)
+    try:
+        out = subprocess.check_output(cmd,
+                                      cwd=builddir,
+                                      env={"LANG": "C"},
+                                      stderr=subprocess.STDOUT,
+                                      text=True,
+                                      universal_newlines=True)

support/testing/infra/__init__.py def download(dldir, filename): · line 78

Quoted 10 lines
support/testing/infra/__init__.py +7 -0
+    except subprocess.CalledProcessError as e:
+        print(f"Command failed with return code {e.returncode}")
+        print("=== STDOUT/STDERR ===")
+        print(e.output)
+        print("=====================")
+        raise
+
      return out
 
 

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

PATCH 2/11 support/testing/infra/basetest.py: add BRHostPkgTest class

In reply to Thomas Petazzoni via buildroot

Runtime test cases are currently mostly used to test target packages, and the BRTest class is perfect for that as we can easily feed a Buildroot configuration, boot it under Qemu and run commands inside the emulator.

A few tests use the more basic BRConfigTest when they have special needs that don't match with BRTest.

However, as we are going to add a number of tests to verify the proper functionality of some host only packages, which have no visible menuconfig option, it makes sense to add another BRHostPkgTest class that allows to easily trigger the build of "make host-<foo> host-<bar>", and then run some commands on the host machine. Such tests could be done by using BRConfigTest, but that would require a bit of duplicated boilerplate, which BRHostPkgTest allows to remove.

---
 support/testing/infra/basetest.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
support/testing/infra/basetest.py +22 -0
index 9fb9dffc53..13f9b2d398 100644
@@ -60,6 +60,28 @@ class BRConfigTest(unittest.TestCase):
             self.b.delete()
 
 
+class BRHostPkgTest(BRConfigTest):
+    """Test up to the build stage of a host package. Define hostpkgs in
+    the class to the list of host packages that should be built."""
+    config = \
+        BASIC_TOOLCHAIN_CONFIG + \
+        MINIMAL_CONFIG
+    hostpkgs = None
+
+    def __init__(self, names):
+        super(BRHostPkgTest, self).__init__(names)
+
+    def setUp(self):
+        super(BRHostPkgTest, self).setUp()
+        if not self.b.is_finished():
+            self.show_msg("Building")
+            self.b.build(make_extra_opts=self.hostpkgs)
+            self.show_msg("Building done")
+
+    def tearDown(self):
+        super(BRHostPkgTest, self).tearDown()
+
+
 class BRTest(BRConfigTest):
     """Test up to the build stage and instantiate an emulator."""
     def __init__(self, names):
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

PATCH 3/11 package/python-crccheck: new package

In reply to Thomas Petazzoni via buildroot

This commit adds a new host only package for the crccheck Python module, which is a dependency of Snagboot.

Homepage on PyPi: https://pypi.org/project/crccheck/

This commit also adds a very basic test case that allows to verify that the Python module can be imported and that some minimal functionality works.

---
 DEVELOPERS                                        |  2 ++
 package/python-crccheck/python-crccheck.hash      |  4 ++++
 package/python-crccheck/python-crccheck.mk        | 15 +++++++++++++++
 .../testing/tests/package/test_python_crccheck.py | 10 ++++++++++
 4 files changed, 31 insertions(+)
 create mode 100644 package/python-crccheck/python-crccheck.hash
 create mode 100644 package/python-crccheck/python-crccheck.mk
 create mode 100644 support/testing/tests/package/test_python_crccheck.py
DEVELOPERS +2 -0
index 69f22259e8..ec52defef8 100644
@@ -3251,6 +3251,7 @@ F:	package/pkg-autotools.mk
 F:	package/pkg-generic.mk
 F:	package/python3/
 F:	package/python-augeas/
+F:	package/python-crccheck/
 F:	package/python-flask-expects-json/
 F:	package/python-git/
 F:	package/python-qrcode/
@@ -3280,6 +3281,7 @@ F:	support/testing/tests/package/sample_python_git.py
 F:	support/testing/tests/package/sample_python_unittest_xml_reporting.py
 F:	support/testing/tests/package/test_nodejs.py
 F:	support/testing/tests/package/test_python_augeas.py
+F:	support/testing/tests/package/test_python_crccheck.py
 F:	support/testing/tests/package/test_python_flask.py
 F:	support/testing/tests/package/test_python_flask_expects_json.py
 F:	support/testing/tests/package/test_python_git.py
package/python-crccheck/python-crccheck.hash new file +4 -0
new file mode 100644
index 0000000000..3fb58a7299
@@ -0,0 +1,4 @@
+# From https://pypi.org/project/crccheck/#crccheck-1.3.1.tar.gz
+sha256  1544c0110bf0a697d875d4f29dc40d7079f9d4d402a9317383f55f90ca72563a  crccheck-1.3.1.tar.gz
+# Locally calculated
+sha256  1237ab8ea60caa782d77d9d2ac0cdccd765475e3848b0b91b5751d3f299e9d31  LICENSE.txt
package/python-crccheck/python-crccheck.mk new file +15 -0
new file mode 100644
index 0000000000..32c1341d32
@@ -0,0 +1,15 @@
+################################################################################
+#
+# python-crccheck
+#
+################################################################################
+
+PYTHON_CRCCHECK_VERSION = 1.3.1
+PYTHON_CRCCHECK_SOURCE = crccheck-$(PYTHON_CRCCHECK_VERSION).tar.gz
+PYTHON_CRCCHECK_SITE = https://files.pythonhosted.org/packages/3c/d1/a943f4f1ca899917cc3fe1cb89d59348edd1b407503e4b02608e8d6b421e
+PYTHON_CRCCHECK_LICENSE = MIT
+PYTHON_CRCCHECK_LICENSE_FILES = LICENSE.txt
+PYTHON_CRCCHECK_SETUP_TYPE = setuptools
+HOST_PYTHON_CRCCHECK_DEPENDENCIES = host-python-setuptools-scm
+
+$(eval $(host-python-package))
support/testing/tests/package/test_python_crccheck.py new file +10 -0
new file mode 100644
index 0000000000..d51bdc7c9f
@@ -0,0 +1,10 @@
+import infra.basetest
+
+
+class TestHostPythonCrccheck(infra.basetest.BRHostPkgTest):
+    hostpkgs = ["host-python-crccheck"]
+
+    def test_run(self):
+        cmd = ["host/bin/python3", "-c", "import crccheck; print(crccheck.crc.Crc32.calc(bytearray.fromhex('DEADBEEF')))"]
+        res = infra.run_cmd_on_host(self.builddir, cmd)
+        self.assertEqual(res.strip(), "2090640218")
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

PATCH 4/11 support/testing/tests/package/test_python_serial.py: new test case

In reply to Thomas Petazzoni via buildroot

This quickly tests that the host-python-serial package at least minimally works.

---
 DEVELOPERS                                          |  1 +
 support/testing/tests/package/test_python_serial.py | 12 ++++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 support/testing/tests/package/test_python_serial.py
DEVELOPERS +1 -0
index ec52defef8..6b525538d7 100644
@@ -3285,6 +3285,7 @@ F:	support/testing/tests/package/test_python_crccheck.py
 F:	support/testing/tests/package/test_python_flask.py
 F:	support/testing/tests/package/test_python_flask_expects_json.py
 F:	support/testing/tests/package/test_python_git.py
+F:	support/testing/tests/package/test_python_serial.py
 F:	support/testing/tests/package/test_python_unittest_xml_reporting.py
 F:	support/testing/tests/toolchain/test_external_arm.py
 F:	toolchain/
support/testing/tests/package/test_python_serial.py new file +12 -0
new file mode 100644
index 0000000000..c4b05a10fb
@@ -0,0 +1,12 @@
+import infra.basetest
+
+
+class TestHostPythonSerial(infra.basetest.BRHostPkgTest):
+    hostpkgs = ["host-python-serial"]
+
+    def test_run(self):
+        cmd = ["host/bin/python3", "-c", "import serial"]
+        infra.run_cmd_on_host(self.builddir, cmd)
+
+        cmd = ["host/bin/python3", "-m", "serial.tools.list_ports"]
+        infra.run_cmd_on_host(self.builddir, cmd)
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

PATCH 5/11 package/python-tftpy: add host variant

In reply to Thomas Petazzoni via buildroot

A host variant of python-tftpy will be needed for Snagboot, so enable it, and add a very simple test for the host package. We considered adding a test that actually starts a TFTP server with tftpy and then downloads from that server with the client-side of tftpy, but allocating an available UDP port reliably is tricky, so we kept the test case very simple for now.

---
 package/python-tftpy/python-tftpy.mk               | 1 +
 support/testing/tests/package/test_python_tftpy.py | 9 +++++++++
 2 files changed, 10 insertions(+)
package/python-tftpy/python-tftpy.mk +1 -0
index 66de17eaab..322d514f1f 100644
@@ -11,3 +11,4 @@ PYTHON_TFTPY_LICENSE_FILES = LICENSE
 PYTHON_TFTPY_SETUP_TYPE = setuptools
 
 $(eval $(python-package))
+$(eval $(host-python-package))
support/testing/tests/package/test_python_tftpy.py +9 -0
index d64f2c29d7..1dfbde0b67 100644
@@ -1,4 +1,5 @@
 from tests.package.test_python import TestPythonPackageBase
+import infra.basetest
 
 
 class TestPythonTftpy(TestPythonPackageBase):
@@ -9,3 +10,11 @@ class TestPythonTftpy(TestPythonPackageBase):
         BR2_PACKAGE_PYTHON_TFTPY=y
         """
     sample_scripts = ["tests/package/sample_python_tftpy.py"]
+
+
+class TestHostPythonTftpy(infra.basetest.BRHostPkgTest):
+    hostpkgs = ["host-python-tftpy"]
+
+    def test_run(self):
+        cmd = ["host/bin/python3", "-c", "import tftpy"]
+        infra.run_cmd_on_host(self.builddir, cmd)
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by on v1 5/11
#8 lore raw

Re: [Buildroot] [PATCH 05/11] package/python-tftpy: add host variant

Quoted 8 lines · Thomas Petazzoni

A host variant of python-tftpy will be needed for Snagboot, so enable it, and add a very simple test for the host package. We considered adding a test that actually starts a TFTP server with tftpy and then downloads from that server with the client-side of tftpy, but allocating an available UDP port reliably is tricky, so we kept the test case very simple for now.

Looks good to me. For what its worth:

The tftpy package is a little out of date. There were some issues with packaging / setuptools. I don't think it should make a difference to Buildroot, but I've been letting the dust settle either way. I can send a patch to the latest (0.8.6) if that's desired.

Colin

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#9 lore raw

PATCH 6/11 package/python-pyusb: enable host variant

In reply to Thomas Petazzoni via buildroot

The host variant of python-pyusb will be neded for Snagboot, so it is enabled with this commit. In addition, we're adding a very simple test case to validate that host-python-pyusb minimally works.

---
 DEVELOPERS                                         | 1 +
 package/python-pyusb/python-pyusb.mk               | 2 ++
 support/testing/tests/package/test_python_pyusb.py | 9 +++++++++
 3 files changed, 12 insertions(+)
 create mode 100644 support/testing/tests/package/test_python_pyusb.py
DEVELOPERS +1 -0
index 6b525538d7..4501a1c98d 100644
@@ -3285,6 +3285,7 @@ F:	support/testing/tests/package/test_python_crccheck.py
 F:	support/testing/tests/package/test_python_flask.py
 F:	support/testing/tests/package/test_python_flask_expects_json.py
 F:	support/testing/tests/package/test_python_git.py
+F:	support/testing/tests/package/test_python_pyusb.py
 F:	support/testing/tests/package/test_python_serial.py
 F:	support/testing/tests/package/test_python_unittest_xml_reporting.py
 F:	support/testing/tests/toolchain/test_external_arm.py
package/python-pyusb/python-pyusb.mk +2 -0
index 7f4c9724f2..cce48e0df8 100644
@@ -11,5 +11,7 @@ PYTHON_PYUSB_LICENSE = BSD-3-Clause
 PYTHON_PYUSB_LICENSE_FILES = LICENSE
 PYTHON_PYUSB_SETUP_TYPE = setuptools
 PYTHON_PYUSB_DEPENDENCIES = host-python-setuptools-scm libusb
+HOST_PYTHON_PYUSB_DEPENDENCIES = host-python-setuptools-scm host-libusb
 
 $(eval $(python-package))
+$(eval $(host-python-package))
support/testing/tests/package/test_python_pyusb.py new file +9 -0
new file mode 100644
index 0000000000..1e0dbba446
@@ -0,0 +1,9 @@
+import infra.basetest
+
+
+class TestHostPythonPyusb(infra.basetest.BRHostPkgTest):
+    hostpkgs = ["host-python-pyusb"]
+
+    def test_run(self):
+        cmd = ["host/bin/python3", "-c", "import usb"]
+        infra.run_cmd_on_host(self.builddir, cmd)
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw

PATCH 7/11 package/python-xmodem: add host variant

In reply to Thomas Petazzoni via buildroot

The host variant of python-xmodem will be needed by Snagboot, so this commit enables it. We also add a very simple test case that simply makes sure we can import the module. Testing xmodem more extensively is difficult without an actual serial port to open.

---
 DEVELOPERS                                          | 1 +
 package/python-xmodem/python-xmodem.mk              | 1 +
 support/testing/tests/package/test_python_xmodem.py | 9 +++++++++
 3 files changed, 11 insertions(+)
 create mode 100644 support/testing/tests/package/test_python_xmodem.py
DEVELOPERS +1 -0
index 4501a1c98d..63c8d5673c 100644
@@ -3288,6 +3288,7 @@ F:	support/testing/tests/package/test_python_git.py
 F:	support/testing/tests/package/test_python_pyusb.py
 F:	support/testing/tests/package/test_python_serial.py
 F:	support/testing/tests/package/test_python_unittest_xml_reporting.py
+F:	support/testing/tests/package/test_python_xmodem.py
 F:	support/testing/tests/toolchain/test_external_arm.py
 F:	toolchain/
 
package/python-xmodem/python-xmodem.mk +1 -0
index d7040f7245..1ef5f53bec 100644
@@ -12,3 +12,4 @@ PYTHON_XMODEM_LICENSE = MIT
 PYTHON_XMODEM_LICENSE_FILES = LICENSE
 
 $(eval $(python-package))
+$(eval $(host-python-package))
support/testing/tests/package/test_python_xmodem.py new file +9 -0
new file mode 100644
index 0000000000..b9feb78109
@@ -0,0 +1,9 @@
+import infra.basetest
+
+
+class TestHostPythonXmodem(infra.basetest.BRHostPkgTest):
+    hostpkgs = ["host-python-xmodem"]
+
+    def test_run(self):
+        cmd = ["host/bin/python3", "-c", "import xmodem"]
+        infra.run_cmd_on_host(self.builddir, cmd)
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#11 lore raw

PATCH 8/11 package/python-appdirs: add host variant

In reply to Thomas Petazzoni via buildroot

The host variant will be needed by the host-python-fs package, soon to be added.

---
 package/python-appdirs/python-appdirs.mk | 1 +
 1 file changed, 1 insertion(+)
package/python-appdirs/python-appdirs.mk +1 -0
index 222aadbb29..3ecf281db0 100644
@@ -12,3 +12,4 @@ PYTHON_APPDIRS_LICENSE = MIT
 PYTHON_APPDIRS_LICENSE_FILES = LICENSE.txt
 
 $(eval $(python-package))
+$(eval $(host-python-package))
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#12 lore raw

PATCH 9/11 package/python-fs: new package

In reply to Thomas Petazzoni via buildroot

This commit adds a host package for the Python 'fs' module, needed as a dependency of pyfatfs, itself needed by Snagboot.

Homepage: https://pypi.org/project/fs/

In addition, a very simple test case is adding to check that host-python-fs is minimally working.

---
 DEVELOPERS                                      |  2 ++
 package/python-fs/python-fs.hash                |  5 +++++
 package/python-fs/python-fs.mk                  | 15 +++++++++++++++
 support/testing/tests/package/test_python_fs.py |  9 +++++++++
 4 files changed, 31 insertions(+)
 create mode 100644 package/python-fs/python-fs.hash
 create mode 100644 package/python-fs/python-fs.mk
 create mode 100644 support/testing/tests/package/test_python_fs.py
DEVELOPERS +2 -0
index 63c8d5673c..a774c30341 100644
@@ -3253,6 +3253,7 @@ F:	package/python3/
 F:	package/python-augeas/
 F:	package/python-crccheck/
 F:	package/python-flask-expects-json/
+F:	package/python-fs/
 F:	package/python-git/
 F:	package/python-qrcode/
 F:	package/python-serial/
@@ -3284,6 +3285,7 @@ F:	support/testing/tests/package/test_python_augeas.py
 F:	support/testing/tests/package/test_python_crccheck.py
 F:	support/testing/tests/package/test_python_flask.py
 F:	support/testing/tests/package/test_python_flask_expects_json.py
+F:	support/testing/tests/package/test_python_fs.py
 F:	support/testing/tests/package/test_python_git.py
 F:	support/testing/tests/package/test_python_pyusb.py
 F:	support/testing/tests/package/test_python_serial.py
package/python-fs/python-fs.hash new file +5 -0
new file mode 100644
index 0000000000..5ebb49128d
@@ -0,0 +1,5 @@
+# From https://pypi.org/project/fs/#fs-2.4.16.tar.gz
+sha256  ae97c7d51213f4b70b6a958292530289090de3a7e15841e108fbe144f069d313  fs-2.4.16.tar.gz
+
+# Locally calculated
+sha256  bcc1fbae1da071a15d17fd7609519af1160a3d72c65622047b61e19ba63e780d  LICENSE
package/python-fs/python-fs.mk new file +15 -0
new file mode 100644
index 0000000000..8d684e6ebd
@@ -0,0 +1,15 @@
+################################################################################
+#
+# python-fs
+#
+################################################################################
+
+PYTHON_FS_VERSION = 2.4.16
+PYTHON_FS_SOURCE = fs-$(PYTHON_FS_VERSION).tar.gz
+PYTHON_FS_SITE = https://files.pythonhosted.org/packages/5d/a9/af5bfd5a92592c16cdae5c04f68187a309be8a146b528eac3c6e30edbad2
+PYTHON_FS_SETUP_TYPE = setuptools
+PYTHON_FS_LICENSE = MIT
+PYTHON_FS_LICENSE_FILES = LICENSE
+HOST_PYTHON_FS_DEPENDENCIES = host-python-six host-python-appdirs
+
+$(eval $(host-python-package))
support/testing/tests/package/test_python_fs.py new file +9 -0
new file mode 100644
index 0000000000..a53d8a64c8
@@ -0,0 +1,9 @@
+import infra.basetest
+
+
+class TestHostPythonFs(infra.basetest.BRHostPkgTest):
+    hostpkgs = ["host-python-fs"]
+
+    def test_run(self):
+        cmd = ["host/bin/python3", "-c", "import fs; fs.open_fs('mem://'); fs.open_fs('temp://')"]
+        infra.run_cmd_on_host(self.builddir, cmd)
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#13 lore raw

PATCH 10/11 package/python-pyfatfs: new package

In reply to Thomas Petazzoni via buildroot

This commit adds a new host package for python-pyfatfs, which is needed by Snagboot.

Homepage: https://pypi.org/project/pyfatfs/

A small test doing some minimal verification that pyfatfs works is also added.

---
 DEVELOPERS                                    |  2 +
 ...oject.toml-relax-version-constraints.patch | 45 ++++++++++++++++
 package/python-pyfatfs/python-pyfatfs.hash    |  4 ++
 package/python-pyfatfs/python-pyfatfs.mk      | 17 ++++++
 .../tests/package/test_python_pyfatfs.py      | 53 +++++++++++++++++++
 5 files changed, 121 insertions(+)
 create mode 100644 package/python-pyfatfs/0001-pyproject.toml-relax-version-constraints.patch
 create mode 100644 package/python-pyfatfs/python-pyfatfs.hash
 create mode 100644 package/python-pyfatfs/python-pyfatfs.mk
 create mode 100644 support/testing/tests/package/test_python_pyfatfs.py
DEVELOPERS +2 -0
index a774c30341..7d48975896 100644
@@ -3255,6 +3255,7 @@ F:	package/python-crccheck/
 F:	package/python-flask-expects-json/
 F:	package/python-fs/
 F:	package/python-git/
+F:	package/python-pyfatfs/
 F:	package/python-qrcode/
 F:	package/python-serial/
 F:	package/python-unittest-xml-reporting/
@@ -3287,6 +3288,7 @@ F:	support/testing/tests/package/test_python_flask.py
 F:	support/testing/tests/package/test_python_flask_expects_json.py
 F:	support/testing/tests/package/test_python_fs.py
 F:	support/testing/tests/package/test_python_git.py
+F:	support/testing/tests/package/test_python_pyfatfs.py
 F:	support/testing/tests/package/test_python_pyusb.py
 F:	support/testing/tests/package/test_python_serial.py
 F:	support/testing/tests/package/test_python_unittest_xml_reporting.py
package/python-pyfatfs/0001-pyproject.toml-relax-version-constraints.patch new file +45 -0

45 lines not on this page · raw message

package/python-pyfatfs/python-pyfatfs.hash new file +4 -0
new file mode 100644
index 0000000000..05e940779e
@@ -0,0 +1,4 @@
+# From https://pypi.org/project/pyfatfs/#pyfatfs-1.1.0.tar.gz
+sha256  9725ccd0a4da1c09c27358abbf10f08c043ac84210af576803e087f51a2b30e0  pyfatfs-1.1.0.tar.gz
+# Locally calculated
+sha256  df8f053d3cbf23fe7002e6a34b06580653a74d40dc2e54f3b717a963ea9b70cb  LICENSE
package/python-pyfatfs/python-pyfatfs.mk new file +17 -0
new file mode 100644
index 0000000000..a61fb1afb2
@@ -0,0 +1,17 @@
+################################################################################
+#
+# python-pyfatfs
+#
+################################################################################
+
+PYTHON_PYFATFS_VERSION = 1.1.0
+PYTHON_PYFATFS_SOURCE = pyfatfs-$(PYTHON_PYFATFS_VERSION).tar.gz
+PYTHON_PYFATFS_SITE = https://files.pythonhosted.org/packages/44/3f/d08f1dbc44a7eef9c7fb355b83423fbd15bb3e487c250479a2c179cb39bf
+PYTHON_PYFATFS_LICENSE = MIT
+PYTHON_PYFATFS_LICENSE_FILES = LICENSE
+PYTHON_PYFATFS_SETUP_TYPE = setuptools
+# host-python-fs is not a build time dependency, but is needed at
+# runtime for host-python-pyfatfs to work
+HOST_PYTHON_PYFATFS_DEPENDENCIES = host-python-setuptools-scm host-python-fs
+
+$(eval $(host-python-package))
support/testing/tests/package/test_python_pyfatfs.py new file +53 -0

53 lines not on this page · raw message

Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#14 lore raw

PATCH 11/11 package/snagboot: new package

In reply to Thomas Petazzoni via buildroot

This commit adds a package for Snagboot, the open-source vendor-neutral recover and reflashing tool for embedded targets. We install the dependencies needed for snagrecover and snagflash, but we don't bother installing the dependencies of the GUI-based snagfactory, as that would require Kivy on the host, which is Qt based.

---
 DEVELOPERS                                    |  2 ++
 package/Config.in.host                        |  1 +
 package/snagboot/Config.in.host               |  8 +++++
 package/snagboot/snagboot.hash                |  3 ++
 package/snagboot/snagboot.mk                  | 29 +++++++++++++++++++
 .../testing/tests/package/test_snagboot.py    | 16 ++++++++++
 6 files changed, 59 insertions(+)
 create mode 100644 package/snagboot/Config.in.host
 create mode 100644 package/snagboot/snagboot.hash
 create mode 100644 package/snagboot/snagboot.mk
 create mode 100644 support/testing/tests/package/test_snagboot.py
DEVELOPERS +2 -0
index 7d48975896..1bc0824952 100644
@@ -3267,6 +3267,7 @@ F:	package/rt-tests/
 F:	package/rtc-tools/
 F:	package/sam-ba/
 F:	package/scons/
+F:	package/snagboot/
 F:	package/squashfs/
 F:	package/tinifier/
 F:	package/wayland/
@@ -3291,6 +3292,7 @@ F:	support/testing/tests/package/test_python_git.py
 F:	support/testing/tests/package/test_python_pyfatfs.py
 F:	support/testing/tests/package/test_python_pyusb.py
 F:	support/testing/tests/package/test_python_serial.py
+F:	support/testing/tests/package/test_snagboot.py
 F:	support/testing/tests/package/test_python_unittest_xml_reporting.py
 F:	support/testing/tests/package/test_python_xmodem.py
 F:	support/testing/tests/toolchain/test_external_arm.py
package/Config.in.host +1 -0
index b0f7529a13..d0088364d0 100644
@@ -112,6 +112,7 @@ menu "Host utilities"
 	source "package/sentry-cli/Config.in.host"
 	source "package/skopeo/Config.in.host"
 	source "package/sloci-image/Config.in.host"
+	source "package/snagboot/Config.in.host"
 	source "package/squashfs/Config.in.host"
 	source "package/starfive-spltool/Config.in.host"
 	source "package/sunxi-tools/Config.in.host"
package/snagboot/Config.in.host new file +8 -0
new file mode 100644
index 0000000000..3087348a87
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_HOST_SNAGBOOT
+	bool "host snagboot"
+	help
+	  Snagboot intends to be an open-source and generic
+	  replacement to the vendor-specific, sometimes proprietary,
+	  tools used to recover and/or reflash embedded platforms.
+
+	  https://github.com/bootlin/snagboot/
package/snagboot/snagboot.hash new file +3 -0
new file mode 100644
index 0000000000..e5978617aa
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  a3ace4245472141c0cdcd8e095530652ce95d804f7515a29613ddb07d2c32033  snagboot-2.4.tar.gz
+sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  LICENSE
package/snagboot/snagboot.mk new file +29 -0
new file mode 100644
index 0000000000..12f77c0b14
@@ -0,0 +1,29 @@
+################################################################################
+#
+# snagboot
+#
+################################################################################
+
+SNAGBOOT_VERSION = 2.4
+SNAGBOOT_SITE = $(call github,bootlin,snagboot,v$(SNAGBOOT_VERSION))
+SNAGBOOT_LICENSE = GPL-2.0
+SNAGBOOT_LICENSE_FILES = LICENSE
+SNAGBOOT_SETUP_TYPE = setuptools
+HOST_SNAGBOOT_DEPENDENCIES = \
+	host-python-pyyaml \
+	host-python-pyusb \
+	host-python-serial \
+	host-python-xmodem \
+	host-python-tftpy \
+	host-python-crccheck \
+	host-python-pylibfdt \
+	host-python-packaging \
+	host-python-pyfatfs
+
+# We do not install the dependencies for the snagfactory GUI
+define SNAGBOOT_REMOVE_SNAGFACTORY
+	$(RM) $(HOST_DIR)/bin/snagfactory
+endef
+HOST_SNAGBOOT_POST_INSTALL_HOOKS += SNAGBOOT_REMOVE_SNAGFACTORY
+
+$(eval $(host-python-package))
support/testing/tests/package/test_snagboot.py new file +16 -0
new file mode 100644
index 0000000000..65fe196520
@@ -0,0 +1,16 @@
+import infra.basetest
+
+
+class TestHostSnagboot(infra.basetest.BRHostPkgTest):
+    hostpkgs = ["host-snagboot"]
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_HOST_SNAGBOOT=y
+        """
+
+    def test_run(self):
+        cmd = ["host/bin/snagrecover", "--help"]
+        infra.run_cmd_on_host(self.builddir, cmd)
+
+        cmd = ["host/bin/snagflash", "--help"]
+        infra.run_cmd_on_host(self.builddir, cmd)
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#15 lore raw

Re: [Buildroot] [PATCH 11/11] package/snagboot: new package

Hi Thomas,

Quoted 1 line · On Saturday, 18 October 2025 21:43:09 CEST Thomas Petazzoni wrote:

This commit adds a package for Snagboot, the open-source

...

package/snagboot/snagboot.mk line 26

Quoted 5 lines
package/snagboot/snagboot.mk new file +5 -0
+
+# We do not install the dependencies for the snagfactory GUI
+define SNAGBOOT_REMOVE_SNAGFACTORY
+	$(RM) $(HOST_DIR)/bin/snagfactory
+endef

Only the "gui" variant of the Snagboot package provides Snagfactory, the base version doesn't, so is this removal really necessary?

Thanks!

Signature · 3 lines
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#16 lore raw

Re: [Buildroot] [PATCH 11/11] package/snagboot: new package

Hello Romain,

Quoted 2 lines · On Mon, 20 Oct 2025 09:17:49 +0200 Romain Gantois <[email protected]>…

Only the "gui" variant of the Snagboot package provides Snagfactory, the base version doesn't, so is this removal really necessary?

From my testing, the snagfactory main script gets installed, which is why I had to remove it.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#17 lore raw

Re: [Buildroot] [PATCH 11/11] package/snagboot: new package

Hi Thomas,

Quoted 10 lines · On Monday, 20 October 2025 09:54:51 CET Thomas Petazzoni wrote:

Hello Romain,

On Mon, 20 Oct 2025 09:17:49 +0200

Quoted 2 lines · Romain Gantois

Only the "gui" variant of the Snagboot package provides Snagfactory, the base version doesn't, so is this removal really necessary?

From my testing, the snagfactory main script gets installed, which is why I had to remove it.

Okay, lets just keep the removal for now then.

Signature · 3 lines
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot