Skip to contentSkip to conversation

Migration to using binman to generate

PATCH Superseded Neha Malcom Francis 3 participants 28 messages Apr 4, 2023 – Apr 12, 2023

Subsystems (3)

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v2 cover Migration to using binman to generate

This series aims to eliminate the use of additional custom repositories such as k3-image-gen (K3 Image Generation) repo that was plumbed into the U-Boot build flow to generate boot images for TI K3 platform devices. And instead, we move towards using binman that aligns better with the community standard build flow.

This series uses binman for all K3 platforms supported on U-Boot currently; both HS (High Security) and GP (General Purpose) devices.

Background on using k3-image-gen:
* TI K3 devices require a SYSFW (System Firmware) image consisting of a signed system firmware image and board configuration binaries, this is needed to bring up system firmware during U-Boot R5 SPL startup.
* Board configuration data contain board-specific information such as resource management, power management and security.

Series intends to use binman to take over the packaging and signing for the R5 bootloader images tiboot3.bin (and sysfw.itb, for non-combined boot flow) instead of k3-image-gen.

Series also packages the A72/A53 bootloader images (tispl.bin and u-boot.img) using ATF, OPTEE and DM (Device Manager)

Changes in v2:
- removed all external scripts
- created ti-board-config etype to support generation of board config binaries
- created ti-secure and ti-secure-rom etypes to handle signing instead of using external TI_SECURE_DEV_PKG
- updated openssl btool to support x509 certificate generation
- dropped Makefile changes to obtain external binary components, moving to using BINMAN_INDIRS to achieve the same

Neha Malcom Francis (18):
binman: Add support for generating TI Board config binaries
binman: ti-secure: Add support for TI signing
ti: sysfw: tiboot3: Add support for packaging sysfw.itb and
tiboot3.bin
j721e: schema: yaml: Add general schema and J721E board config files
j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin,
u-boot.img
j7200: yaml: Add J7200 board config files
j7200: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img
am65x: yaml: Add AM65x board config files
am65: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin,
u-boot.img
config: am64x: Add board config for AM64x
am64x: dts: binman: Package tiboot3.bin, tispl.bin u-boot.img
j721s2: yaml: Add board config for J721S2
j721s2: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img
am62: yaml: Add board config for AM62
am625: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img
am62a: yaml: Add board config for AM62ax
am62a: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img
k3: tools: config.mk: Update makefile and remove scripts

 arch/arm/dts/k3-am625-r5-sk.dts               |    1 +
 arch/arm/dts/k3-am625-sk-binman.dtsi          |  472 +++
 arch/arm/dts/k3-am625-sk-u-boot.dtsi          |    2 +
 arch/arm/dts/k3-am62a-sk-binman.dtsi          |  472 +++
 arch/arm/dts/k3-am62a7-r5-sk.dts              |    1 +
 arch/arm/dts/k3-am62a7-sk.dts                 |    1 +
 arch/arm/dts/k3-am642-evm-u-boot.dtsi         |    2 +
 arch/arm/dts/k3-am642-r5-evm.dts              |    1 +
 arch/arm/dts/k3-am64x-binman.dtsi             |  521 +++
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  |    1 +
 .../dts/k3-am654-r5-base-board-u-boot.dtsi    |    1 +
 arch/arm/dts/k3-am65x-binman.dtsi             |  543 +++
 arch/arm/dts/k3-j7200-binman.dtsi             |  471 +++
 .../k3-j7200-common-proc-board-u-boot.dtsi    |    2 +
 arch/arm/dts/k3-j721e-binman.dtsi             |  634 ++++
 .../k3-j721e-common-proc-board-u-boot.dtsi    |    1 +
 .../arm/dts/k3-j721e-r5-common-proc-board.dts |    1 +
 arch/arm/dts/k3-j721s2-binman.dtsi            |  474 +++
 .../k3-j721s2-common-proc-board-u-boot.dtsi   |    2 +
 .../dts/k3-j721s2-r5-common-proc-board.dts    |    1 +
 arch/arm/mach-k3/config.mk                    |  126 +-
 board/ti/am62ax/Kconfig                       |    2 +
 board/ti/am62ax/board-cfg.yaml                |   36 +
 board/ti/am62ax/pm-cfg.yaml                   |   12 +
 board/ti/am62ax/rm-cfg.yaml                   | 1151 +++++++
 board/ti/am62ax/sec-cfg.yaml                  |  375 +++
 board/ti/am62x/Kconfig                        |    2 +
 board/ti/am62x/board-cfg.yaml                 |   36 +
 board/ti/am62x/pm-cfg.yaml                    |   12 +
 board/ti/am62x/rm-cfg.yaml                    | 1088 +++++++
 board/ti/am62x/sec-cfg.yaml                   |  375 +++
 board/ti/am64x/Kconfig                        |    2 +
 board/ti/am64x/board-cfg.yaml                 |   37 +
 board/ti/am64x/pm-cfg.yaml                    |   12 +
 board/ti/am64x/rm-cfg.yaml                    | 1400 ++++++++
 board/ti/am64x/sec-cfg.yaml                   |  378 +++
 board/ti/am65x/Kconfig                        |    2 +
 board/ti/am65x/board-cfg.yaml                 |   36 +
 board/ti/am65x/pm-cfg.yaml                    |   12 +
 board/ti/am65x/rm-cfg.yaml                    | 2068 ++++++++++++
 board/ti/am65x/sec-cfg.yaml                   |  375 +++
 board/ti/common/schema.yaml                   |  355 ++
 board/ti/j721e/Kconfig                        |    4 +
 board/ti/j721e/board-cfg.yaml                 |   37 +
 board/ti/j721e/board-cfg_j7200.yaml           |   36 +
 board/ti/j721e/pm-cfg.yaml                    |   13 +
 board/ti/j721e/pm-cfg_j7200.yaml              |   12 +
 board/ti/j721e/rm-cfg.yaml                    | 2757 ++++++++++++++++
 board/ti/j721e/rm-cfg_j7200.yaml              | 2065 ++++++++++++
 board/ti/j721e/sec-cfg.yaml                   |  379 +++
 board/ti/j721e/sec-cfg_j7200.yaml             |  378 +++
 board/ti/j721s2/Kconfig                       |    2 +
 board/ti/j721s2/board-cfg.yaml                |   37 +
 board/ti/j721s2/pm-cfg.yaml                   |   12 +
 board/ti/j721s2/rm-cfg.yaml                   | 2901 +++++++++++++++++
 board/ti/j721s2/sec-cfg.yaml                  |  375 +++
 board/ti/keys/custMpk.pem                     |   51 +
 board/ti/keys/ti-degenerate-key.pem           |   10 +
 scripts/Makefile.spl                          |    2 +
 tools/binman/btool/openssl.py                 |  244 ++
 tools/binman/entries.rst                      |   75 +
 tools/binman/etype/ti_board_config.py         |  246 ++
 tools/binman/etype/ti_secure.py               |   83 +
 tools/binman/etype/ti_secure_rom.py           |  233 ++
 tools/binman/etype/x509_cert.py               |   87 +-
 tools/binman/ftest.py                         |   57 +
 tools/binman/test/277_ti_board_cfg.dts        |   11 +
 .../binman/test/278_ti_board_cfg_combined.dts |   25 +
 tools/binman/test/279_ti_secure.dts           |   17 +
 tools/binman/test/280_ti_secure_rom.dts       |   17 +
 .../test/281_ti_secure_rom_combined.dts       |   25 +
 tools/binman/test/yaml/config.yaml            |   11 +
 tools/binman/test/yaml/schema.yaml            |   26 +
 tools/k3_fit_atf.sh                           |  123 -
 tools/k3_gen_x509_cert.sh                     |  262 --
 75 files changed, 21634 insertions(+), 475 deletions(-)
 create mode 100644 arch/arm/dts/k3-am625-sk-binman.dtsi
 create mode 100644 arch/arm/dts/k3-am62a-sk-binman.dtsi
 create mode 100644 arch/arm/dts/k3-am64x-binman.dtsi
 create mode 100644 arch/arm/dts/k3-am65x-binman.dtsi
 create mode 100644 arch/arm/dts/k3-j7200-binman.dtsi
 create mode 100644 arch/arm/dts/k3-j721e-binman.dtsi
 create mode 100644 arch/arm/dts/k3-j721s2-binman.dtsi
 create mode 100644 board/ti/am62ax/board-cfg.yaml
 create mode 100644 board/ti/am62ax/pm-cfg.yaml
 create mode 100644 board/ti/am62ax/rm-cfg.yaml
 create mode 100644 board/ti/am62ax/sec-cfg.yaml
 create mode 100644 board/ti/am62x/board-cfg.yaml
 create mode 100644 board/ti/am62x/pm-cfg.yaml
 create mode 100644 board/ti/am62x/rm-cfg.yaml
 create mode 100644 board/ti/am62x/sec-cfg.yaml
 create mode 100644 board/ti/am64x/board-cfg.yaml
 create mode 100644 board/ti/am64x/pm-cfg.yaml
 create mode 100644 board/ti/am64x/rm-cfg.yaml
 create mode 100644 board/ti/am64x/sec-cfg.yaml
 create mode 100644 board/ti/am65x/board-cfg.yaml
 create mode 100644 board/ti/am65x/pm-cfg.yaml
 create mode 100644 board/ti/am65x/rm-cfg.yaml
 create mode 100644 board/ti/am65x/sec-cfg.yaml
 create mode 100644 board/ti/common/schema.yaml
 create mode 100644 board/ti/j721e/board-cfg.yaml
 create mode 100644 board/ti/j721e/board-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/pm-cfg.yaml
 create mode 100644 board/ti/j721e/pm-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/rm-cfg.yaml
 create mode 100644 board/ti/j721e/rm-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/sec-cfg.yaml
 create mode 100644 board/ti/j721e/sec-cfg_j7200.yaml
 create mode 100644 board/ti/j721s2/board-cfg.yaml
 create mode 100644 board/ti/j721s2/pm-cfg.yaml
 create mode 100644 board/ti/j721s2/rm-cfg.yaml
 create mode 100644 board/ti/j721s2/sec-cfg.yaml
 create mode 100644 board/ti/keys/custMpk.pem
 create mode 100644 board/ti/keys/ti-degenerate-key.pem
 create mode 100644 tools/binman/etype/ti_board_config.py
 create mode 100644 tools/binman/etype/ti_secure.py
 create mode 100644 tools/binman/etype/ti_secure_rom.py
 create mode 100644 tools/binman/test/277_ti_board_cfg.dts
 create mode 100644 tools/binman/test/278_ti_board_cfg_combined.dts
 create mode 100644 tools/binman/test/279_ti_secure.dts
 create mode 100644 tools/binman/test/280_ti_secure_rom.dts
 create mode 100644 tools/binman/test/281_ti_secure_rom_combined.dts
 create mode 100644 tools/binman/test/yaml/config.yaml
 create mode 100644 tools/binman/test/yaml/schema.yaml
 delete mode 100755 tools/k3_fit_atf.sh
 delete mode 100755 tools/k3_gen_x509_cert.sh
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/18 binman: Add support for generating TI Board config binaries

The ti-board-config entry loads and validates a given YAML config file against a given schema, and generates the board config binary. K3 devices require these generated binaries to be packed into the final system firmware images.

---
 tools/binman/entries.rst                      |  50 ++++
 tools/binman/etype/ti_board_config.py         | 246 ++++++++++++++++++
 tools/binman/ftest.py                         |  11 +
 tools/binman/test/277_ti_board_cfg.dts        |  11 +
 .../binman/test/278_ti_board_cfg_combined.dts |  25 ++
 tools/binman/test/yaml/config.yaml            |  11 +
 tools/binman/test/yaml/schema.yaml            |  26 ++
 7 files changed, 380 insertions(+)
 create mode 100644 tools/binman/etype/ti_board_config.py
 create mode 100644 tools/binman/test/277_ti_board_cfg.dts
 create mode 100644 tools/binman/test/278_ti_board_cfg_combined.dts
 create mode 100644 tools/binman/test/yaml/config.yaml
 create mode 100644 tools/binman/test/yaml/schema.yaml
tools/binman/entries.rst +50 -0
index b71af801fd..7cfe61dd09 100644
@@ -2423,3 +2423,53 @@ may be used instead.
 
 
 
+.. _etype_ti_board_config:
+
+Entry: ti-board-config: Texas Instruments board config binary
+-------------------------------------------------------------
+
+Support for generation of TI schema validated board configuration
+binary
+This etype supports generation of two kinds of board configuration
+binaries: singular board config binary as well as combined board config
+binary.
+
+Properties / Entry arguments:
+    - config-file: File containing board configuration data in YAML
+    - schema-file: File containing board configuration YAML schema against
+    which the config file is validated
+
+These above parameters are used only when the generated binary is
+intended to be a single board configuration binary. Example::
+
+/* generate a my-ti-board-config.bin generated from a YAML configuration
+file validated against the schema*/
+my-ti-board-config {
+    ti-board-config {
+        config = "board-config.yaml";
+        schema = "schema.yaml";
+    };
+};
+
+To generate a combined board configuration binary, we pack the
+needed individual binaries into a ti-board-config binary. In this case,
+the available supported subnode names are board-cfg, pm-cfg, sec-cfg and
+rm-cfg. For example::
+
+/* generate a my-combined-ti-board-config.bin packed with a header
+(containing details about the included board config binaries), along
+with the YAML schema validated binaries themselves*/
+my-combined-ti-board-config {
+    ti-board-config {
+        board-cfg {
+            config = "board-cfg.yaml";
+            schema = "schema.yaml";
+        };
+        sec-cfg {
+            config = "sec-cfg.yaml";
+            schema = "schema.yaml";
+        };
+    };
+};
+
+
tools/binman/etype/ti_board_config.py new file +246 -0

246 lines not on this page · raw message

tools/binman/ftest.py +11 -0
index 43b4f850a6..28b5bd19d5 100644
@@ -97,6 +97,7 @@ ENV_DATA              = b'var1=1\nvar2="2"'
 PRE_LOAD_MAGIC        = b'UBSH'
 PRE_LOAD_VERSION      = 0x11223344.to_bytes(4, 'big')
 PRE_LOAD_HDR_SIZE     = 0x00001000.to_bytes(4, 'big')
+TI_BOARD_CONFIG_DATA  = b'\x00\x01'
 
 # Subdirectory of the input dir to use to put test FDTs
 TEST_FDT_SUBDIR       = 'fdts'
@@ -6676,6 +6677,16 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
                                 ['fit'])
         self.assertIn("Node '/fit': Missing tool: 'mkimage'", str(e.exception))
 
+    def testTIBoardConfig(self):
+        """Test that a schema validated board config file can be generated"""
+        data = self._DoReadFile('277_ti_board_cfg.dts')
+        self.assertEqual(TI_BOARD_CONFIG_DATA, data)
+
+    def testTIBoardConfig(self):
+        """Test that a schema validated combined board config file can be generated"""
+        data = self._DoReadFile('278_ti_board_cfg_combined.dts')
+        configlen_noheader = TI_BOARD_CONFIG_DATA*4
+        self.assertGreater(data, configlen_noheader)
 
 if __name__ == "__main__":
     unittest.main()
tools/binman/test/277_ti_board_cfg.dts new file +11 -0
new file mode 100644
index 0000000000..8b1b210d9d
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
+/dts-v1/;
+
+/ {
+	binman {
+		ti-board-config {
+			config = "tools/binman/test/yaml/config.yaml";
+			schema = "tools/binman/test/yaml/schema.yaml";
+		};
+	};
+};
tools/binman/test/278_ti_board_cfg_combined.dts new file +25 -0
new file mode 100644
index 0000000000..54cb383d90
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0+
+/dts-v1/;
+
+/ {
+	binman {
+		ti-board-config {
+			board-cfg {
+				config = "tools/binman/test/yaml/config.yaml";
+				schema = "tools/binman/test/yaml/schema.yaml";
+			};
+			sec-cfg {
+				config = "tools/binman/test/yaml/config.yaml";
+				schema = "tools/binman/test/yaml/schema.yaml";
+			};
+			rm-cfg {
+				config = "tools/binman/test/yaml/config.yaml";
+				schema = "tools/binman/test/yaml/schema.yaml";
+			};
+			pm-cfg {
+				config = "tools/binman/test/yaml/config.yaml";
+				schema = "tools/binman/test/yaml/schema.yaml";
+			};
+		};
+	};
+};
tools/binman/test/yaml/config.yaml new file +11 -0
new file mode 100644
index 0000000000..5b17e78af9
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Test config
+#
+---
+
+main-branch:
+  small-branch:
+    a: 0x0
+    b: 0x1
tools/binman/test/yaml/schema.yaml new file +26 -0
new file mode 100644
index 0000000000..44f08bb6b0
@@ -0,0 +1,26 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Test schema
+#
+---
+
+definitions:
+    u8:
+        type: integer
+        minimum: 0
+        maximum: 0xff
+
+type: object
+properties:
+    main-branch:
+        type: object
+        properties:
+            small-branch:
+                type: object
+                properties:
+                    a:
+                        $ref: "#/definitions/u8"
+                    b:
+                        $ref: "#/definitions/u8"
+
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 01/18] binman: Add support for generating TI Board config binaries

Hi Neha,

Quoted 7 lines · Neha Malcom Francis

The ti-board-config entry loads and validates a given YAML config file against a given schema, and generates the board config binary. K3 devices require these generated binaries to be packed into the final system firmware images.

Quoted 14 lines
---
 tools/binman/entries.rst                      |  50 ++++
 tools/binman/etype/ti_board_config.py         | 246 ++++++++++++++++++
 tools/binman/ftest.py                         |  11 +
 tools/binman/test/277_ti_board_cfg.dts        |  11 +
 .../binman/test/278_ti_board_cfg_combined.dts |  25 ++
 tools/binman/test/yaml/config.yaml            |  11 +
 tools/binman/test/yaml/schema.yaml            |  26 ++
 7 files changed, 380 insertions(+)
 create mode 100644 tools/binman/etype/ti_board_config.py
 create mode 100644 tools/binman/test/277_ti_board_cfg.dts
 create mode 100644 tools/binman/test/278_ti_board_cfg_combined.dts
 create mode 100644 tools/binman/test/yaml/config.yaml
 create mode 100644 tools/binman/test/yaml/schema.yaml

This looks pretty good. Some things to fix:

The first line of a function comment should fit on that line. Add a blank line afterwards. Add full comments to all functions, describing the purpose / type of each arg (you have done many of them).

Use 'binman entry-docs >tools/binman/entries.rst' to generate the docs rather than hand editing. Try 'make htmldocs' as this fails for your updates.

Some test coverage is missing - use 'binman test -T' to try it. You will need to add tests for failing cases as well as success, perhaps adding new .dts files for your tests.

The jsonschema module is now required. That needs to be added to the 'dependencies' line of tools/binman/pyproject.toml

A few minor nits below

