Last edited one week ago

Developer Package - SDK-infos

Applicable for STM32MP13x lines, STM32MP15x lines, STM32MP21x lines, STM32MP23x lines, STM32MP25x lines


1. Purpose[edit | edit source]

SDK-infos is a way via script and configuration example to use the OpenSTLinux SDK for generating boot stage of stm32mpu. It is provided via the developer package to simplify the work and in addition of basic process.

2. Structure[edit | edit source]

SDK-infos provides:

  • generic script for generating common script action and empty configuration
  • generic script for generating signature/encryption key and associated configuration
  • examples of configuration: as given below
 stm32mp1
 stm32mp15 with signature
 stm32mp13 with signature/encryption
 stm32mp1 with MX devicetree
 stm32mp15 with MX devicetree and with signature
 stm32mp13 with MX devicetree and with signature/encryption
 stm32mp2
 stm32mp2 with signature/encryption
 stm32mp2 with MX devicetree and with signature/encryption
 stm32mp2 with MX devicetree and with signature/encryption
 stm32mp2-m33td
 stm32mp2-m33td with signature/encryption
 stm32mp2-m33td with MX devicetree and with signature/encryption
 stm32mp2-m33td with MX devicetree and with signature/encryption
Tree:
├── external-<version>
│   ├── ...
│   ├── README.HOW_TO.txt.stm32mp1
│   ├── README.HOW_TO.txt.stm32mp2
│   └── README.HOW_TO.txt.stm32mp2-m33td
├── gcnano-driver-stm32mp-<version>
│   ├── ...
│   ├── README.HOW_TO.txt.stm32mp1
│   ├── README.HOW_TO.txt.stm32mp2
│   └── README.HOW_TO.txt.stm32mp2-m33td
├── linux-stm32mp-<version>
│   ├── ...
│   ├── linux-<version>.tar.xz
│   ├── README.HOW_TO.txt.stm32mp1
│   ├── README.HOW_TO.txt.stm32mp2
│   └── README.HOW_TO.txt.stm32mp2-m33td
├── m33tdprojects-starter-stm32mp2-<version>
│   ├── ...
│   ├── m33fwtool-stm32mp.stm32mp2-m33td
│   ├── Makefile.sdk.stm32mp2-m33td
│   └── README.HOW_TO.txt.stm32mp2-m33td
├── optee-os-stm32mp-<version>
│   ├── ...
│   ├── fiptool-stm32mp.stm32mp1
│   ├── fiptool-stm32mp.stm32mp2
│   ├── fiptool-stm32mp.stm32mp2-m33td
│   ├── Makefile.sdk.stm32mp1
│   ├── Makefile.sdk.stm32mp2
│   ├── Makefile.sdk.stm32mp2-m33td
│   ├── README.HOW_TO.txt.stm32mp1
│   ├── README.HOW_TO.txt.stm32mp2
│   └── README.HOW_TO.txt.stm32mp2-m33td
├── sdk-infos-<version>
│   ├── create_signature_encryption_key.sh
│   ├── examples
│   │   ├── sdk_compilation_stm32mp1_mx_sign_encrypt_stm32mp135f-dk.example
│   │   ├── sdk_compilation_stm32mp1_mx_sign_stm32mp157f-dk.example
│   │   ├── sdk_compilation_stm32mp1_mx_sign_stm32mp157f-ev1.example
│   │   ├── sdk_compilation_stm32mp1_mx_stm32mp135f-dk.example
│   │   ├── sdk_compilation_stm32mp1_mx_stm32mp157f-dk.example
│   │   ├── sdk_compilation_stm32mp1_mx_stm32mp157f-ev1.example
│   │   ├── sdk_compilation_stm32mp1_sign_encrypt_stm32mp135f-dk.example
│   │   ├── sdk_compilation_stm32mp1_sign_stm32mp157f-dk.example
│   │   ├── sdk_compilation_stm32mp1_sign_stm32mp157f-ev1.example
│   │   ├── sdk_compilation_stm32mp1_stm32mp135f-dk.example
│   │   ├── sdk_compilation_stm32mp1_stm32mp157f-dk.example
│   │   ├── sdk_compilation_stm32mp1_stm32mp157f-ev1.example
│   │   ├── sdk_compilation_stm32mp2-m33td_mx_sign_encrypt_stm32mp215f-dk.example
│   │   ├── sdk_compilation_stm32mp2-m33td_mx_sign_encrypt_stm32mp257f-ev1.example
│   │   ├── sdk_compilation_stm32mp2-m33td_mx_stm32mp215f-dk.example
│   │   ├── sdk_compilation_stm32mp2-m33td_mx_stm32mp257f-ev1.example
│   │   ├── sdk_compilation_stm32mp2-m33td_sign_encrypt_stm32mp215f-dk.example
│   │   ├── sdk_compilation_stm32mp2-m33td_sign_encrypt_stm32mp235f-dk.example
│   │   ├── sdk_compilation_stm32mp2-m33td_sign_encrypt_stm32mp257f-dk.example
│   │   ├── sdk_compilation_stm32mp2-m33td_sign_encrypt_stm32mp257f-ev1.example
│   │   ├── sdk_compilation_stm32mp2-m33td_stm32mp215f-dk.example
│   │   ├── sdk_compilation_stm32mp2-m33td_stm32mp235f-dk.example
│   │   ├── sdk_compilation_stm32mp2-m33td_stm32mp257f-dk.example
│   │   ├── sdk_compilation_stm32mp2-m33td_stm32mp257f-ev1.example
│   │   ├── sdk_compilation_stm32mp2_mx_sign_encrypt_stm32mp215f-dk.example
│   │   ├── sdk_compilation_stm32mp2_mx_sign_encrypt_stm32mp235f-dk.example
│   │   ├── sdk_compilation_stm32mp2_mx_sign_encrypt_stm32mp257f-dk.example
│   │   ├── sdk_compilation_stm32mp2_mx_sign_encrypt_stm32mp257f-ev1.example
│   │   ├── sdk_compilation_stm32mp2_mx_stm32mp215f-dk.example
│   │   ├── sdk_compilation_stm32mp2_mx_stm32mp235f-dk.example
│   │   ├── sdk_compilation_stm32mp2_mx_stm32mp257f-dk.example
│   │   ├── sdk_compilation_stm32mp2_mx_stm32mp257f-ev1.example
│   │   ├── sdk_compilation_stm32mp2_sign_encrypt_stm32mp215f-dk.example
│   │   ├── sdk_compilation_stm32mp2_sign_encrypt_stm32mp235f-dk.example
│   │   ├── sdk_compilation_stm32mp2_sign_encrypt_stm32mp257f-dk.example
│   │   ├── sdk_compilation_stm32mp2_sign_encrypt_stm32mp257f-ev1.example
│   │   ├── sdk_compilation_stm32mp2_stm32mp215f-dk.example
│   │   ├── sdk_compilation_stm32mp2_stm32mp235f-dk.example
│   │   ├── sdk_compilation_stm32mp2_stm32mp257f-dk.example
│   │   └── sdk_compilation_stm32mp2_stm32mp257f-ev1.example
│   ├── generated_build_script-stm32mpx.sh
│   ├── README.HOW_TO.txt.stm32mp1
│   ├── README.HOW_TO.txt.stm32mp2
│   └── README.HOW_TO.txt.stm32mp2-m33td
├── stm32mp-ddr-phy-<version>
│   ├── ...
│   ├── README.HOW_TO.txt.stm32mp1
│   ├── README.HOW_TO.txt.stm32mp2
│   └── README.HOW_TO.txt.stm32mp2-m33td
├── tf-a-stm32mp-<version>
│   ├── ...
│   ├── fiptool-stm32mp.stm32mp1
│   ├── fiptool-stm32mp.stm32mp2
│   ├── fiptool-stm32mp.stm32mp2-m33td
│   ├── Makefile.sdk.stm32mp1
│   ├── Makefile.sdk.stm32mp2
│   ├── Makefile.sdk.stm32mp2-m33td
│   ├── README.HOW_TO.txt.stm32mp1
│   ├── README.HOW_TO.txt.stm32mp2
│   └── README.HOW_TO.txt.stm32mp2-m33td
├── tf-m-stm32mp-v2.1.5-stm32mp-r1-rc1-r0
│   ├── ...
│   ├── m33fwtool-stm32mp.stm32mp2-m33td
│   ├── Makefile.sdk.stm32mp2-m33td
│   └── README.HOW_TO.txt.stm32mp2-m33td
└── u-boot-stm32mp-v2026.04-stm32mp-r1-rc2-r0
    ├── ...
    ├── fiptool-stm32mp.stm32mp1
    ├── fiptool-stm32mp.stm32mp2
    ├── fiptool-stm32mp.stm32mp2-m33td
    ├── Makefile.sdk.stm32mp1
    ├── Makefile.sdk.stm32mp2
    ├── Makefile.sdk.stm32mp2-m33td
    ├── README.HOW_TO.txt.stm32mp1
    ├── README.HOW_TO.txt.stm32mp2
    └── README.HOW_TO.txt.stm32mp2-m33td

