| 123 | | # sign it |
| 124 | | $ wget http://trac.gateworks.com/raw-attachment/wiki/venice/secure_boot/sign_hab_imx8m.sh |
| 125 | | $ chmod +x sign_hab_imx8m.sh |
| 126 | | $ ./sign_hab_imx8m.sh |
| 127 | | Install SRK |
| 128 | | Install CSFK |
| 129 | | Authenticate CSF |
| 130 | | Install key |
| 131 | | Authenticate data |
| 132 | | CSF Processed successfully and signed data available in csf_spl.bin |
| 133 | | Install SRK |
| 134 | | Install CSFK |
| 135 | | Authenticate CSF |
| 136 | | Install key |
| 137 | | Authenticate data |
| 138 | | CSF Processed successfully and signed data available in csf_fit.bin |
| 139 | | 6472+0 records in |
| 140 | | 6472+0 records out |
| 141 | | 6472 bytes (6.5 kB, 6.3 KiB) copied, 0.0102526 s, 631 kB/s |
| 142 | | 6488+0 records in |
| 143 | | 6488+0 records out |
| 144 | | 6488 bytes (6.5 kB, 6.3 KiB) copied, 0.0119102 s, 545 kB/s |
| 145 | | signed_flash.bin is ready! |
| 146 | | # create a JTAG image if needed |
| 147 | | mkimage_jtag --emmc -s signed_flash.bin@user:erase_none:66-32640 > signed_u-boot_spl-imx8mm.bin |
| 148 | | }}} |
| 149 | | * the script will create csf_spl.txt and csf_fit.txt which are templates used to create csf_spl.bin and csf_fit.bin which are then copied to the correct offsets in flash.bin to create signed_flash.bin |
| 150 | | * on a board without SRK Hash fuses programmed and flashed with this signed image the serial console will look this this: |
| 151 | | {{{#!bash |
| 152 | | U-Boot SPL 2021.07-00087-g54ac394a7c74 (Jun 09 2023 - 14:39:52 -0700) |
| | 118 | export PATH=$CST_DIR/linux64/bin:$PATH |
| | 119 | # sign flash.bin |
| | 120 | /bin/sh doc/imx/habv4/csf_examples/mx8m/csf.sh |
| | 121 | # create a JTAG image (if needed) using one of the following |
| | 122 | mkimage_jtag --emmc -s --partconf=boot0 \ |
| | 123 | flash.bin@boot0:erase_none:66-8192 > signed_u-boot_spl-imx8mm.bin # imx8mm emmc boot0 partition |
| | 124 | mkimage_jtag --emmc -s --partconf=boot0 \ |
| | 125 | flash.bin@boot0:erase_none:0-8192 > signed_u-boot_spl-imx8mm.bin # imx8mp/imx8mn emmc boot0 partition |
| | 126 | }}} |
| | 127 | 4. Program signed firmware image: |
| | 128 | {{{#!bash |
| | 129 | jtag_usbv4 -p signed_u-boot_spl-imx8mm.bin |
| | 130 | }}} |
| | 131 | * Booting this would look something like the following: |
| | 132 | {{{#!bash |
| | 133 | U-Boot SPL 2023.04-00034-g1f567dfbe119 (Jun 23 2023 - 15:53:20 -0700) |
| 170 | | U-Boot 2021.07-00087-g54ac394a7c74 (Jun 09 2023 - 14:39:52 -0700) |
| 171 | | |
| 172 | | CPU: Freescale i.MX8MMQ rev1.0 1600 MHz (running at 1200 MHz) |
| 173 | | CPU: Industrial temperature grade (-40C to 105C) at 34C |
| 174 | | Reset cause: POR |
| 175 | | Model: Gateworks Venice GW73xx-0x i.MX8MM Development Kit |
| 176 | | DRAM: 1 GiB |
| 177 | | WDT: Started with servicing (60s timeout) |
| 178 | | MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2 |
| 179 | | Loading Environment from MMC... OK |
| 180 | | In: serial |
| 181 | | Out: serial |
| 182 | | Err: serial |
| 183 | | Net: DP83867 eth0: ethernet@30be0000 [PRIME] |
| 184 | | GSC : boot watchdog disabled |
| 185 | | Hit any key to stop autoboot: 0 |
| 186 | | u-boot=> |
| 187 | | }}} |
| 188 | | - Note the 'hab fuse not enabled' and the 'Authenticate image from DDR location' messages |
| 189 | | 4. Program SRK Hash fuses from Step 1 into IMX OTP (using U-Boot and the keys from fuse bin) |
| | 152 | U-Boot 2023.04-00034-g1f567dfbe119 (Jun 23 2023 - 15:53:20 -0700) |
| | 153 | }}} |
| | 154 | - Note the 'hab fuse not enabled' message which means the SEC_CONFIG[1] fuse is not blown and the device is not locked |
| | 155 | - Note the 'Authenticate image from DDR location' messages which shows that image authentication is able to be used |
| | 156 | 5. Program SRK Hash fuses from Step 1 into IMX OTP (using U-Boot and the keys from fuse bin) |
| 219 | | * on a board with SRK Hash fuses programmed, SEC_CONFIG[1] set and flashed with a signed image the serial console will look this this: |
| 220 | | {{{#!bash |
| 221 | | U-Boot SPL 2021.07-00087-g54ac394a7c74 (Jun 09 2023 - 14:39:52 -0700) |
| 222 | | GSCv3 : v58 0xf098 RST:VIN Thermal protection:enabled at 96C |
| 223 | | RTC : 1970-01-03 16:34:29 UTC |
| 224 | | Model : GW7301-01-B1B |
| 225 | | Serial : 852455 |
| 226 | | MFGDate : 11-10-2020 |
| 227 | | PMIC : MP5416 |
| 228 | | DRAM : LPDDR4 4 GiB |
| 229 | | WDT: Started with servicing (60s timeout) |
| 230 | | Trying to boot from MMC1 |
| 231 | | DTB : imx8mm-venice-gw73xx-0x |
| 232 | | |
| 233 | | Authenticate image from DDR location 0x401fcdc0... |
| 234 | | NOTICE: BL31: v2.4(release):f884ad7b0ba2 |
| 235 | | NOTICE: BL31: Built : 13:06:09, Oct 20 2021 |
| 236 | | |
| 237 | | |
| 238 | | U-Boot 2021.07-00087-g54ac394a7c74 (Jun 09 2023 - 14:39:52 -0700) |
| 239 | | |
| 240 | | CPU: Freescale i.MX8MMQ rev1.0 1600 MHz (running at 1200 MHz) |
| 241 | | CPU: Industrial temperature grade (-40C to 105C) at 30C |
| 242 | | Reset cause: POR |
| 243 | | Model: Gateworks Venice GW73xx-0x i.MX8MM Development Kit |
| 244 | | DRAM: 4 GiB |
| 245 | | WDT: Started with servicing (60s timeout) |
| 246 | | MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2 |
| 247 | | Loading Environment from MMC... OK |
| 248 | | In: serial |
| 249 | | Out: serial |
| 250 | | Err: serial |
| 251 | | Net: DP83867 eth0: ethernet@30be0000 [PRIME] |
| 252 | | GSC : boot watchdog disabled |
| 253 | | Thermal protection:enabled at 96C |
| 254 | | Hit any key to stop autoboot: 0 |
| 255 | | }}} |
| 256 | | - Note the 'Authenticate image from DDR location' message |
| | 182 | |
| | 183 | For more info see: |
| | 184 | - https://elixir.bootlin.com/u-boot/latest/source/doc/imx/habv4/introduction_habv4.txt |
| | 185 | - https://elixir.bootlin.com/u-boot/latest/source/doc/imx/habv4/guides/mx8m_spl_secure_boot.txt |
| | 186 | |