14-Secure Boot
Last updated
Last updated
During the Secure Boot startup process, when the chip starts, it will first check the security of the system, and then boot the system after passing the inspection. If the inspection fails, it is considered that the system has been modified, and the boot system is refused and enters the burning mode.
The script that generates the key is located at: longan/build/createkeys
The generated key is located inlongan/out/$(platform)/common/keys
such as:longan/out/h618/common/keys
These keys are all interrelated and must be used together. Please keep the generated keys in a safe set.
Where rotpk.bin is burned into the chip, used to verify the public key of the root certificate. **rotpk.bin needs to be burned into the chip on a device that has burned the security firmware **, the method of use will be described later, see rotpk programming for details. Others are private keys used to sign the firmware package when packing the firmware. A firmware consists of multiple parts, each of which is signed and authenticated using a separate key pair.
If you already have a password, put the key under longan/out/$ (platform)/common/keys
The file number and name of the key are adapted according to the platform firmware packaging process. The key generated by platform A cannot be used for the packaging of platform B security firmware. Otherwise hit The package process may fail because the specified key cannot be found.
When the chip boots the firmware, it will compare the version number of the firmware with the version number reserved by the chip memory.
The anti-rollback version number is configured in longan/devices/configs/chips/${chip}/configs/default/version_base.mk, and there are two main properties in the file that can be configured:
ROOT_ROLLBACK_USED
Whether to fill in the return scroll version number for BROM use, platform-related, configured, and use the default value.
MAIN_VERSION
The anti-rollback version number of the firmware, the available range is 0-31. Configuring other value chips will directly consider that the firmware version number verification failed.
Configuring burn_key properties
Set the burn_key attribute value to 1, the device will receive the information transmitted by DragonSN through usb and perform the corresponding burning work. This attribute is in the file longan/device/config/chips/h618/configs/p2/sys_config .fex, under the item [target], as shown in the figure. If not explicitly configured, press burn_key = 0 to process.
The generated security firmware is located at:longan/out/ h618_android12_p2_uart0_secure_v0.img
The v0 at the back is the version number you set, and the factory default of the chip is 0.
Rotpk burns through the PC-side tool dragonSN. The DragonSN tool communicates with the device through usb and controls the device to burn the specified rotpk information. The specific burning steps are as follows:
1. Burn the packaged security firmware (Note: After burning the security firmware, ordinary firmware cannot be burned. If ordinary firmware is burned, it will be printed at the end of startup. Prompt: need secure firmware)
Through the serial port log secure enable bit: determine whether it is secure firmware
0: normal firmware, 1: security firmware
2. Run after configuring the DrangonSN tool on the PC.
3.Tool configuration
Right-click to open the menu bar
4. Connect the PC to the board through USB or reset the board again (the board can only be recognized by the DrangonSN tool during shutdown and restart)
5. Successful programming
FAQ:It can only be programmed once, and the programming will faile
Serial port debugging is connected, starting, press and hold s and wait to enter uboot.
Enter printenv
environment variables for uboot
rotpk_status=1
0: means no burning
1: Indicates that rotpk is burned.