3. How to generate a SDK-infos configuration for a specific board[edit | edit source]

./sdk-infos-<version>/generated_build_script-stm32mpx.sh
generated_build_script <machine name> [--security]
 <machine name>: name of the machine which can be use for sdk compilation
     stm32mp1 or stm32mp1-mx
     stm32mp2 or stm32mp2-mx
     stm32mp2-m33td or stm32mp2-m33td-mx
 --security: generate configuration for signature/encryption

The script permit to generate a generic SDK-infos configuration and the corresponding action.
Following the configuration requested, the file generated and usable by user will be like this:

 sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh
 (this file must be filled according to the board configuration targerted) 

The action script will be:

 sdk_action-common-for-<soc name>[-mx][with-security].source

The script relie on README located on each components to generate the action script.

  • generate configuration stm32mp1
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp1
  • generate configuration stm32mp1 with security (signature/encryption)
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp1 --security
  • generate configuration stm32mp1 with MX
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp1-mx
  • generate configuration stm32mp1 with MX and security (signature/encryption)
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp1-mx --security
  • generate configuration stm32mp2
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp2
  • generate configuration stm32mp2 with security (signature/encryption)
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp2 --security
  • generate configuration stm32mp2 with MX
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp2-mx --security
  • generate configuration stm32mp2 with MX and security (signature/encryption)
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp2-mx --security
  • generate configuration stm32mp2-m33td
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp2-m33td
  • generate configuration stm32mp2-m33td with security (signature/encryption)
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp2-m33td --security
  • generate configuration stm32mp2-m33td with MX
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp2-m33td-mx
  • generate configuration stm32mp2-m33td with MX and security (signature/encryption)
./sdk-infos-<version>/generated_build_script-stm32mpx.sh stm32mp2-m33td-mx --security

3.1. Configuration: basic configuration[edit | edit source]

Each configuration file (sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh) have:

  • sdk_absolute_path: location of the sdk
  • your_board_name: name of the board (also name of devicetree use by boot stage component)
  • your_soc_name: soc name, could be stm32mp13, stm32mp15, stm32mp21, stm32mp23, stm32mp25
  • your_storage_boot_scheme_security: type of security, could be optee or optemin
   optee is preconize for the majority of the stm32mp soc except for stm32mp15
  • your_storage_boot_scheme_cortex_a: type of boot scheme, several are availble:
    optee-emmc: boot on emmc with optee security
    optee-sdcard: boot on sdcard with optee security
    optee-nor: boot on nor with optee security
    optee-nand: boot on nor with optee security
    opteemin-emmc: boot on emmc with opteemin security
    opteemin-sdcard: boot on sdcard with opteemin security
    opteemin-nor: boot on nor with opteemin security
    opteemin-nand: boot on nand with opteemin security
  • your_deploy_dir_path: Location to store all the binaries generated
  • your_build_subdir_path: name of build subdirectory for each component

3.2. Configuration: Device tree configuration[edit | edit source]

There is several case of usage following the board you would like to use have the devicetree present:

  1. on component source code
  2. on ST external devicetree component
  3. on specific directory which is CubeMX output

For board devicetree present on component source code: set externaldt_path to empty.

  externaldt_path=

For board devicetree present on ST external devicetree component:set externaldt_path to absolute path of externel-dt component.

 externaldt_path=<path to developer package>/sources/ostl-linux/external-dt-<version>-r0/external-dt-<version>

For board devicetree present on specific directory which is CubeMX output:set externaldt_path to absolute path of CubeMx ouput directory.

  externaldt_path=<path to CubeMX project output>
Warning
You need to verify if the path for each component on CubeMX project match with what is described

on your configuration for externaldt_optee_path, externaldt_optee_programmer_path, externaldt_uboot_path, ...
You can take as example the example of ST board configuration present on sdk-infos-<version>/examples.

3.3. Configuration: specific for CubeMX configuration[edit | edit source]

Your need to specify the CubeMX project name which correspond to path on CubeMX output directory:

 your_cubemx_project_name=<cubemx project name>

3.4. Configuration: specific Signature/Encryption configuration[edit | edit source]

  • SIGN_ENABLE: Activate signature for BL2 and FIP
  • ENCRYPT_ENABLE: Encryption for BL2 and FIP
  • SIGN_TOOL: path to STM32 Ken Tools available with STM32CubeProgrammer
  • your_absolute_key_path: absolute path to directory which contains signaute/encryption keys
... (adapt public key, private, and password in function of your configuration)
Information
The signature/encryption can be generated with key via the tool script create_signature_encryption_key.sh

3.5. Configuration: advanced/addons configuration[edit | edit source]

3.5.1. For all components[edit | edit source]

  • Parallel make: number of parallel build process
ex.: PARALLEL_MAKE=-j8
for 8 parallel build

3.5.2. For TF-A specifically[edit | edit source]

  • activate DEBUG for TF-A:
ex: TF_A_DEBUG=1
  • set a specific LOG LEVEL for TF-A
ex: TF_A_LOG_LEVEL=20
Preconize 20 by default and 40 for debug
if signature if enable the log level is force to 20
  • activate support of firmware update
ex: TF_A_FIRMWARE_UPDATE=1
  • activate support of firmware update with A/B
ex: TF_A_FIRMWARE_UPDATE_AB=1

3.5.3. For metadata firmware generation[edit | edit source]

  • METADATA_IMAGE_NUMBER: number of image present on metada (fip only = 1, fip,bootfs,rootfs=3)
  • METADATA_NAME: name of metadata firmware generated
  • METADATA_TOOL_ARGS: argument with number of image and information about image (see example for content)

3.5.4. For Optee-os[edit | edit source]

  • activate DEBUG for optee-os
ex: OPTEE_DEBUG_CORE=y
  • desactivate DEBUG for optee-os
ex: OPTEE_DEBUG_CORE=n
  • set LOG LEVEL for optee-os
ex: OPTEE_LOG_LEVEL=2
  0: Minimum level
  1: Error level
  2: Info level
  3: DEBUG level
  4: Flow level (used to print the execution flox, typically the in/out of functions)

3.5.5. For U-BOOT[edit | edit source]

  • set list of fragments to add to configuration for runtime binaries:

UBOOT_FRAGMENT_LIST=" <fragment1> <fragment2> .."

ex: UBOOT_FRAGMENT_LIST="../fragment-03-efi.fragment ../fragment-06-m33td-no-splashscreen.fragment"
Information
if you activate TF_A_FIRMWARE_UPDATE_AB on tf-a, you need to use the fragment associated: fragment-07-firmware-update-ab.fragmen
  • set list of fragments to add to configuration for programming binaries:
UBOOT_PROGRAMMER_FRAGMENT_LIST=" <fragment1> <fragment2> .."