Quoted 150 lines
tools/binman/entries.rst +50 -0
index b71af801fd..7cfe61dd09 100644
@@ -2423,3 +2423,53 @@ may be used instead.
 
 
 
+.. _etype_ti_board_config:
+
+Entry: ti-board-config: Texas Instruments board config binary
+-------------------------------------------------------------
+
+Support for generation of TI schema validated board configuration
+binary
+This etype supports generation of two kinds of board configuration
+binaries: singular board config binary as well as combined board config
+binary.
+
+Properties / Entry arguments:
+    - config-file: File containing board configuration data in YAML
+    - schema-file: File containing board configuration YAML schema against
+    which the config file is validated
+
+These above parameters are used only when the generated binary is
+intended to be a single board configuration binary. Example::
+
+/* generate a my-ti-board-config.bin generated from a YAML configuration
+file validated against the schema*/
+my-ti-board-config {
+    ti-board-config {
+        config = "board-config.yaml";
+        schema = "schema.yaml";
+    };
+};
+
+To generate a combined board configuration binary, we pack the
+needed individual binaries into a ti-board-config binary. In this case,
+the available supported subnode names are board-cfg, pm-cfg, sec-cfg and
+rm-cfg. For example::
+
+/* generate a my-combined-ti-board-config.bin packed with a header
+(containing details about the included board config binaries), along
+with the YAML schema validated binaries themselves*/
+my-combined-ti-board-config {
+    ti-board-config {
+        board-cfg {
+            config = "board-cfg.yaml";
+            schema = "schema.yaml";
+        };
+        sec-cfg {
+            config = "sec-cfg.yaml";
+            schema = "schema.yaml";
+        };
+    };
+};
+
+
tools/binman/etype/ti_board_config.py new file +85 -0
new file mode 100644
index 0000000000..0a9be44afc
@@ -0,0 +1,246 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2022 Texas Instruments Incorporated - https://www.ti.com/
+# Written by Neha Malcom Francis <[email protected]>
+#
+# Entry-type module for generating schema validated TI board
+# configuration binary
+#
+
+import os
+import struct
+import tempfile
+import yaml
+
+from collections import OrderedDict
+from jsonschema import validate
+from shutil import copyfileobj
+from shutil import rmtree
+
+from binman.entry import Entry
+from binman.etype.section import Entry_section
+from binman.etype.blob_ext import Entry_blob_ext
+from binman.etype.blob_ext_list import Entry_blob_ext_list
+from dtoc import fdt_util
+from u_boot_pylib import tools, tout
+
+BOARDCFG = 0xB
+BOARDCFG_SEC = 0xD
+BOARDCFG_PM = 0xE
+BOARDCFG_RM = 0xC
+BOARDCFG_NUM_ELEMS = 4
+
+class Entry_ti_board_config(Entry_section):
+    """
+    Support for generation of TI schema validated board configuration
+    binary
+    This etype supports generation of two kinds of board configuration
+    binaries: singular board config binary as well as combined board config
+    binary.
+
+    Available parameters are:
+
+    config-file
+        File containing board configuration data in YAML
+
+    schema-file
+        File containing board configuration YAML schema against which the
+        config file is validated
+
+    These above parameters are used only when the generated binary is
+    intended to be a single board configuration binary. Example::
+
+    /* generate a my-ti-board-config.bin generated from a YAML configuration
+    file validated against the schema*/
+    my-ti-board-config {
+        ti-board-config {
+            config = "board-config.yaml";
+            schema = "schema.yaml";
+        };
+    };
+
+    To generate a combined board configuration binary, we pack the
+    needed individual binaries into a ti-board-config binary. In this case,
+    the available supported subnode names are board-cfg, pm-cfg, sec-cfg and
+    rm-cfg. For example::
+
+    /* generate a my-combined-ti-board-config.bin packed with a header
+    (containing details about the included board config binaries), along
+    with the YAML schema validated binaries themselves*/
+    my-combined-ti-board-config {
+        ti-board-config {
+            board-cfg {
+                config = "board-cfg.yaml";
+                schema = "schema.yaml";
+            };
+            sec-cfg {
+                config = "sec-cfg.yaml";
+                schema = "schema.yaml";
+            };
+        }
+    }
+    """
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node)
+
+        self.config_file = None

tools/binman/etype/ti_board_config.py line 95

Quoted 10 lines
tools/binman/etype/ti_board_config.py new file +10 -0
+        self.schema_file = None
+
+        self._entries = OrderedDict()
+        self._entries_data = OrderedDict()
+        self.num_elems = BOARDCFG_NUM_ELEMS
+        self.fmt = '<HHHBB'
+        self.index = 0
+        self.binary_offset = 0
+        self.sw_rev = 1
+        self.devgrp = 0

Better to use a _ prefix with private properties, ie.. self._devgr[

tools/binman/etype/ti_board_config.py line 102

Quoted 7 lines
tools/binman/etype/ti_board_config.py new file +7 -0
+
+    def ReadNode(self):
+        super().ReadNode()
+        self.config_file = fdt_util.GetString(self._node, 'config')
+        self.schema_file = fdt_util.GetString(self._node, 'schema')
+        if self.config_file is None:
+            self.ReadEntries()

Why is this not done if self.config_file is not None? Please add a comment.

tools/binman/etype/ti_board_config.py line 110

Quoted 8 lines
tools/binman/etype/ti_board_config.py new file +8 -0
+
+    def ReadEntries(self):
+        """Read the subnodes to find out what should go in this image"""
+        num_cfgs = 0
+        for node in self._node.subnodes:
+            if 'type' not in node.props:
+                num_cfgs += 1
+                etype = 'ti-board-config'

Can you drop that and just use the string in the next line?

tools/binman/etype/ti_board_config.py line 115

Quoted 5 lines
tools/binman/etype/ti_board_config.py new file +5 -0
+                entry = Entry.Create(self, node, etype)
+                entry.ReadNode()
+                cfg_data = entry.BuildSectionData(True)
+                self._entries[entry.name] = entry
+                self._entries_data[entry.name] = cfg_data

You could add your data to the entry if you like?

entry._cfg_data = cfg_data

?

tools/binman/etype/ti_board_config.py line 116

Quoted 1 line
tools/binman/etype/ti_board_config.py new file +1 -0
+        self.num_elems = num_cfgs

Isn't that len(self._node.subnodes) ?

tools/binman/etype/ti_board_config.py line 128

Quoted 12 lines
tools/binman/etype/ti_board_config.py new file +12 -0
+
+    def _convert_to_byte_chunk(self, val, data_type):
+        """Convert value into byte array"""
+        size = 0
+        if (data_type == "#/definitions/u8"):
+            size = 1
+        elif (data_type == "#/definitions/u16"):
+            size = 2
+        elif (data_type == "#/definitions/u32"):
+            size = 4
+        else:
+            raise Exception("Data type not present in definitions")

ValueError()

Please use single quotes where possible except for function docs (please fix throughout)

Quoted 17 lines
tools/binman/etype/ti_board_config.py new file +17 -0
+        if type(val) == int:
+            br = val.to_bytes(size, byteorder="little")
+        return br
+
+    def _compile_yaml(self, schema_yaml, file_yaml):
+        """Convert YAML file into byte array based on YAML schema"""
+        br = bytearray()
+        for key in file_yaml.keys():
+            node = file_yaml[key]
+            node_schema = schema_yaml['properties'][key]
+            node_type = node_schema.get('type')
+            if not 'type' in node_schema:
+                br += self._convert_to_byte_chunk(node,
+                                                  node_schema.get('$ref'))
+            elif node_type == 'object':
+                br += self._compile_yaml(node_schema, node)
+            elif node_type == 'array':

tools/binman/etype/ti_board_config.py line 155

Quoted 10 lines
tools/binman/etype/ti_board_config.py new file +10 -0
+                for item in node:
+                    if not isinstance(item, dict):
+                        br += self._convert_to_byte_chunk(
+                            item, schema_yaml['properties'][key]['items']["$ref"])
+                    else:
+                        br += self._compile_yaml(node_schema.get('items'), item)
+        return br
+
+    def _generate_binaries(self):
+        """Generate config binary artifacts from the loaded YAML configuration file"""

Return:

tools/binman/etype/ti_board_config.py line 159

Quoted 4 lines
tools/binman/etype/ti_board_config.py new file +4 -0
+        try:
+            cfg_binary = bytearray()
+            for key in self.file_yaml.keys():
+                node = self.file_yaml[key]

You can do:

for key, node in self.file_yaml.items():

tools/binman/etype/ti_board_config.py line 168

Quoted 9 lines
tools/binman/etype/ti_board_config.py new file +9 -0
+                node_schema = self.schema_yaml['properties'][key]
+                br = self._compile_yaml(node_schema, node)
+                cfg_binary += br
+        except Exception as e:
+            tout.warning("Combined board config binary was not generated properly")
+            cfg_binary = tools.get_bytes(0, 512)
+        return cfg_binary
+
+    def _add_boardcfg(self, bcfgtype, bcfgdata):

comment

Quoted 7 lines
tools/binman/etype/ti_board_config.py new file +7 -0
+        size = len(bcfgdata)
+        desc = struct.pack(self.fmt, bcfgtype,
+                            self.binary_offset, size, self.devgrp, 0)
+        with open(self.descfile, "ab+") as desc_fh:
+            desc_fh.write(desc)
+        with open(self.bcfgfile, "ab+") as bcfg_fh:
+            bcfg_fh.write(bcfgdata)

tools/binman/etype/ti_board_config.py line 185

Quoted 10 lines
tools/binman/etype/ti_board_config.py new file +10 -0
+        self.binary_offset += size
+        self.index += 1
+
+    def _finalize(self):
+        try:
+            with open(self.descfile, "rb") as desc_fh:
+                with open(self.bcfgfile, "rb") as bcfg_fh:
+                    with open(self.fh_file, 'ab+') as fh:
+                        desc_fh.seek(0)
+                        bcfg_fh.seek(0)

But if they are just opened you don't need to seek. Can't you drop those two lines?

tools/binman/etype/ti_board_config.py line 189

Quoted 4 lines
tools/binman/etype/ti_board_config.py new file +4 -0
+                        copyfileobj(desc_fh, fh)
+                        copyfileobj(bcfg_fh, fh)
+            data = tools.read_file(self.fh_file)
+        except Exception as e:

You should not catch Exception since this will cause anything to be caught. Here I think you want IOError ?

tools/binman/etype/ti_board_config.py line 198

Quoted 9 lines
tools/binman/etype/ti_board_config.py new file +9 -0
+            tout.warning("Combined board config binary was not generated properly")
+            data = tools.get_bytes(0, 512)
+        rmtree(self.tmpdir)
+        return data
+
+    def BuildSectionData(self, required):
+        if self.config_file is None:
+            self.binary_offset = 0
+            self.tmpdir = tempfile.mkdtemp()

This should use tools.get_output_filename() rather than create a temp dir. We want the output to be visible for debugging, etc.

Quoted 48 lines
tools/binman/etype/ti_board_config.py new file +48 -0
+            self.fh_file = os.path.join(self.tmpdir, "fh")
+            self.descfile = os.path.join(self.tmpdir, "desc")
+            self.bcfgfile = os.path.join(self.tmpdir, "bcfg")
+            try:
+                with open(self.fh_file, 'wb') as f:
+                    t_bytes = f.write(struct.pack(
+                        '<BB', self.num_elems, self.sw_rev))
+                self.binary_offset += t_bytes
+                self.binary_offset += self.num_elems * struct.calcsize(self.fmt)
+            except Exception as e:
+                tout.warning("Combined board config header was not generated properly")
+
+            if 'board-cfg' in self._entries:
+                self._add_boardcfg(BOARDCFG, self._entries_data['board-cfg'])
+
+            if 'sec-cfg' in self._entries:
+                self._add_boardcfg(BOARDCFG_SEC, self._entries_data['sec-cfg'])
+
+            if 'pm-cfg' in self._entries:
+                self._add_boardcfg(BOARDCFG_PM, self._entries_data['pm-cfg'])
+
+            if 'rm-cfg' in self._entries:
+                self._add_boardcfg(BOARDCFG_RM, self._entries_data['rm-cfg'])
+
+            data = self._finalize()
+            return data
+
+        else:
+            with open(self.config_file, 'r') as f:
+                self.file_yaml = yaml.safe_load(f)
+            with open(self.schema_file, 'r') as sch:
+                self.schema_yaml = yaml.safe_load(sch)
+            try:
+                validate(self.file_yaml, self.schema_yaml)
+            except Exception as e:
+                tout.error(f"Schema validation error: {e}")
+
+            data = self._generate_binaries()
+            return data
+
+    def SetImagePos(self, image_pos):
+        Entry.SetImagePos(self, image_pos)
+
+    def SetCalculatedProperties(self):
+        Entry.SetCalculatedProperties(self)
+
+    def CheckEntries(self):
+        Entry.CheckEntries(self)

[..]

tools/binman/etype/ti_board_config.py

Quoted 9 lines
tools/binman/etype/ti_board_config.py new file +9 -0
+    def testTIBoardConfig(self):
+        """Test that a schema validated board config file can be generated"""
+        data = self._DoReadFile('277_ti_board_cfg.dts')
+        self.assertEqual(TI_BOARD_CONFIG_DATA, data)
+
+    def testTIBoardConfig(self):
+        """Test that a schema validated combined board config file can be generated"""
+        data = self._DoReadFile('278_ti_board_cfg_combined.dts')
+        configlen_noheader = TI_BOARD_CONFIG_DATA*4

spaces around *

Quoted 4 lines

+ self.assertGreater(data, configlen_noheader)

if __name__ == "__main__":
unittest.main()

Regards,
Simon

#3 lore raw

PATCH v2 2/18 binman: ti-secure: Add support for TI signing

In reply to Neha Malcom Francis

The ti-secure entry contains certificate for binaries that will be loaded or booted by system firmware whereas the ti-secure-rom entry contains certificate for binaries that will be booted by ROM. Support for both these types of certificates is necessary for booting of K3 devices.

---
 board/ti/keys/custMpk.pem                     |  51 ++++
 board/ti/keys/ti-degenerate-key.pem           |  10 +
 tools/binman/btool/openssl.py                 | 244 ++++++++++++++++++
 tools/binman/entries.rst                      |  25 ++
 tools/binman/etype/ti_secure.py               |  83 ++++++
 tools/binman/etype/ti_secure_rom.py           | 233 +++++++++++++++++
 tools/binman/etype/x509_cert.py               |  87 ++++++-
 tools/binman/ftest.py                         |  46 ++++
 tools/binman/test/279_ti_secure.dts           |  17 ++
 tools/binman/test/280_ti_secure_rom.dts       |  17 ++
 .../test/281_ti_secure_rom_combined.dts       |  25 ++
 11 files changed, 830 insertions(+), 8 deletions(-)
 create mode 100644 board/ti/keys/custMpk.pem
 create mode 100644 board/ti/keys/ti-degenerate-key.pem
 create mode 100644 tools/binman/etype/ti_secure.py
 create mode 100644 tools/binman/etype/ti_secure_rom.py
 create mode 100644 tools/binman/test/279_ti_secure.dts
 create mode 100644 tools/binman/test/280_ti_secure_rom.dts
 create mode 100644 tools/binman/test/281_ti_secure_rom_combined.dts
board/ti/keys/custMpk.pem new file +51 -0
new file mode 100644
index 0000000000..adba378c80
@@ -0,0 +1,51 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIJKQIBAAKCAgEAvxSuSdh/ctNrI83rSA5l3CJN8g5PgvbttfLd23yR+m5Z/9X3
+tt4EHYrM0pXZ0eDEwfhQv/9IDJEiUJpMe4vzlgooJrOk2eCpVUEa+z5bJ2y/ysBx
+ry9yIu5GASVirT7HBPaxGLYswBJuD+KbPuWmoKgGRQNBF04WH6l01oRO1nmnELgR
+qQ6SHyXdf7Hy0bnyaNgzWUuCfXfM0Zz6I7T7WIjyzerVFvIsdS36YsPBCW7gBnDg
+tQcJmWLZ1uTnbG3IggdQk/fi2O3RX+PQns+TVNlf3V3ON2DxqxSKBHtlp7p/30VF
+fEuhW65OxpQ9jE6H0pQ8pPOf2vzyNnznDa1aQjfxKoHQbqGnZwMeh+0Au3NKaCgx
+ooKaowTB6If/RX6qwZ/UOwXHg/0hcf69fzjJFhlSDuYDM40dHsk2HM1OnYIpiM2b
+Kr5sX3uysjp5AGp99a0anR7NWCrPXvROgKs7T9341N40osQg2VkZLYUCXh9osUyN
+uREG6S12tViMUKg3bmZ4b4MwRk00n7QYSrm7+nvFrtYyEISEbD+agDM1/E281W5g
+VFDPfm2AlwT6jwsg/b2YK6E3vVn9SuxFoQmLF8lyFDO3BV4SXeJaHc4hVPbh6tVV
+qifrTQnfGUCCLmaJF2XZbrPWOE6NYRbWdNTeFl9RGdVCuIPSyN5LqWmXto0CAwEA
+AQKCAgAzkAwcJ0z1GnId/lJQZno8NhGckRoJuEKbR8dwlCP8VUz6Ca5H7Y9kvXDa
+Hs/hn+rYgP6hYOz7XyrIX2rmJ/T6dxEwqGeC1+o59FConcIRWHpE5zuGT6JYJL5F
+TuZa48bm4v8VMQvQZOjIZpkIFwao8c6HTwKAnHTB5IN/48I2hCt+Cn3RhfoOZ7Rm
+4gkpaSkt+7GXlhXHb82YfujNO+hbktEamhUYlQ9EK70Wa8aqmf3gHxO0JgsEFjW8
+lJaSnultlTW8SDcx3LMUUjCYumECk4oX/VlJfmKYjPlVjkr3QQ+Cm3nNucb4K4hc
+c+JL+2ERhSj8RjXL7VgbNgdPnIjvQDJuTNqecTU8xWPYrkOLQpNibbLjnutLkhJz
+fMyRtmDtrsey8WiCDuCHkPJ8/f8RjL2zWI9fzTDDIzdlEKouUFGOovaHVnbua6pn
+hymcu9d9FV3p2rcbj0ivCs7e8j+vhSxFJEJoAbcQdXCTi/n2uR7pLtoMNiUzsejy
+d46Uz+KEU920NTwE2z6JJq8I2vegnxjc7PDDrV3/5rK04B93aXiqvwWseCpxelrI
+xaMkRHbXrIXRO6MXQ3N+zNq8Dg3hjGTTvaBKuwgvqLwlXY8+Aa3ooFzEOInIOSsI
+XcWqXxt/tgZgsj9RwpC42t8kbA+BkbNk9EIUa+P5kEr2P/fO7QKCAQEA4EtArnOX
+D6tQF8uTw8USOZC2P9s/ez1z4jRq3oKP0Kv4tJiuIObJ/dUvGVD7aM5v2xaCfhm8
+xpk09VPUgghfG5jR5qVvQr75kCNToJQudWi4ngk1HwKJzzTO11giFEdybvTUA+Pj
+fmxCM0dYYqRWZoj0hLqXlUCwxE74BFIhJVjeYbf+nTQrqpllTLoW7MTZHzGx5SXx
+4dNzyVAUH49Yt2D8mgXXCkf5sGLh762wj34b/rR10Kr4O5utGMZrfTRIbuQ1pNjU
+m66baPzq+mC0BzqZEW70TgEb7lOr8rcVXLOi3r36omfd9/MHx7iZD6o3K1axSO15
+grD4ZrN7Ac3QJwKCAQEA2heCoBdpvy6YUk8AO2k8qDygTdmPQRuwjjT+Z2fMslBt
+D7DkpKwZ6Bl9OclcpiiLHmH+hv65KqYg+tR0RRb7PcogB9El9x7yKkGTPZEYWGky
+n8P84rJpKwjnwWQvPQktI1cs3YGvZA9DQTFBavRrwuzgd1oSJq5aPQ2tme0kMvWp
+l1/B/cPK+PKCi/Wfisaze1TjijP9qIeUwkdNN6WLrLU3QgsGppcg2I7RQtAIikT6
+GkuiOQAvWMsrJVV6PNrVKz4fJDJ59Rz6jbDHZNi1MEYNxQoB/Pl7QIakbfjWpHLv
+8Ey7cB2JKxjQy8tmyl8WNQVbXbE6daPXcMTUmaRAKwKCAQBv1lYMJmq+T2eCVen6
+BbvOpE+bi5EdvEiaFBTtmiBnpjg+pJq+oRU60h/H+c9CNR0lGxY6Fk9An4f+g6xE
+ojP6KLsQzJCrsVny+wpp2TlJJcxYULMCIVvhy60PR0zG29E9biqBPhJjKUvhEcQK
+e3LxcXyq6fdHXphFajLUxLbuTl+kTgBRFoBnclFGbsubh5PTsA3J+p+fQLZNPPar
+veg4l82cZykQYU8pGkUaI3sUMYd3+zd7sqRP5JHs9pMGPRmY4YW2CsAIWIn5UZNB
+ARMDP76vKKn8cyUgMuxb+9pU/OVLN2NPs4bEaZQJjAwV+YPEwldny7F47xEM9JVz
+EtKlAoIBAQDUt62u3GdGE/p5/ZgqWoDRTyDEDfmN9aYFbmbdEP80xQE7FrxMaZhz
+K7laja6SWmUm40nQ/c45bQQp4uLtKHcxU15egX7YRBTLZl5o5IasZR79ebnEm2O8
+l9kEZeU1USf3mmWmP4GExOZCRfqaiYA6BbUCdJXTqKdXeWnkAssV8UrS3JFoJHpq
+yo7OWGqefyQ8nRW6jO9SW7uaqtUD+7H6aF5XSk3YWvusfdBZrHNH+fM/hpnZovaL
+Us7ogTDS/laA8PyK37jYfMVdQhmZoU1Iomt3zkUWK3gt/aWPpfAlQf4Jka4YspZB
+tNiijefaZ1hPqsPs5Joyd/YAhdsfaHc1AoIBAQCn/9j6RRjRaw0ip756oad4AXHz
+XBwVB2CrY96qT6Hj9Sq7tGgdskqGkOQkAivBLBizUdcWv0t1yenOsSgasQeMlvlh
+B8md9cLvpKXPB3HM3rTDH/xNXe0TpVKLf7SXC8HfDyIweHwMW3QgO2DWrvI4BV/T
+ckBatRNQ90HxkqGFhC/Mp529lQlyg3ifxPxJsvZOyPMUnrflAvsKQk5c2ZiQg3nZ
+h7I2pjSYgCl+Ib52l8p9bf1kcrVGgPM+auzm496i0RPobFeDBoBvSoznJktHJ7+3
+NnZH+jLiZCODiQPGtQUi+T6eIZUIJF0YASpsCCtUzXCxwW3lYIDNy7UlMivF
+-----END RSA PRIVATE KEY-----
board/ti/keys/ti-degenerate-key.pem new file +10 -0
new file mode 100644
index 0000000000..bd7d3745ad
@@ -0,0 +1,10 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBWwIBAAKBgQDRfrnXQaP0k6vRK/gZ+bDflSU6y1JagGeQ/b+QYuiDz14japog
+8fRSu5WBsAxaSaySAUwS3L9Ppw+hGMecmyIJ494aMfZTtk1g49gU58joduiRnu7e
+QSZHMnehhuNlfD7A2tAAKnxIYuabs8zHYM/SS9Ne7t3kIQMbKfUSzNy6qQIBAQIB
+AQJBAOelUA376o6w3HkShXfN+shaOZYqFuTJ9exLMwsLp7DZKXB5F9I4JJ+Vkvho
+k6QWs7vkhleLSYUZknXHYm26ZE0CQQDnhTtd4PTBoZPjPXOeYMJFtEdMNy0XP6ey
+bcce389ugoY7BEkvASrd8PHgJQHziepgWOG4DGp33c64Hfq4zI3NAgEBAgEBAkA0
+RbK4uqoLciQluesTPU6lBy7Se3Dw0F9xBqlF5SR4KI6q+zQrHpBKyFOofMHZgizR
+iCrL55cxEM146zMw3AnF
+-----END RSA PRIVATE KEY-----
tools/binman/btool/openssl.py +244 -0

256 lines not on this page · raw message

tools/binman/entries.rst +25 -0
index 7cfe61dd09..e240d5ce62 100644
@@ -2473,3 +2473,28 @@ my-combined-ti-board-config {
 };
 
 
+
+.. _etype_ti_secure:
+
+Entry: ti-secure: Texas Instruments secured binary
+-------------------------------------------------------------
+
+Support for generation of TI secured binary blobs
+
+Properties / Entry arguments:
+    - content: List of phandles to entries to sign
+    - keyfile: Filename of file containing key to sign binary with
+    - sha: Hash function to be used for signing
+
+Output files:
+    - input.<unique_name> - input file passed to openssl
+    - config.<unique_name> - input file generated for openssl (which is
+        used as the config file)
+    - cert.<unique_name> - output file generated by openssl (which is
+        used as the entry contents)
+
+openssl signs the provided data, using the TI templated config file and
+writes the signature in this entry. This allows verification that the
+data is genuine.
+
+
tools/binman/etype/ti_secure.py new file +83 -0

83 lines not on this page · raw message

tools/binman/etype/ti_secure_rom.py new file +233 -0

233 lines not on this page · raw message

tools/binman/etype/x509_cert.py +79 -8

111 lines not on this page · raw message

tools/binman/ftest.py +46 -0

63 lines not on this page · raw message

tools/binman/test/279_ti_secure.dts new file +17 -0
new file mode 100644
index 0000000000..941d0ab4ca
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		ti-secure {
+			content = <&unsecure_binary>;
+		};
+		unsecure_binary: blob-ext {
+			filename = "ti_unsecure.bin";
+		};
+	};
+};
tools/binman/test/280_ti_secure_rom.dts new file +17 -0
new file mode 100644
index 0000000000..d1313769f4
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		ti-secure-rom {
+			content = <&unsecure_binary>;
+		};
+		unsecure_binary: blob-ext {
+			filename = "ti_unsecure.bin";
+		};
+	};
+};
tools/binman/test/281_ti_secure_rom_combined.dts new file +25 -0
new file mode 100644
index 0000000000..bf872739bc
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		ti-secure-rom {
+			content = <&unsecure_binary>;
+			content-sbl = <&unsecure_binary>;
+			content-sysfw = <&unsecure_binary>;
+			content-sysfw-data = <&unsecure_binary>;
+			content-sysfw-inner-cert = <&unsecure_binary>;
+			content-dm-data = <&unsecure_binary>;
+			combined;
+			sysfw-inner-cert;
+			dm-data;
+		};
+		unsecure_binary: blob-ext {
+			filename = "ti_unsecure.bin";
+		};
+	};
+};
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v2 02/18] binman: ti-secure: Add support for TI signing

