All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
To: u-boot@lists.denx.de
Cc: Heiko Thiery <heiko.thiery@gmail.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Simon Glass <sjg@chromium.org>,
	Alper Nebi Yasak <alpernebiyasak@gmail.com>
Subject: [PATCH v2 2/5] binman: Register and check bintools from FIT subentries
Date: Tue,  8 Feb 2022 01:08:05 +0300	[thread overview]
Message-ID: <20220207220809.4497-3-alpernebiyasak@gmail.com> (raw)
In-Reply-To: <20220207220809.4497-1-alpernebiyasak@gmail.com>

Binman keeps track of binary tools each entry wants to use. The
implementation of this for the FIT entry only adds "mkimage", but not
the tools that would be used by its subentries.

Register the binary tools that FIT subentries will use in addition to
the one FIT itself uses, and check their existence by copying the
appropriate method from Section entry type. Also add tests that check if
these subentries can use and warn about binary tools.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Add tag: "Reviewed-by: Simon Glass <sjg@chromium.org>"

 tools/binman/etype/fit.py                     | 14 +++++++
 tools/binman/ftest.py                         | 25 ++++++++++++
 .../binman/test/220_fit_subentry_bintool.dts  | 39 +++++++++++++++++++
 3 files changed, 78 insertions(+)
 create mode 100644 tools/binman/test/220_fit_subentry_bintool.dts

diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index 38bc2a2d784e..9dffcd5adbd6 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -311,4 +311,18 @@ def SetAllowMissing(self, allow_missing):
             section.SetAllowMissing(allow_missing)
 
     def AddBintools(self, tools):
+        for section in self._fit_sections.values():
+            section.AddBintools(tools)
         self.mkimage = self.AddBintool(tools, 'mkimage')
+
+    def check_missing_bintools(self, missing_list):
+        """Check if any entries in this section have missing bintools
+
+        If there are missing bintools, these are added to the list
+
+        Args:
+            missing_list: List of Bintool objects to be added to
+        """
+        super().check_missing_bintools(missing_list)
+        for entry in self._fit_sections.values():
+            entry.check_missing_bintools(missing_list)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 626df786c8c9..bc073587cc07 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -5133,6 +5133,31 @@ def testListWithGenNode(self):
         finally:
             shutil.rmtree(tmpdir)
 
+    def testFitSubentryUsesBintool(self):
+        """Test that binman FIT subentries can use bintools"""
+        command.test_result = self._HandleGbbCommand
+        entry_args = {
+            'keydir': 'devkeys',
+            'bmpblk': 'bmpblk.bin',
+        }
+        data, _, _, _ = self._DoReadFileDtb('220_fit_subentry_bintool.dts',
+                entry_args=entry_args)
+
+        expected = (GBB_DATA + GBB_DATA + tools.GetBytes(0, 8) +
+                    tools.GetBytes(0, 0x2180 - 16))
+        self.assertIn(expected, data)
+
+    def testFitSubentryMissingBintool(self):
+        """Test that binman reports missing bintools for FIT subentries"""
+        entry_args = {
+            'keydir': 'devkeys',
+        }
+        with test_util.capture_sys_output() as (_, stderr):
+            self._DoTestFile('220_fit_subentry_bintool.dts',
+                    force_missing_bintools='futility', entry_args=entry_args)
+        err = stderr.getvalue()
+        self.assertRegex(err,
+                         "Image 'main-section'.*missing bintools.*: futility")
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/220_fit_subentry_bintool.dts b/tools/binman/test/220_fit_subentry_bintool.dts
new file mode 100644
index 000000000000..6e29d41eeb33
--- /dev/null
+++ b/tools/binman/test/220_fit_subentry_bintool.dts
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		fit {
+			description = "test-desc";
+			#address-cells = <1>;
+
+			images {
+				test {
+					description = "Something using a bintool";
+					type = "kernel";
+					arch = "arm";
+					os = "linux";
+					compression = "gzip";
+					load = <00000000>;
+					entry = <00000000>;
+
+					gbb {
+						size = <0x2180>;
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-1";
+				conf-1 {
+					description = "Boot bintool output";
+					kernel = "kernel";
+				};
+			};
+		};
+	};
+};
-- 
2.34.1


  parent reply	other threads:[~2022-02-07 22:08 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07 22:08 [PATCH v2 0/5] binman: Improvements to FIT entry type Alper Nebi Yasak
2022-02-07 22:08 ` [PATCH v2 1/5] binman: Fix subentry expansion for " Alper Nebi Yasak
2022-02-08 15:05   ` Simon Glass
2022-02-08 20:39   ` Simon Glass
2022-02-07 22:08 ` Alper Nebi Yasak [this message]
2022-02-07 22:08 ` [PATCH v2 3/5] binman: Check missing bintools of Section subclasses Alper Nebi Yasak
2022-02-07 22:08 ` [PATCH v2 4/5] binman: Convert FIT entry type to a subclass of Section entry type Alper Nebi Yasak
2022-02-14  9:09   ` Jan Kiszka
2022-02-15 12:27     ` Alper Nebi Yasak
2022-02-15 16:50       ` Jan Kiszka
2022-02-15 17:06         ` Jan Kiszka
2022-02-18 16:50           ` Jan Kiszka
2022-02-18 17:34             ` Alper Nebi Yasak
2022-02-19 15:53               ` Simon Glass
2022-02-21  4:40                 ` Simon Glass
2022-02-22 18:58                   ` Alper Nebi Yasak
2022-02-23 22:59                     ` Simon Glass
2022-02-28 11:48                       ` Jan Kiszka
2022-02-28 13:51                         ` Alper Nebi Yasak
2022-02-28 13:56                         ` Simon Glass
2022-02-28 14:14                           ` Jan Kiszka
2022-02-07 22:08 ` [PATCH v2 5/5] binman: Update image positions of FIT subentries Alper Nebi Yasak
2022-02-08 20:43   ` Simon Glass
2022-02-23  2:35   ` Simon Glass
2022-02-08 20:39 ` [PATCH v2 4/5] binman: Convert FIT entry type to a subclass of Section entry type Simon Glass
2022-02-08 20:39 ` [PATCH v2 3/5] binman: Check missing bintools of Section subclasses Simon Glass
2022-02-08 20:39 ` [PATCH v2 2/5] binman: Register and check bintools from FIT subentries Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220207220809.4497-3-alpernebiyasak@gmail.com \
    --to=alpernebiyasak@gmail.com \
    --cc=heiko.thiery@gmail.com \
    --cc=jan.kiszka@siemens.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.