3.5.6. For linux kernel[edit | edit source]

Set list of fragments to add to configuration:

ex: KERNEL_FRAGMENT_LIST="../fragment-03-systemd.config ../fragment-04-modules.config"
  List of fragments available:
    fragment-03-systemd.config :  configuration for systemd usage
    fragment-04-modules.config : addons st configuration
  List of optional fragment available:
    optional-fragment-05-signature.config : configuration to use signed modules
    optional-fragment-06-nosmp.config : configuration to disable smp
    optional-fragment-07-efi.config: configuration to enable EFI functionality
    optional-fragment-07-efi-stm32mp1.config : specific addons cleanup for efi configuration for stm32mp1
    optional-fragment-08-disable-etnaviv.config: configuration to disable etnaviv

4. Generate binaries[edit | edit source]

The different binaries can be generated component by component or by type of binaries: bl2, fip, programmer.
(see help of script sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh )

4.1. By components[edit | edit source]

4.1.1. List of available components[edit | edit source]

  • external-dt
  • optee-os-stm32mp
  • u-boot-stm32mp
  • tf-a-stm32mp
  • linux-stm32mp
  • gcnano-driver-stm32mp
4.1.1.1. Components specific to stm32mp2[edit | edit source]
  • stm32mp-ddr-phy
4.1.1.2. Components specific to stm32mp2-m33td[edit | edit source]
  • tf-m-stm32mp
  • m33tdprojects-starter-stm32mp2

4.1.2. Action available by component[edit | edit source]

./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh component-action

Action available for all components:

  • extract: extract and apply patch on the source code for all components
  • compile: configure and build all the components for runtime
  • deploy: generate the deploy with input of each component (need to have made compile of component before)
  • programmer: binaries for programmer usage
  • clean: clean all components (remove all build directory, preserve source code)
  • cleanall: clean all components (remove all build directory and extracted source code)

Action specific for M33TD configuration:

  • compile-for-m33fw: compile all the component needed to generate m33fw
  • deploy-for-m33fw: deploy all the component needed to generate m33fw and generate m33fw

For Linux kernel some extended action are available:

  • dtb: generate only devicetree described on configuration
  • dtbs: generate all devicetree
  • images: generate the images requested: UImage, Image.gz, vmlinux, ...
  • modules: generate kernel modules
  • menuconfig: permit to edit kernel configuration

For U-BOOT an extended action is available:

  • menuconfig: permit to edit U-BOOT configuration

4.2. By type of binaries[edit | edit source]

4.2.1. Macro action[edit | edit source]

  • extract: extract all the source code
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh extract
  • compile-for-fip: compile all the component needed to generate fip
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh compile-for-fip
  • deploy-for-fip: deploy all the component needed to generate fip and generate fip
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh deploy-for-fip
  • programmer: generate all binaires needed for flashing the board
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh programmer
  • linux-stm32mp: generate the kernel binaries (Image, dtb, kernel modules)
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh linux-stm32mp
  • gcnano-driver-stm32mp: kernel module for GPU
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh gcnano-driver-stm32mp
  • compile-for-m33fw: compile binaries to boot on Cortex M33 (for stm32mp2-m33td machine)
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh compile-for-m33fw
  • deploy-for-m33fw: deploy binaries to boot on Cortex M33 (for stm32mp2-m33td machine)
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh deploy-for-m33fw

4.2.2. Action Preconize for stm32mp1[edit | edit source]

For runtime binaries

./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh extract
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh compile-for-fip
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh deploy-for-fip
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh linux-stm32mp
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh gcnano-driver-stm32mp

For Flashing binaries

./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh programmer

4.2.3. Action Preconize for stm32mp2[edit | edit source]

For runtime binaries

./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh extract
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh compile-for-fip
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh deploy-for-fip
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh linux-stm32mp
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh gcnano-driver-stm32mp

For Flashing binaries

./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh programmer

4.2.4. Action Preconize for stm32mp2-m33td[edit | edit source]

For runtime binaries

./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh extract
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh compile-for-fip
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh deploy-for-fip
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh compile-for-m33fw
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh deploy-for-m33fw
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh linux-stm32mp
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh gcnano-driver-stm32mp

For Flashing binaries

./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh programmer

5. Signature Encryption[edit | edit source]

5.1. Generate key[edit | edit source]

The script create_signature_encryption_key.sh permit to generate all the key needed for the stm32mpu soc. The script request to know:

  • location of STM32 KeyGen script
  • the soc name for which the key are generated.
  • the different password for signature or encryption
  • specific configuration like usage of M33TD boot behaviour

5.1.1. For stm32mp13[edit | edit source]

Command:

KEY_GEN=<path to STM32CubeProgrammer-x.xx>/bin/STM32_KeyGen_CLI ./sdk-infos-<version>/create_signature_encryption_key.sh \
      stm32mp13 \
      -pk1 pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7 \
      -o <output path>

Execution:

[INFO]: The output directory doesn't exist
[INFO]:    /tmp/dv/stm32mp13_key
[INFO]: Would you like to create it: [Y/n]
y
###########################################################
Parameters:
  Machine: stm32mp13
  Output directory: /tmp/dv/stm32mp13_key

  Password:
     for bl2 on cortex A (key1): pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7
###########################################################

/local/home/frq10491/STMicroelectronics/STM32Cube/STM32CubeProgrammer-2.23-s/bin/STM32_KeyGen_CLI -abs /tmp/dv/stm32mp13_key/tmp_key_PKHTH -pwd pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7 -n 8
       -------------------------------------------------------------------
                       STM32 Key Generator v2.23.0
       -------------------------------------------------------------------

 Prime256v1 curve is selected. 
 AES_256_cbc algorithm is selected for private key encryption
 Generating Prime256v1 keys... 
 Private key PEM file created 
 Public key PEM file created 
 public key hash file created 
 Keys packet 0 generated successfully.
 + public key:       /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKey00.pem
 + private key:      /tmp/dv/stm32mp13_key/tmp_key_PKHTH/privateKey00.pem
 + public hash key:  /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKeyHash00.bin
 ------------------------------------------------------------
 AES_256_cbc algorithm is selected for private key encryption
 Generating Prime256v1 keys... 
 Private key PEM file created 
 Public key PEM file created 
 public key hash file created 
 Keys packet 1 generated successfully.
 + public key:       /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKey01.pem
 + private key:      /tmp/dv/stm32mp13_key/tmp_key_PKHTH/privateKey01.pem
 + public hash key:  /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKeyHash01.bin
 ------------------------------------------------------------
 AES_256_cbc algorithm is selected for private key encryption
 Generating Prime256v1 keys... 
 Private key PEM file created 
 Public key PEM file created 
 public key hash file created 
 Keys packet 2 generated successfully.
 + public key:       /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKey02.pem
 + private key:      /tmp/dv/stm32mp13_key/tmp_key_PKHTH/privateKey02.pem
 + public hash key:  /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKeyHash02.bin
 ------------------------------------------------------------
 AES_256_cbc algorithm is selected for private key encryption
 Generating Prime256v1 keys... 
 Private key PEM file created 
 Public key PEM file created 
 public key hash file created 
 Keys packet 3 generated successfully.
 + public key:       /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKey03.pem
 + private key:      /tmp/dv/stm32mp13_key/tmp_key_PKHTH/privateKey03.pem
 + public hash key:  /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKeyHash03.bin
 ------------------------------------------------------------
 AES_256_cbc algorithm is selected for private key encryption
 Generating Prime256v1 keys... 
 Private key PEM file created 
 Public key PEM file created 
 public key hash file created 
 Keys packet 4 generated successfully.
 + public key:       /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKey04.pem
 + private key:      /tmp/dv/stm32mp13_key/tmp_key_PKHTH/privateKey04.pem
 + public hash key:  /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKeyHash04.bin
 ------------------------------------------------------------
 AES_256_cbc algorithm is selected for private key encryption
 Generating Prime256v1 keys... 
 Private key PEM file created 
 Public key PEM file created 
 public key hash file created 
 Keys packet 5 generated successfully.
 + public key:       /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKey05.pem
 + private key:      /tmp/dv/stm32mp13_key/tmp_key_PKHTH/privateKey05.pem
 + public hash key:  /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKeyHash05.bin
 ------------------------------------------------------------
 AES_256_cbc algorithm is selected for private key encryption
 Generating Prime256v1 keys... 
 Private key PEM file created 
 Public key PEM file created 
 public key hash file created 
 Keys packet 6 generated successfully.
 + public key:       /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKey06.pem
 + private key:      /tmp/dv/stm32mp13_key/tmp_key_PKHTH/privateKey06.pem
 + public hash key:  /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKeyHash06.bin
 ------------------------------------------------------------
 AES_256_cbc algorithm is selected for private key encryption
 Generating Prime256v1 keys... 
 Private key PEM file created 
 Public key PEM file created 
 public key hash file created 
 Keys packet 7 generated successfully.
 + public key:       /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKey07.pem
 + private key:      /tmp/dv/stm32mp13_key/tmp_key_PKHTH/privateKey07.pem
 + public hash key:  /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKeyHash07.bin
 ------------------------------------------------------------
 Hash of table of Hash of {algorithm + public Key} file generated successfully.
 + Hash Hash:  /tmp/dv/stm32mp13_key/tmp_key_PKHTH/publicKeysHashHashes.bin