Quoted 8 lines · Neha Malcom Francis

The ti-secure entry contains certificate for binaries that will be loaded or booted by system firmware whereas the ti-secure-rom entry contains certificate for binaries that will be booted by ROM. Support for both these types of certificates is necessary for booting of K3 devices.

---

[...]

Review line 2

Quoted 4 lines

+++ b/tools/binman/etype/ti_secure.py

(quoted diff) +2 -0
@@ -0,0 +1,83 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 20

Looks like this Copyright string got broken, I see this in a couple spots.

Andrew

#5 lore raw

Re: [PATCH v2 02/18] binman: ti-secure: Add support for TI signing

Hi Andrew,

Quoted 12 lines · Andrew Davis
Quoted 8 lines · Neha Malcom Francis

The ti-secure entry contains certificate for binaries that will be loaded or booted by system firmware whereas the ti-secure-rom entry contains certificate for binaries that will be booted by ROM. Support for both these types of certificates is necessary for booting of K3 devices.

---

[...]

Quoted 8 lines

Review line 2

Quoted 4 lines

+++ b/tools/binman/etype/ti_secure.py

(quoted diff) +2 -0
@@ -0,0 +1,83 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 20

Looks like this Copyright string got broken, I see this in a couple spots.

Andrew

Right, I'll clean those up. Thanks!

Signature · 2 lines
Thanking You
Neha Malcom Francis
#6 lore raw

Re: [PATCH v2 02/18] binman: ti-secure: Add support for TI signing

In reply to Neha Malcom Francis

kHi Neha,

Quoted 89 lines · Neha Malcom Francis

The ti-secure entry contains certificate for binaries that will be loaded or booted by system firmware whereas the ti-secure-rom entry contains certificate for binaries that will be booted by ROM. Support for both these types of certificates is necessary for booting of K3 devices.

---
 board/ti/keys/custMpk.pem                     |  51 ++++
 board/ti/keys/ti-degenerate-key.pem           |  10 +
 tools/binman/btool/openssl.py                 | 244 ++++++++++++++++++
 tools/binman/entries.rst                      |  25 ++
 tools/binman/etype/ti_secure.py               |  83 ++++++
 tools/binman/etype/ti_secure_rom.py           | 233 +++++++++++++++++
 tools/binman/etype/x509_cert.py               |  87 ++++++-
 tools/binman/ftest.py                         |  46 ++++
 tools/binman/test/279_ti_secure.dts           |  17 ++
 tools/binman/test/280_ti_secure_rom.dts       |  17 ++
 .../test/281_ti_secure_rom_combined.dts       |  25 ++
 11 files changed, 830 insertions(+), 8 deletions(-)
 create mode 100644 board/ti/keys/custMpk.pem
 create mode 100644 board/ti/keys/ti-degenerate-key.pem
 create mode 100644 tools/binman/etype/ti_secure.py
 create mode 100644 tools/binman/etype/ti_secure_rom.py
 create mode 100644 tools/binman/test/279_ti_secure.dts
 create mode 100644 tools/binman/test/280_ti_secure_rom.dts
 create mode 100644 tools/binman/test/281_ti_secure_rom_combined.dts
tools/binman/btool/openssl.py +45 -0
index 3a4dbdd6d7..aad3b61ae2 100644
@@ -15,6 +15,13 @@ import hashlib
 from binman import bintool
 from u_boot_pylib import tools
 
+
+VALID_SHAS = [256, 384, 512, 224]
+SHA_OIDS = {256:'2.16.840.1.101.3.4.2.1',
+            384:'2.16.840.1.101.3.4.2.2',
+            512:'2.16.840.1.101.3.4.2.3',
+            224:'2.16.840.1.101.3.4.2.4'}
+
 class Bintoolopenssl(bintool.Bintool):
     """openssl tool
 
@@ -74,6 +81,243 @@ imageSize              = INTEGER:{len(indata)}
                 '-sha512']
         return self.run_cmd(*args)
 
+    def x509_cert_sysfw(self, cert_fname, input_fname, key_fname, sw_rev,
+                  config_fname, req_dist_name_dict):
+        """Create a certificate to be booted by system firmware
+
+        Args:
+            cert_fname (str): Filename of certificate to create
+            input_fname (str): Filename containing data to sign
+            key_fname (str): Filename of .pem file
+            sw_rev (int): Software revision
+            config_fname (str): Filename to write fconfig into
+            req_dist_name_dict (dict): Dictionary containing key-value pairs of
+            req_distinguished_name section extensions, must contain extensions for
+            C, ST, L, O, OU, CN and emailAddress
+
+        Returns:
+            str: Tool output
+        """
+        indata = tools.read_file(input_fname)
+        hashval = hashlib.sha512(indata).hexdigest()
+        with open(config_fname, 'w', encoding='utf-8') as outf:
+            print(f'''[ req ]
+distinguished_name     = req_distinguished_name
+x509_extensions        = v3_ca
+prompt                 = no
+dirstring_type         = nobmp
+
+[ req_distinguished_name ]
+C                      = {req_dist_name_dict['C']}
+ST                     = {req_dist_name_dict['ST']}
+L                      = {req_dist_name_dict['L']}
+O                      = {req_dist_name_dict['O']}
+OU                     = {req_dist_name_dict['OU']}
+CN                     = {req_dist_name_dict['CN']}
+emailAddress           = {req_dist_name_dict['emailAddress']}
+
+[ v3_ca ]
+basicConstraints       = CA:true
+1.3.6.1.4.1.294.1.3    = ASN1:SEQUENCE:swrv

tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 131

Quoted 10 lines
tools/binman/btool/openssl.py +10 -0
+1.3.6.1.4.1.294.1.34   = ASN1:SEQUENCE:sysfw_image_integrity
+1.3.6.1.4.1.294.1.35   = ASN1:SEQUENCE:sysfw_image_load
+
+[ swrv ]
+swrv = INTEGER:{sw_rev}
+
+[ sysfw_image_integrity ]
+shaType                = OID:2.16.840.1.101.3.4.2.3
+shaValue               = FORMAT:HEX,OCT:{hashval}
+imageSize              = INTEGER:{len(indata)}

There's a lot of duplication here, but at least it is in one file.

Would it make sense, for example, to have a function like

add_dn(buf, dict)

which adds the req_distinguished_name to a stringio buffer? Then that could be calls from multiple places.

Also, please check test coverage (binman test -T). That should be 100% so you will need to add tests for failing cases as well.

Regards,
Simon

#7 lore raw

Re: [PATCH v2 02/18] binman: ti-secure: Add support for TI signing

Hi Simon

Quoted 105 lines · Simon Glass

kHi Neha,

Quoted 89 lines · Neha Malcom Francis

The ti-secure entry contains certificate for binaries that will be loaded or booted by system firmware whereas the ti-secure-rom entry contains certificate for binaries that will be booted by ROM. Support for both these types of certificates is necessary for booting of K3 devices.

---
  board/ti/keys/custMpk.pem                     |  51 ++++
  board/ti/keys/ti-degenerate-key.pem           |  10 +
  tools/binman/btool/openssl.py                 | 244 ++++++++++++++++++
  tools/binman/entries.rst                      |  25 ++
  tools/binman/etype/ti_secure.py               |  83 ++++++
  tools/binman/etype/ti_secure_rom.py           | 233 +++++++++++++++++
  tools/binman/etype/x509_cert.py               |  87 ++++++-
  tools/binman/ftest.py                         |  46 ++++
  tools/binman/test/279_ti_secure.dts           |  17 ++
  tools/binman/test/280_ti_secure_rom.dts       |  17 ++
  .../test/281_ti_secure_rom_combined.dts       |  25 ++
  11 files changed, 830 insertions(+), 8 deletions(-)

create mode 100644 board/ti/keys/custMpk.pem
create mode 100644 board/ti/keys/ti-degenerate-key.pem create mode 100644 tools/binman/etype/ti_secure.py create mode 100644 tools/binman/etype/ti_secure_rom.py create mode 100644 tools/binman/test/279_ti_secure.dts create mode 100644 tools/binman/test/280_ti_secure_rom.dts create mode 100644 tools/binman/test/281_ti_secure_rom_combined.dts

tools/binman/btool/openssl.py +45 -0
index 3a4dbdd6d7..aad3b61ae2 100644
@@ -15,6 +15,13 @@ import hashlib
  from binman import bintool
  from u_boot_pylib import tools
 
+
+VALID_SHAS = [256, 384, 512, 224]
+SHA_OIDS = {256:'2.16.840.1.101.3.4.2.1',
+            384:'2.16.840.1.101.3.4.2.2',
+            512:'2.16.840.1.101.3.4.2.3',
+            224:'2.16.840.1.101.3.4.2.4'}
+
  class Bintoolopenssl(bintool.Bintool):
      """openssl tool
 
@@ -74,6 +81,243 @@ imageSize              = INTEGER:{len(indata)}
                  '-sha512']
          return self.run_cmd(*args)
 
