[PATCH v2 05/11] binman: Add support for ATF BL31
Simon Glass
sjg at chromium.org
Mon Aug 31 01:20:10 CEST 2020
Add an entry for ARM Trusted Firmware's 'BL31' payload, which is the
device's main firmware. Typically this is U-Boot.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v2:
- Update docs to mention both bl31.bin and bl31.elf
- Add the URL of ARM Trusted Firmware and mention of U-Boot docs
- Fix copyright year
- Update docs to indicate that BL31 is loaded from SPL
tools/binman/README.entries | 14 ++++++++++++++
tools/binman/etype/atf_bl31.py | 24 ++++++++++++++++++++++++
tools/binman/ftest.py | 9 +++++++++
tools/binman/test/165_atf_bl31.dts | 16 ++++++++++++++++
4 files changed, 63 insertions(+)
create mode 100644 tools/binman/etype/atf_bl31.py
create mode 100644 tools/binman/test/165_atf_bl31.dts
diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 1086a6a9790..8999d5eb387 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -11,6 +11,20 @@ features to produce new behaviours.
+Entry: atf-bl31: Entry containing an ARM Trusted Firmware (ATF) BL31 blob
+-------------------------------------------------------------------------
+
+Properties / Entry arguments:
+ - atf-bl31-path: Filename of file to read into entry. This is typically
+ called bl31.bin or bl31.elf
+
+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/ARM-software/arm-trusted-firmware for more information
+about ATF.
+
+
+
Entry: blob: Entry containing an arbitrary binary blob
------------------------------------------------------
diff --git a/tools/binman/etype/atf_bl31.py b/tools/binman/etype/atf_bl31.py
new file mode 100644
index 00000000000..195adc714b5
--- /dev/null
+++ b/tools/binman/etype/atf_bl31.py
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2020 Google LLC
+# Written by Simon Glass <sjg at chromium.org>
+#
+# Entry-type module for Intel Management Engine binary blob
+#
+
+from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+
+class Entry_atf_bl31(Entry_blob_named_by_arg):
+ """Entry containing an ARM Trusted Firmware (ATF) BL31 blob
+
+ Properties / Entry arguments:
+ - atf-bl31-path: Filename of file to read into entry. This is typically
+ called bl31.bin or bl31.elf
+
+ 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/ARM-software/arm-trusted-firmware for more information
+ about ATF.
+ """
+ def __init__(self, section, etype, node):
+ super().__init__(section, etype, node, 'atf-bl31')
+ self.external = True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 6c63cd10c68..4fe0316ba19 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -74,6 +74,7 @@ REFCODE_DATA = b'refcode'
FSP_M_DATA = b'fsp_m'
FSP_S_DATA = b'fsp_s'
FSP_T_DATA = b'fsp_t'
+ATF_BL31_DATA = b'bl31'
# The expected size for the device tree in some tests
EXTRACT_DTB_SIZE = 0x3c9
@@ -167,6 +168,7 @@ class TestFunctional(unittest.TestCase):
os.path.join(cls._indir, 'files'))
TestFunctional._MakeInputFile('compress', COMPRESS_DATA)
+ TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA)
# Travis-CI may have an old lz4
cls.have_lz4 = True
@@ -3504,5 +3506,12 @@ class TestFunctional(unittest.TestCase):
self.assertIn("Missing required properties/entry args: cros-ec-rw-path",
str(e.exception))
+ def testPackBl31(self):
+ """Test that an image with an ATF BL31 binary can be created"""
+ data = self._DoReadFile('165_atf_bl31.dts')
+ self.assertEqual(ATF_BL31_DATA, data[:len(ATF_BL31_DATA)])
+
+ATF_BL31_DATA
+
if __name__ == "__main__":
unittest.main()
diff --git a/tools/binman/test/165_atf_bl31.dts b/tools/binman/test/165_atf_bl31.dts
new file mode 100644
index 00000000000..2b7547d70f9
--- /dev/null
+++ b/tools/binman/test/165_atf_bl31.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ size = <16>;
+
+ atf-bl31 {
+ filename = "bl31.bin";
+ };
+ };
+};
--
2.28.0.402.g5ffc5be6b7-goog
More information about the U-Boot
mailing list