Some SoCs require a Trusted Firmware-A (TF-A) AP Trusted ROM (BL1) to
initialize the SoC before U-Boot can run properly. Add an atf-bl1 etype
so we can properly package BL1 into a final binary

Signed-off-by: Bryan Brattlof <b...@ti.com>
---
 Makefile                      |  1 +
 tools/binman/entries.rst      | 16 ++++++++++++++++
 tools/binman/etype/atf_bl1.py | 23 +++++++++++++++++++++++
 tools/binman/ftest.py         |  7 +++++++
 tools/binman/test/347_bl1.dts | 13 +++++++++++++
 5 files changed, 60 insertions(+)

diff --git a/Makefile b/Makefile
index f3278e3b01387..4bc907d14b292 100644
--- a/Makefile
+++ b/Makefile
@@ -1414,6 +1414,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if 
$(BINMAN_DEBUG),-D) \
                -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
                $(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
                $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
+               -a atf-bl1-path=${BL1} \
                -a atf-bl31-path=${BL31} \
                -a tee-os-path=${TEE} \
                -a ti-dm-path=${TI_DM} \
diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index 4f05aa0a32362..12a39d070e48d 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -53,6 +53,22 @@ respecting the `bootph-xxx` tags in the devicetree.
 
 
 
+.. _etype_atf_bl1:
+
+Entry: atf-bl1: AP Trusted ROM (TF-A) BL1 blob
+-----------------------------------------------------
+
+Properties / Entry arguments:
+    - atf-bl1-path: Filename of file to read into entry. This is typically
+      called bl1.bin
+
+This entry holds the AP Trusted ROM firmware typically used by an SoC to
+help initialize the SoC before the SPL or U-Boot is started. See
+https://github.com/TrustedFirmware-A/trusted-firmware-a for more information
+about Boot Loader stage 1 (BL1) or about Trusted Firmware (TF-A)
+
+
+
 .. _etype_atf_bl31:
 
 Entry: atf-bl31: ARM Trusted Firmware (ATF) BL31 blob
diff --git a/tools/binman/etype/atf_bl1.py b/tools/binman/etype/atf_bl1.py
new file mode 100644
index 0000000000000..7adf10e693c7c
--- /dev/null
+++ b/tools/binman/etype/atf_bl1.py
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2025 Texas Instruments Incorporated
+#
+# Entry-type module for Application Processor Trusted ROM (BL1)
+#
+
+from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+
+class Entry_atf_bl1(Entry_blob_named_by_arg):
+    """Application Processor (AP) Trusted ROM BL1 blob
+
+    Properties / Entry arguments:
+        - atf-bl1-path: Filename of file to read into entry. This is typically
+            called bl1.bin or bl1.elf
+
+    This entry holds the boot code initialization like exception vectors and
+    processor and platform initialization.
+
+    See https://github.com/TrustedFirmware-A/trusted-firmware-a for more 
information.
+    """
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node, 'atf-bl1')
+        self.external = True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index fa17490001488..0c41b346821c9 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -87,6 +87,7 @@ REFCODE_DATA          = b'refcode'
 FSP_M_DATA            = b'fsp_m'
 FSP_S_DATA            = b'fsp_s'
 FSP_T_DATA            = b'fsp_t'
+ATF_BL1_DATA         = b'bl1'
 ATF_BL31_DATA         = b'bl31'
 TEE_OS_DATA           = b'this is some tee OS data'
 TI_DM_DATA            = b'tidmtidm'
@@ -225,6 +226,7 @@ class TestFunctional(unittest.TestCase):
 
         TestFunctional._MakeInputFile('compress', COMPRESS_DATA)
         TestFunctional._MakeInputFile('compress_big', COMPRESS_DATA_BIG)
+        TestFunctional._MakeInputFile('bl1.bin', ATF_BL1_DATA)
         TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)
         TestFunctional._MakeInputFile('tee-pager.bin', TEE_OS_DATA)
         TestFunctional._MakeInputFile('dm.bin', TI_DM_DATA)
@@ -5573,6 +5575,11 @@ fdt         fdtmap                Extract the devicetree 
blob from the fdtmap
         data = self._DoReadFile('225_ti_dm.dts')
         self.assertEqual(TI_DM_DATA, data[:len(TI_DM_DATA)])
 
+    def testPackBl1(self):
+        """test if an image with a bl1 binary can be created"""
+        data = self._DoReadFile('347_bl1.dts')
+        self.assertEqual(ATF_BL1_DATA, data[:len(ATF_BL1_DATA)])
+
     def testFitFdtOper(self):
         """Check handling of a specified FIT operation"""
         entry_args = {
diff --git a/tools/binman/test/347_bl1.dts b/tools/binman/test/347_bl1.dts
new file mode 100644
index 0000000000000..1a10995620450
--- /dev/null
+++ b/tools/binman/test/347_bl1.dts
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+       binman {
+               atf-bl1 {
+                       filename = "bl1.bin";
+               };
+       };
+};

---
base-commit: 1b5e435102aa29a665119430196cb366ce36a01b
change-id: 20250514-bl1-support-971d5d139ec1

Best regards,
-- 
Bryan Brattlof <b...@ti.com>

Reply via email to