+    def x509_cert_sysfw(self, cert_fname, input_fname, key_fname, sw_rev,
+                  config_fname, req_dist_name_dict):
+        """Create a certificate to be booted by system firmware
+
+        Args:
+            cert_fname (str): Filename of certificate to create
+            input_fname (str): Filename containing data to sign
+            key_fname (str): Filename of .pem file
+            sw_rev (int): Software revision
+            config_fname (str): Filename to write fconfig into
+            req_dist_name_dict (dict): Dictionary containing key-value pairs of
+            req_distinguished_name section extensions, must contain extensions for
+            C, ST, L, O, OU, CN and emailAddress
+
+        Returns:
+            str: Tool output
+        """
+        indata = tools.read_file(input_fname)
+        hashval = hashlib.sha512(indata).hexdigest()
+        with open(config_fname, 'w', encoding='utf-8') as outf:
+            print(f'''[ req ]
+distinguished_name     = req_distinguished_name
+x509_extensions        = v3_ca
+prompt                 = no
+dirstring_type         = nobmp
+
+[ req_distinguished_name ]
+C                      = {req_dist_name_dict['C']}
+ST                     = {req_dist_name_dict['ST']}
+L                      = {req_dist_name_dict['L']}
+O                      = {req_dist_name_dict['O']}
+OU                     = {req_dist_name_dict['OU']}
+CN                     = {req_dist_name_dict['CN']}
+emailAddress           = {req_dist_name_dict['emailAddress']}
+
+[ v3_ca ]
+basicConstraints       = CA:true
+1.3.6.1.4.1.294.1.3    = ASN1:SEQUENCE:swrv

tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 131

Quoted 10 lines
tools/binman/btool/openssl.py +10 -0
+1.3.6.1.4.1.294.1.34   = ASN1:SEQUENCE:sysfw_image_integrity
+1.3.6.1.4.1.294.1.35   = ASN1:SEQUENCE:sysfw_image_load
+
+[ swrv ]
+swrv = INTEGER:{sw_rev}
+
+[ sysfw_image_integrity ]
+shaType                = OID:2.16.840.1.101.3.4.2.3
+shaValue               = FORMAT:HEX,OCT:{hashval}
+imageSize              = INTEGER:{len(indata)}

There's a lot of duplication here, but at least it is in one file.

Quoted 7 lines

Would it make sense, for example, to have a function like

add_dn(buf, dict)

which adds the req_distinguished_name to a stringio buffer? Then that could be calls from multiple places.

Right that is possible, plus it gives an outline if this etype can be simplified in the future similarly.

Quoted 3 lines

Also, please check test coverage (binman test -T). That should be 100% so you will need to add tests for failing cases as well.

I'll take note of these corrections and send v3 soon, thanks!

Quoted 2 lines

Regards,
Simon

Signature · 2 lines
Thanking You
Neha Malcom Francis
#8 lore raw

PATCH v2 3/18 ti: sysfw: tiboot3: Add support for packaging sysfw.itb and tiboot3.bin

In reply to Neha Malcom Francis

Board config binary artifacts must be populated in the R5 output directory to be used by binman to package sysfw.itb and tiboot3.bin.

For devices that follow combined flow, these board configuration binaries must again be packaged into a combined board configuration blobs to be used by binman to package tiboot3.bin.

Modify config.mk to generate all the board configuration binaries as well as the combined blob binaries.

---
 arch/arm/mach-k3/config.mk | 50 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
arch/arm/mach-k3/config.mk +50 -0
index 9306f2627d..b280a6a048 100644
@@ -39,6 +39,56 @@ $(warning "WARNING: Software revision file not found. Default may not work on HS
 endif
 endif
 
+O ?= .
+
+# Board config binary artifacts necessary for packaging of tiboot3.bin
+# and sysfw.itb by binman, currently for general purpose devices and
+# devices that require sysfw.itb in ROM boot image.
+
+ifdef CONFIG_BINMAN
+
+ifndef CONFIG_TARGET_J7200_R5_EVM
+BOARD_YAML = $(srctree)/board/ti/$(BOARD)/board-cfg.yaml
+RM_YAML = $(srctree)/board/ti/$(BOARD)/rm-cfg.yaml
+SEC_YAML = $(srctree)/board/ti/$(BOARD)/sec-cfg.yaml
+PM_YAML = $(srctree)/board/ti/$(BOARD)/pm-cfg.yaml
+else
+BOARD_YAML = $(srctree)/board/ti/$(BOARD)/board-cfg_j7200.yaml
+RM_YAML = $(srctree)/board/ti/$(BOARD)/rm-cfg_j7200.yaml
+SEC_YAML = $(srctree)/board/ti/$(BOARD)/sec-cfg_j7200.yaml
+PM_YAML = $(srctree)/board/ti/$(BOARD)/pm-cfg_j7200.yaml
+endif
+
+CUSTOMER_KEY = $(srctree)/board/ti/keys/custMpk.pem
+TI_DEGENERATE_KEY = $(srctree)/board/ti/keys/ti-degenerate-key.pem
+
+SCHEMA_YAML = $(srctree)/board/ti/common/schema.yaml
+
+board-cfg.yaml: $(BOARD_YAML)
+	@cp $< $@
+rm-cfg.yaml: $(RM_YAML)
+	@cp $< $@
+sec-cfg.yaml: $(SEC_YAML)
+	@cp $< $@
+pm-cfg.yaml: $(PM_YAML)
+	@cp $< $@
+
+schema.yaml: $(SCHEMA_YAML)
+	@cp $< $@
+custMpk.pem: $(CUSTOMER_KEY)
+	@cp $< $@
+ti-degenerate-key.pem: $(TI_DEGENERATE_KEY)
+	@cp $< $@
+
+INPUTS-y	+= board-cfg.yaml
+INPUTS-y	+= rm-cfg.yaml
+INPUTS-y	+= sec-cfg.yaml
+INPUTS-y	+= pm-cfg.yaml
+INPUTS-y	+= schema.yaml
+INPUTS-y	+= custMpk.pem
+INPUTS-y	+= ti-degenerate-key.pem
+endif
+
 # tiboot3.bin is mandated by ROM and ROM only supports R5 boot.
 # So restrict tiboot3.bin creation for CPU_V7R.
 ifdef CONFIG_CPU_V7R
Signature · 1 line
2.34.1
#9 lore raw

PATCH v2 4/18 j721e: schema: yaml: Add general schema and J721E board config files

In reply to Neha Malcom Francis

Schema file in YAML must be provided in board/ti/common for validating input config files and packaging system firmware. The schema includes entries for rm-cfg, board-cfg, pm-cfg and sec-cfg.

Board config file must be provided in board/ti/<devicename> in YAML. These can then be consumed for generation of binaries to package system firmware. Added YAML config for J721E in particular.

[[email protected]: prepared patch for upstreaming]
---
 board/ti/common/schema.yaml   |  355 +++++
 board/ti/j721e/board-cfg.yaml |   37 +
 board/ti/j721e/pm-cfg.yaml    |   13 +
 board/ti/j721e/rm-cfg.yaml    | 2757 +++++++++++++++++++++++++++++++++
 board/ti/j721e/sec-cfg.yaml   |  379 +++++
 5 files changed, 3541 insertions(+)
 create mode 100644 board/ti/common/schema.yaml
 create mode 100644 board/ti/j721e/board-cfg.yaml
 create mode 100644 board/ti/j721e/pm-cfg.yaml
 create mode 100644 board/ti/j721e/rm-cfg.yaml
 create mode 100644 board/ti/j721e/sec-cfg.yaml
board/ti/common/schema.yaml new file +355 -0
new file mode 100644
index 0000000000..070ff797e0
@@ -0,0 +1,355 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Config schema for TI K3 devices
+#
+
+---
+
+definitions:
+    u8:
+        type: integer
+        minimum: 0
+        maximum: 0xff
+    u16:
+        type: integer
+        minimum: 0
+        maximum: 0xffff
+    u32:
+        type: integer
+        minimum: 0
+        maximum: 0xffffffff
+
+
+
+type: object
+properties:
+    pm-cfg:
+        type: object
+        properties:
+            rev:
+                type: object
+                properties:
+                    boardcfg_abi_maj:
+                        $ref: "#/definitions/u8"
+                    boardcfg_abi_min:
+                        $ref: "#/definitions/u8"
+    board-cfg:
+        type: object
+        properties:
+            rev:
+                type: object
+                properties:
+                    boardcfg_abi_maj:
+                        $ref: "#/definitions/u8"
+                    boardcfg_abi_min:
+                        $ref: "#/definitions/u8"
+            control:
+                type: object
+                properties:
+                    subhdr:
+                        type: object
+                        properties:
+                            magic:
+                                $ref: "#/definitions/u16"
+                            size:
+                                $ref: "#/definitions/u16"
+                    main_isolation_enable:
+                        $ref: "#/definitions/u8"
+                    main_isolation_hostid:
+                        $ref: "#/definitions/u16"
+
+
+            secproxy:
+                type: object
+                properties:
+                    subhdr:
+                        type: object
+                        properties:
+                            magic:
+                                $ref: "#/definitions/u16"
+                            size:
+                                $ref: "#/definitions/u16"
+                    scaling_factor:
+                        $ref: "#/definitions/u8"
+                    scaling_profile:
+                        $ref: "#/definitions/u8"
+                    disable_main_nav_secure_proxy:
+                        $ref: "#/definitions/u8"
+
+            msmc:
+                type: object
+                properties:
+                    subhdr:
+                        type: object
+                        properties:
+                            magic:
+                                $ref: "#/definitions/u16"
+                            size:
+                                $ref: "#/definitions/u16"
+                    msmc_cache_size:
+                        $ref: "#/definitions/u8"
+            debug_cfg:
+                type: object
+                properties:
+                    subhdr:
+                        type: object
+                        properties:
+                            magic:
+                                $ref: "#/definitions/u16"
+                            size:
+                                $ref: "#/definitions/u16"
+                    trace_dst_enables:
+                        $ref: "#/definitions/u16"
+                    trace_src_enables:
+                        $ref: "#/definitions/u16"
+
+    sec-cfg:
+        type: object
+        properties:
+            rev:
+                type: object
+                properties:
+                    boardcfg_abi_maj:
+                        $ref: "#/definitions/u8"
+                    boardcfg_abi_min:
+                        $ref: "#/definitions/u8"
+
+            processor_acl_list:
+                type: object
+                properties:
+                    subhdr:
+                        type: object
+                        properties:
+                            magic:
+                                $ref: "#/definitions/u16"
+                            size:
+                                $ref: "#/definitions/u16"
+                    proc_acl_entries:
+                        type: array
+                        minItems: 32
+                        maxItems: 32
+                        items:
+                            type: object
+                            properties:
+                                processor_id:
+                                    $ref: "#/definitions/u8"
+                                proc_access_master:
+                                    $ref: "#/definitions/u8"
+                                proc_access_secondary:
+                                    type: array
+                                    minItems: 3
+                                    maxItems: 3
+                                    items:
+                                        $ref: "#/definitions/u8"
+            host_hierarchy:
+                type: object
+                properties:
+                    subhdr:
+                        type: object
+                        properties:
+                            magic:
+                                $ref: "#/definitions/u16"
+                            size:
+                                $ref: "#/definitions/u16"
+                    host_hierarchy_entries:
+                        type: array
+                        minItems: 32
+                        maxItems: 32
+                        items:
+                            type: object
+                            properties:
+                                host_id:
+                                    $ref: "#/definitions/u8"
+                                supervisor_host_id:
+                                    $ref: "#/definitions/u8"
+
+            otp_config:
+                type: object
+                properties:
+                    subhdr:
+                        type: object
+                        properties:
+                            magic:
+                                $ref: "#/definitions/u16"
+                            size:
+                                $ref: "#/definitions/u16"
+                    otp_entry:
+                        type: array
+                        minItems: 32
+                        maxItems: 32
+                        items:
+                            type: object
+                            properties:
+                                host_id:
+                                    $ref: "#/definitions/u8"
+                                host_perms:
+                                    $ref: "#/definitions/u8"
+                    write_host_id:
+                        $ref: "#/definitions/u8"
+
+            dkek_config:
+                type: object
+                properties:
+                    subhdr:
+                        type: object
+                        properties:
+                            magic:
+                                $ref: "#/definitions/u16"
+                            size:
+                                $ref: "#/definitions/u16"
+                    allowed_hosts:
+                        type: array
+                        minItems: 4
+                        maxItems: 4
+                        items:
+                            $ref: "#/definitions/u8"
+                    allow_dkek_export_tisci:
+                        $ref: "#/definitions/u8"
+                    rsvd:
+                        type: array
+                        minItems: 3
+                        maxItems: 3
+                        items:
+                            $ref: "#/definitions/u8"
+
+            sa2ul_cfg:
+                type: object
+                properties:
+                    subhdr:
+                        type: object
+                        properties:
+                            magic:
+                                $ref: "#/definitions/u16"
+                            size:
+                                $ref: "#/definitions/u16"
+                    rsvd:
+                        type: array
+                        minItems: 4
+                        maxItems: 4
+                        items:
+                            $ref: "#/definitions/u8"
+            sec_dbg_config:
+                type: object
+                properties:
+                    subhdr:
+                        type: object
+                        properties:
+                            magic:
+                                $ref: "#/definitions/u16"
+                            size:
+                                $ref: "#/definitions/u16"
+                    allow_jtag_unlock:
+                        $ref: "#/definitions/u8"
+                    allow_wildcard_unlock:
+                        $ref: "#/definitions/u8"
+                    allowed_debug_level_rsvd:
+                        $ref: "#/definitions/u8"
+                    rsvd:
+                        $ref: "#/definitions/u8"
+                    min_cert_rev:
+                        $ref: "#/definitions/u32"
+                    jtag_unlock_hosts:
+                        type: array
+                        minItems: 4
+                        maxItems: 4
+                        items:
+                            $ref: "#/definitions/u8"
+
+
+            sec_handover_cfg:
+                type: object
+                properties:
+                    subhdr:
+                        type: object
+                        properties:
+                            magic:
+                                $ref: "#/definitions/u16"
+                            size:
+                                $ref: "#/definitions/u16"
+                    handover_msg_sender:
+                        $ref: "#/definitions/u8"
+                    handover_to_host_id:
+                        $ref: "#/definitions/u8"
+                    rsvd:
+                        type: array
+                        minItems: 4
+                        maxItems: 4
+                        items:
+                            $ref: "#/definitions/u8"
+
+    rm-cfg:
+        type: object
+        properties:
+            rm_boardcfg:
+                type: object
+                properties:
+                    rev:
+                        type: object
+                        properties:
+                            boardcfg_abi_maj:
+                                $ref: "#/definitions/u8"
+                            boardcfg_abi_min:
+                                $ref: "#/definitions/u8"
+
+                    host_cfg:
+                        type: object
+                        properties:
+                            subhdr:
+                                type: object
+                                properties:
+                                    magic:
+                                        $ref: "#/definitions/u16"
+                                    size:
+                                        $ref: "#/definitions/u16"
+                            host_cfg_entries:
+                                type: array
+                                minItems: 0
+                                maxItems: 32
+                                items:
+                                    type: object
+                                    properties:
+                                        host_id:
+                                            $ref: "#/definitions/u8"
+                                        allowed_atype:
+                                            $ref: "#/definitions/u8"
+                                        allowed_qos:
+                                            $ref: "#/definitions/u16"
+                                        allowed_orderid:
+                                            $ref: "#/definitions/u32"
+                                        allowed_priority:
+                                            $ref: "#/definitions/u16"
+                                        allowed_sched_priority:
+                                            $ref: "#/definitions/u8"
+                    resasg:
+                        type: object
+                        properties:
+                            subhdr:
+                                type: object
+                                properties:
+                                    magic:
+                                        $ref: "#/definitions/u16"
+                                    size:
+                                        $ref: "#/definitions/u16"
+                            resasg_entries_size:
+                                        $ref: "#/definitions/u16"
+                            reserved:
+                                        $ref: "#/definitions/u16"
+
+            resasg_entries:
+                type: array
+                minItems: 0
+                maxItems: 418
+                items:
+                    type: object
+                    properties:
+                        start_resource:
+                            $ref: "#/definitions/u16"
+                        num_resource:
+                            $ref: "#/definitions/u16"
+                        type:
+                            $ref: "#/definitions/u16"
+                        host_id:
+                            $ref: "#/definitions/u8"
+                        reserved:
+                            $ref: "#/definitions/u8"
board/ti/j721e/board-cfg.yaml new file +37 -0
new file mode 100644
index 0000000000..9f5e00b3dc
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for J721E
+#
+
+---
+
+board-cfg:
+        rev:
+                boardcfg_abi_maj: 0x0
+                boardcfg_abi_min: 0x1
+        control:
+                subhdr:
+                        magic: 0xC1D3
+                        size: 7
+                main_isolation_enable: 0x5A
+                main_isolation_hostid: 0x2
+        secproxy:
+                subhdr:
+                        magic: 0x1207
+                        size: 7
+                scaling_factor: 0x1
+                scaling_profile: 0x1
+                disable_main_nav_secure_proxy: 0
+        msmc:
+                subhdr:
+                        magic: 0xA5C3
+                        size: 5
+                msmc_cache_size: 0x0
+        debug_cfg:
+                subhdr:
+                        magic: 0x020C
+                        size: 8
+                trace_dst_enables: 0x00
+                trace_src_enables: 0x00
+
board/ti/j721e/pm-cfg.yaml new file +13 -0
new file mode 100644
index 0000000000..40a8dfb7af
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for J721E
+#
+
+---
+
+pm-cfg:
+        rev:
+                boardcfg_abi_maj: 0x0
+                boardcfg_abi_min: 0x1
+
board/ti/j721e/rm-cfg.yaml new file +2757 -0

2,595 lines not on this page · raw message

board/ti/j721e/sec-cfg.yaml new file +379 -0

379 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.34.1

Part of the diff is not shown here. View the raw message.

#10 lore raw

PATCH v2 5/18 j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

In reply to Neha Malcom Francis

By providing entries in the binman node of the device tree, binman will be able to find and package board config artifacts generated by TIBoardConfig with sysfw.bin and generate the final image sysfw.itb. It will also pick out the R5 SPL and sign it with the help of TI signing entry and generate the final tiboot3.bin.

Entries for A72 build have been added to k3-j721e-binman.dtsi to generate tispl.bin and u-boot.img.

Support has been added for both HS(SR 1.1) and GP images where the encrypted system firmware binary must be signed along with the signed certificate binary.

tiboot3.bin and sysfw-j721e_sr1_1-hs.itb: For HS devices tiboot3.bin_unsigned and sysfw-j721e-gp-evm.itb: For GP devices <filename>.bin/img: For HS devices <filename>.bin_unsigned/img_unsigned: For GP devices

Intention of patch is to move signing and packaging to binman, thus making makefile target only if binman is not enabled.

It is to be noted that the bootflow followed by J721E requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs

sysfw.itb:
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

---
 arch/arm/dts/k3-j721e-binman.dtsi             | 634 ++++++++++++++++++
 .../k3-j721e-common-proc-board-u-boot.dtsi    |   1 +
 .../arm/dts/k3-j721e-r5-common-proc-board.dts |   1 +
 arch/arm/mach-k3/config.mk                    |   4 +
 board/ti/j721e/Kconfig                        |   2 +
 scripts/Makefile.spl                          |   2 +
 6 files changed, 644 insertions(+)
 create mode 100644 arch/arm/dts/k3-j721e-binman.dtsi
arch/arm/dts/k3-j721e-binman.dtsi new file +634 -0
new file mode 100644
index 0000000000..fc53b3f119
@@ -0,0 +1,634 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/ {
+	binman: binman {
+		multiple-images;
+	};
+};
+
+#ifdef CONFIG_TARGET_J721E_R5_EVM
+
+&binman {
+	board-cfg {
+		filename = "board-cfg.bin";
+		ti-board-config {
+			config = "board-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	pm-cfg {
+		filename = "pm-cfg.bin";
+		ti-board-config {
+			config = "pm-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	rm-cfg {
+		filename = "rm-cfg.bin";
+		ti-board-config {
+			config = "rm-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	sec-cfg {
+		filename = "sec-cfg.bin";
+		ti-board-config {
+			config = "sec-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	tiboot3 {
+		filename = "tiboot3.bin";
+		ti-secure-rom {
+			content = <&u_boot_spl>;
+			core = "public";
+			load = <CONFIG_SPL_TEXT_BASE>;
+			keyfile = "custMpk.pem";
+		};
+		u_boot_spl: u-boot-spl {
+			no-expanded;
+		};
+	};
+	sysfw {
+		filename = "sysfw.bin";
+		ti-secure-rom {
+			content = <&ti_fs_cert>;
+			core = "secure";
+			load = <0x40000>;
+			keyfile = "custMpk.pem";
+			countersign;
+		};
+		ti_fs_cert: ti-fs-cert.bin {
+			filename = "ti-fs-firmware-j721e_sr1_1-hs-cert.bin";
+			type = "blob-ext";
+			optional;
+		};
+		ti-fs-firmware-j721e_sr1_1-hs-enc.bin {
+			filename = "ti-fs-firmware-j721e_sr1_1-hs-enc.bin";
+			type = "blob-ext";
+			optional;
+		};
+	};
+	itb {
+		filename = "sysfw-j721e_sr1_1-hs.itb";
+		fit {
+			description = "SYSFW and Config fragments";
+			#address-cells = <1>;
+			images {
+				sysfw.bin {
+					description = "sysfw";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+					    filename = "sysfw.bin";
+					};
+				};
+				board-cfg.bin {
+					description = "board-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&board_cfg>;
+						keyfile = "custMpk.pem";
+					};
+					board_cfg: board-cfg {
+						filename = "board-cfg.bin";
+						type = "blob-ext";
+					};
+
+				};
+				pm-cfg.bin {
+					description = "pm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&pm_cfg>;
+						keyfile = "custMpk.pem";
+					};
+					pm_cfg: pm-cfg {
+						filename = "pm-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+				rm-cfg.bin {
+					description = "rm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&rm_cfg>;
+						keyfile = "custMpk.pem";\
+					};
+					rm_cfg: rm-cfg {
+						filename = "rm-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+				sec-cfg.bin {
+					description = "sec-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&sec_cfg>;
+						keyfile = "custMpk.pem";
+					};
+					sec_cfg: sec-cfg {
+						filename = "sec-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	tiboot3_unsigned {
+		filename = "tiboot3.bin_unsigned";
+		ti-secure-rom {
+			content = <&u_boot_spl_unsigned>;
+			core = "public";
+			load = <CONFIG_SPL_TEXT_BASE>;
+			sw-rev = <CONFIG_K3_X509_SWRV>;
+			keyfile = "ti-degenerate-key.pem";
+		};
+		u_boot_spl_unsigned: u-boot-spl {
+			no-expanded;
+		};
+	};
+	sysfw_gp {
+		filename = "sysfw.bin_gp";
+		ti-secure-rom {
+			content = <&ti_fs>;
+			core = "secure";
+			load = <0x40000>;
+			sw-rev = <CONFIG_K3_X509_SWRV>;
+			keyfile = "ti-degenerate-key.pem";
+			countersign;
+		};
+		ti_fs: ti-fs.bin {
+			filename = "ti-fs-firmware-j721e-gp.bin";
+			type = "blob-ext";
+			optional;
+		};
+	};
+	itb_gp {
+		filename = "sysfw-j721e-gp-evm.itb";
+		symlink = "sysfw.itb";
+		fit {
+			description = "SYSFW and Config fragments";
+			#address-cells = <1>;
+			images {
+				sysfw.bin {
+					description = "sysfw";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+					    filename = "sysfw.bin_gp";
+					};
+				};
+				board-cfg.bin {
+					description = "board-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+						filename = "board-cfg.bin";
+					};
+				};
+				pm-cfg.bin {
+					description = "pm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+						filename = "pm-cfg.bin";
+					};
+				};
+				rm-cfg.bin {
+					description = "rm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+						filename = "rm-cfg.bin";
+					};
+				};
+				sec-cfg.bin {
+					description = "sec-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+						filename = "sec-cfg.bin";
+					};
+				};
+			};
+		};
+	};
+};
+#endif
+
+#ifdef CONFIG_TARGET_J721E_A72_EVM
+
+#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
+#define SPL_J721E_EVM_DTB "spl/dts/k3-j721e-common-proc-board.dtb"
+#define SPL_J721E_SK_DTB "spl/dts/k3-j721e-sk.dtb"
+
+#define UBOOT_NODTB "u-boot-nodtb.bin"
+#define J721E_EVM_DTB "arch/arm/dts/k3-j721e-common-proc-board.dtb"
+#define J721E_SK_DTB "arch/arm/dts/k3-j721e-sk.dtb"
+
+&binman {
+	ti-dm {
+		filename = "ti-dm.bin";
+		blob-ext {
+			filename = "ipc_echo_testb_mcu1_0_release_strip.xer5f";
+		};
+	};
+	ti-spl {
+		filename = "tispl.bin";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					atf-bl31 {
+					};
+				};
+
+				tee {
+					description = "OPTEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					tee-os {
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+					blob-ext {
+						filename = "ti-dm.bin";
+					};
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_spl_nodtb>;
+						keyfile = "custMpk.pem";
+
+					};
+					u_boot_spl_nodtb: blob-ext {
+						filename = SPL_NODTB;
+					};
+				};
+
+				fdt-1 {
+					description = "k3-j721e-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&spl_j721e_evm_dtb>;
+						keyfile = "custMpk.pem";
+					};
+					spl_j721e_evm_dtb: blob-ext {
+						filename = SPL_J721E_EVM_DTB;
+					};
+				};
+
+				fdt-2 {
+					description = "k3-j721e-sk";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&spl_j721e_sk_dtb>;
+						keyfile = "custMpk.pem";
+
+					};
+					spl_j721e_sk_dtb: blob-ext {
+						filename = SPL_J721E_SK_DTB;
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-1";
+
+				conf-1 {
+					description = "k3-j721e-common-proc-board";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-0";
+				};
+
+				conf-2 {
+					description = "k3-j721e-sk";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-2";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	u-boot {
+		filename = "u-boot.img";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					description = "U-Boot for j721e board";
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_nodtb>;
+						keyfile = "custMpk.pem";
+					};
+					u_boot_nodtb: u-boot-nodtb {
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-0 {
+					description = "k3-j721e-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&j721e_evm_dtb>;
+						keyfile = "custMpk.pem";
+
+					};
+					j721e_evm_dtb: blob-ext {
+						filename = J721E_EVM_DTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-2 {
+					description = "k3-j721e-sk";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&j721e_sk_dtb>;
+						keyfile = "custMpk.pem";
+
+					};
+					j721e_sk_dtb: blob-ext {
+						filename = J721E_SK_DTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-0";
+
+				conf-0 {
+					description = "k3-j721e-common-proc-board";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-0";
+				};
+
+				conf-2 {
+					description = "k3-j721e-sk";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-2";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	ti-spl_unsigned {
+		filename = "tispl.bin_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					atf-bl31 {
+						filename = "bl31.bin";
+					};
+				};
+
+				tee {
+					description = "OPTEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					tee-os {
+						filename = "tee-pager_v2.bin";
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+					blob-ext {
+						filename = "ti-dm.bin";
+					};
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					blob-ext {
+						filename = SPL_NODTB;
+					};
+				};
+
+				fdt-1 {
+					description = "k3-j721e-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = SPL_J721E_EVM_DTB;
+					};
+				};
+
+				fdt-2 {
+					description = "k3-j721e-sk";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = SPL_J721E_SK_DTB;
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-1";
+
+				conf-1 {
+					description = "k3-j721e-common-proc-board";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-1";
+				};
+
+				conf-2 {
+					description = "k3-j721e-sk";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-2";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	u-boot_unsigned {
+		filename = "u-boot.img_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					description = "U-Boot for j721e board";
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					blob {
+						filename = UBOOT_NODTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-1 {
+					description = "k3-j721e-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = J721E_EVM_DTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-2 {
+					description = "k3-j721e-sk";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = J721E_SK_DTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-1";
+
+				conf-1 {
+					description = "k3-j721e-common-proc-board";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-1";
+				};
+
+				conf-2 {
+					description = "k3-j721e-sk";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-2";
+				};
+			};
+		};
+	};
+};
+#endif
arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +1 -0
index 867ec2bb1a..540c847eb3 100644
@@ -4,6 +4,7 @@
  */
 
 #include <dt-bindings/net/ti-dp83867.h>
+#include "k3-j721e-binman.dtsi"
 
 / {
 	chosen {
arch/arm/dts/k3-j721e-r5-common-proc-board.dts +1 -0
index e9e50538cb..2913eae4d2 100644
@@ -8,6 +8,7 @@
 #include "k3-j721e-som-p0.dtsi"
 #include "k3-j721e-ddr-evm-lp4-4266.dtsi"
 #include "k3-j721e-ddr.dtsi"
+#include "k3-j721e-binman.dtsi"
 #include <dt-bindings/phy/phy-cadence.h>
 
 / {
arch/arm/mach-k3/config.mk +4 -0
index b280a6a048..b342a56538 100644
@@ -91,6 +91,7 @@ endif
 
 # tiboot3.bin is mandated by ROM and ROM only supports R5 boot.
 # So restrict tiboot3.bin creation for CPU_V7R.
+ifndef CONFIG_BINMAN
 ifdef CONFIG_CPU_V7R
 image_check: $(obj)/u-boot-spl.bin FORCE
 	@if [ $(IMAGE_SIZE) -gt $(MAX_SIZE) ]; then			    \
@@ -107,6 +108,7 @@ tiboot3.bin: image_check FORCE
 
 INPUTS-y	+= tiboot3.bin
 endif
+endif
 
 ifdef CONFIG_ARM64
 
@@ -114,6 +116,7 @@ ifeq ($(CONFIG_SOC_K3_J721E),)
 export DM := /dev/null
 endif
 
+ifndef CONFIG_BINMAN
 ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
 SPL_ITS := u-boot-spl-k3_HS.its
 $(SPL_ITS): export IS_HS=1
@@ -122,6 +125,7 @@ else
 SPL_ITS := u-boot-spl-k3.its
 INPUTS-y	+= tispl.bin
 endif
+endif
 
 ifeq ($(CONFIG_SPL_OF_LIST),)
 LIST_OF_DTB := $(CONFIG_DEFAULT_DEVICE_TREE)
board/ti/j721e/Kconfig +2 -0
index 84bca32712..4a127c4a10 100644
@@ -13,6 +13,7 @@ config TARGET_J721E_A72_EVM
 	select BOARD_LATE_INIT
 	imply TI_I2C_BOARD_DETECT
 	select SYS_DISABLE_DCACHE_OPS
+	select BINMAN
 
 config TARGET_J721E_R5_EVM
 	bool "TI K3 based J721E EVM running on R5"
@@ -22,6 +23,7 @@ config TARGET_J721E_R5_EVM
 	select RAM
 	select SPL_RAM
 	select K3_DDRSS
+	select BINMAN
 	imply SYS_K3_SPL_ATF
 	imply TI_I2C_BOARD_DETECT
 
scripts/Makefile.spl +2 -0
index 15ac87286d..a7811609bf 100644
@@ -593,6 +593,8 @@ $(obj)/$(SPL_BIN).multidtb.fit.lzo: $(obj)/$(SPL_BIN).multidtb.fit
 	@lzop -f9 $< > $@
 
 ifdef CONFIG_ARCH_K3
+ifndef CONFIG_BINMAN
 tispl.bin: $(obj)/u-boot-spl-nodtb.bin $(SHRUNK_ARCH_DTB) $(SPL_ITS) FORCE
 	$(call if_changed,mkfitimage)
 endif
+endif
Signature · 1 line
2.34.1
#11 lore raw

Re: [PATCH v2 05/18] j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

Quoted 47 lines · Neha Malcom Francis

By providing entries in the binman node of the device tree, binman will be able to find and package board config artifacts generated by TIBoardConfig with sysfw.bin and generate the final image sysfw.itb. It will also pick out the R5 SPL and sign it with the help of TI signing entry and generate the final tiboot3.bin.

Entries for A72 build have been added to k3-j721e-binman.dtsi to generate tispl.bin and u-boot.img.

Support has been added for both HS(SR 1.1) and GP images where the encrypted system firmware binary must be signed along with the signed certificate binary.

tiboot3.bin and sysfw-j721e_sr1_1-hs.itb: For HS devices tiboot3.bin_unsigned and sysfw-j721e-gp-evm.itb: For GP devices <filename>.bin/img: For HS devices <filename>.bin_unsigned/img_unsigned: For GP devices

Intention of patch is to move signing and packaging to binman, thus making makefile target only if binman is not enabled.

It is to be noted that the bootflow followed by J721E requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs

sysfw.itb:
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

---

[...]

arch/arm/dts/k3-j721e-binman.dtsi line 65

Quoted 2 lines
arch/arm/dts/k3-j721e-binman.dtsi new file +2 -0
+		ti_fs_cert: ti-fs-cert.bin {
+			filename = "ti-fs-firmware-j721e_sr1_1-hs-cert.bin";

Suggest prefix these with the expected directory name,

filename = "ti-sysfw/ti-fs-firmware-j721e_sr1_1-hs-cert.bin";

that way we only need to do one simple firmware path export:

export BINMAN_INDIRS="<ti-linux-firmware>"

Same below for DM firmware which lives in the same firmware repo but in a directory that depends on the platform, selecting the correct platform directory here in this file makes it so much easier for users.

[...]

Quoted 1 line

+ filename = "ipc_echo_testb_mcu1_0_release_strip.xer5f";

filename = "ti-dm/j721e/ipc_echo_testb_mcu1_0_release_strip.xer5f";

Do that for all the DM/SYSFW files for all the platforms in this series.

Thanks,
Andrew

#12 lore raw

Re: [PATCH v2 05/18] j721e: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

Hi Andrew

Quoted 65 lines · Andrew Davis
Quoted 47 lines · Neha Malcom Francis

By providing entries in the binman node of the device tree, binman will be able to find and package board config artifacts generated by TIBoardConfig with sysfw.bin and generate the final image sysfw.itb. It will also pick out the R5 SPL and sign it with the help of TI signing entry and generate the final tiboot3.bin.

Entries for A72 build have been added to k3-j721e-binman.dtsi to generate tispl.bin and u-boot.img.

Support has been added for both HS(SR 1.1) and GP images where the encrypted system firmware binary must be signed along with the signed certificate binary.

tiboot3.bin and sysfw-j721e_sr1_1-hs.itb: For HS devices tiboot3.bin_unsigned and sysfw-j721e-gp-evm.itb: For GP devices <filename>.bin/img: For HS devices <filename>.bin_unsigned/img_unsigned: For GP devices

Intention of patch is to move signing and packaging to binman, thus making makefile target only if binman is not enabled.

It is to be noted that the bootflow followed by J721E requires:

tiboot3.bin:
    * R5 SPL
    * R5 SPL dtbs

sysfw.itb:
    * TIFS
    * board-cfg
    * pm-cfg
    * sec-cfg
    * rm-cfg

tispl.bin:
    * DM
    * ATF
    * OPTEE
    * A72 SPL
    * A72 SPL dtbs

u-boot.img:
    * A72 U-Boot
    * A72 U-Boot dtbs

---

[...]

Quoted 2 lines

+        ti_fs_cert: ti-fs-cert.bin {
+            filename = "ti-fs-firmware-j721e_sr1_1-hs-cert.bin";

Suggest prefix these with the expected directory name,

filename = "ti-sysfw/ti-fs-firmware-j721e_sr1_1-hs-cert.bin";

that way we only need to do one simple firmware path export:

export BINMAN_INDIRS="<ti-linux-firmware>"

Same below for DM firmware which lives in the same firmware repo but in a directory that depends on the platform, selecting the correct platform directory here in this file makes it so much easier for users.

Quoted 8 lines

[...]

Quoted 1 line

+ filename = "ipc_echo_testb_mcu1_0_release_strip.xer5f";

filename = "ti-dm/j721e/ipc_echo_testb_mcu1_0_release_strip.xer5f";

Do that for all the DM/SYSFW files for all the platforms in this series.

That makes it easier, I'll do that, thanks!

Quoted 2 lines

Thanks,
Andrew

Signature · 2 lines
Thanking You
Neha Malcom Francis
#13 lore raw

PATCH v2 6/18 j7200: yaml: Add J7200 board config files

In reply to Neha Malcom Francis

Added YAML config for J7200

---
 board/ti/j721e/board-cfg_j7200.yaml |   36 +
 board/ti/j721e/pm-cfg_j7200.yaml    |   12 +
 board/ti/j721e/rm-cfg_j7200.yaml    | 2065 +++++++++++++++++++++++++++
 board/ti/j721e/sec-cfg_j7200.yaml   |  378 +++++
 4 files changed, 2491 insertions(+)
 create mode 100644 board/ti/j721e/board-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/pm-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/rm-cfg_j7200.yaml
 create mode 100644 board/ti/j721e/sec-cfg_j7200.yaml
board/ti/j721e/board-cfg_j7200.yaml new file +36 -0
new file mode 100644
index 0000000000..1453317ecb
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for J7200
+#
+
+---
+
+board-cfg:
+        rev:
+                boardcfg_abi_maj : 0x0
+                boardcfg_abi_min : 0x1
+        control:
+                subhdr:
+                        magic: 0xC1D3
+                        size: 7
+                main_isolation_enable : 0x5A
+                main_isolation_hostid : 0x2
+        secproxy:
+                subhdr:
+                        magic: 0x1207
+                        size: 7
+                scaling_factor : 0x1
+                scaling_profile : 0x1
+                disable_main_nav_secure_proxy : 0
+        msmc:
+                subhdr:
+                        magic: 0xA5C3
+                        size: 5
+                msmc_cache_size : 0x10
+        debug_cfg:
+                subhdr:
+                        magic: 0x020C
+                        size: 8
+                trace_dst_enables : 0x00
+                trace_src_enables : 0x00
board/ti/j721e/pm-cfg_j7200.yaml new file +12 -0
new file mode 100644
index 0000000000..588a1d530d
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for J7200
+#
+
+---
+
+pm-cfg:
+        rev:
+                boardcfg_abi_maj : 0x0
+                boardcfg_abi_min : 0x1
board/ti/j721e/rm-cfg_j7200.yaml new file +2065 -0

2,065 lines not on this page · raw message

board/ti/j721e/sec-cfg_j7200.yaml new file +378 -0

378 lines not on this page · raw message

Signature · 1 line
2.34.1
#14 lore raw

PATCH v2 7/18 j7200: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img

In reply to Neha Malcom Francis

Support added for HS and GP boot binaries for J7200.

tiboot3.bin, tispl.bin and u-boot.img: For HS devices tiboot3.bin_unsigned, tispl.bin_unsigned and u-boot.img_unsigned: For GP devices

It is to be noted that the bootflow followed by J7200 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

---
 arch/arm/dts/k3-j7200-binman.dtsi             | 471 ++++++++++++++++++
 .../k3-j7200-common-proc-board-u-boot.dtsi    |   2 +
 board/ti/j721e/Kconfig                        |   2 +
 3 files changed, 475 insertions(+)
 create mode 100644 arch/arm/dts/k3-j7200-binman.dtsi
arch/arm/dts/k3-j7200-binman.dtsi new file +471 -0
new file mode 100644
index 0000000000..f4906e2b4e
@@ -0,0 +1,471 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/ {
+	binman: binman {
+		multiple-images;
+	};
+};
+
+#ifdef CONFIG_TARGET_J7200_R5_EVM
+
+&binman {
+	board-cfg {
+		filename = "board-cfg.bin";
+		ti-board-config {
+			config = "board-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	pm-cfg {
+		filename = "pm-cfg.bin";
+		ti-board-config {
+			config = "pm-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	rm-cfg {
+		filename = "rm-cfg.bin";
+		ti-board-config {
+			config = "rm-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	sec-cfg {
+		filename = "sec-cfg.bin";
+		ti-board-config {
+			config = "sec-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+
+	combined-tifs-cfg {
+		filename = "combined-tifs-cfg.bin";
+		ti-board-config {
+			board-cfg {
+				config = "board-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			sec-cfg {
+				config = "sec-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			pm-cfg {
+				config = "pm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			rm-cfg {
+				config = "rm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+		};
+	};
+	combined-dm-cfg {
+		filename = "combined-dm-cfg.bin";
+		ti-board-config {
+			pm-cfg {
+				config = "pm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			rm-cfg {
+				config = "rm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+
+		};
+	};
+
+	tiboot3 {
+		filename = "tiboot3.bin";
+		ti-secure-rom {
+			content = <&u_boot_spl>, <&ti_fs_enc>, <&combined_tifs_cfg>,
+				<&combined_dm_cfg>, <&sysfw_inner_cert>;
+			combined;
+			dm-data;
+			sysfw-inner-cert;
+			keyfile = "custMpk.pem";
+			sw-rev = <1>;
+			content-sbl = <&u_boot_spl>;
+			content-sysfw = <&ti_fs_enc>;
+			content-sysfw-data = <&combined_tifs_cfg>;
+			content-sysfw-inner-cert = <&sysfw_inner_cert>;
+			content-dm-data = <&combined_dm_cfg>;
+			load = <0x41c00000>;
+			load-sysfw = <0x40000>;
+			load-sysfw-data = <0x7f000>;
+			load-dm-data = <0x41c80000>;
+		};
+		u_boot_spl: u-boot-spl {
+			no-expanded;
+		};
+		ti_fs_enc: ti-fs-enc.bin {
+			filename = "ti-fs-firmware-j7200-hs-enc.bin";
+			type = "blob-ext";
+			optional;
+		};
+		combined_tifs_cfg: blob-ext@1 {
+			filename = "combined-tifs-cfg.bin";
+		};
+		combined_dm_cfg: combined-dm-cfg.bin {
+			filename = "combined-dm-cfg.bin";
+			type = "blob-ext";
+		};
+		sysfw_inner_cert: sysfw-inner-cert {
+			filename = "ti-fs-firmware-j7200-hs-cert.bin";
+			type = "blob-ext";
+			optional;
+		};
+	};
+};
+
+&binman {
+	tiboot3_unsigned {
+		filename = "tiboot3.bin_unsigned";
+		ti-secure-rom {
+			content = <&u_boot_spl_unsigned>, <&ti_fs_gp>,
+				<&combined_tifs_cfg_gp>, <&combined_dm_cfg_gp>;
+			combined;
+			dm-data;
+			content-sbl = <&u_boot_spl_unsigned>;
+			load = <0x41c00000>;
+			content-sysfw = <&ti_fs_gp>;
+			load-sysfw = <0x40000>;
+			content-sysfw-data = <&combined_tifs_cfg_gp>;
+			load-sysfw-data = <0x7f000>;
+			content-dm-data = <&combined_dm_cfg_gp>;
+			load-dm-data = <0x41c80000>;
+			sw-rev = <1>;
+			keyfile = "ti-degenerate-key.pem";
+		};
+		u_boot_spl_unsigned: u-boot-spl {
+			no-expanded;
+		};
+		ti_fs_gp: ti-fs-gp.bin {
+			filename = "ti-fs-firmware-j7200-gp.bin";
+			type = "blob-ext";
+			optional;
+		};
+		combined_tifs_cfg_gp: combined-tifs-cfg-gp.bin {
+			filename = "combined-tifs-cfg.bin";
+			type = "blob-ext";
+		};
+		combined_dm_cfg_gp: combined-dm-cfg-gp.bin {
+			filename = "combined-dm-cfg.bin";
+			type = "blob-ext";
+		};
+	};
+};
+
+#endif
+
+#ifdef CONFIG_TARGET_J7200_A72_EVM
+
+#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
+#define SPL_J7200_EVM_DTB "spl/dts/k3-j7200-common-proc-board.dtb"
+
+#define UBOOT_NODTB "u-boot-nodtb.bin"
+#define J7200_EVM_DTB "arch/arm/dts/k3-j7200-common-proc-board.dtb"
+
+&binman {
+	ti-dm {
+		filename = "ti-dm.bin";
+		blob-ext {
+			filename = "ipc_echo_testb_mcu1_0_release_strip.xer5f";
+		};
+	};
+	ti-spl {
+		filename = "tispl.bin";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					atf-bl31 {
+					};
+				};
+
+				tee {
+					description = "OPTEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					tee-os {
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+					blob-ext {
+						filename = "ti-dm.bin";
+					};
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_spl_nodtb>;
+						keyfile = "custMpk.pem";
+					};
+					u_boot_spl_nodtb: blob-ext {
+						filename = SPL_NODTB;
+					};
+				};
+
+				fdt-0 {
+					description = "k3-j7200-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&spl_j7200_evm_dtb>;
+						keyfile = "custMpk.pem";
+					};
+					spl_j7200_evm_dtb: blob-ext {
+						filename = SPL_J7200_EVM_DTB;
+					};
+				};
+
+			};
+
+			configurations {
+				default = "conf-0";
+
+				conf-0 {
+					description = "k3-j7200-common-proc-board";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-0";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	u-boot {
+		filename = "u-boot.img";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					description = "U-Boot for J7200 board";
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_nodtb>;
+						keyfile = "custMpk.pem";
+					};
+					u_boot_nodtb: u-boot-nodtb {
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-0 {
+					description = "k3-j7200-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&j7200_evm_dtb>;
+						keyfile = "custMpk.pem";
+					};
+					j7200_evm_dtb: blob-ext {
+						filename = J7200_EVM_DTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-0";
+
+				conf-0 {
+					description = "k3-j7200-common-proc-board";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-0";
+				};
+
+			};
+		};
+	};
+};
+
+&binman {
+	ti-spl_unsigned {
+		filename = "tispl.bin_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					atf-bl31 {
+						filename = "bl31.bin";
+					};
+				};
+
+				tee {
+					description = "OPTEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					tee-os {
+						filename = "tee-pager_v2.bin";
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+					blob-ext {
+						filename = "ti-dm.bin";
+					};
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					blob {
+						filename = SPL_NODTB;
+					};
+				};
+
+				fdt-1 {
+					description = "k3-j7200-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = SPL_J7200_EVM_DTB;
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-1";
+
+				conf-1 {
+					description = "k3-j7200-common-proc-board";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-1";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	u-boot_unsigned {
+		filename = "u-boot.img_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					description = "U-Boot for J7200 board";
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					blob {
+						filename = UBOOT_NODTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-1 {
+					description = "k3-j7200-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = J7200_EVM_DTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-1";
+
+				conf-1 {
+					description = "k3-j7200-common-proc-board";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-1";
+				};
+			};
+		};
+	};
+};
+#endif
arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi +2 -0
index f57c2306ba..f25c7136c9 100644
@@ -3,6 +3,8 @@
  * Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-j7200-binman.dtsi"
+
 / {
 	chosen {
 		stdout-path = "serial2:115200n8";
board/ti/j721e/Kconfig +2 -0
index 4a127c4a10..e6cb21f77b 100644
@@ -33,6 +33,7 @@ config TARGET_J7200_A72_EVM
 	select BOARD_LATE_INIT
 	imply TI_I2C_BOARD_DETECT
 	select SYS_DISABLE_DCACHE_OPS
+	select BINMAN
 
 config TARGET_J7200_R5_EVM
 	bool "TI K3 based J7200 EVM running on R5"
@@ -42,6 +43,7 @@ config TARGET_J7200_R5_EVM
 	select RAM
 	select SPL_RAM
 	select K3_DDRSS
+	select BINMAN
 	imply SYS_K3_SPL_ATF
 	imply TI_I2C_BOARD_DETECT
 
Signature · 1 line
2.34.1
#15 lore raw

PATCH v2 8/18 am65x: yaml: Add AM65x board config files

In reply to Neha Malcom Francis

Added YAML config for AM65x

---
 board/ti/am65x/board-cfg.yaml |   36 +
 board/ti/am65x/pm-cfg.yaml    |   12 +
 board/ti/am65x/rm-cfg.yaml    | 2068 +++++++++++++++++++++++++++++++++
 board/ti/am65x/sec-cfg.yaml   |  375 ++++++
 4 files changed, 2491 insertions(+)
 create mode 100644 board/ti/am65x/board-cfg.yaml
 create mode 100644 board/ti/am65x/pm-cfg.yaml
 create mode 100644 board/ti/am65x/rm-cfg.yaml
 create mode 100644 board/ti/am65x/sec-cfg.yaml
board/ti/am65x/board-cfg.yaml new file +36 -0
new file mode 100644
index 0000000000..133720ec3e
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM65x
+#
+
+---
+
+board-cfg:
+    rev:
+        boardcfg_abi_maj : 0x0
+        boardcfg_abi_min : 0x1
+    control:
+        subhdr:
+            magic: 0xC1D3
+            size: 7
+        main_isolation_enable : 0x5A
+        main_isolation_hostid : 0x2
+    secproxy:
+        subhdr:
+            magic: 0x1207
+            size: 7
+        scaling_factor : 0x1
+        scaling_profile : 0x1
+        disable_main_nav_secure_proxy : 0
+    msmc:
+        subhdr:
+            magic: 0xA5C3
+            size: 5
+        msmc_cache_size : 0x10
+    debug_cfg:
+        subhdr:
+            magic: 0x020C
+            size: 8
+        trace_dst_enables : 0x00
+        trace_src_enables : 0x00
board/ti/am65x/pm-cfg.yaml new file +12 -0
new file mode 100644
index 0000000000..4b1ce475cd
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM65x
+#
+
+---
+
+pm-cfg:
+    rev:
+        boardcfg_abi_maj : 0x0
+        boardcfg_abi_min : 0x1
board/ti/am65x/rm-cfg.yaml new file +2068 -0

2,068 lines not on this page · raw message

board/ti/am65x/sec-cfg.yaml new file +375 -0

375 lines not on this page · raw message

Signature · 1 line
2.34.1
#16 lore raw

PATCH v2 9/18 am65: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

In reply to Neha Malcom Francis

Support added for HS and GP boot binaries for AM65x.

tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img: For HS devices tiboot3.bin_unsigned, sysfw.itb, tispl.bin_unsigned, u-boot.img_unsigned: For GP devices

Note that the bootflow followed by AM65x requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
sysfw.itb:
* sysfw
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* ATF
* OPTEE
* A53 SPL
* A53 SPL dtbs

u-boot.img:
* A53 U-Boot
* A53 U-Boot dtbs

---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  |   1 +
 .../dts/k3-am654-r5-base-board-u-boot.dtsi    |   1 +
 arch/arm/dts/k3-am65x-binman.dtsi             | 543 ++++++++++++++++++
 board/ti/am65x/Kconfig                        |   2 +
 4 files changed, 547 insertions(+)
 create mode 100644 arch/arm/dts/k3-am65x-binman.dtsi
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +1 -0
index 0c1305df7e..e4cbc47c2a 100644
@@ -4,6 +4,7 @@
  */
 
 #include "k3-am654-r5-base-board-u-boot.dtsi"
+#include "k3-am65x-binman.dtsi"
 
 &pru0_0 {
 	remoteproc-name = "pru0_0";
arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi +1 -0
index 4516ab1437..949320c91d 100644
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/pinctrl/k3.h>
 #include <dt-bindings/net/ti-dp83867.h>
+#include "k3-am65x-binman.dtsi"
 
 / {
 	chosen {
arch/arm/dts/k3-am65x-binman.dtsi new file +543 -0

543 lines not on this page · raw message

board/ti/am65x/Kconfig +2 -0
index 220dd0234c..5fd19d652a 100644
@@ -12,6 +12,7 @@ config TARGET_AM654_A53_EVM
 	select ARM64
 	select SYS_DISABLE_DCACHE_OPS
 	select BOARD_LATE_INIT
+	select BINMAN
 	imply TI_I2C_BOARD_DETECT
 
 config TARGET_AM654_R5_EVM
@@ -20,6 +21,7 @@ config TARGET_AM654_R5_EVM
 	select SYS_THUMB_BUILD
 	select K3_LOAD_SYSFW
 	select K3_AM654_DDRSS
+	select BINMAN
 	imply SYS_K3_SPL_ATF
 	imply TI_I2C_BOARD_DETECT
 
Signature · 1 line
2.34.1
#17 lore raw

PATCH v2 10/18 config: am64x: Add board config for AM64x

In reply to Neha Malcom Francis

Added YAML config for AM64xx

---
 board/ti/am64x/board-cfg.yaml |   37 +
 board/ti/am64x/pm-cfg.yaml    |   12 +
 board/ti/am64x/rm-cfg.yaml    | 1400 +++++++++++++++++++++++++++++++++
 board/ti/am64x/sec-cfg.yaml   |  378 +++++++++
 4 files changed, 1827 insertions(+)
 create mode 100644 board/ti/am64x/board-cfg.yaml
 create mode 100644 board/ti/am64x/pm-cfg.yaml
 create mode 100644 board/ti/am64x/rm-cfg.yaml
 create mode 100644 board/ti/am64x/sec-cfg.yaml
board/ti/am64x/board-cfg.yaml new file +37 -0
new file mode 100644
index 0000000000..f1f7c68d50
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM64x
+#
+
+---
+
+board-cfg:
+        rev:
+                boardcfg_abi_maj : 0x0
+                boardcfg_abi_min : 0x1
+        control:
+                subhdr:
+                        magic: 0xC1D3
+                        size: 7
+                main_isolation_enable : 0x5A
+                main_isolation_hostid : 0x2
+        secproxy:
+                subhdr:
+                        magic: 0x1207
+                        size: 7
+                scaling_factor : 0x1
+                scaling_profile : 0x1
+                disable_main_nav_secure_proxy : 0
+        msmc:
+                subhdr:
+                        magic: 0xA5C3
+                        size: 5
+                msmc_cache_size : 0x0
+        debug_cfg:
+                subhdr:
+                        magic: 0x020C
+                        size: 8
+                trace_dst_enables : 0x00
+                trace_src_enables : 0x00
+
board/ti/am64x/pm-cfg.yaml new file +12 -0
new file mode 100644
index 0000000000..c97495f482
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM64x
+#
+
+---
+
+pm-cfg:
+        rev:
+                boardcfg_abi_maj : 0x0
+                boardcfg_abi_min : 0x1
board/ti/am64x/rm-cfg.yaml new file +1400 -0

1,400 lines not on this page · raw message

board/ti/am64x/sec-cfg.yaml new file +378 -0

378 lines not on this page · raw message

Signature · 1 line
2.34.1
#18 lore raw

PATCH v2 11/18 am64x: dts: binman: Package tiboot3.bin, tispl.bin u-boot.img

In reply to Neha Malcom Francis

Support added for HS and GP boot binaries for AM64x.

tiboot3.bin, tispl.bin and u-boot.img: For HS devices tiboot3.bin_unsigned, tispl.bin_unsigned, u-boot.img_unsigned: For GP devices

Note that the bootflow followed by AM64x requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* sysfw
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* ATF
* OPTEE
* A53 SPL
* A53 SPL dtbs

u-boot.img:
* A53 U-Boot
* A53 U-Boot dtbs

---
 arch/arm/dts/k3-am642-evm-u-boot.dtsi |   2 +
 arch/arm/dts/k3-am642-r5-evm.dts      |   1 +
 arch/arm/dts/k3-am64x-binman.dtsi     | 521 ++++++++++++++++++++++++++
 board/ti/am64x/Kconfig                |   2 +
 4 files changed, 526 insertions(+)
 create mode 100644 arch/arm/dts/k3-am64x-binman.dtsi
arch/arm/dts/k3-am642-evm-u-boot.dtsi +2 -0
index 64857b0909..73577e8cfd 100644
@@ -3,6 +3,8 @@
  * Copyright (C) 2020-2021 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-am64x-binman.dtsi"
+
 / {
 	chosen {
 		stdout-path = "serial2:115200n8";
arch/arm/dts/k3-am642-r5-evm.dts +1 -0
index ca5ce4a35a..d6b1ec6e58 100644
@@ -8,6 +8,7 @@
 #include "k3-am642.dtsi"
 #include "k3-am64-evm-ddr4-1600MTs.dtsi"
 #include "k3-am64-ddr.dtsi"
+#include "k3-am64x-binman.dtsi"
 
 / {
 	chosen {
arch/arm/dts/k3-am64x-binman.dtsi new file +521 -0

521 lines not on this page · raw message

board/ti/am64x/Kconfig +2 -0
index afb54f8cda..fb596e4adf 100644
@@ -9,6 +9,7 @@ choice
 config TARGET_AM642_A53_EVM
 	bool "TI K3 based AM642 EVM running on A53"
 	select ARM64
+	select BINMAN
 	imply BOARD
 	imply SPL_BOARD
 	imply TI_I2C_BOARD_DETECT
@@ -21,6 +22,7 @@ config TARGET_AM642_R5_EVM
 	select RAM
 	select SPL_RAM
 	select K3_DDRSS
+	select BINMAN
 	imply SYS_K3_SPL_ATF
 	imply TI_I2C_BOARD_DETECT
 
Signature · 1 line
2.34.1
#19 lore raw

PATCH v2 12/18 j721s2: yaml: Add board config for J721S2

In reply to Neha Malcom Francis

Added YAML config for J721S2

---
 board/ti/j721s2/board-cfg.yaml |   37 +
 board/ti/j721s2/pm-cfg.yaml    |   12 +
 board/ti/j721s2/rm-cfg.yaml    | 2901 ++++++++++++++++++++++++++++++++
 board/ti/j721s2/sec-cfg.yaml   |  375 +++++
 4 files changed, 3325 insertions(+)
 create mode 100644 board/ti/j721s2/board-cfg.yaml
 create mode 100644 board/ti/j721s2/pm-cfg.yaml
 create mode 100644 board/ti/j721s2/rm-cfg.yaml
 create mode 100644 board/ti/j721s2/sec-cfg.yaml
board/ti/j721s2/board-cfg.yaml new file +37 -0
new file mode 100644
index 0000000000..d80f308ca6
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for J721S2
+#
+
+---
+
+board-cfg:
+    rev:
+        boardcfg_abi_maj : 0x0
+        boardcfg_abi_min : 0x1
+    control:
+        subhdr:
+            magic: 0xC1D3
+            size: 7
+        main_isolation_enable : 0x5A
+        main_isolation_hostid : 0x2
+    secproxy:
+        subhdr:
+            magic: 0x1207
+            size: 7
+        scaling_factor : 0x1
+        scaling_profile : 0x1
+        disable_main_nav_secure_proxy : 0
+    msmc:
+        subhdr:
+            magic: 0xA5C3
+            size: 5
+        msmc_cache_size : 0x0
+    debug_cfg:
+        subhdr:
+            magic: 0x020C
+            size: 8
+        trace_dst_enables : 0x00
+        trace_src_enables : 0x00
+
board/ti/j721s2/pm-cfg.yaml new file +12 -0
new file mode 100644
index 0000000000..45994e23cc
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for J721S2
+#
+
+---
+
+pm-cfg:
+    rev:
+        boardcfg_abi_maj : 0x0
+        boardcfg_abi_min : 0x1
board/ti/j721s2/rm-cfg.yaml new file +2901 -0

2,901 lines not on this page · raw message

board/ti/j721s2/sec-cfg.yaml new file +375 -0

50 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.34.1

Part of the diff is not shown here. View the raw message.

#20 lore raw

PATCH v2 13/18 j721s2: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img

In reply to Neha Malcom Francis

Support added for HS and GP boot binaries for J721S2.

tiboot3.bin, tispl.bin and u-boot.img: For HS devices tiboot3.bin_unsigned, tispl.bin_unsigned, u-boot.img_unsigned: For GP devices

It is to be noted that the bootflow followed by J721S2 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

---
 arch/arm/dts/k3-j721s2-binman.dtsi            | 474 ++++++++++++++++++
 .../k3-j721s2-common-proc-board-u-boot.dtsi   |   2 +
 .../dts/k3-j721s2-r5-common-proc-board.dts    |   1 +
 board/ti/j721s2/Kconfig                       |   2 +
 4 files changed, 479 insertions(+)
 create mode 100644 arch/arm/dts/k3-j721s2-binman.dtsi
arch/arm/dts/k3-j721s2-binman.dtsi new file +474 -0
new file mode 100644
index 0000000000..0c0cde1df2
@@ -0,0 +1,474 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/ {
+	binman: binman {
+		multiple-images;
+	};
+};
+
+#ifdef CONFIG_TARGET_J721S2_R5_EVM
+
+&binman {
+	board-cfg {
+		filename = "board-cfg.bin";
+		ti-board-config {
+			config = "board-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	pm-cfg {
+		filename = "pm-cfg.bin";
+		ti-board-config {
+			config = "pm-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	rm-cfg {
+		filename = "rm-cfg.bin";
+		ti-board-config {
+			config = "rm-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	sec-cfg {
+		filename = "sec-cfg.bin";
+		ti-board-config {
+			config = "sec-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	combined-tifs-cfg {
+		filename = "combined-tifs-cfg.bin";
+		ti-board-config {
+			board-cfg {
+				config = "board-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			sec-cfg {
+				config = "sec-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			pm-cfg {
+				config = "pm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			rm-cfg {
+				config = "rm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+		};
+	};
+	combined-dm-cfg {
+		filename = "combined-dm-cfg.bin";
+		ti-board-config {
+			pm-cfg {
+				config = "pm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			rm-cfg {
+				config = "rm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+
+		};
+	};
+
+	tiboot3 {
+		filename = "tiboot3.bin";
+		ti-secure-rom {
+			content = <&u_boot_spl>, <&ti_fs_enc>, <&combined_tifs_cfg>,
+				<&combined_dm_cfg>, <&sysfw_inner_cert>;
+			combined;
+			dm-data;
+			sysfw-inner-cert;
+			keyfile = "custMpk.pem";
+			sw-rev = <1>;
+			content-sbl = <&u_boot_spl>;
+			content-sysfw = <&ti_fs_enc>;
+			content-sysfw-data = <&combined_tifs_cfg>;
+			content-sysfw-inner-cert = <&sysfw_inner_cert>;
+			content-dm-data = <&combined_dm_cfg>;
+			load = <0x41c00000>;
+			load-sysfw = <0x40000>;
+			load-sysfw-data = <0x67000>;
+			load-dm-data = <0x41c80000>;
+		};
+		u_boot_spl: u-boot-spl {
+			no-expanded;
+		};
+		ti_fs_enc: ti-fs-enc.bin {
+			filename = "ti-fs-firmware-j721s2-hs-enc.bin";
+			type = "blob-ext";
+			optional;
+		};
+		combined_tifs_cfg: blob-ext@1 {
+			filename = "combined-tifs-cfg.bin";
+		};
+		combined_dm_cfg: combined-dm-cfg.bin {
+			filename = "combined-dm-cfg.bin";
+			type = "blob-ext";
+		};
+		sysfw_inner_cert: sysfw-inner-cert {
+			filename = "ti-fs-firmware-j721s2-hs-cert.bin";
+			type = "blob-ext";
+			optional;
+		};
+
+	};
+};
+
+&binman {
+	tiboot3_unsigned {
+		filename = "tiboot3.bin_unsigned";
+		ti-secure-rom {
+			content = <&u_boot_spl_unsigned>, <&ti_fs_gp>,
+				<&combined_tifs_cfg_gp>, <&combined_dm_cfg_gp>;
+			combined;
+			dm-data;
+			content-sbl = <&u_boot_spl_unsigned>;
+			load = <0x41c00000>;
+			content-sysfw = <&ti_fs_gp>;
+			load-sysfw = <0x40000>;
+			content-sysfw-data = <&combined_tifs_cfg_gp>;
+			load-sysfw-data = <0x67000>;
+			content-dm-data = <&combined_dm_cfg_gp>;
+			load-dm-data = <0x41c80000>;
+			sw-rev = <1>;
+			keyfile = "ti-degenerate-key.pem";
+		};
+		u_boot_spl_unsigned: u-boot-spl {
+			no-expanded;
+		};
+		ti_fs_gp: ti-fs-gp.bin {
+			filename = "ti-fs-firmware-j721s2-gp.bin";
+			type = "blob-ext";
+			optional;
+		};
+		combined_tifs_cfg_gp: combined-tifs-cfg-gp.bin {
+			filename = "combined-tifs-cfg.bin";
+			type = "blob-ext";
+		};
+		combined_dm_cfg_gp: combined-dm-cfg-gp.bin {
+			filename = "combined-dm-cfg.bin";
+			type = "blob-ext";
+		};
+
+	};
+};
+
+#endif
+
+#ifdef CONFIG_TARGET_J721S2_A72_EVM
+
+#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
+#define SPL_J721S2_EVM_DTB "spl/dts/k3-j721s2-common-proc-board.dtb"
+
+#define UBOOT_NODTB "u-boot-nodtb.bin"
+#define J721S2_EVM_DTB "arch/arm/dts/k3-j721s2-common-proc-board.dtb"
+
+&binman {
+	ti-dm {
+		filename = "ti-dm.bin";
+		blob-ext {
+			filename = "ipc_echo_testb_mcu1_0_release_strip.xer5f";
+		};
+	};
+	ti-spl {
+		filename = "tispl.bin";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					atf-bl31 {
+					};
+				};
+
+				tee {
+					description = "OPTEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					tee-os {
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+					blob-ext {
+						filename = "ti-dm.bin";
+					};
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_spl_nodtb>;
+						keyfile = "custMpk.pem";
+					};
+					u_boot_spl_nodtb: blob-ext {
+						filename = SPL_NODTB;
+					};
+				};
+
+				fdt-0 {
+					description = "k3-j721s2-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&spl_j721s2_evm_dtb>;
+						keyfile = "custMpk.pem";
+					};
+					spl_j721s2_evm_dtb: blob-ext {
+						filename = SPL_J721S2_EVM_DTB;
+					};
+
+				};
+
+			};
+
+			configurations {
+				default = "conf-0";
+
+				conf-0 {
+					description = "k3-j721s2-common-proc-board";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-0";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	u-boot {
+		filename = "u-boot.img";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					description = "U-Boot for J721S2 board";
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_nodtb>;
+						keyfile = "custMpk.pem";
+					};
+					u_boot_nodtb: u-boot-nodtb {
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-0 {
+					description = "k3-j721s2-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&j721s2_evm_dtb>;
+						keyfile = "custMpk.pem";
+					};
+					j721s2_evm_dtb: blob-ext {
+						filename = J721S2_EVM_DTB;
+					};
+
+					hash {
+						algo = "crc32";
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-0";
+
+				conf-0 {
+					description = "k3-j721s2-common-proc-board";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-0";
+				};
+
+			};
+		};
+	};
+};
+
+&binman {
+	ti-spl_unsigned {
+		filename = "tispl.bin_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					atf-bl31 {
+						filename = "bl31.bin";
+					};
+				};
+
+				tee {
+					description = "OPTEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					tee-os {
+						filename = "tee-pager_v2.bin";
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+					blob-ext {
+						filename = "ti-dm.bin";
+					};
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					blob {
+						filename = "spl/u-boot-spl-nodtb.bin";
+					};
+				};
+
+				fdt-1 {
+					description = "k3-j721s2-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = SPL_J721S2_EVM_DTB;
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-1";
+
+				conf-1 {
+					description = "k3-j721s2-common-proc-board";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-1";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	u-boot_unsigned {
+		filename = "u-boot.img_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					description = "U-Boot for J721S2 board";
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					blob {
+						filename = UBOOT_NODTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-1 {
+					description = "k3-j721s2-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = J721S2_EVM_DTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-1";
+
+				conf-1 {
+					description = "k3-j721s2-common-proc-board";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-1";
+				};
+			};
+		};
+	};
+};
+#endif
arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi +2 -0
index 4fd6d36417..f940ffee87 100644
@@ -3,6 +3,8 @@
  * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-j721s2-binman.dtsi"
+
 / {
 	chosen {
 		stdout-path = "serial2:115200n8";
arch/arm/dts/k3-j721s2-r5-common-proc-board.dts +1 -0
index bc617022c1..e04cee3d99 100644
@@ -8,6 +8,7 @@
 #include "k3-j721s2-som-p0.dtsi"
 #include "k3-j721s2-ddr-evm-lp4-4266.dtsi"
 #include "k3-j721s2-ddr.dtsi"
+#include "k3-j721s2-binman.dtsi"
 
 / {
 	chosen {
board/ti/j721s2/Kconfig +2 -0
index a24641f8cf..f6d1cb5765 100644
@@ -13,6 +13,7 @@ config TARGET_J721S2_A72_EVM
 	select BOARD_LATE_INIT
 	imply TI_I2C_BOARD_DETECT
 	select SYS_DISABLE_DCACHE_OPS
+	select BINMAN
 
 config TARGET_J721S2_R5_EVM
 	bool "TI K3 based J721S2 EVM running on R5"
@@ -22,6 +23,7 @@ config TARGET_J721S2_R5_EVM
 	select RAM
 	select SPL_RAM
 	select K3_DDRSS
+	select BINMAN
 	imply SYS_K3_SPL_ATF
 	imply TI_I2C_BOARD_DETECT
 
Signature · 1 line
2.34.1
#21 lore raw

PATCH v2 14/18 am62: yaml: Add board config for AM62

In reply to Neha Malcom Francis

Added YAML config for AM62

---
 board/ti/am62x/board-cfg.yaml |   36 ++
 board/ti/am62x/pm-cfg.yaml    |   12 +
 board/ti/am62x/rm-cfg.yaml    | 1088 +++++++++++++++++++++++++++++++++
 board/ti/am62x/sec-cfg.yaml   |  375 ++++++++++++
 board/ti/am65x/rm-cfg.yaml    |  144 ++---
 5 files changed, 1583 insertions(+), 72 deletions(-)
 create mode 100644 board/ti/am62x/board-cfg.yaml
 create mode 100644 board/ti/am62x/pm-cfg.yaml
 create mode 100644 board/ti/am62x/rm-cfg.yaml
 create mode 100644 board/ti/am62x/sec-cfg.yaml
board/ti/am62x/board-cfg.yaml new file +36 -0
new file mode 100644
index 0000000000..a26ef55bd4
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM62
+#
+
+---
+
+board-cfg:
+    rev:
+        boardcfg_abi_maj : 0x0
+        boardcfg_abi_min : 0x1
+    control:
+        subhdr:
+            magic: 0xC1D3
+            size: 7
+        main_isolation_enable : 0x5A
+        main_isolation_hostid : 0x2
+    secproxy:
+        subhdr:
+            magic: 0x1207
+            size: 7
+        scaling_factor : 0x1
+        scaling_profile : 0x1
+        disable_main_nav_secure_proxy : 0
+    msmc:
+        subhdr:
+            magic: 0xA5C3
+            size: 5
+        msmc_cache_size : 0x0
+    debug_cfg:
+        subhdr:
+            magic: 0x020C
+            size: 8
+        trace_dst_enables : 0x00
+        trace_src_enables : 0x00
board/ti/am62x/pm-cfg.yaml new file +12 -0
new file mode 100644
index 0000000000..aa94097e97
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM62
+#
+
+---
+
+pm-cfg:
+    rev:
+        boardcfg_abi_maj : 0x0
+        boardcfg_abi_min : 0x1
board/ti/am62x/rm-cfg.yaml new file +1088 -0

1,088 lines not on this page · raw message

board/ti/am62x/sec-cfg.yaml new file +375 -0

375 lines not on this page · raw message

board/ti/am65x/rm-cfg.yaml +72 -72

171 lines not on this page · raw message

Signature · 1 line
2.34.1
#22 lore raw

PATCH v2 15/18 am625: dts: binman: Package tiboot3.bin, tispl.bin and u-boot.img

In reply to Neha Malcom Francis

Support added for HS and GP boot binaries for AM62

tiboot3.bin, tispl.bin and u-boot.img: For HS devices tiboot3.bin_unsigned, tispl.bin_unsigned, u-boot.img_unsigned: For GP devices

It is to be noted that the bootflow followed by AM62 requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

---
 arch/arm/dts/k3-am625-r5-sk.dts      |   1 +
 arch/arm/dts/k3-am625-sk-binman.dtsi | 472 +++++++++++++++++++++++++++
 arch/arm/dts/k3-am625-sk-u-boot.dtsi |   2 +
 board/ti/am62x/Kconfig               |   2 +
 4 files changed, 477 insertions(+)
 create mode 100644 arch/arm/dts/k3-am625-sk-binman.dtsi
arch/arm/dts/k3-am625-r5-sk.dts +1 -0
index dad46704a2..26ccfa0a4b 100644
@@ -9,6 +9,7 @@
 #include "k3-am62-ddr.dtsi"
 
 #include "k3-am625-sk-u-boot.dtsi"
+#include "k3-am625-sk-binman.dtsi"
 
 / {
 	aliases {
arch/arm/dts/k3-am625-sk-binman.dtsi new file +472 -0

472 lines not on this page · raw message

arch/arm/dts/k3-am625-sk-u-boot.dtsi +2 -0
index 249155733a..a60c37f1db 100644
@@ -4,6 +4,8 @@
  * Copyright (C) 2021-2022 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include "k3-am625-sk-binman.dtsi"
+
 / {
 	chosen {
 		stdout-path = "serial2:115200n8";
board/ti/am62x/Kconfig +2 -0
index 5e8dfa3cc4..cd17e939e5 100644
@@ -10,6 +10,7 @@ choice
 config TARGET_AM625_A53_EVM
 	bool "TI K3 based AM625 EVM running on A53"
 	select ARM64
+	select BINMAN
 
 config TARGET_AM625_R5_EVM
 	bool "TI K3 based AM625 EVM running on R5"
@@ -19,6 +20,7 @@ config TARGET_AM625_R5_EVM
 	select RAM
 	select SPL_RAM
 	select K3_DDRSS
+	select BINMAN
 	imply SYS_K3_SPL_ATF
 
 endchoice
Signature · 1 line
2.34.1
#23 lore raw

PATCH v2 16/18 am62a: yaml: Add board config for AM62ax

In reply to Neha Malcom Francis

Added YAML config for AM62ax

---
 board/ti/am62ax/board-cfg.yaml |   36 +
 board/ti/am62ax/pm-cfg.yaml    |   12 +
 board/ti/am62ax/rm-cfg.yaml    | 1151 ++++++++++++++++++++++++++++++++
 board/ti/am62ax/sec-cfg.yaml   |  375 +++++++++++
 4 files changed, 1574 insertions(+)
 create mode 100644 board/ti/am62ax/board-cfg.yaml
 create mode 100644 board/ti/am62ax/pm-cfg.yaml
 create mode 100644 board/ti/am62ax/rm-cfg.yaml
 create mode 100644 board/ti/am62ax/sec-cfg.yaml
board/ti/am62ax/board-cfg.yaml new file +36 -0
new file mode 100644
index 0000000000..6e45b494e0
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Board configuration for AM62ax
+#
+
+---
+
+board-cfg:
+    rev:
+        boardcfg_abi_maj : 0x0
+        boardcfg_abi_min : 0x1
+    control:
+        subhdr:
+            magic: 0xC1D3
+            size: 7
+        main_isolation_enable : 0x5A
+        main_isolation_hostid : 0x2
+    secproxy:
+        subhdr:
+            magic: 0x1207
+            size: 7
+        scaling_factor : 0x1
+        scaling_profile : 0x1
+        disable_main_nav_secure_proxy : 0
+    msmc:
+        subhdr:
+            magic: 0xA5C3
+            size: 5
+        msmc_cache_size : 0x10
+    debug_cfg:
+        subhdr:
+            magic: 0x020C
+            size: 8
+        trace_dst_enables : 0x00
+        trace_src_enables : 0x00
board/ti/am62ax/pm-cfg.yaml new file +12 -0
new file mode 100644
index 0000000000..a491f11260
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+#
+# Power management configuration for AM62ax
+#
+
+---
+
+pm-cfg:
+    rev:
+        boardcfg_abi_maj : 0x0
+        boardcfg_abi_min : 0x1
board/ti/am62ax/rm-cfg.yaml new file +1151 -0

1,151 lines not on this page · raw message

board/ti/am62ax/sec-cfg.yaml new file +375 -0

375 lines not on this page · raw message

Signature · 1 line
2.34.1
#24 lore raw

PATCH v2 17/18 am62a: dts: binman: Package tiboot3.bin, tispl.bin, u-boot.img

In reply to Neha Malcom Francis

Support added for HS and GP boot binaries for AM62ax.

tiboot3.bin, tispl.bin and u-boot.img: For HS devices tiboot3.bin_unsigned, tispl.bin_unsigned and u-boot.img_unsigned: For GP devices

It is to be noted that the bootflow followed by AM62ax requires:

tiboot3.bin:
* R5 SPL
* R5 SPL dtbs
* TIFS
* board-cfg
* pm-cfg
* sec-cfg
* rm-cfg

tispl.bin:
* DM
* ATF
* OPTEE
* A72 SPL
* A72 SPL dtbs

u-boot.img:
* A72 U-Boot
* A72 U-Boot dtbs

---
 arch/arm/dts/k3-am62a-sk-binman.dtsi | 472 +++++++++++++++++++++++++++
 arch/arm/dts/k3-am62a7-r5-sk.dts     |   1 +
 arch/arm/dts/k3-am62a7-sk.dts        |   1 +
 board/ti/am62ax/Kconfig              |   2 +
 4 files changed, 476 insertions(+)
 create mode 100644 arch/arm/dts/k3-am62a-sk-binman.dtsi
arch/arm/dts/k3-am62a-sk-binman.dtsi new file +472 -0
new file mode 100644
index 0000000000..d79e4e47af
@@ -0,0 +1,472 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/ {
+	binman: binman {
+		multiple-images;
+	};
+};
+
+#ifdef CONFIG_TARGET_AM62A7_R5_EVM
+
+&binman {
+	board-cfg {
+		filename = "board-cfg.bin";
+		ti-board-config {
+			config = "board-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	pm-cfg {
+		filename = "pm-cfg.bin";
+		ti-board-config {
+			config = "pm-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	rm-cfg {
+		filename = "rm-cfg.bin";
+		ti-board-config {
+			config = "rm-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	sec-cfg {
+		filename = "sec-cfg.bin";
+		ti-board-config {
+			config = "sec-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	combined-tifs-cfg {
+		filename = "combined-tifs-cfg.bin";
+		ti-board-config {
+			board-cfg {
+				config = "board-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			sec-cfg {
+				config = "sec-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			pm-cfg {
+				config = "pm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			rm-cfg {
+				config = "rm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+		};
+	};
+	combined-dm-cfg {
+		filename = "combined-dm-cfg.bin";
+		ti-board-config {
+			pm-cfg {
+				config = "pm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+			rm-cfg {
+				config = "rm-cfg.yaml";
+				schema = "schema.yaml";
+			};
+
+		};
+	};
+
+	tiboot3 {
+		filename = "tiboot3.bin";
+		ti-secure-rom {
+			content = <&u_boot_spl>, <&ti_fs_enc>, <&combined_tifs_cfg>,
+				<&combined_dm_cfg>, <&sysfw_inner_cert>;
+			combined;
+			dm-data;
+			sysfw-inner-cert;
+			keyfile = "custMpk.pem";
+			sw-rev = <1>;
+			content-sbl = <&u_boot_spl>;
+			content-sysfw = <&ti_fs_enc>;
+			content-sysfw-data = <&combined_tifs_cfg>;
+			content-sysfw-inner-cert = <&sysfw_inner_cert>;
+			content-dm-data = <&combined_dm_cfg>;
+			load = <0x43c00000>;
+			load-sysfw = <0x40000>;
+			load-sysfw-data = <0x67000>;
+			load-dm-data = <0x43c3a800>;
+		};
+		u_boot_spl: u-boot-spl {
+			no-expanded;
+		};
+		ti_fs_enc: ti-fs-enc.bin {
+			filename = "ti-fs-firmware-am62ax-hs-enc.bin";
+			type = "blob-ext";
+			optional;
+		};
+		combined_tifs_cfg: blob-ext@1 {
+			filename = "combined-tifs-cfg.bin";
+		};
+		combined_dm_cfg: combined-dm-cfg.bin {
+			filename = "combined-dm-cfg.bin";
+			type = "blob-ext";
+		};
+		sysfw_inner_cert: sysfw-inner-cert {
+			filename = "ti-fs-firmware-am62ax-hs-cert.bin";
+			type = "blob-ext";
+			optional;
+		};
+
+	};
+};
+
+&binman {
+	tiboot3_unsigned {
+		filename = "tiboot3.bin_unsigned";
+		ti-secure-rom {
+			content = <&u_boot_spl_unsigned>, <&ti_fs_gp>,
+				<&combined_tifs_cfg_gp>, <&combined_dm_cfg_gp>;
+			combined;
+			dm-data;
+			content-sbl = <&u_boot_spl_unsigned>;
+			load = <0x43c00000>;
+			content-sysfw = <&ti_fs_gp>;
+			load-sysfw = <0x40000>;
+			content-sysfw-data = <&combined_tifs_cfg_gp>;
+			load-sysfw-data = <0x67000>;
+			content-dm-data = <&combined_dm_cfg_gp>;
+			load-dm-data = <0x43c3a800>;
+			sw-rev = <1>;
+			keyfile = "ti-degenerate-key.pem";
+		};
+		u_boot_spl_unsigned: u-boot-spl {
+			no-expanded;
+		};
+		ti_fs_gp: ti-fs-gp.bin {
+			filename = "ti-fs-firmware-am62ax-gp.bin";
+			type = "blob-ext";
+			optional;
+		};
+		combined_tifs_cfg_gp: combined-tifs-cfg-gp.bin {
+			filename = "combined-tifs-cfg.bin";
+			type = "blob-ext";
+		};
+		combined_dm_cfg_gp: combined-dm-cfg-gp.bin {
+			filename = "combined-dm-cfg.bin";
+			type = "blob-ext";
+		};
+	};
+};
+
+#endif
+
+#ifdef CONFIG_TARGET_AM62A7_A53_EVM
+
+#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
+#define SPL_AM62A7_SK_DTB "spl/dts/k3-am62a7-sk.dtb"
+
+#define UBOOT_NODTB "u-boot-nodtb.bin"
+#define AM62A7_SK_DTB "arch/arm/dts/k3-am62a7-sk.dtb"
+
+&binman {
+	ti-dm {
+		filename = "ti-dm.bin";
+		blob-ext {
+			filename = "ipc_echo_testb_mcu1_0_release_strip.xer5f";
+		};
+	};
+	ti-spl {
+		filename = "tispl.bin";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					atf-bl31 {
+					};
+				};
+
+				tee {
+					description = "OPTEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					tee-os {
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+					blob-ext {
+						filename = "ti-dm.bin";
+					};
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_spl_nodtb>;
+						keyfile = "custMpk.pem";
+					};
+					u_boot_spl_nodtb: blob-ext {
+						filename = SPL_NODTB;
+					};
+				};
+
+				fdt-0 {
+					description = "k3-am62a7-sk";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&spl_am62a7_sk_dtb>;
+						keyfile = "custMpk.pem";
+					};
+					spl_am62a7_sk_dtb: blob-ext {
+						filename = SPL_AM62A7_SK_DTB;
+					};
+
+				};
+
+			};
+
+			configurations {
+				default = "conf-0";
+
+				conf-0 {
+					description = "k3-am62a7-sk";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-0";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	u-boot {
+		filename = "u-boot.img";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					description = "U-Boot for AM62Ax board";
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_nodtb>;
+						keyfile = "custMpk.pem";
+					};
+					u_boot_nodtb: u-boot-nodtb {
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-0 {
+					description = "k3-am62a7-sk";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&am62a7_sk_dtb>;
+						keyfile = "custMpk.pem";
+					};
+					am62a7_sk_dtb: blob-ext {
+						filename = AM62A7_SK_DTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-0";
+
+				conf-0 {
+					description = "k3-am62a7-sk";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-0";
+				};
+
+			};
+		};
+	};
+};
+
+&binman {
+	ti-spl_unsigned {
+		filename = "tispl.bin_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					atf-bl31 {
+						filename = "bl31.bin";
+					};
+				};
+
+				tee {
+					description = "OPTEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					tee-os {
+						filename = "tee-pager_v2.bin";
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+					blob-ext {
+						filename = "ti-dm.bin";
+					};
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					blob {
+						filename = "spl/u-boot-spl-nodtb.bin";
+					};
+				};
+
+				fdt-1 {
+					description = "k3-am62a7-sk";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = SPL_AM62A7_SK_DTB;
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-1";
+
+				conf-1 {
+					description = "k3-am62a7-sk";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-1";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	u-boot_unsigned {
+		filename = "u-boot.img_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					description = "U-Boot for AM62Ax board";
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					blob {
+						filename = UBOOT_NODTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-1 {
+					description = "k3-am62a7-sk";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = AM62A7_SK_DTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-1";
+
+				conf-1 {
+					description = "k3-am62a7-sk";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-1";
+				};
+			};
+		};
+	};
+};
+#endif
arch/arm/dts/k3-am62a7-r5-sk.dts +1 -0
index c953a82c7a..0b799a2537 100644
@@ -7,6 +7,7 @@
 #include "k3-am62a7-sk.dts"
 #include "k3-am62a-ddr-1866mhz-32bit.dtsi"
 #include "k3-am62a-ddr.dtsi"
+#include "k3-am62a-sk-binman.dtsi"
 
 #include "k3-am62a7-sk-u-boot.dtsi"
 
arch/arm/dts/k3-am62a7-sk.dts +1 -0
index b08a083d72..270e669f65 100644
@@ -10,6 +10,7 @@
 #include <dt-bindings/leds/common.h>
 #include <dt-bindings/gpio/gpio.h>
 #include "k3-am62a7.dtsi"
+#include "k3-am62a-sk-binman.dtsi"
 
 / {
 	compatible =  "ti,am62a7-sk", "ti,am62a7";
board/ti/am62ax/Kconfig +2 -0
index 9b868e4553..61f289facc 100644
@@ -10,6 +10,7 @@ choice
 config TARGET_AM62A7_A53_EVM
 	bool "TI K3 based AM62A7 EVM running on A53"
 	select ARM64
+	select BINMAN
 	imply BOARD
 	imply SPL_BOARD
 	imply TI_I2C_BOARD_DETECT
@@ -22,6 +23,7 @@ config TARGET_AM62A7_R5_EVM
 	select RAM
 	select SPL_RAM
 	select K3_DDRSS
+	select BINMAN
 	imply SYS_K3_SPL_ATF
 	imply TI_I2C_BOARD_DETECT
 
Signature · 1 line
2.34.1
#25 lore raw

PATCH v2 18/18 k3: tools: config.mk: Update makefile and remove scripts

In reply to Neha Malcom Francis

Since binman is used to package bootloader images for all K3 devices, we do not have to rely on the earlier methods to package them.

config.mk has been edited to only have binman required make commands.

Scripts that were used to generate x509 certificate for tiboot3.bin and generate tispl.bin have also been removed.

---
 arch/arm/mach-k3/config.mk |  92 -------------
 tools/k3_fit_atf.sh        | 123 -----------------
 tools/k3_gen_x509_cert.sh  | 262 -------------------------------------
 3 files changed, 477 deletions(-)
 delete mode 100755 tools/k3_fit_atf.sh
 delete mode 100755 tools/k3_gen_x509_cert.sh
arch/arm/mach-k3/config.mk +0 -92
index b342a56538..39767196a7 100644
@@ -11,34 +11,6 @@ ifeq ($(shell which openssl),)
 $(error "No openssl in $(PATH), consider installing openssl")
 endif
 
-IMAGE_SIZE= $(shell cat $(obj)/u-boot-spl.bin | wc -c)
-MAX_SIZE= $(shell printf "%d" $(CONFIG_SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE))
-
-ifeq ($(CONFIG_SYS_K3_KEY), "")
-KEY=""
-# On HS use real key or warn if not available
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/keys/custMpk.pem),)
-KEY=$(TI_SECURE_DEV_PKG)/keys/custMpk.pem
-else
-$(warning "WARNING: signing key not found. Random key will NOT work on HS hardware!")
-endif
-endif
-else
-KEY=$(patsubst "%",$(srctree)/%,$(CONFIG_SYS_K3_KEY))
-endif
-
-# X509 SWRV default
-SWRV = $(CONFIG_K3_X509_SWRV)
-# On HS use SECDEV provided software revision or warn if not available
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/keys/swrv.txt),)
-SWRV= $(shell cat $(TI_SECURE_DEV_PKG)/keys/swrv.txt)
-else
-$(warning "WARNING: Software revision file not found. Default may not work on HS hardware.")
-endif
-endif
-
 O ?= .
 
 # Board config binary artifacts necessary for packaging of tiboot3.bin
@@ -88,68 +60,4 @@ INPUTS-y	+= schema.yaml
 INPUTS-y	+= custMpk.pem
 INPUTS-y	+= ti-degenerate-key.pem
 endif
-
-# tiboot3.bin is mandated by ROM and ROM only supports R5 boot.
-# So restrict tiboot3.bin creation for CPU_V7R.
-ifndef CONFIG_BINMAN
-ifdef CONFIG_CPU_V7R
-image_check: $(obj)/u-boot-spl.bin FORCE
-	@if [ $(IMAGE_SIZE) -gt $(MAX_SIZE) ]; then			    \
-		echo "===============================================" >&2; \
-		echo "ERROR: Final Image too big. " >&2;		    \
-		echo "$< size = $(IMAGE_SIZE), max size = $(MAX_SIZE)" >&2; \
-		echo "===============================================" >&2; \
-		exit 1;							    \
-	fi
-
-tiboot3.bin: image_check FORCE
-	$(srctree)/tools/k3_gen_x509_cert.sh -c 16 -b $(obj)/u-boot-spl.bin \
-				-o $@ -l $(CONFIG_SPL_TEXT_BASE) -r $(SWRV) -k $(KEY)
-
-INPUTS-y	+= tiboot3.bin
-endif
-endif
-
-ifdef CONFIG_ARM64
-
-ifeq ($(CONFIG_SOC_K3_J721E),)
-export DM := /dev/null
 endif
-
-ifndef CONFIG_BINMAN
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-SPL_ITS := u-boot-spl-k3_HS.its
-$(SPL_ITS): export IS_HS=1
-INPUTS-y	+= tispl.bin_HS
-else
-SPL_ITS := u-boot-spl-k3.its
-INPUTS-y	+= tispl.bin
-endif
-endif
-
-ifeq ($(CONFIG_SPL_OF_LIST),)
-LIST_OF_DTB := $(CONFIG_DEFAULT_DEVICE_TREE)
-else
-LIST_OF_DTB := $(CONFIG_SPL_OF_LIST)
-endif
-
-quiet_cmd_k3_mkits = MKITS   $@
-cmd_k3_mkits = \
-	$(srctree)/tools/k3_fit_atf.sh \
-	$(CONFIG_K3_ATF_LOAD_ADDR) \
-	$(patsubst %,$(obj)/dts/%.dtb,$(subst ",,$(LIST_OF_DTB))) > $@
-
-$(SPL_ITS): FORCE
-	$(call cmd,k3_mkits)
-endif
-
-else
-
-ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
-INPUTS-y	+= u-boot.img_HS
-else
-INPUTS-y	+= u-boot.img
-endif
-endif
-
-include $(srctree)/arch/arm/mach-k3/config_secure.mk
tools/k3_fit_atf.sh deleted +0 -123

123 lines not on this page · raw message

tools/k3_gen_x509_cert.sh deleted +0 -262

262 lines not on this page · raw message

Signature · 1 line
2.34.1
Acked-by on the v2 series
#26 lore raw
In reply to Neha Malcom Francis
Quoted 24 lines · Neha Malcom Francis

This series aims to eliminate the use of additional custom repositories such as k3-image-gen (K3 Image Generation) repo that was plumbed into the U-Boot build flow to generate boot images for TI K3 platform devices. And instead, we move towards using binman that aligns better with the community standard build flow.

This series uses binman for all K3 platforms supported on U-Boot currently; both HS (High Security) and GP (General Purpose) devices.

Background on using k3-image-gen:
* TI K3 devices require a SYSFW (System Firmware) image consisting of a signed system firmware image and board configuration binaries, this is needed to bring up system firmware during U-Boot R5 SPL startup.
* Board configuration data contain board-specific information such as resource management, power management and security.

Series intends to use binman to take over the packaging and signing for the R5 bootloader images tiboot3.bin (and sysfw.itb, for non-combined boot flow) instead of k3-image-gen.

Series also packages the A72/A53 bootloader images (tispl.bin and u-boot.img) using ATF, OPTEE and DM (Device Manager)

Quoted 10 lines

Changes in v2:
- removed all external scripts
- created ti-board-config etype to support generation of board config binaries
- created ti-secure and ti-secure-rom etypes to handle signing instead of using external TI_SECURE_DEV_PKG
- updated openssl btool to support x509 certificate generation
- dropped Makefile changes to obtain external binary components, moving to using BINMAN_INDIRS to achieve the same

Another thing that got changed is you seem to have dropped the documentation update patch from v1. The documentation change is the best part as it shows how much easier this series makes building U-Boot for K3! :)

I did notice a build error when trying this with am62x_evm_r5_defconfig. I don't think this series caused the issue, but it does expose the issue. Fix sent here[0]. So if anyone has issues building this series try that patch.

Other than the couple minor comments, everything looks good and I'm extremely impressed how well this all turned out. Removing the external tooling and scripts previously needed to build U-Boot for K3 is key to our upstream-first goals and long term support strategy.

Thank you!

For the whole series,

[0] https://lists.denx.de/pipermail/u-boot/2023-April/514400.html

#27 lore raw

Hi Andrew,

Quoted 36 lines · Andrew Davis
Quoted 24 lines · Neha Malcom Francis

This series aims to eliminate the use of additional custom repositories such as k3-image-gen (K3 Image Generation) repo that was plumbed into the U-Boot build flow to generate boot images for TI K3 platform devices. And instead, we move towards using binman that aligns better with the community standard build flow.

This series uses binman for all K3 platforms supported on U-Boot currently; both HS (High Security) and GP (General Purpose) devices.

Background on using k3-image-gen:
    * TI K3 devices require a SYSFW (System Firmware) image consisting of a signed system firmware image and board configuration binaries, this is needed to bring up system firmware during U-Boot R5 SPL startup.
    * Board configuration data contain board-specific information such as resource management, power management and security.

Series intends to use binman to take over the packaging and signing for the R5 bootloader images tiboot3.bin (and sysfw.itb, for non-combined boot flow) instead of k3-image-gen.

Series also packages the A72/A53 bootloader images (tispl.bin and u-boot.img) using ATF, OPTEE and DM (Device Manager)

Quoted 10 lines

Changes in v2:
    - removed all external scripts
    - created ti-board-config etype to support generation of board config binaries
    - created ti-secure and ti-secure-rom etypes to handle signing instead of using external TI_SECURE_DEV_PKG
    - updated openssl btool to support x509 certificate generation
    - dropped Makefile changes to obtain external binary components, moving to using BINMAN_INDIRS to achieve the same

Quoted 4 lines

Another thing that got changed is you seem to have dropped the documentation update patch from v1. The documentation change is the best part as it shows how much easier this series makes building U-Boot for K3! :)

My bad, I didn't realize that had slipped out while sending v2, I will be sure to add it when sending the next version.

Quoted 4 lines

I did notice a build error when trying this with am62x_evm_r5_defconfig. I don't think this series caused the issue, but it does expose the issue. Fix sent here[0]. So if anyone has issues building this series try that patch.

Thank you for noticing, I had included types.h while building and excluded it later, this patch should fix it. Thanks for the patch!

Quoted 12 lines

Other than the couple minor comments, everything looks good and I'm extremely impressed how well this all turned out. Removing the external tooling and scripts previously needed to build U-Boot for K3 is key to our upstream-first goals and long term support strategy.

Thank you!

For the whole series,

[0] https://lists.denx.de/pipermail/u-boot/2023-April/514400.html

Signature · 2 lines
Thanking You
Neha Malcom Francis