You need to fuse the RPMB key to your emmc with fastboot cmds. You can find the instructions to do that in our release user guide. Once you have fused, you cannot change it. So be careful to do that
Two ways are provided to set the RPMB key.
- Manually specify a 256-bit key and program it
Firstly, a file contains the key need to be generated. In the default key file “rpmb_key_test.bin”, all 256 bits are zero. It can be generated with below commands:
$ touch rpmb_key.bin
$ echo –n “RPMB” > rpmb_key.bin
$ echo –n -e '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' >> rpmb_key.bin
The '\xHH' means eight-bit character whose value is the hexadecimal value 'HH'. You can replace above "00" with the key you want to set.
Then, program the key with the file just generated
Make the board enter fastboot mode, then execute below commands on host side:
$ fastboot stage rpmb_key.bin
$ fastboot oem set-rpmb-key
- Program a random key
Make the board enter fastboot mode, execute below commands on host side:
$ fastboot oem set-rpmb-random-key
After RPMB key programed with either of the two ways, reboot the board, the RPMB service in Trusty OS will be initialized successfully.
The preceding two ways will program the key to eMMC fuse, a key blob will be generated base on the key value and the blob will be saved for TEE to use. In default condition, this key blob is saved in the 16383rd block of BOOT1 partition in eMMC for i.MX8QuadMax and i.MX8QuadXPlus. The BOOT1 partition size of eMMC on i.MX8QuadMax and i.MX8QuadXPlus is 8MB, we can find that the key blob is in the last block in BOOT1 partition. To prevent key blob from been tampered when the system is running, BOO1 partition will be set with power-on write protection when the board boot up.