All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v5 05/13] binman: Add support for RISC-V OpenSBI fw_dynamic blob
Date: Mon, 10 May 2021 20:23:33 +0800	[thread overview]
Message-ID: <20210510122341.13798-6-bmeng.cn@gmail.com> (raw)
In-Reply-To: <20210510122341.13798-1-bmeng.cn@gmail.com>

Add an entry for RISC-V OpenSBI's 'fw_dynamic' firmware payload.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---

(no changes since v2)

Changes in v2:
- drop "size = <16>" in the binman node

 tools/binman/entries.rst          | 13 +++++++++++++
 tools/binman/etype/opensbi.py     | 23 +++++++++++++++++++++++
 tools/binman/ftest.py             |  7 +++++++
 tools/binman/test/201_opensbi.dts | 14 ++++++++++++++
 4 files changed, 57 insertions(+)
 create mode 100644 tools/binman/etype/opensbi.py
 create mode 100644 tools/binman/test/201_opensbi.dts

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index f1c3b7de7a..dcac700c46 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -761,6 +761,19 @@ binman.
 
 
 
+Entry: opensbi: RISC-V OpenSBI fw_dynamic blob
+----------------------------------------------
+
+Properties / Entry arguments:
+    - opensbi-path: Filename of file to read into entry. This is typically
+        called fw_dynamic.bin
+
+This entry holds the run-time firmware, typically started by U-Boot SPL.
+See the U-Boot README for your architecture or board for how to use it. See
+https://github.com/riscv/opensbi for more information about OpenSBI.
+
+
+
 Entry: powerpc-mpc85xx-bootpg-resetvec: PowerPC mpc85xx bootpg + resetvec code for U-Boot
 -----------------------------------------------------------------------------------------
 
diff --git a/tools/binman/etype/opensbi.py b/tools/binman/etype/opensbi.py
new file mode 100644
index 0000000000..74d473d535
--- /dev/null
+++ b/tools/binman/etype/opensbi.py
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2021, Bin Meng <bmeng.cn@gmail.com>
+#
+# Entry-type module for RISC-V OpenSBI binary blob
+#
+
+from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+
+class Entry_opensbi(Entry_blob_named_by_arg):
+    """RISC-V OpenSBI fw_dynamic blob
+
+    Properties / Entry arguments:
+        - opensbi-path: Filename of file to read into entry. This is typically
+            called fw_dynamic.bin
+
+    This entry holds the run-time firmware, typically started by U-Boot SPL.
+    See the U-Boot README for your architecture or board for how to use it. See
+    https://github.com/riscv/opensbi for more information about OpenSBI.
+    """
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node, 'opensbi')
+        self.external = True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index b0daccbc3b..5383eec489 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -76,6 +76,7 @@ FSP_M_DATA            = b'fsp_m'
 FSP_S_DATA            = b'fsp_s'
 FSP_T_DATA            = b'fsp_t'
 ATF_BL31_DATA         = b'bl31'
+OPENSBI_DATA          = b'opensbi'
 SCP_DATA              = b'scp'
 TEST_FDT1_DATA        = b'fdt1'
 TEST_FDT2_DATA        = b'test-fdt2'
@@ -178,6 +179,7 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('compress', COMPRESS_DATA)
         TestFunctional._MakeInputFile('compress_big', COMPRESS_DATA_BIG)
         TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)
+        TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA)
         TestFunctional._MakeInputFile('scp.bin', SCP_DATA)
 
         # Add a few .dtb files for testing
@@ -4535,5 +4537,10 @@ class TestFunctional(unittest.TestCase):
         expected += tools.GetBytes(0, 88 - len(expected)) + U_BOOT_NODTB_DATA
         self.assertEqual(expected, data)
 
+    def testPackOpenSBI(self):
+        """Test that an image with an OpenSBI binary can be created"""
+        data = self._DoReadFile('201_opensbi.dts')
+        self.assertEqual(OPENSBI_DATA, data[:len(OPENSBI_DATA)])
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/201_opensbi.dts b/tools/binman/test/201_opensbi.dts
new file mode 100644
index 0000000000..942183f990
--- /dev/null
+++ b/tools/binman/test/201_opensbi.dts
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		opensbi {
+			filename = "fw_dynamic.bin";
+		};
+	};
+};
-- 
2.25.1

  parent reply	other threads:[~2021-05-10 12:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 12:23 [PATCH v5 00/13] riscv: Switch to use binman to generate u-boot.itb Bin Meng
2021-05-10 12:23 ` [PATCH v5 01/13] common: kconfig: Correct a typo in SPL_LOAD_FIT Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FE5EA1264@ATCPCS12.andestech.com>
2021-05-12  3:38     ` Rick Chen
2021-05-10 12:23 ` [PATCH v5 02/13] binman: Correct '-a' description in the doc Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FE5EA1271@ATCPCS12.andestech.com>
2021-05-12  3:39     ` Rick Chen
2021-05-10 12:23 ` [PATCH v5 03/13] binman: Correct the comment for ATF entry type Bin Meng
2021-05-10 12:23 ` [PATCH v5 04/13] binman: test: Rename 172_fit_fdt.dts to 170_fit_fdt.dts Bin Meng
2021-05-10 12:23 ` Bin Meng [this message]
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FE5EA0B99@ATCPCS12.andestech.com>
2021-05-11  1:12     ` FW: [PATCH v5 05/13] binman: Add support for RISC-V OpenSBI fw_dynamic blob Rick Chen
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FE5EA12A3@ATCPCS12.andestech.com>
2021-05-12  3:44     ` Rick Chen
2021-05-10 12:23 ` [PATCH v5 06/13] makefile: Pass OpenSBI blob to binman make rules Bin Meng
2021-05-10 12:23 ` [PATCH v5 07/13] riscv: sifive: unleashed: Switch to use binman to generate u-boot.itb Bin Meng
2021-05-10 12:23 ` [PATCH v5 08/13] lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED Bin Meng
2021-05-10 16:28   ` Simon Glass
2021-05-10 16:34     ` Bin Meng
2021-05-10 16:46       ` Simon Glass
2021-05-10 12:23 ` [PATCH v5 09/13] binman: Support packaging U-Boot for scenarios like OF_BOARD or OF_PRIOR_STAGE Bin Meng
2021-05-10 16:28   ` Simon Glass
2021-05-10 12:23 ` [PATCH v5 10/13] riscv: dts: Sort build targets in alphabetical order Bin Meng
2021-05-10 16:28   ` Simon Glass
2021-05-10 12:23 ` [PATCH v5 11/13] riscv: qemu: Switch to use binman to generate u-boot.itb Bin Meng
2021-05-10 12:23 ` [PATCH v5 12/13] riscv: ae350: " Bin Meng
2021-05-10 16:28   ` Simon Glass
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FE5EA1246@ATCPCS12.andestech.com>
2021-05-12  3:35     ` Rick Chen
2021-05-10 12:23 ` [PATCH v5 13/13] riscv: Drop USE_SPL_FIT_GENERATOR Bin Meng
2021-05-10 16:28   ` 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=20210510122341.13798-6-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --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.