xref: /openbmc/u-boot/doc/README.armada-secureboot (revision f77309d34325369dbdf0bf62387c9e974f1b37da)
1*a1b6b0a9SMario SixThe trusted boot framework on Marvell Armada 38x
2*a1b6b0a9SMario Six================================================
3*a1b6b0a9SMario Six
4*a1b6b0a9SMario SixContents:
5*a1b6b0a9SMario Six
6*a1b6b0a9SMario Six1. Overview of the trusted boot
7*a1b6b0a9SMario Six2. Terminology
8*a1b6b0a9SMario Six3. Boot image layout
9*a1b6b0a9SMario Six4. The secured header
10*a1b6b0a9SMario Six5. The secured boot flow
11*a1b6b0a9SMario Six6. Usage example
12*a1b6b0a9SMario Six7. Work to be done
13*a1b6b0a9SMario Six8. Bibliography
14*a1b6b0a9SMario Six
15*a1b6b0a9SMario Six1. Overview of the trusted boot
16*a1b6b0a9SMario Six-------------------------------
17*a1b6b0a9SMario Six
18*a1b6b0a9SMario SixThe Armada's trusted boot framework enables the SoC to cryptographically verify
19*a1b6b0a9SMario Sixa specially prepared boot image. This can be used to establish a chain of trust
20*a1b6b0a9SMario Sixfrom the boot firmware all the way to the OS.
21*a1b6b0a9SMario Six
22*a1b6b0a9SMario SixTo achieve this, the Armada SoC requires a specially prepared boot image, which
23*a1b6b0a9SMario Sixcontains the relevant cryptographic data, as well as other information
24*a1b6b0a9SMario Sixpertaining to the boot process. Furthermore, a eFuse structure (a
25*a1b6b0a9SMario Sixone-time-writeable memory) need to be configured in the correct way.
26*a1b6b0a9SMario Six
27*a1b6b0a9SMario SixRoughly, the secure boot process works as follows:
28*a1b6b0a9SMario Six
29*a1b6b0a9SMario Six* Load the header block of the boot image, extract a special "root" public RSA
30*a1b6b0a9SMario Six  key from it, and verify its SHA-256 hash against a SHA-256 stored in a eFuse
31*a1b6b0a9SMario Six  field.
32*a1b6b0a9SMario Six* Load an array of code signing public RSA keys from the header block, and
33*a1b6b0a9SMario Six  verify its RSA signature (contained in the header block as well) using the
34*a1b6b0a9SMario Six  "root" RSA key.
35*a1b6b0a9SMario Six* Choose a code signing key, and use it to verify the header block (excluding
36*a1b6b0a9SMario Six  the key array).
37*a1b6b0a9SMario Six* Verify the binary image's signature (contained in the header block) using the
38*a1b6b0a9SMario Six  code signing key.
39*a1b6b0a9SMario Six* If all checks pass successfully, boot the image.
40*a1b6b0a9SMario Six
41*a1b6b0a9SMario SixThe chain of trust is thus as follows:
42*a1b6b0a9SMario Six
43*a1b6b0a9SMario Six* The SHA-256 value in the eFuse field verifies the "root" public key.
44*a1b6b0a9SMario Six* The "root" public key verifies the code signing key array.
45*a1b6b0a9SMario Six* The selected code signing key verifies the header block and the binary image.
46*a1b6b0a9SMario Six
47*a1b6b0a9SMario SixIn the special case of building a boot image containing U-Boot as the binary
48*a1b6b0a9SMario Siximage, which employs this trusted boot framework, the following tasks need to
49*a1b6b0a9SMario Sixbe addressed:
50*a1b6b0a9SMario Six
51*a1b6b0a9SMario Six1. Creation of the needed cryptographic key material.
52*a1b6b0a9SMario Six2. Creation of a conforming boot image containing the U-Boot image as binary
53*a1b6b0a9SMario Six   image.
54*a1b6b0a9SMario Six3. Burning the necessary eFuse values.
55*a1b6b0a9SMario Six
56*a1b6b0a9SMario Six(1) will be addressed later, (2) will be taken care of by U-Boot's build
57*a1b6b0a9SMario Sixsystem (some user configuration is required, though), and for (3) the necessary
58*a1b6b0a9SMario Sixdata (essentially a series of U-Boot commands to be entered at the U-Boot
59*a1b6b0a9SMario Sixcommand prompt) will be created by the build system as well.
60*a1b6b0a9SMario Six
61*a1b6b0a9SMario SixThe documentation of the trusted boot mode is contained in part 1, chapter
62*a1b6b0a9SMario Six7.2.5 in the functional specification [1], and in application note [2].
63*a1b6b0a9SMario Six
64*a1b6b0a9SMario Six2. Terminology
65*a1b6b0a9SMario Six--------------
66*a1b6b0a9SMario Six
67*a1b6b0a9SMario Six	           CSK - Code Signing Key(s): An array of RSA key pairs, which
68*a1b6b0a9SMario Six                         are used to sign and verify the secured header and the
69*a1b6b0a9SMario Six                         boot loader image.
70*a1b6b0a9SMario Six	           KAK - Key Authentication Key: A RSA key pair, which is used
71*a1b6b0a9SMario Six                         to sign and verify the array of CSKs.
72*a1b6b0a9SMario Six	  Header block - The first part of the boot image, which contains the
73*a1b6b0a9SMario Six			 image's headers (also known as "headers block", "boot
74*a1b6b0a9SMario Six			 header", and "image header")
75*a1b6b0a9SMario Six                 eFuse - A one-time-writeable memory.
76*a1b6b0a9SMario Six               BootROM - The Armada's built-in boot firmware, which is
77*a1b6b0a9SMario Six                         responsible for verifying and starting secure images.
78*a1b6b0a9SMario Six	    Boot image - The complete image the SoC's boot firmware loads
79*a1b6b0a9SMario Six			 (contains the header block and the binary image)
80*a1b6b0a9SMario Six	   Main header - The header in the header block containing information
81*a1b6b0a9SMario Six			 and data pertaining to the boot process (used for both
82*a1b6b0a9SMario Six			 the regular and secured boot processes)
83*a1b6b0a9SMario Six	  Binary image - The binary code payload of the boot image; in this
84*a1b6b0a9SMario Six			 case the U-Boot's code (also known as "source image",
85*a1b6b0a9SMario Six			 or just "image")
86*a1b6b0a9SMario Six	Secured header - The specialized header in the header block that
87*a1b6b0a9SMario Six			 contains information and data pertaining to the
88*a1b6b0a9SMario Six			 trusted boot (also known as "security header")
89*a1b6b0a9SMario Six     Secured boot mode - A special boot mode of the Armada SoC in which secured
90*a1b6b0a9SMario Six                         images are verified (non-secure images won't boot);
91*a1b6b0a9SMario Six                         the mode is activated by setting a eFuse field.
92*a1b6b0a9SMario Six    Trusted debug mode - A special mode for the trusted boot that allows
93*a1b6b0a9SMario Six			 debugging of devices employing the trusted boot
94*a1b6b0a9SMario Six			 framework in a secure manner (untested in the current
95*a1b6b0a9SMario Six			 implementation).
96*a1b6b0a9SMario SixTrusted boot framework - The ARMADA SoC's implementation of a secure verified
97*a1b6b0a9SMario Six                         boot process.
98*a1b6b0a9SMario Six
99*a1b6b0a9SMario Six3. Boot image layout
100*a1b6b0a9SMario Six--------------------
101*a1b6b0a9SMario Six
102*a1b6b0a9SMario Six+-- Boot image --------------------------------------------+
103*a1b6b0a9SMario Six|                                                          |
104*a1b6b0a9SMario Six| +-- Header block --------------------------------------+ |
105*a1b6b0a9SMario Six| | Main header                                          | |
106*a1b6b0a9SMario Six| +------------------------------------------------------+ |
107*a1b6b0a9SMario Six| | Secured header                                       | |
108*a1b6b0a9SMario Six| +------------------------------------------------------+ |
109*a1b6b0a9SMario Six| | BIN header(s)                                        | |
110*a1b6b0a9SMario Six| +------------------------------------------------------+ |
111*a1b6b0a9SMario Six| | REG header(s)                                        | |
112*a1b6b0a9SMario Six| +------------------------------------------------------+ |
113*a1b6b0a9SMario Six| | Padding                                              | |
114*a1b6b0a9SMario Six| +------------------------------------------------------+ |
115*a1b6b0a9SMario Six|                                                          |
116*a1b6b0a9SMario Six| +------------------------------------------------------+ |
117*a1b6b0a9SMario Six| | Binary image + checksum                              | |
118*a1b6b0a9SMario Six| +------------------------------------------------------+ |
119*a1b6b0a9SMario Six+----------------------------------------------------------+
120*a1b6b0a9SMario Six
121*a1b6b0a9SMario Six4. The secured header
122*a1b6b0a9SMario Six---------------------
123*a1b6b0a9SMario Six
124*a1b6b0a9SMario SixFor the trusted boot framework, a additional header is added to the boot image.
125*a1b6b0a9SMario SixThe following data are relevant for the secure boot:
126*a1b6b0a9SMario Six
127*a1b6b0a9SMario Six		   KAK: The KAK is contained in the secured header in the form
128*a1b6b0a9SMario Six		        of a RSA-2048 public key in DER format with a length of
129*a1b6b0a9SMario Six			524 bytes.
130*a1b6b0a9SMario SixHeader block signature: The RSA signature of the header block (excluding the
131*a1b6b0a9SMario Six                        CSK array), created using the selected CSK.
132*a1b6b0a9SMario SixBinary image signature: The RSA signature of the binary image, created using
133*a1b6b0a9SMario Six                        the selected CSK.
134*a1b6b0a9SMario Six             CSK array: The array of the 16 CSKs as RSA-2048 public keys in DER
135*a1b6b0a9SMario Six	                format with a length of 8384 = 16 * 524 bytes.
136*a1b6b0a9SMario Six   CSK block signature: The RSA signature of the CSK array, created using the
137*a1b6b0a9SMario Six                        KAK.
138*a1b6b0a9SMario Six
139*a1b6b0a9SMario SixNOTE: The JTAG delay, Box ID, and Flash ID header fields do play a role in the
140*a1b6b0a9SMario Sixtrusted boot process to enable and configure secure debugging, but they were
141*a1b6b0a9SMario Sixnot tested in the current implementation of the trusted boot in U-Boot.
142*a1b6b0a9SMario Six
143*a1b6b0a9SMario Six5. The secured boot flow
144*a1b6b0a9SMario Six------------------------
145*a1b6b0a9SMario Six
146*a1b6b0a9SMario SixThe steps in the boot flow that are relevant for the trusted boot framework
147*a1b6b0a9SMario Sixproceed as follows:
148*a1b6b0a9SMario Six
149*a1b6b0a9SMario Six1) Check if trusted boot is enabled, and perform regular boot if it is not.
150*a1b6b0a9SMario Six2) Load the secured header, and verify its checksum.
151*a1b6b0a9SMario Six3) Select the lowest valid CSK from CSK0 to CSK15.
152*a1b6b0a9SMario Six4) Verify the SHA-256 hash of the KAK embedded in the secured header.
153*a1b6b0a9SMario Six5) Verify the RSA signature of the CSK block from the secured header with the
154*a1b6b0a9SMario Six   KAK.
155*a1b6b0a9SMario Six6) Verify the header block signature (which excludes the CSK block) from the
156*a1b6b0a9SMario Six   secured header with the selected CSK.
157*a1b6b0a9SMario Six7) Load the binary image to the main memory and verify its checksum.
158*a1b6b0a9SMario Six8) Verify the binary image's RSA signature from the secured header with the
159*a1b6b0a9SMario Six   selected CSK.
160*a1b6b0a9SMario Six9) Continue the boot process as in the case of the regular boot.
161*a1b6b0a9SMario Six
162*a1b6b0a9SMario SixNOTE: All RSA signatures are verified according to the PKCS #1 v2.1 standard
163*a1b6b0a9SMario Sixdescribed in [3].
164*a1b6b0a9SMario Six
165*a1b6b0a9SMario SixNOTE: The Box ID and Flash ID are checked after step 6, and the trusted debug
166*a1b6b0a9SMario Sixmode may be entered there, but since this mode is untested in the current
167*a1b6b0a9SMario Siximplementation, it is not described further.
168*a1b6b0a9SMario Six
169*a1b6b0a9SMario Six6. Usage example
170*a1b6b0a9SMario Six----------------
171*a1b6b0a9SMario Six
172*a1b6b0a9SMario Six### Create key material
173*a1b6b0a9SMario Six
174*a1b6b0a9SMario SixTo employ the trusted boot framework, cryptographic key material needs to be
175*a1b6b0a9SMario Sixcreated. In the current implementation, two keys are needed to build a valid
176*a1b6b0a9SMario Sixsecured boot image: The KAK private key and a CSK private key (both have to be
177*a1b6b0a9SMario Six2048 bit RSA keys in PEM format). Note that the usage of more than one CSK is
178*a1b6b0a9SMario Sixcurrently not supported.
179*a1b6b0a9SMario Six
180*a1b6b0a9SMario SixNOTE: Since the public key can be generated from the private key, it is
181*a1b6b0a9SMario Sixsufficient to store the private key for each key pair.
182*a1b6b0a9SMario Six
183*a1b6b0a9SMario SixOpenSSL can be used to generate the needed files kwb_kak.key and kwb_csk.key
184*a1b6b0a9SMario Six(the names of these files have to be configured, see the next section on
185*a1b6b0a9SMario Sixkwbimage.cfg settings):
186*a1b6b0a9SMario Six
187*a1b6b0a9SMario Sixopenssl genrsa -out kwb_kak.key 2048
188*a1b6b0a9SMario Sixopenssl genrsa -out kwb_csk.key 2048
189*a1b6b0a9SMario Six
190*a1b6b0a9SMario SixThe generated files have to be placed in the U-Boot root directory.
191*a1b6b0a9SMario Six
192*a1b6b0a9SMario SixAlternatively, instead of copying the files, symlinks to the private keys can
193*a1b6b0a9SMario Sixbe placed in the U-Boot root directory.
194*a1b6b0a9SMario Six
195*a1b6b0a9SMario SixWARNING: Knowledge of the KAK or CSK private key would enable an attacker to
196*a1b6b0a9SMario Sixgenerate secured boot images containing arbitrary code. Hence, the private keys
197*a1b6b0a9SMario Sixshould be carefully guarded.
198*a1b6b0a9SMario Six
199*a1b6b0a9SMario Six### Create/Modifiy kwbimage.cfg
200*a1b6b0a9SMario Six
201*a1b6b0a9SMario SixThe Kirkwook architecture in U-Boot employs a special board-specific
202*a1b6b0a9SMario Sixconfiguration file (kwbimage.cfg), which controls various boot image settings
203*a1b6b0a9SMario Sixthat are interpreted by the BootROM, such as the boot medium. The support the
204*a1b6b0a9SMario Sixtrusted boot framework, several new options were added to faciliate
205*a1b6b0a9SMario Sixconfiguration of the secured boot.
206*a1b6b0a9SMario Six
207*a1b6b0a9SMario SixThe configuration file's layout has been retained, only the following new
208*a1b6b0a9SMario Sixoptions were added:
209*a1b6b0a9SMario Six
210*a1b6b0a9SMario Six		KAK - The name of the KAK RSA private key file in the U-Boot
211*a1b6b0a9SMario Six                      root directory, without the trailing extension of ".key".
212*a1b6b0a9SMario Six		CSK - The name of the (active) CSK RSA private key file in the
213*a1b6b0a9SMario Six		      U-Boot root directory, without the trailing extension of
214*a1b6b0a9SMario Six		      ".key".
215*a1b6b0a9SMario Six	     BOX_ID - The BoxID to be used for trusted debugging (a integer
216*a1b6b0a9SMario Six	              value).
217*a1b6b0a9SMario Six	   FLASH_ID - The FlashID to be used for trusted debugging (a integer
218*a1b6b0a9SMario Six	              value).
219*a1b6b0a9SMario Six	 JTAG_DELAY - The JTAG delay to be used for trusted debugging (a
220*a1b6b0a9SMario Six	              integer value).
221*a1b6b0a9SMario Six          CSK_INDEX - The index of the active CSK (a integer value).
222*a1b6b0a9SMario SixSEC_SPECIALIZED_IMG - Flag to indicate whether to include the BoxID and FlashID
223*a1b6b0a9SMario Six		      in the image (that is, whether to use the trusted debug
224*a1b6b0a9SMario Six		      mode or not); no parameters.
225*a1b6b0a9SMario Six       SEC_BOOT_DEV - The boot device from which the trusted boot is allowed to
226*a1b6b0a9SMario Six		      proceed, identified via a numeric ID. The tested values
227*a1b6b0a9SMario Six		      are 0x34 = NOR flash, 0x31 = SDIO/MMC card; for
228*a1b6b0a9SMario Six		      additional ID values, consult the documentation in [1].
229*a1b6b0a9SMario Six      SEC_FUSE_DUMP - Dump the "fuse prog" commands necessary for writing the
230*a1b6b0a9SMario Six		      correct eFuse values to a text file in the U-Boot root
231*a1b6b0a9SMario Six		      directory. The parameter is the architecture for which to
232*a1b6b0a9SMario Six		      dump the commands (currently only "a38x" is supported).
233*a1b6b0a9SMario Six
234*a1b6b0a9SMario SixThe parameter values may be hardcoded into the file, but it is also possible to
235*a1b6b0a9SMario Sixemploy a dynamic approach of creating a Autoconf-like kwbimage.cfg.in, then
236*a1b6b0a9SMario Sixreading configuration values from Kconfig options or from the board config
237*a1b6b0a9SMario Sixfile, and generating the actual kwbimage.cfg from this template using Makefile
238*a1b6b0a9SMario Sixmechanisms (see board/gdsys/a38x/Makefile as an example for this approach).
239*a1b6b0a9SMario Six
240*a1b6b0a9SMario Six### Set config options
241*a1b6b0a9SMario Six
242*a1b6b0a9SMario SixTo enable the generation of trusted boot images, the corresponding support
243*a1b6b0a9SMario Sixneeds to be activated, and a index for the active CSK needs to be selected as
244*a1b6b0a9SMario Sixwell.
245*a1b6b0a9SMario Six
246*a1b6b0a9SMario SixFurthermore, eFuse writing support has to be activated in order to burn the
247*a1b6b0a9SMario SixeFuse structure's values (this option is just needed for programming the eFuse
248*a1b6b0a9SMario Sixstructure; production boot images may disable it).
249*a1b6b0a9SMario Six
250*a1b6b0a9SMario SixARM architecture
251*a1b6b0a9SMario Six -> [*] Build image for trusted boot
252*a1b6b0a9SMario Six    (0)   Index of active CSK
253*a1b6b0a9SMario Six -> [*] Enable eFuse support
254*a1b6b0a9SMario Six    [ ]   Fake eFuse access (dry run)
255*a1b6b0a9SMario Six
256*a1b6b0a9SMario Six### Build and test boot image
257*a1b6b0a9SMario Six
258*a1b6b0a9SMario SixThe creation of the boot image is done via the usual invocation of make (with a
259*a1b6b0a9SMario Sixsuitably set CROSS_COMPILE environment variable, of course). The resulting boot
260*a1b6b0a9SMario Siximage u-boot-spl.kwb can then be tested, if so desired. The hdrparser from [5]
261*a1b6b0a9SMario Sixcan be used for this purpose. To build the tool, invoke make in the
262*a1b6b0a9SMario Six'tools/marvell/doimage_mv' directory of [5], which builds a stand-alone
263*a1b6b0a9SMario Sixhdrparser executable. A test can be conducted by calling hdrparser with the
264*a1b6b0a9SMario Sixproduced boot image and the following (mandatory) parameters:
265*a1b6b0a9SMario Six
266*a1b6b0a9SMario Six./hdrparser -k 0 -t u-boot-spl.kwb
267*a1b6b0a9SMario Six
268*a1b6b0a9SMario SixHere we assume that the CSK index is 0 and the boot image file resides in the
269*a1b6b0a9SMario Sixsame directory (adapt accordingly if needed). The tool should report that all
270*a1b6b0a9SMario Sixchecksums are valid ("GOOD"), that all signature verifications succeed
271*a1b6b0a9SMario Six("PASSED"), and, finally, that the overall test was successful
272*a1b6b0a9SMario Six("T E S T   S U C C E E D E D" in the last line of output).
273*a1b6b0a9SMario Six
274*a1b6b0a9SMario Six### Burn eFuse structure
275*a1b6b0a9SMario Six
276*a1b6b0a9SMario Six+----------------------------------------------------------+
277*a1b6b0a9SMario Six| WARNING: Burning the eFuse structure is a irreversible   |
278*a1b6b0a9SMario Six| operation! Should wrong or corrupted values be used, the |
279*a1b6b0a9SMario Six| board won't boot anymore, and recovery is likely         |
280*a1b6b0a9SMario Six| impossible!                                              |
281*a1b6b0a9SMario Six+----------------------------------------------------------+
282*a1b6b0a9SMario Six
283*a1b6b0a9SMario SixAfter the build process has finished, and the SEC_FUSE_DUMP option was set in
284*a1b6b0a9SMario Sixthe kwbimage.cfg was set, a text file kwb_fuses_a38x.txt should be present in
285*a1b6b0a9SMario Sixthe U-Boot top-level directory. It contains all the necessary commands to set
286*a1b6b0a9SMario Sixthe eFuse structure to the values needed for the used KAK digest, as well as
287*a1b6b0a9SMario Sixthe CSK index, Flash ID and Box ID that were selected in kwbimage.cfg.
288*a1b6b0a9SMario Six
289*a1b6b0a9SMario SixSequentially executing the commands in this file at the U-Boot command prompt
290*a1b6b0a9SMario Sixwill write these values to the eFuse structure.
291*a1b6b0a9SMario Six
292*a1b6b0a9SMario SixIf the SEC_FUSE_DUMP option was not set, the commands needed to burn the fuses
293*a1b6b0a9SMario Sixhave to be crafted by hand. The needed fuse lines can be looked up in [1]; a
294*a1b6b0a9SMario Sixrough overview of the process is:
295*a1b6b0a9SMario Six
296*a1b6b0a9SMario Six* Burn the KAK public key hash. The hash itself can be found in the file
297*a1b6b0a9SMario Six  pub_kak_hash.txt in the U-Boot top-level directory; be careful to account for
298*a1b6b0a9SMario Six  the endianness!
299*a1b6b0a9SMario Six* Burn the CSK selection, BoxID, and FlashID
300*a1b6b0a9SMario Six* Enable trusted boot by burning the corresponding fuse (WARNING: this must be
301*a1b6b0a9SMario Six  the last fuse line written!)
302*a1b6b0a9SMario Six* Lock the unused fuse lines
303*a1b6b0a9SMario Six
304*a1b6b0a9SMario SixThe command to employ is the "fuse prog" command previously enabled by setting
305*a1b6b0a9SMario Sixthe corresponding configuration option.
306*a1b6b0a9SMario Six
307*a1b6b0a9SMario SixFor the trusted boot, the fuse prog command has a special syntax, since the
308*a1b6b0a9SMario SixARMADA SoC demands that whole fuse lines (64 bit values) have to be written as
309*a1b6b0a9SMario Sixa whole. The fuse prog command itself allows lists of 32 bit words to be
310*a1b6b0a9SMario Sixwritten at a time, but this is translated to a series of single 32 bit write
311*a1b6b0a9SMario Sixoperations to the fuse line, where the individual 32 bit words are identified
312*a1b6b0a9SMario Sixby a "word" counter that is increased for each write.
313*a1b6b0a9SMario Six
314*a1b6b0a9SMario SixTo work around this restriction, we interpret each line to have three "words"
315*a1b6b0a9SMario Six(0-2): The first and second words are the values to be written to the fuse
316*a1b6b0a9SMario Sixline, and the third is a lock flag, which is supposed to lock the fuse line
317*a1b6b0a9SMario Sixwhen set to 1. Writes to the first and second words are memoized between
318*a1b6b0a9SMario Sixfunction calls, and the fuse line is only really written and locked (on writing
319*a1b6b0a9SMario Sixthe third word) if both words were previously set, so that "incomplete" writes
320*a1b6b0a9SMario Sixare prevented. An exception to this is a single write to the third word (index
321*a1b6b0a9SMario Six2) without previously writing neither the first nor the second word, which
322*a1b6b0a9SMario Sixlocks the fuse line without setting any value; this is needed to lock the
323*a1b6b0a9SMario Sixunused fuse lines.
324*a1b6b0a9SMario Six
325*a1b6b0a9SMario SixAs an example, to write the value 0011223344556677 to fuse line 10, we would
326*a1b6b0a9SMario Sixuse the following command:
327*a1b6b0a9SMario Six
328*a1b6b0a9SMario Sixfuse prog -y 10 0 00112233 44556677 1
329*a1b6b0a9SMario Six
330*a1b6b0a9SMario SixHere 10 is the fuse line number, 0 is the index of the first word to be
331*a1b6b0a9SMario Sixwritten, 00112233 and 44556677 are the values to be written to the fuse line
332*a1b6b0a9SMario Six(first and second word) and the trailing 1 is the value for the third word
333*a1b6b0a9SMario Sixresponsible for locking the line.
334*a1b6b0a9SMario Six
335*a1b6b0a9SMario SixA "lock-only" command would look like this:
336*a1b6b0a9SMario Six
337*a1b6b0a9SMario Sixfuse prog -y 11 2 1
338*a1b6b0a9SMario Six
339*a1b6b0a9SMario SixHere 11 is the fuse number, 2 is the index of the first word to be written
340*a1b6b0a9SMario Six(notice that we only write to word 2 here; the third word for fuse line
341*a1b6b0a9SMario Sixlocking), and the 1 is the value for the word we are writing to.
342*a1b6b0a9SMario Six
343*a1b6b0a9SMario SixWARNING: According to application note [4], the VHV pin of the SoC must be
344*a1b6b0a9SMario Sixconnected to a 1.8V source during eFuse programming, but *must* be disconnected
345*a1b6b0a9SMario Sixfor normal operation. The AN [4] describes a software-controlled circuit (based
346*a1b6b0a9SMario Sixon a N-channel or P-channel FET and a free GPIO pin of the SoC) to achieve
347*a1b6b0a9SMario Sixthis, but a jumper-based circuit should suffice as well. Regardless of the
348*a1b6b0a9SMario Sixchosen circuit, the issue needs to be addressed accordingly!
349*a1b6b0a9SMario Six
350*a1b6b0a9SMario Six7. Work to be done
351*a1b6b0a9SMario Six------------------
352*a1b6b0a9SMario Six
353*a1b6b0a9SMario Six* Add the ability to populate more than one CSK
354*a1b6b0a9SMario Six* Test secure debug
355*a1b6b0a9SMario Six* Test on Armada XP
356*a1b6b0a9SMario Six
357*a1b6b0a9SMario Six8. Bibliography
358*a1b6b0a9SMario Six---------------
359*a1b6b0a9SMario Six
360*a1b6b0a9SMario Six[1] ARMADA(R) 38x Family High-Performance Single/Dual CPU System on Chip
361*a1b6b0a9SMario Six    Functional Specification; MV-S109094-00, Rev. C; August 2, 2015,
362*a1b6b0a9SMario Six    Preliminary
363*a1b6b0a9SMario Six[2] AN-383: ARMADA(R) 38x Families Secure Boot Mode Support; MV-S302501-00
364*a1b6b0a9SMario Six    Rev.  A; March 11, 2015, Preliminary
365*a1b6b0a9SMario Six[3] Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography
366*a1b6b0a9SMario Six    Specifications Version 2.1; February 2003;
367*a1b6b0a9SMario Six    https://www.ietf.org/rfc/rfc3447.txt
368*a1b6b0a9SMario Six[4] AN-389: ARMADA(R) VHV Power; MV-S302545-00 Rev. B; January 28, 2016,
369*a1b6b0a9SMario Six    Released
370*a1b6b0a9SMario Six[5] Marvell Armada 38x U-Boot support; November 25, 2015;
371*a1b6b0a9SMario Six    https://github.com/MarvellEmbeddedProcessors/u-boot-marvell
372*a1b6b0a9SMario Six
373*a1b6b0a9SMario Six2017-01-05, Mario Six <mario.six@gdsys.cc>
374