U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jonas Karlman <jonas@kwiboo.se>
To: Simon Glass <sjg@chromium.org>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Kever Yang <kever.yang@rock-chips.com>,
	Joseph Chen <chenjh@rock-chips.com>,
	Alper Nebi Yasak <alpernebiyasak@gmail.com>
Cc: Quentin Schulz <quentin.schulz@theobroma-systems.com>,
	Jagan Teki <jagan@edgeble.ai>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	u-boot@lists.denx.de, Jonas Karlman <jonas@kwiboo.se>
Subject: [PATCH 1/3] binman: Add support for an external-tpl entry
Date: Sun, 05 Feb 2023 20:21:21 +0000 (UTC)	[thread overview]
Message-ID: <20230205202116.2891673-2-jonas@kwiboo.se> (raw)
In-Reply-To: <20230205202116.2891673-1-jonas@kwiboo.se>

The external-tpl entry can be used when an external TPL binary must be
used instead of normal U-Boot TPL.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
 tools/binman/entries.rst               | 12 ++++++++++++
 tools/binman/etype/external_tpl.py     | 18 ++++++++++++++++++
 tools/binman/ftest.py                  |  7 +++++++
 tools/binman/test/277_external_tpl.dts | 16 ++++++++++++++++
 4 files changed, 53 insertions(+)
 create mode 100644 tools/binman/etype/external_tpl.py
 create mode 100644 tools/binman/test/277_external_tpl.dts

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index 7a04a613992d..95317271bb74 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -468,6 +468,18 @@ updating the EC on startup via software sync.
 
 
 
+.. _etype_external_tpl:
+
+Entry: external-tpl: External TPL binary
+----------------------------------------
+
+Properties / Entry arguments:
+    - external-tpl-path: Filename of file to read into the entry.
+
+This entry holds an external TPL binary.
+
+
+
 .. _etype_fdtmap:
 
 Entry: fdtmap: An entry which contains an FDT map
diff --git a/tools/binman/etype/external_tpl.py b/tools/binman/etype/external_tpl.py
new file mode 100644
index 000000000000..50562914711e
--- /dev/null
+++ b/tools/binman/etype/external_tpl.py
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Entry-type module for external TPL binary
+#
+
+from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+
+class Entry_external_tpl(Entry_blob_named_by_arg):
+    """External TPL binary
+
+    Properties / Entry arguments:
+        - external-tpl-path: Filename of file to read into the entry.
+
+    This entry holds an external TPL binary.
+    """
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node, 'external-tpl')
+        self.external = True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 6b203dfb644f..2446122eea29 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -90,6 +90,7 @@ TEE_OS_DATA           = b'this is some tee OS data'
 ATF_BL2U_DATA         = b'bl2u'
 OPENSBI_DATA          = b'opensbi'
 SCP_DATA              = b'scp'
+EXTERNAL_TPL_DATA     = b'external-tpl'
 TEST_FDT1_DATA        = b'fdt1'
 TEST_FDT2_DATA        = b'test-fdt2'
 ENV_DATA              = b'var1=1\nvar2="2"'
@@ -205,6 +206,7 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA)
         TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA)
         TestFunctional._MakeInputFile('scp.bin', SCP_DATA)
