|
| 1 | + |
| 2 | +.. _fitImage-for-HS: |
| 3 | + |
| 4 | +Creating the kernel fitImage for high security device / GP devices |
| 5 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | + |
| 7 | +SDKs have pre-built FIT images that contain the default Kernel and DTB files. |
| 8 | +But developers may want to deploy and test new Kernel and DTB without going |
| 9 | +through the standard build system. For the specific purpose, board specific |
| 10 | +fitImage.its will be present in the prebuilt-images directory. |
| 11 | + |
| 12 | +.. ifconfig:: CONFIG_part_family in ('AM335X_family', 'AM437X_family', 'AM57X_family') |
| 13 | + |
| 14 | + Pre-requisites ( Already part of SDK installations ): |
| 15 | + |
| 16 | + - Uboot build directory for ARMV7 |
| 17 | + - Linux Image and DTB |
| 18 | + |
| 19 | +.. ifconfig:: CONFIG_part_family not in ('AM335X_family', 'AM437X_family', 'AM57X_family') |
| 20 | + |
| 21 | + Pre-requisites ( Already part of SDK installations ): |
| 22 | + |
| 23 | + - Uboot build directory for ARMV8 |
| 24 | + - Linux Image and DTB |
| 25 | + |
| 26 | +.. note:: |
| 27 | + |
| 28 | + GP/HS-FS devices will also enforce authentication if booting fitImage. To |
| 29 | + disable authentication enforcement, FIT_SIGNATURE_ENFORCE needs to be |
| 30 | + disabled in defconfig for the specific board during uboot build. |
| 31 | + |
| 32 | +Describing FIT source |
| 33 | +""""""""""""""""""""" |
| 34 | + |
| 35 | +FIT Image is a packed structure containing binary blobs and configurations. |
| 36 | +The Kernel FIT Image that we have has Kernel Image, DTB and the DTBOs |
| 37 | + |
| 38 | +.. ifconfig:: CONFIG_part_family not in ('AM335X_family', 'AM437X_family', 'AM57X_family') |
| 39 | + |
| 40 | + .. code-block:: dts |
| 41 | +
|
| 42 | + kernel-1 { |
| 43 | + description = "Linux kernel"; |
| 44 | + data = /incbin/("linux.bin"); |
| 45 | + type = "kernel"; |
| 46 | + arch = "arm64"; |
| 47 | + os = "linux"; |
| 48 | + compression = "gzip"; |
| 49 | + load = <0x81000000>; |
| 50 | + entry = <0x81000000>; |
| 51 | + hash-1 { |
| 52 | + algo = "sha512"; |
| 53 | + }; |
| 54 | + }; |
| 55 | +
|
| 56 | + fdt-ti_k3-j721e-common-proc-board.dtb { |
| 57 | + description = "Flattened Device Tree blob"; |
| 58 | + data = /incbin/("arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dtb"); |
| 59 | + type = "flat_dt"; |
| 60 | + arch = "arm64"; |
| 61 | + compression = "none"; |
| 62 | + load = <0x83000000>; |
| 63 | + hash-1 { |
| 64 | + algo = "sha512"; |
| 65 | + }; |
| 66 | + }; |
| 67 | +
|
| 68 | + fdt-ti_k3-j721e-evm-virt-mac-client.dtbo { |
| 69 | + description = "Flattened Device Tree blob"; |
| 70 | + data = /incbin/("arch/arm64/boot/dts/ti/k3-j721e-evm-virt-mac-client.dtbo"); |
| 71 | + type = "flat_dt"; |
| 72 | + arch = "arm64"; |
| 73 | + compression = "none"; |
| 74 | + load = <0x83080000>; |
| 75 | + hash-1 { |
| 76 | + algo = "sha512"; |
| 77 | + }; |
| 78 | + }; |
| 79 | +
|
| 80 | +.. ifconfig:: CONFIG_part_family in ('AM57X_family') |
| 81 | + |
| 82 | + .. code-block:: dts |
| 83 | +
|
| 84 | + kernel-1 { |
| 85 | + description = "Linux kernel"; |
| 86 | + data = /incbin/("linux.bin.sec"); |
| 87 | + type = "kernel"; |
| 88 | + arch = "arm"; |
| 89 | + os = "linux"; |
| 90 | + compression = "none"; |
| 91 | + load = <0x82000000>; |
| 92 | + entry = <0x82000000>; |
| 93 | + }; |
| 94 | +
|
| 95 | + am5729-beagleboneai.dtb { |
| 96 | + description = "Flattened Device Tree blob"; |
| 97 | + data = /incbin/("arch/arm/boot/dts/am5729-beagleboneai.dtb.sec"); |
| 98 | + type = "flat_dt"; |
| 99 | + arch = "arm"; |
| 100 | + compression = "none"; |
| 101 | + }; |
| 102 | +
|
| 103 | + am57xx-beagle-x15.dtb { |
| 104 | + description = "Flattened Device Tree blob"; |
| 105 | + data = /incbin/("arch/arm/boot/dts/am57xx-beagle-x15.dtb.sec"); |
| 106 | + type = "flat_dt"; |
| 107 | + arch = "arm"; |
| 108 | + compression = "none"; |
| 109 | + }; |
| 110 | +
|
| 111 | +Change the path in data variables to point to the respective files in your |
| 112 | +local machine. |
| 113 | + |
| 114 | +For e.g change "linux.bin" to |
| 115 | +"<path-to-tisdk>/board-support/prebuilt-images/Image". |
| 116 | + |
| 117 | +.. ifconfig:: CONFIG_part_family not in ('AM335X_family', 'AM437X_family', 'AM57X_family') |
| 118 | + |
| 119 | + The new addition to the FIT from 8.6 to 9.0 is the FIT Signature. |
| 120 | + |
| 121 | + .. code-block:: dts |
| 122 | +
|
| 123 | + conf-ti_k3-j721e-common-proc-board.dtb { |
| 124 | + description = "Linux kernel, FDT blob"; |
| 125 | + fdt = "fdt-ti_k3-j721e-common-proc-board.dtb"; |
| 126 | + kernel = "kernel-1"; |
| 127 | + signature-1 { |
| 128 | + algo = "sha512,rsa4096"; |
| 129 | + key-name-hint = "custMpk"; |
| 130 | + sign-images = "kernel", "fdt"; |
| 131 | + }; |
| 132 | + }; |
| 133 | +
|
| 134 | +
|
| 135 | + Specify all images you need the signature to authenticate as a part of |
| 136 | + sign-images. The key-name-hint needs to be changed if you are using some |
| 137 | + other key other than the TI dummy key that we are using for this example. |
| 138 | + It should be the name of the file containing the keys. |
| 139 | + |
| 140 | + .. note:: |
| 141 | + |
| 142 | + Generating new set of keys: |
| 143 | + |
| 144 | + .. code-block:: console |
| 145 | +
|
| 146 | + $ mkdir keys |
| 147 | + $ openssl genpkey -algorithm RSA -out keys/dev.key \ |
| 148 | + -pkeyopt rsa_keygen_bits:4096 -pkeyopt rsa_keygen_pubexp:65537 |
| 149 | + $ openssl req -batch -new -x509 -key keys/dev.key -out keys/dev.crt |
| 150 | +
|
| 151 | +Generating the fitImage |
| 152 | +^^^^^^^^^^^^^^^^^^^^^^^ |
| 153 | + |
| 154 | +.. ifconfig:: CONFIG_part_family not in ('AM335X_family', 'AM437X_family', 'AM57X_family') |
| 155 | + |
| 156 | + .. note:: |
| 157 | + |
| 158 | + For signing a secondary platform like SK boards, you'll require |
| 159 | + additional steps |
| 160 | + |
| 161 | + Change the CONFIG_DEFAULT_DEVICE_TREE and binman nodes to package u-boot.dtb |
| 162 | + |
| 163 | + For e.g |
| 164 | + |
| 165 | + .. code-block:: diff |
| 166 | +
|
| 167 | + diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig |
| 168 | + index a5c1df7e0054..6d0126d955ef 100644 |
| 169 | + --- a/configs/j721e_evm_a72_defconfig |
| 170 | + +++ b/configs/j721e_evm_a72_defconfig |
| 171 | + @@ -13,7 +13,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000 |
| 172 | + CONFIG_ENV_SIZE=0x20000 |
| 173 | + CONFIG_DM_GPIO=y |
| 174 | + CONFIG_SPL_DM_SPI=y |
| 175 | + -CONFIG_DEFAULT_DEVICE_TREE="k3-j721e-common-proc-board" |
| 176 | + +CONFIG_DEFAULT_DEVICE_TREE="k3-j721e-sk" |
| 177 | + CONFIG_SPL_TEXT_BASE=0x80080000 |
| 178 | + CONFIG_DM_RESET=y |
| 179 | + CONFIG_SPL_MMC=y |
| 180 | +
|
| 181 | + diff --git a/arch/arm/dts/k3-j721e-binman.dtsi b/arch/arm/dts/k3-j721e-binman.dtsi |
| 182 | + index 673be646b1e3..752fa805fe8d 100644 |
| 183 | + --- a/arch/arm/dts/k3-j721e-binman.dtsi |
| 184 | + +++ b/arch/arm/dts/k3-j721e-binman.dtsi |
| 185 | + @@ -299,8 +299,8 @@ |
| 186 | + #define SPL_J721E_SK_DTB "spl/dts/k3-j721e-sk.dtb" |
| 187 | +
|
| 188 | + #define UBOOT_NODTB "u-boot-nodtb.bin" |
| 189 | + -#define J721E_EVM_DTB "u-boot.dtb" |
| 190 | + -#define J721E_SK_DTB "arch/arm/dts/k3-j721e-sk.dtb" |
| 191 | + +#define J721E_EVM_DTB "arch/arm/dts/k3-j721e-common-proc-board.dtb" |
| 192 | + +#define J721E_SK_DTB "u-boot.dtb" |
| 193 | +
|
| 194 | +This step will embed the public key in the u-boot.dtb file that was already |
| 195 | +built during the initial u-boot build. |
| 196 | + |
| 197 | +.. ifconfig:: CONFIG_part_family in ('AM335X_family', 'AM437X_family', 'AM57X_family') |
| 198 | + |
| 199 | + .. code-block:: console |
| 200 | +
|
| 201 | + mkimage -r -f fitImage.its -k $UBOOT_PATH/board/ti/keys -K $UBOOT_PATH/build/$ARMV7/dts/dt.dtb fitImage |
| 202 | +
|
| 203 | +.. ifconfig:: CONFIG_part_family not in ('AM335X_family', 'AM437X_family', 'AM57X_family') |
| 204 | + |
| 205 | + .. code-block:: console |
| 206 | +
|
| 207 | + mkimage -r -f fitImage.its -k $UBOOT_PATH/arch/arm/mach-k3/keys -K $UBOOT_PATH/build/$ARMV8/dts/dt.dtb fitImage |
| 208 | +
|
| 209 | +.. note:: |
| 210 | + |
| 211 | + If you have another set of keys then change the -k argument to point to |
| 212 | + the folder where your keys are present, the build requires the presence |
| 213 | + of both .key and .crt file. |
| 214 | + |
| 215 | +Build uboot again |
| 216 | +^^^^^^^^^^^^^^^^^ |
| 217 | + |
| 218 | +.. ifconfig:: CONFIG_part_family in ('AM335X_family', 'AM437X_family', 'AM57X_family') |
| 219 | + |
| 220 | + The updated u-boot.dtb needs to be packed in u-boot.img for authentication |
| 221 | + so rebuild uboot ARMV7 without changing any parameters. |
| 222 | + |
| 223 | +.. ifconfig:: CONFIG_part_family not in ('AM335X_family', 'AM437X_family', 'AM57X_family') |
| 224 | + |
| 225 | + The updated u-boot.dtb needs to be packed in u-boot.img for authentication |
| 226 | + so rebuild uboot ARMV8 without changing any parameters. |
| 227 | + |
| 228 | +Refer to :ref:`top-level-makefile` |
0 commit comments