/local/home/frq10491/STMicroelectronics/STM32Cube/STM32CubeProgrammer-2.23-s/bin/STM32_KeyGen_CLI -rand 16 /tmp/dv/stm32mp13_key/tmp_enc_key/a7_EDMK_key_128bits.bin
       -------------------------------------------------------------------
                       STM32 Key Generator v2.23.0
       -------------------------------------------------------------------

 
Random Data Generation : 
     Size        : 16 Bytes
     Output path : /tmp/dv/stm32mp13_key/tmp_enc_key/a7_EDMK_key_128bits.bin
 
Random data generated successfully : /tmp/dv/stm32mp13_key/tmp_enc_key/a7_EDMK_key_128bits.bin
hexdump -ve '1/1 "%.2x"' "/tmp/dv/stm32mp13_key"/a7_EDMK_key_128bits.bin > "/tmp/dv/stm32mp13_key"/a7_EDMK_key_256bits.txt
hexdump -ve '1/1 "%.2x"' "/tmp/dv/stm32mp13_key"/a7_EDMK_key_128bits.bin >> "/tmp/dv/stm32mp13_key"/a7_EDMK_key_256bits.txt
###########################################################
Summary of key creation for stm32mp13:
Location: /tmp/dv/stm32mp13_key
Signature:
[           PKHTH] a7_PKHTH_publicKeysHashHashes.bin (To FUSE ON BOARD)
                   a7_PKHTH_privateKey00.pem
                   a7_PKHTH_privateKey01.pem
                   a7_PKHTH_privateKey02.pem
                   a7_PKHTH_privateKey03.pem
                   a7_PKHTH_privateKey04.pem
                   a7_PKHTH_privateKey05.pem
                   a7_PKHTH_privateKey06.pem
                   a7_PKHTH_privateKey07.pem
                   a7_PKHTH_publicKey00.pem
                   a7_PKHTH_publicKey01.pem
                   a7_PKHTH_publicKey02.pem
                   a7_PKHTH_publicKey03.pem
                   a7_PKHTH_publicKey04.pem
                   a7_PKHTH_publicKey05.pem
                   a7_PKHTH_publicKey06.pem
                   a7_PKHTH_publicKey07.pem
                   a7_PKHTH_publicKeyHash00.pem
                   a7_PKHTH_publicKeyHash01.pem
                   a7_PKHTH_publicKeyHash02.pem
                   a7_PKHTH_publicKeyHash03.pem
                   a7_PKHTH_publicKeyHash04.pem
                   a7_PKHTH_publicKeyHash05.pem
                   a7_PKHTH_publicKeyHash06.pem
                   a7_PKHTH_publicKeyHash07.pem

Encryption:
[            EDMK] a7_EDMK_key_128bits.bin (To FUSE ON BOARD)
                   a7_EDMK_key_256bits.txt

###########################################################

Content of output directory:

   stm32mp13_key/
   ├── a7_EDMK_key_128bits.bin
   ├── a7_EDMK_key_256bits.txt
   ├── a7_PKHTH_privateKey00.pem
   ├── a7_PKHTH_privateKey01.pem
   ├── a7_PKHTH_privateKey02.pem
   ├── a7_PKHTH_privateKey03.pem
   ├── a7_PKHTH_privateKey04.pem
   ├── a7_PKHTH_privateKey05.pem
   ├── a7_PKHTH_privateKey06.pem
   ├── a7_PKHTH_privateKey07.pem
   ├── a7_PKHTH_publicKey00.pem
   ├── a7_PKHTH_publicKey01.pem
   ├── a7_PKHTH_publicKey02.pem
   ├── a7_PKHTH_publicKey03.pem
   ├── a7_PKHTH_publicKey04.pem
   ├── a7_PKHTH_publicKey05.pem
   ├── a7_PKHTH_publicKey06.pem
   ├── a7_PKHTH_publicKey07.pem
   ├── a7_PKHTH_publicKeyHash00.bin
   ├── a7_PKHTH_publicKeyHash01.bin
   ├── a7_PKHTH_publicKeyHash02.bin
   ├── a7_PKHTH_publicKeyHash03.bin
   ├── a7_PKHTH_publicKeyHash04.bin
   ├── a7_PKHTH_publicKeyHash05.bin
   ├── a7_PKHTH_publicKeyHash06.bin
   ├── a7_PKHTH_publicKeyHash07.bin
   ├── a7_PKHTH_publicKeysHashHashes.bin
   ├── distro_configuration_for_signature_encryption_stm32mp13.txt
   └── infos_keys.txt
Information
The name of file reflect type of core and the name of key on soc.

infos_key.txt is a kind of dump of execution which indicate which command was used to generate key and indicate which file will be fuse on board
distro_configuration_for_signature_encryption_stm32mp13.txt is the configuraton to report on sdk-infos configuration.

Dump of configuration generated:

##################################################################
##################################################################
### Signature / Encryption configuration
##################################################################
##################################################################
#
#          STM32MP13: CORTEX A7
#   ---------------------------------------
#   |                   BL2               |
#   |                 (TF-A)              |
#   |                                     |
#   |    verified with  | decrypted with  |
#   |       PKHTH       |       EDMK      |
#   ---------------------------------------
#   |                 FIP                 |
#   |        (FW-CONFIG - TF-A)           |
#   |               (optee)               |
#   |                                     |
#   |    verified with  | decrypted with  |
#   |      PKHTH        |       EDMK      |
#   ---------------------------------------
# WARNING: For FIP will be verified (and decrypted) by BL2, you need to compile
#   TF-A with specific option for signature support:
#     for all platform: TRUSTED_BOARD_BOOT=1 MBEDTLS_DIR=<path to mbedtls source code>
#   TF-A with specific option for encryption support:
#     for all platform: DECRYPTION_SUPPORT=aes_gcm ENCRYPT_BL32=1 MBEDTLS_DIR=<path to mbedtls source code>
#            ENCRYPT_BL31=1
#
#
# Activate signature for BL2 and FIP on cortex A7
SIGN_ENABLE=0

# Activate Encryption for BL2 and FIP on cortex A7
ENCRYPT_ENABLE=0

# Absolute path to signing tools
SIGN_TOOL="<absolute path>/STM32CubeProgrammer-x.xx/bin/STM32_SigningTool_CLI"

# Directory on which all key are available
your_absolute_key_path=/tmp/dv/stm32mp13_key

# For naming the output file, use the following suffix:
signature_suffix="_Signed"
encryption_suffix="_Encrypted"

# ------ Key associated to PKHTH ---------------------
# Private Key for signature (absolute path to key)
SIGN_KEY="${your_absolute_key_path}/a7_PKHTH_privateKey00.pem"
# List of Public key for signature
SIGN_KEY_PUB="\
    ${your_absolute_key_path}/a7_PKHTH_publicKey00.pem \
    ${your_absolute_key_path}/a7_PKHTH_publicKey01.pem \
    ${your_absolute_key_path}/a7_PKHTH_publicKey02.pem \
    ${your_absolute_key_path}/a7_PKHTH_publicKey03.pem \
    ${your_absolute_key_path}/a7_PKHTH_publicKey04.pem \
    ${your_absolute_key_path}/a7_PKHTH_publicKey05.pem \
    ${your_absolute_key_path}/a7_PKHTH_publicKey06.pem \
    ${your_absolute_key_path}/a7_PKHTH_publicKey07.pem \
"
# Password (key pass) for all signature key
SIGN_KEY_PASS="pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7"

# Password key associated to private key selected via SIGN_KEY
SIGN_KEY_PASS_FOR_SPECIFC_KEY="pass0"

# ------ Key associated to EDMK---------------------------
# encryption key use to decrypt Bl2 (TF-A) (128bits)
ENCRYPT_FSBL_KEY="${your_absolute_key_path}/a7_EDMK_key_128bits.bin"

# ------ Key associated to EDMK ---------------------------
# Encryption key use for fip content (256bits on txt)
ENCRYPT_FIP_KEY="${your_absolute_key_path}/a7_EDMK_key_256bits.txt"

##################################################################
##################################################################
### End of Signature / Encryption
##################################################################
##################################################################
Information
on SDK-infos configuration, the flags SIGN_ENABLE or (SIGN_ENABLE and ENCRYPT_ENABLE) must be adapted to your need, by default they are disabled.

5.1.2. For stm32mp15[edit | edit source]

Command:

KEY_GEN=<path to STM32CubeProgrammer-x.xx>/bin/STM32_KeyGen_CLI ./sdk-infos-<version>/create_signature_encryption_key.sh \
      stm32mp15 \
      -pk1 pass \
      -o <output path>

Content of output directory:

stm32mp15_key/
   ├── a7_PKH_privateKey00.pem
   ├── a7_PKH_publicKey00.pem
   ├── a7_PKH_publicKeyHash00.bin
   ├── a7_PKH_publicKeysHashHashes.bin
   ├── distro_configuration_for_signature_encryption_stm32mp15.txt
   └── infos_keys.txt

Dump of configuration generated:

##################################################################
##################################################################
### Signature / Encryption configuration
##################################################################
##################################################################
#
#    STM32MP15: CORTEX A7
#    ---------------------
#   |           BL2      |
#   |        (TF-A)      |
#   |                    |
#   |   verified with    |
#   |        PKHTH       |
#   ----------------------
#   |         FIP        |
#   | (FW-CONFIG - TF-A) |
#   |    (optee)         |
#   |                    |
#   |   verified with    |
#   |       PKHTH        |
#   ---------------------
# WARNING: For FIP will be verified (and decrypted) by BL2, you need to compile
#   TF-A with specific option for signature support:
#     for all platform: TRUSTED_BOARD_BOOT=1 MBEDTLS_DIR=<path to mbedtls source code>
#   TF-A with specific option for encryption support:
#     for all platform: DECRYPTION_SUPPORT=aes_gcm ENCRYPT_BL32=1 MBEDTLS_DIR=<path to mbedtls source code>
#            ENCRYPT_BL31=1
#
#
# Activate signature for BL2 and FIP on cortex A7
SIGN_ENABLE=0

# Activate Encryption for BL2 and FIP on cortex A7
# WARNING: encryption is not supported by stm32mp15 platform
# ENCRYPT_ENABLE MUST be disabled
ENCRYPT_ENABLE=0

# Absolute path to signing tools
SIGN_TOOL="<absolute path>/STM32CubeProgrammer-x.xx/bin/STM32_SigningTool_CLI"

# Directory on which all key are available
your_absolute_key_path=${output}

# For naming the output file, use the following suffix:
signature_suffix="_Signed"
encryption_suffix="_Encrypted"

# ------ Key associated to PKH ---------------------
# Private Key for signature (absolute path to key)
SIGN_KEY="${your_absolute_key_path}/a7_PKH_privateKey00.pem"
# List of Public key for signature
SIGN_KEY_PUB="\
    ${your_absolute_key_path}/a7_PKH_publicKey00.pem \
"
# Password (key pass) for all signature key
SIGN_KEY_PASS="pass"

# Password key associated to private key selected via SIGN_KEY
SIGN_KEY_PASS_FOR_SPECIFC_KEY="pass"

##################################################################
##################################################################
### End of Signature / Encryption
##################################################################
##################################################################

5.1.3. For stm32mp21, stm32mp23, stm32mp25 on A35-TD flavor [edit | edit source]

Caommand:

 KEY_GEN=<path to STM32CubeProgrammer-x.xx>/bin/STM32_KeyGen_CLI ./sdk-infos-<version>/create_signature_encryption_key.sh \
       stm32mp21 \
       -pk1 pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7 \
       --passrproc passrproc \
       -o <output path>
KEY_GEN=<path to STM32CubeProgrammer-x.xx>/bin/STM32_KeyGen_CLI ./sdk-infos-<version>/create_signature_encryption_key.sh \
       stm32mp23 \
       -pk1 pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7 \
       --passrproc passrproc \
       -o <output path>
KEY_GEN=<path to STM32CubeProgrammer-x.xx>/bin/STM32_KeyGen_CLI ./sdk-infos-<version>/create_signature_encryption_key.sh \
       stm32mp25 \
       -pk1 pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7 \
       --passrproc passrproc \
       -o <output path>

Content of output directory: stm32mp21_key/

   ├── a35_EDMK1-128b_key_128bits.bin
   ├── a35_FIP-EDMK_key_256bits.bin
   ├── a35_OEM-KEY1_privateKey00.pem
   ├── a35_OEM-KEY1_privateKey01.pem
   ├── a35_OEM-KEY1_privateKey02.pem
   ├── a35_OEM-KEY1_privateKey03.pem
   ├── a35_OEM-KEY1_privateKey04.pem
   ├── a35_OEM-KEY1_privateKey05.pem
   ├── a35_OEM-KEY1_privateKey06.pem
   ├── a35_OEM-KEY1_privateKey07.pem
   ├── a35_OEM-KEY1_publicKey00.pem
   ├── a35_OEM-KEY1_publicKey01.pem
   ├── a35_OEM-KEY1_publicKey02.pem
   ├── a35_OEM-KEY1_publicKey03.pem
   ├── a35_OEM-KEY1_publicKey04.pem
   ├── a35_OEM-KEY1_publicKey05.pem
   ├── a35_OEM-KEY1_publicKey06.pem
   ├── a35_OEM-KEY1_publicKey07.pem
   ├── a35_OEM-KEY1_publicKeyHash00.bin
   ├── a35_OEM-KEY1_publicKeyHash01.bin
   ├── a35_OEM-KEY1_publicKeyHash02.bin
   ├── a35_OEM-KEY1_publicKeyHash03.bin
   ├── a35_OEM-KEY1_publicKeyHash04.bin
   ├── a35_OEM-KEY1_publicKeyHash05.bin
   ├── a35_OEM-KEY1_publicKeyHash06.bin
   ├── a35_OEM-KEY1_publicKeyHash07.bin
   ├── a35_OEM-KEY1_publicKeysHashHashes.bin
   ├── distro_configuration_for_signature_encryption_stm32mp21.txt
   ├── infos_keys.txt
   ├── m33_RPROC-FW-ENC-KEY_key_256bits.bin
   ├── m33_RPROC-FW-PKH_ecc_privateKey.pem
   ├── m33_RPROC-FW-PKH_ecc_publicKey.der
   ├── m33_RPROC-FW-PKH_ecc_publicKeyhash.bin
   └── m33_RPROC-FW-PKH_ecc_publicKey.pem

Dump of configuration generated:

##################################################################
##################################################################
### Signature / Encryption configuration
##################################################################
##################################################################
#
#          STM32MP2: CORTEX A35 A35TD               CORTEX M33
#   ---------------------------------------    ---------------------
#   |                   BL2               |   |                    |
#   |                 (TF-A)              |   |                    |
#   |                                     |   |                    |
#   |    verified with  | decrypted with  |   |                    |
#   |       OEM-KEY1    |     *(1)        |   |                    |
#   --------------------------------------    ----------------------
#   |                 FIP                 |   |  co-processor FW   |
#   |        (FW-CONFIG - TF-A)           |   |    (M33Project)    |
#   |               (optee)               |   |                    |
#   [          (DDR fw - TF-A)            |   |   verified with    |
#   |                                     |   |     RPROC-FW-PKH   |
#   |    verified with  | decrypted with  |   |   decrypted with   |
#   |      OEM-KEY1     |     FIP-EDMK    |   |   RPROC-FW-ENC-KEY |
#    --------------------------------------   ----------------------
#
# (*1):
#   for stm32mp21 is EDMK1-128b
#   for stm32mp23/25 is EDMK1
#
# WARNING: For FIP will be verified (and decrypted) by BL2, you need to compile
#   TF-A with specific option for signature support:
#     for all platform: TRUSTED_BOARD_BOOT=1 MBEDTLS_DIR=<path to mbedtls source code> BRANCH_PROTECTION=0
#   TF-A with specific option for encryption support:
#     for all platform: DECRYPTION_SUPPORT=aes_gcm ENCRYPT_BL32=1 MBEDTLS_DIR=<path to mbedtls source code>
#

# Activate signature for BL2 and FIP on cortex A35
SIGN_ENABLE=0

# Activate Encryption for BL2 and FIP on cortex A35
ENCRYPT_ENABLE=0

# Activate signature during for loading firmware on Cortex M33 (coprocessor)
SIGN_COPRO_ENABLE=0
# Activate encryption during for loading firmware on Cortex M33 (coprocessor)
ENCRYPT_COPRO_ENABLE=0

# Absolute path to signing tools
SIGN_TOOL="<absolute path>/STM32CubeProgrammer-x.xx/bin/STM32_SigningTool_CLI"

# Directory on which all key are available
your_absolute_key_path=/tmp/dv/stm32mp21_key

# For naming the output file, use the following suffix:
signature_suffix="_Signed"
encryption_suffix="_Encrypted"

# ------ Key associated to OEM-KEY1 ---------------------
# Private Key for signature (absolute path to key)
SIGN_KEY="${your_absolute_key_path}/a35_OEM-KEY1_privateKey00.pem"
# List of Public key for signature
# NOTE:
# for stm32mp2 platform, 8 key pairs public/private are supported
SIGN_KEY_PUB="\
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey00.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey01.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey02.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey03.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey04.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey05.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey06.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey07.pem \
"
# Password (key pass) for all signature key
# NOTE:
# for stm32mp2 platform, up to 8 keys can be requested (means put all password according to key)
SIGN_KEY_PASS="pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7"

# Password key associated to private key selected via SIGN_KEY
SIGN_KEY_PASS_FOR_SPECIFC_KEY="pass0"

# ------ Key associated to EDMK1-128b------------
# encryption key use to decrypt Bl2 (TF-A) (128bits)
ENCRYPT_FSBL_KEY="${your_absolute_key_path}/a35_EDMK1-128b_key_128bits.bin"

# ------ Key associated to FIP-EDMK------------
# encryption key use to decrypt FIP component (256bits)
ENCRYPT_FIP_KEY="${your_absolute_key_path}/a35_FIP-EDMK_key_256bits.bin"

# ------ Key associated to RPROC-FW-PKH for coprocessor signature----------
# Type of key use for coprocessor signature:
# (256bits symmetric key)
#  RSA: Asymetric cryptography algorithm
#  ECC: Elliptic curve cryptography
SIGN_COPRO_TYPE=ecc

# For RSA KEY
SIGN_COPRO_RSA_INFOKEY=""
SIGN_COPRO_RSA_PRIVKEY=""
SIGN_COPRO_RSA_PASS=""

# For ECC KEY
SIGN_COPRO_ECC_INFOKEY="${your_absolute_key_path}/m33_RPROC-FW-PKH_ecc_publicKey.der"
SIGN_COPRO_ECC_PRIVKEY="${your_absolute_key_path}/m33_RPROC-FW-PKH_ecc_privateKey.pem"
SIGN_COPRO_ECC_PASS="passrproc"

# ------ Key associated to RPROC-FW-ENC-KEY for coprocessor encryption-------
# Encryption key (256bits)
ENCRYPT_COPRO_KEY="${your_absolute_key_path}/m33_RPROC-FW-ENC-KEY_key_256bits.bin"

##################################################################
##################################################################
### End of Signature / Encryption configuration
##################################################################
##################################################################

5.1.4. For stm32mp21, stm32mp23, stm32mp25 on M33-TD flavor [edit | edit source]

Command:

KEY_GEN=<path to STM32CubeProgrammer-x.xx>/bin/STM32_KeyGen_CLI ./sdk-info-<version>/create_signature_encryption_key.sh \
       stm32mp21 \
       --m33 \
       -pk1 pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7 \
       --passrproc passrproc \
       -pk2 passM0 passM1 passM2 passM3 passM4 passM5 passM6 passM7 \
       --passm33ddr passddr \
       --passm33fw passfw \
       -o <output path>
KEY_GEN=<path to STM32CubeProgrammer-x.xx>/bin/STM32_KeyGen_CLI ./sdk-info-<version>/create_signature_encryption_key.sh \
       stm32mp23 \
       --m33 \
       -pk1 pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7 \
       --passrproc passrproc \
       -pk2 passM0 passM1 passM2 passM3 passM4 passM5 passM6 passM7 \
       --passm33ddr passddr \
       --passm33fw passfw \
       -o <output path>
KEY_GEN=<path to STM32CubeProgrammer-x.xx>/bin/STM32_KeyGen_CLI ./sdk-info-<version>/create_signature_encryption_key.sh \
       stm32mp25 \
       --m33 \
       -pk1 pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7 \
       --passrproc passrproc \
       -pk2 passM0 passM1 passM2 passM3 passM4 passM5 passM6 passM7 \
       --passm33ddr passddr \
       --passm33fw passfw \
       -o <output path>