+        TestFunctional._MakeInputFile('external-tpl.bin', EXTERNAL_TPL_DATA)
 
         # Add a few .dtb files for testing
         TestFunctional._MakeInputFile('%s/test-fdt1.dtb' % TEST_FDT_SUBDIR,
@@ -4103,6 +4105,11 @@ class TestFunctional(unittest.TestCase):
         data = self._DoReadFile('172_scp.dts')
         self.assertEqual(SCP_DATA, data[:len(SCP_DATA)])
 
+    def testPackExternalTpl(self):
+        """Test that an image with an external TPL binary can be created"""
+        data = self._DoReadFile('277_external_tpl.dts')
+        self.assertEqual(EXTERNAL_TPL_DATA, data[:len(EXTERNAL_TPL_DATA)])
+
     def testFitFdt(self):
         """Test an image with an FIT with multiple FDT images"""
         def _CheckFdt(seq, expected_data):
diff --git a/tools/binman/test/277_external_tpl.dts b/tools/binman/test/277_external_tpl.dts
new file mode 100644
index 000000000000..99899771ea7c
--- /dev/null
+++ b/tools/binman/test/277_external_tpl.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		size = <16>;
+
+		external-tpl {
+			filename = "external-tpl.bin";
+		};
+	};
+};
-- 
2.39.1


  reply	other threads:[~2023-02-05 20:21 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-05 20:21 [PATCH 0/3] rockchip: Use external TPL binary to create a working firmware image Jonas Karlman
2023-02-05 20:21 ` Jonas Karlman [this message]
2023-02-07  4:02   ` [PATCH 1/3] binman: Add support for an external-tpl entry Simon Glass
2023-02-05 20:21 ` [PATCH 2/3] rockchip: Require an external TPL binary when TPL is missing Jonas Karlman
2023-02-05 20:28   ` Jagan Teki
2023-02-05 20:34     ` Jonas Karlman
2023-02-06 11:26   ` Quentin Schulz
2023-02-06 12:51     ` Jonas Karlman
2023-02-14  3:45       ` Kever Yang
2023-02-14 10:52         ` Jonas Karlman
2023-02-08 15:41     ` Kever Yang
2023-02-08 16:06       ` Quentin Schulz
2023-02-14  3:42         ` Kever Yang
2023-02-07  4:02   ` Simon Glass
2023-02-05 20:21 ` [PATCH 3/3] Revert "board: rockchip: Fix binman_init failure on EVB-RK3568" Jonas Karlman
2023-02-07  4:02   ` Simon Glass
2023-02-07  4:02 ` [PATCH 0/3] rockchip: Use external TPL binary to create a working firmware image Simon Glass
2023-02-08 14:53   ` Jonas Karlman
2023-02-14 10:33 ` [PATCH v2 0/5] " Jonas Karlman
2023-02-14 10:33   ` [PATCH v2 1/6] binman: Add support for a rockchip-tpl entry Jonas Karlman
2023-02-14 19:48     ` Simon Glass
2023-02-14 20:35       ` Jonas Karlman
2023-02-16  7:50     ` Kever Yang
2023-02-16 11:26     ` Eugen Hristev
2023-02-16 14:02       ` Jonas Karlman
2023-02-14 10:33   ` [PATCH v2 2/6] rockchip: Use an external TPL binary on RK3568 Jonas Karlman
2023-02-14 19:48     ` Simon Glass
2023-02-15  9:54       ` Jonas Karlman
2023-02-16  7:51     ` Kever Yang
2023-02-16  9:06     ` Jagan Teki
2023-02-14 10:33   ` [PATCH v2 3/6] Revert "board: rockchip: Fix binman_init failure on EVB-RK3568" Jonas Karlman
2023-02-16  7:51     ` Kever Yang
2023-02-14 10:33   ` [PATCH v2 4/6] rockchip: mkimage: Update init size limit Jonas Karlman
2023-02-16  7:59     ` Kever Yang
2023-02-16 14:36       ` Jonas Karlman
2023-02-14 10:33   ` [PATCH v2 5/6] rockchip: evb-rk3568: Update defconfig Jonas Karlman
2023-02-14 10:34   ` [PATCH v2 6/6] RFC: binman: Improve allow missing for mkimage entry Jonas Karlman
2023-02-14 19:48     ` Simon Glass
2023-02-15 18:25       ` Jonas Karlman
2023-02-17  2:55         ` Simon Glass
2023-02-17 14:42           ` Jonas Karlman

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=20230205202116.2891673-2-jonas@kwiboo.se \
    --to=jonas@kwiboo.se \
    --cc=alpernebiyasak@gmail.com \
    --cc=chenjh@rock-chips.com \
    --cc=jagan@edgeble.ai \
    --cc=kever.yang@rock-chips.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=quentin.schulz@theobroma-systems.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox