nxp-ls-tbbr.rst 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. --------------
  2. NXP Platforms:
  3. --------------
  4. TRUSTED_BOARD_BOOT option can be enabled by specifying TRUSTED_BOARD_BOOT=1 on command line during make.
  5. Bare-Minimum Preparation to run TBBR on NXP Platforms:
  6. =======================================================
  7. - OTPMK(One Time Programable Key) needs to be burnt in fuses.
  8. -- It is the 256 bit key that stores a secret value used by the NXP SEC 4.0 IP in Trusted or Secure mode.
  9. Note: It is primarily for the purpose of decrypting additional secrets stored in system non-volatile memory.
  10. -- NXP CST tool gives an option to generate it.
  11. Use the below command from directory 'cst', with correct options.
  12. .. code:: shell
  13. ./gen_otpmk_drbg
  14. - SRKH (Super Root Key Hash) needs to be burnt in fuses.
  15. -- It is the 256 bit hash of the list of the public keys of the SRK key pair.
  16. -- NXP CST tool gives an option to generate the RSA key pair and its hash.
  17. Use the below command from directory 'cst', with correct options.
  18. .. code:: shell
  19. ./gen_keys
  20. Refer fuse frovisioning readme 'nxp-ls-fuse-prov.rst' for steps to blow these keys.
  21. Two options are provided for TRUSTED_BOARD_BOOT:
  22. ================================================
  23. -------------------------------------------------------------------------
  24. Option 1: CoT using X 509 certificates
  25. -------------------------------------------------------------------------
  26. - This CoT is as provided by ARM.
  27. - To use this option user needs to specify mbedtld dir path in MBEDTLS_DIR.
  28. - To generate CSF header, path of CST repository needs to be specified as CST_DIR
  29. - CSF header is embedded to each of the BL2 image.
  30. - GENERATE_COT=1 adds the tool 'cert_create' to the build environment to generate:
  31. -- X509 Certificates as (.crt) files.
  32. -- X509 Pem key file as (.pem) files.
  33. - SAVE_KEYS=1 saves the keys and certificates, if GENERATE_COT=1.
  34. -- For this to work, file name for cert and keys are provided as part of compilation or build command.
  35. --- default file names will be used, incase not provided as part compilation or build command.
  36. --- default folder 'BUILD_PLAT' will be used to store them.
  37. - ROTPK for x.509 certificates is generated and embedded in bl2.bin and
  38. verified as part of CoT by Boot ROM during secure boot.
  39. - Compilation steps:
  40. All Images
  41. .. code:: shell
  42. make PLAT=$PLAT TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 MBEDTLS_DIR=$MBEDTLS_PATH CST_DIR=$CST_DIR_PATH \
  43. BOOT_MODE=<platform_supported_boot_mode> \
  44. RCW=$RCW_BIN \
  45. BL32=$TEE_BIN SPD=opteed\
  46. BL33=$UBOOT_SECURE_BIN \
  47. pbl \
  48. fip
  49. Additional FIP_DDR Image (For NXP platforms like lx2160a)
  50. .. code:: shell
  51. make PLAT=$PLAT TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 MBEDTLS_DIR=$MBEDTLS_PATH fip_ddr
  52. Note: make target 'fip_ddr' should never be combine with other make target 'fip', 'pbl' & 'bl2'.
  53. -------------------------------------------------------------------------
  54. Option 2: CoT using NXP CSF headers.
  55. -------------------------------------------------------------------------
  56. - This option is automatically selected when TRUSTED_BOARD_BOOT is set but MBEDTLS_DIR path is not specified.
  57. - CSF header is embedded to each of the BL31, BL32 and BL33 image.
  58. - To generate CSF header, path of CST repository needs to be specified as CST_DIR
  59. - Default input files for CSF header generation is added in this repo.
  60. - Default input file requires user to generate RSA key pair named
  61. -- srk.pri, and
  62. -- srk.pub, and add them in ATF repo.
  63. -- These keys can be generated using gen_keys tool of CST.
  64. - To change the input file , user can use the options BL33_INPUT_FILE, BL32_INPUT_FILE, BL31_INPUT_FILE
  65. - There are 2 paths in secure boot flow :
  66. -- Development Mode (sb_en in RCW = 1, SFP->OSPR, ITS = 0)
  67. --- In this flow , even on ROTPK comparison failure, flow would continue.
  68. --- However SNVS is transitioned to non-secure state
  69. -- Production mode (SFP->OSPR, ITS = 1)
  70. --- Any failure is fatal failure
  71. - Compilation steps:
  72. All Images
  73. .. code:: shell
  74. make PLAT=$PLAT TRUSTED_BOARD_BOOT=1 CST_DIR=$CST_DIR_PATH \
  75. BOOT_MODE=<platform_supported_boot_mode> \
  76. RCW=$RCW_BIN \
  77. BL32=$TEE_BIN SPD=opteed\
  78. BL33=$UBOOT_SECURE_BIN \
  79. pbl \
  80. fip
  81. Additional FIP_DDR Image (For NXP platforms like lx2160a)
  82. .. code:: shell
  83. make PLAT=$PLAT TRUSTED_BOARD_BOOT=1 CST_DIR=$CST_DIR_PATH fip_ddr
  84. - Compilation Steps with build option for generic image processing filters to prepend CSF header:
  85. -- Generic image processing filters to prepend CSF header
  86. BL32_INPUT_FILE = < file name>
  87. BL33_INPUT_FILE = <file name>
  88. .. code:: shell
  89. make PLAT=$PLAT TRUSTED_BOARD_BOOT=1 CST_DIR=$CST_DIR_PATH \
  90. BOOT_MODE=<platform_supported_boot_mode> \
  91. RCW=$RCW_BIN \
  92. BL32=$TEE_BIN SPD=opteed\
  93. BL33=$UBOOT_SECURE_BIN \
  94. BL33_INPUT_FILE = <ip file> \
  95. BL32_INPUT_FILE = <ip_file> \
  96. BL31_INPUT_FILE = <ip file> \
  97. pbl \
  98. fip
  99. Deploy ATF Images
  100. =================
  101. Same steps as mentioned in the readme "nxp-layerscape.rst".
  102. Verification to check if Secure state is achieved:
  103. ==================================================
  104. +---+----------------+-----------------+------------------------+----------------------------------+-------------------------------+
  105. | | Platform | SNVS_HPSR_REG | SYS_SECURE_BIT(=value) | SYSTEM_SECURE_CONFIG_BIT(=value) | SSM_STATE |
  106. +===+================+=================+========================+==================================+===============================+
  107. | 1.| lx2160ardb or | 0x01E90014 | 15 | 14-12 | 11-8 |
  108. | | lx2160aqds or | | ( = 1, BootROM Booted) | ( = 010 means Intent to Secure, | (=1111 means secure boot) |
  109. | | lx2162aqds | | | ( = 000 Unsecure) | (=1011 means Non-secure Boot) |
  110. +---+----------------+-----------------+------------------------+----------------------------------+-------------------------------+
  111. - Production mode (SFP->OSPR, ITS = 1)
  112. -- Linux prompt will successfully come. if the TBBR is successful.
  113. --- Else, Linux boot will be successful.
  114. -- For secure-boot status, read SNVS Register $SNVS_HPSR_REG from u-boot prompt:
  115. .. code:: shell
  116. md $SNVS_HPSR_REG
  117. Command Output:
  118. 1e90014: 8000AF00
  119. In case it is read as 00000000, then read this register using jtag (in development mode only through CW tap).
  120. +0 +4 +8 +C
  121. [0x01E90014] 8000AF00
  122. - Development Mode (sb_en in RCW = 1, SFP->OSPR, ITS = 0)
  123. -- Refer the SoC specific table to read the register to interpret whether the secure boot is achieved or not.
  124. -- Using JTAG (in development environment only, using CW tap):
  125. --- For secure-boot status, read SNVS Register $SNVS_HPSR_REG
  126. .. code:: shell
  127. ccs::display_regs 86 0x01E90014 4 0 1
  128. Command Output:
  129. Using the SAP chain position number 86, following is the output.
  130. +0 +4 +8 +C
  131. [0x01E90014] 8000AF00
  132. Note: Chain position number will vary from one SoC to other SoC.
  133. - Interpretation of the value:
  134. -- 0xA indicates BootROM booted, with intent to secure.
  135. -- 0xF = secure boot, as SSM_STATE.