Content of output directory::

   stm32mp25-m33td_key/
   ├── a35_EDMK1_key_128bits.bin
   ├── a35_FIP-EDMK_key_256bits.bin
   ├── a35_OEM-KEY1_privateKey00.pem
   ├── a35_OEM-KEY1_privateKey01.pem
   ├── a35_OEM-KEY1_privateKey02.pem
   ├── a35_OEM-KEY1_privateKey03.pem
   ├── a35_OEM-KEY1_privateKey04.pem
   ├── a35_OEM-KEY1_privateKey05.pem
   ├── a35_OEM-KEY1_privateKey06.pem
   ├── a35_OEM-KEY1_privateKey07.pem
   ├── a35_OEM-KEY1_publicKey00.pem
   ├── a35_OEM-KEY1_publicKey01.pem
   ├── a35_OEM-KEY1_publicKey02.pem
   ├── a35_OEM-KEY1_publicKey03.pem
   ├── a35_OEM-KEY1_publicKey04.pem
   ├── a35_OEM-KEY1_publicKey05.pem
   ├── a35_OEM-KEY1_publicKey06.pem
   ├── a35_OEM-KEY1_publicKey07.pem
   ├── a35_OEM-KEY1_publicKeyHash00.bin
   ├── a35_OEM-KEY1_publicKeyHash01.bin
   ├── a35_OEM-KEY1_publicKeyHash02.bin
   ├── a35_OEM-KEY1_publicKeyHash03.bin
   ├── a35_OEM-KEY1_publicKeyHash04.bin
   ├── a35_OEM-KEY1_publicKeyHash05.bin
   ├── a35_OEM-KEY1_publicKeyHash06.bin
   ├── a35_OEM-KEY1_publicKeyHash07.bin
   ├── a35_OEM-KEY1_publicKeysHashHashes.bin
   ├── a35_RPROC-FW-ENC-KEY_key_256bits.bin
   ├── distro_configuration_for_signature_encryption_stm32mp25-m33td.txt
   ├── distro_configuration_for_signature_encryption_stm32mp25.txt
   ├── infos_keys.txt
   ├── m33_EDMK2_key_128bits.bin
   ├── m33_FSBLM-DDR-FW-PKH_hash.bin
   ├── m33_FSBLM-DDR-FW-PKH_privateKey.pem
   ├── m33_FSBLM-DDR-FW-PKH_publicKey.der
   ├── m33_FSBLM-DDR-FW-PKH_publicKey.pem
   ├── m33_FSBLM-M33-FW-PKH_hash.bin
   ├── m33_FSBLM-M33-FW-PKH_privateKey.pem
   ├── m33_FSBLM-M33-FW-PKH_publicKey.der
   ├── m33_FSBLM-M33-FW-PKH_publicKey.pem
   ├── m33_OEM-KEY2_privateKey00.pem
   ├── m33_OEM-KEY2_privateKey01.pem
   ├── m33_OEM-KEY2_privateKey02.pem
   ├── m33_OEM-KEY2_privateKey03.pem
   ├── m33_OEM-KEY2_privateKey04.pem
   ├── m33_OEM-KEY2_privateKey05.pem
   ├── m33_OEM-KEY2_privateKey06.pem
   ├── m33_OEM-KEY2_privateKey07.pem
   ├── m33_OEM-KEY2_publicKey00.pem
   ├── m33_OEM-KEY2_publicKey01.pem
   ├── m33_OEM-KEY2_publicKey02.pem
   ├── m33_OEM-KEY2_publicKey03.pem
   ├── m33_OEM-KEY2_publicKey04.pem
   ├── m33_OEM-KEY2_publicKey05.pem
   ├── m33_OEM-KEY2_publicKey06.pem
   ├── m33_OEM-KEY2_publicKey07.pem
   ├── m33_OEM-KEY2_publicKeyHash00.bin
   ├── m33_OEM-KEY2_publicKeyHash01.bin
   ├── m33_OEM-KEY2_publicKeyHash02.bin
   ├── m33_OEM-KEY2_publicKeyHash03.bin
   ├── m33_OEM-KEY2_publicKeyHash04.bin
   ├── m33_OEM-KEY2_publicKeyHash05.bin
   ├── m33_OEM-KEY2_publicKeyHash06.bin
   ├── m33_OEM-KEY2_publicKeyHash07.bin
   ├── m33_OEM-KEY2_publicKeysHashHashes.bin
   ├── m33_RPROC-FW-PKH_ecc_privateKey.pem
   ├── m33_RPROC-FW-PKH_ecc_publicKey.der
   ├── m33_RPROC-FW-PKH_ecc_publicKeyhash.bin
   ├── m33_RPROC-FW-PKH_ecc_publicKey.pem
   └── m33_TFM-IAK_key_256bits.bin

Dump of configuration generated:

##################################################################
##################################################################
### Signature / Encryption configuration
##################################################################
##################################################################
#
#          STM32MP2: CORTEX A35 A35TD               CORTEX M33
#   ---------------------------------------    ---------------------
#   |                   BL2               |   |       BL2          |
#   |                 (TF-A)              |   |   (TF-M MCUBOOT)   |
#   |                                     |   |                    |
#   |    verified with  | decrypted with  |   | verified with      |
#   |       OEM-KEY1    |       (*1)      |   |   OEM-KEY2         |
#   |                                     |   |  (or OEM-KEY1)     |
#   --------------------------------------    ----------------------
#   |                 FIP                 |   |       DDR FW       |
#   |        (FW-CONFIG - TF-A)           |   |    (TF-M)          |
#   |               (optee)               |   |                    |
#   [          (DDR fw - TF-A)            |   |   verified with    |
#   |                                     |   |  FSBLM-DDR-FW-PKH  |
#   |    verified with  | decrypted with  |   ----------------------
#   |      OEM-KEY1     |     FIP-EDMK    |   |       M33 FW       |
#    --------------------------------------   |                    |
#                                             |   verified with    |
#                                             |  FSBLM-M33-FW-PKH  |
#                                             ----------------------
#
# (*1):
#   for stm32mp21 is EDMK1-128b
#   for stm32mp23/25 is EDMK1
#
# WARNING: For FIP will be verified (and decrypted) by BL2, you need to compile
#   TF-A with specific option for signature support:
#     for all platform: TRUSTED_BOARD_BOOT=1 MBEDTLS_DIR=<path to mbedtls source code> BRANCH_PROTECTION=0
#   TF-A with specific option for encryption support:
#     for all platform: DECRYPTION_SUPPORT=aes_gcm ENCRYPT_BL32=1 MBEDTLS_DIR=<path to mbedtls source code>
#

# Activate signature for BL2 and FIP on cortex A35
SIGN_ENABLE=0

# Activate Encryption for BL2 and FIP on cortex A35
ENCRYPT_ENABLE=0

# Activate signature during for loading firmware on Cortex M33 (coprocessor)
SIGN_COPRO_ENABLE=0
# Activate encryption during for loading firmware on Cortex M33 (coprocessor)
ENCRYPT_COPRO_ENABLE=0

# Absolute path to signing tools
SIGN_TOOL="<absolute path>/STM32CubeProgrammer-x.xx/bin/STM32_SigningTool_CLI"

# Directory on which all key are available
your_absolute_key_path=/tmp/dv/stm32mp25-m33td_key

# For naming the output file, use the following suffix:
signature_suffix="_Signed"
encryption_suffix="_Encrypted"

# ------ Key associated to OEM-KEY1 ---------------------
# Private Key for signature (absolute path to key)
SIGN_KEY="${your_absolute_key_path}/a35_OEM-KEY1_privateKey00.pem"
# List of Public key for signature
# NOTE:
# for stm32mp2 platform, 8 key pairs public/private are supported
SIGN_KEY_PUB="\
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey00.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey01.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey02.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey03.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey04.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey05.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey06.pem \
    ${your_absolute_key_path}/a35_OEM-KEY1_publicKey07.pem \
"
# Password (key pass) for all signature key
# NOTE:
# for stm32mp2 platform, up to 8 keys can be requested (means put all password according to key)
SIGN_KEY_PASS="pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7"

# Password key associated to private key selected via SIGN_KEY
SIGN_KEY_PASS_FOR_SPECIFC_KEY="pass0"

# ------ Key associated to EDMK1------------
# encryption key use to decrypt Bl2 (TF-A) (128bits)
ENCRYPT_FSBL_KEY="${your_absolute_key_path}/a35_EDMK1_key_128bits.bin"

# ------ Key associated to OEM-KEY2 ---------------------
# NOTE: if OEM-KEY1 is configured on OTP for verifying Cortex M33 BL2
#     You need to configure the following variable as OEM-KEY1

USE_SAME_KEY_FOR_OEM_KEY1_AND_OEM_KEY2=1
if [ ${USE_SAME_KEY_FOR_OEM_KEY1_AND_OEM_KEY2} -eq 1 ]; then
    # USING OEM-KEY1 for Cortex M33 BL2 verification
    # Private Key for signature (absolute path to key)
    SIGN_KEY_M="${your_absolute_key_path}/a35_OEM-KEY1_privateKey00.pem"
    # List of Public key for signature
    # NOTE:
    # for stm32mp2 platform, 8 key pairs public/private are supported
    SIGN_KEY_PUB_M="\
        ${your_absolute_key_path}/a35_OEM-KEY1_publicKey00.pem \
        ${your_absolute_key_path}/a35_OEM-KEY1_publicKey01.pem \
        ${your_absolute_key_path}/a35_OEM-KEY1_publicKey02.pem \
        ${your_absolute_key_path}/a35_OEM-KEY1_publicKey03.pem \
        ${your_absolute_key_path}/a35_OEM-KEY1_publicKey04.pem \
        ${your_absolute_key_path}/a35_OEM-KEY1_publicKey05.pem \
        ${your_absolute_key_path}/a35_OEM-KEY1_publicKey06.pem \
        ${your_absolute_key_path}/a35_OEM-KEY1_publicKey07.pem \
    "
    # Password (key pass) for all signature key
    # NOTE:
    # for stm32mp2 platform, up to 8 keys can be requested (means put all password according to key)
    SIGN_KEY_PASS_M="pass0 pass1 pass2 pass3 pass4 pass5 pass6 pass7"

    # Password key associated to private key selected via SIGN_KEY
    SIGN_KEY_PASS_M_FOR_SPECIFC_KEY="pass0"

    # ------ Key associated to EDMK1------------
    # encryption key use to decrypt Bl2 (TF-A) (128bits)
    ENCRYPT_FSBL_M_KEY="${your_absolute_key_path}/a35_EDMK1_key_128bits.bin"

else
    # USING two separate key, one for Cortex A35 one for CortexM33
    # Private Key for signature (absolute path to key)
    SIGN_KEY_M="${your_absolute_key_path}/m33_OEM-KEY2_privateKey00.pem"
    # List of Public key for signature
    # NOTE:
    # for stm32mp2 platform, 8 key pairs public/private are supported
    SIGN_KEY_PUB_M="\
        ${your_absolute_key_path}/m33_OEM-KEY2_publicKey00.pem \
        ${your_absolute_key_path}/m33_OEM-KEY2_publicKey01.pem \
        ${your_absolute_key_path}/m33_OEM-KEY2_publicKey02.pem \
        ${your_absolute_key_path}/m33_OEM-KEY2_publicKey03.pem \
        ${your_absolute_key_path}/m33_OEM-KEY2_publicKey04.pem \
        ${your_absolute_key_path}/m33_OEM-KEY2_publicKey05.pem \
        ${your_absolute_key_path}/m33_OEM-KEY2_publicKey06.pem \
        ${your_absolute_key_path}/m33_OEM-KEY2_publicKey07.pem \
    "
    # Password (key pass) for all signature key
    # NOTE:
    # for stm32mp2 platform, up to 8 keys can be requested (means put all password according to key)
    SIGN_KEY_PASS_M="passM0 passM1 passM2 passM3 passM4 passM5 passM6 passM7"

    # Password key associated to private key selected via SIGN_KEY
    SIGN_KEY_PASS_M_FOR_SPECIFC_KEY="passM0"

    # ------ Key associated to EDMK2------------
    # encryption key use to decrypt Bl2 (TF-A) (128bits)
    ENCRYPT_FSBL_M_KEY="${your_absolute_key_path}/m33_EDMK2_key_128bits.bin"

fi

# ------ Key associated to FSBLM-DDR-FW-PKH ---------------------
SIGN_M33DDR_KEY="${your_absolute_key_path}/m33_FSBLM-DDR-FW-PKH_privateKey.pem"
SIGN_M33DDR_KEY_PASS="passddr"

# ------ Key associated to FSBLM-M33-FW-PKH ---------------------
SIGN_M33FW_KEY="${your_absolute_key_path}/m33_FSBLM-M33-FW-PKH_privateKey.pem"
SIGN_M33FW_KEY_PASS="passfw"

# ------ Key associated to FIP-EDMK------------
# encryption key use to decrypt FIP component (256bits)
ENCRYPT_FIP_KEY="${your_absolute_key_path}/a35_FIP-EDMK_key_256bits.bin"

# ------ Key associated to RPROC-FW-PKH for coprocessor signature----------
# Type of key use for coprocessor signature:
# (256bits symmetric key)
#  RSA: Asymetric cryptography algorithm
#  ECC: Elliptic curve cryptography
SIGN_COPRO_TYPE=ecc

# For RSA KEY
SIGN_COPRO_RSA_INFOKEY=""
SIGN_COPRO_RSA_PRIVKEY=""
SIGN_COPRO_RSA_PASS=""

# For ECC KEY
SIGN_COPRO_ECC_INFOKEY="${your_absolute_key_path}/m33_RPROC-FW-PKH_ecc_publicKey.der"
SIGN_COPRO_ECC_PRIVKEY="${your_absolute_key_path}/m33_RPROC-FW-PKH_ecc_privateKey.pem"
SIGN_COPRO_ECC_PASS="passrproc"

# ------ Key associated to RPROC-FW-ENC-KEY for coprocessor encryption-------
# Encryption key (256bits)
ENCRYPT_COPRO_KEY="${your_absolute_key_path}/m33_RPROC-FW-ENC-KEY_key_256bits.bin"

##################################################################
##################################################################
### End of Signature / Encryption configuration
##################################################################
##################################################################
Warning
About OEM-KEY2 and EDMK2:

If you fuse these two keys, at runtime OEM-KEY2 will be used to verify first boot binary on Cortex M33 and EDMK2 will be used to decrypt verify first boot binary on Cortex M33.

It's no more possible to use OEM-KEY1 EDMK1 instead for Cortex M33.

Information
With M33-TD flavor, there are two possible key configurations to verify FSBL-M partition binary of Cortex M33:
  • Using same key than the one used to verify BL2 boot stage binary on Cortex A35 (i.e. OEM-KEY1 key)
Need to set USE_SAME_KEY_FOR_OEM_KEY1_AND_OEM_KEY2 to '1'
  • Using a different key for Cortex A35 (BL2) and Cortex M33 (FSBL-M) cores
Need to set USE_SAME_KEY_FOR_OEM_KEY1_AND_OEM_KEY2 to '0'

5.2. sign or (sign and encrypt)[edit | edit source]

5.2.1. Pre-requisite[edit | edit source]

  • having a SDK-infos configuration generated with security option
  • having key generated (and potentially fuse on board)
  • having SDK-infos configuration updated with key information set (see ouput of create_signature_encryption_key.sh for corresponding configuration)
  • For signature: enabling SIGN_ENABLE on SDK-infos configuration
  • For signature and encryption: enabling SIGN_ENABLE and ENCRYPT_ENABLE on SDK-infos configuration
  • re-compile or compile the boot stage impacted by signature/encryption:
    • on Cortex A: tf-a for bl2 generation and fip generation
    • on Cortex M33: tf-m for bl2 generation

5.2.2. Signature only[edit | edit source]

  • compilation for runtime binaries:
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh extract

Generate bl2 and fip for CortexA

./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh compile-for-fip
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.shdeploy-for-fip
or
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh u-boot-stm32mp
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh optee-os-stm32mp
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh tf-a-stm32mp
(tf-a-stm32mp-deploy rule generate fip image)
  • signature for runtime binaries:
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh sign-bl2
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh sign-fip
  • compilation for programming binaries:
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh programmer
  • signature for programming binaries:
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh sign-bl2-programmer
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh sign-fip-programmer

5.2.3. Signature and Encryption[edit | edit source]

  • compilation for runtime binaries:
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh  extract

Generate bl2 and fip for CortexA

./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh compile-for-fip
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh deploy-for-fip
  • signature and encryption for runtime binaries:
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh sign-encrypt-bl2
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh sign-encrypt-fip
  • compilation for programming binaries:
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh programmer
  • signature and encryption for programming binaries:
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh sign-encrypt-bl2-programmer
./sdk_compilation-<soc name>[-mx][-sign_encrypt]-my-custom-board.sh sign-encrypt-fip-programmer