blob: ae4305c99e4d4b6ad21e551213b533ce02697bc2 [file] [log] [blame]
Simon Glass7a61c6b2018-07-17 13:25:37 -06001Binman Entry Documentation
2===========================
3
4This file describes the entry types supported by binman. These entry types can
5be placed in an image one by one to build up a final firmware image. It is
6fairly easy to create new entry types. Just add a new file to the 'etype'
7directory. You can use the existing entries as examples.
8
9Note that some entries are subclasses of others, using and extending their
10features to produce new behaviours.
11
12
13
Simon Glass8911fa12021-03-18 20:25:16 +130014Entry: atf-bl31: ARM Trusted Firmware (ATF) BL31 blob
15-----------------------------------------------------
Simon Glass559c4de2020-09-01 05:13:58 -060016
17Properties / Entry arguments:
18 - atf-bl31-path: Filename of file to read into entry. This is typically
19 called bl31.bin or bl31.elf
20
21This entry holds the run-time firmware, typically started by U-Boot SPL.
22See the U-Boot README for your architecture or board for how to use it. See
23https://github.com/ARM-software/arm-trusted-firmware for more information
24about ATF.
25
26
27
Simon Glass3efb2972021-11-23 21:08:59 -070028Entry: atf-fip: ARM Trusted Firmware's Firmware Image Package (FIP)
29-------------------------------------------------------------------
30
31A FIP_ provides a way to group binaries in a firmware image, used by ARM's
32Trusted Firmware A (TF-A) code. It is a simple format consisting of a
33table of contents with information about the type, offset and size of the
34binaries in the FIP. It is quite similar to FMAP, with the major difference
35that it uses UUIDs to indicate the type of each entry.
36
37Note: It is recommended to always add an fdtmap to every image, as well as
38any FIPs so that binman and other tools can access the entire image
39correctly.
40
41The UUIDs correspond to useful names in `fiptool`, provided by ATF to
42operate on FIPs. Binman uses these names to make it easier to understand
43what is going on, although it is possible to provide a UUID if needed.
44
45The contents of the FIP are defined by subnodes of the atf-fip entry, e.g.::
46
47 atf-fip {
48 soc-fw {
49 filename = "bl31.bin";
50 };
51
52 scp-fwu-cfg {
53 filename = "bl2u.bin";
54 };
55
56 u-boot {
57 fip-type = "nt-fw";
58 };
59 };
60
61This describes a FIP with three entries: soc-fw, scp-fwu-cfg and nt-fw.
62You can use normal (non-external) binaries like U-Boot simply by adding a
63FIP type, with the `fip-type` property, as above.
64
65Since FIP exists to bring blobs together, Binman assumes that all FIP
66entries are external binaries. If a binary may not exist, you can use the
67`--allow-missing` flag to Binman, in which case the image is still created,
68even though it will not actually work.
69
70The size of the FIP depends on the size of the binaries. There is currently
71no way to specify a fixed size. If the `atf-fip` node has a `size` entry,
72this affects the space taken up by the `atf-fip` entry, but the FIP itself
73does not expand to use that space.
74
75Some other FIP features are available with Binman. The header and the
76entries have 64-bit flag works. The flag flags do not seem to be defined
77anywhere, but you can use `fip-hdr-flags` and fip-flags` to set the values
78of the header and entries respectively.
79
80FIP entries can be aligned to a particular power-of-two boundary. Use
81fip-align for this.
82
83Binman only understands the entry types that are included in its
84implementation. It is possible to specify a 16-byte UUID instead, using the
85fip-uuid property. In this case Binman doesn't know what its type is, so
86just uses the UUID. See the `u-boot` node in this example::
87
88 binman {
89 atf-fip {
90 fip-hdr-flags = /bits/ 64 <0x123>;
91 fip-align = <16>;
92 soc-fw {
93 fip-flags = /bits/ 64 <0x456>;
94 filename = "bl31.bin";
95 };
96
97 scp-fwu-cfg {
98 filename = "bl2u.bin";
99 };
100
101 u-boot {
102 fip-uuid = [fc 65 13 92 4a 5b 11 ec
103 94 35 ff 2d 1c fc 79 9c];
104 };
105 };
106 fdtmap {
107 };
108 };
109
110Binman allows reading and updating FIP entries after the image is created,
111provided that an FDPMAP is present too. Updates which change the size of a
112FIP entry will cause it to be expanded or contracted as needed.
113
114Properties for top-level atf-fip node
115~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116
117fip-hdr-flags (64 bits)
118 Sets the flags for the FIP header.
119
120Properties for subnodes
121~~~~~~~~~~~~~~~~~~~~~~~
122
123fip-type (str)
124 FIP type to use for this entry. This is needed if the entry
125 name is not a valid type. Value types are defined in `fip_util.py`.
126 The FIP type defines the UUID that is used (they map 1:1).
127
128fip-uuid (16 bytes)
129 If there is no FIP-type name defined, or it is not supported by Binman,
130 this property sets the UUID. It should be a 16-byte value, following the
131 hex digits of the UUID.
132
133fip-flags (64 bits)
134 Set the flags for a FIP entry. Use in one of the subnodes of the
135 7atf-fip entry.
136
137fip-align
138 Set the alignment for a FIP entry, FIP entries can be aligned to a
139 particular power-of-two boundary. The default is 1.
140
141Adding new FIP-entry types
142~~~~~~~~~~~~~~~~~~~~~~~~~~
143
144When new FIP entries are defined by TF-A they appear in the
145`TF-A source tree`_. You can use `fip_util.py` to update Binman to support
146new types, then `send a patch`_ to the U-Boot mailing list. There are two
147source files that the tool examples:
148
149- `include/tools_share/firmware_image_package.h` has the UUIDs
150- `tools/fiptool/tbbr_config.c` has the name and descripion for each UUID
151
152To run the tool::
153
154 $ tools/binman/fip_util.py -s /path/to/arm-trusted-firmware
155 Warning: UUID 'UUID_NON_TRUSTED_WORLD_KEY_CERT' is not mentioned in tbbr_config.c file
156 Existing code in 'tools/binman/fip_util.py' is up-to-date
157
158If it shows there is an update, it writes a new version of `fip_util.py`
159to `fip_util.py.out`. You can change the output file using the `-i` flag.
160If you have a problem, use `-D` to enable traceback debugging.
161
162FIP commentary
163~~~~~~~~~~~~~~
164
165As a side effect of use of UUIDs, FIP does not support multiple
166entries of the same type, such as might be used to store fonts or graphics
167icons, for example. For verified boot it could be used for each part of the
168image (e.g. separate FIPs for A and B) but cannot describe the whole
169firmware image. As with FMAP there is no hierarchy defined, although FMAP
170works around this by having 'section' areas which encompass others. A
171similar workaround would be possible with FIP but is not currently defined.
172
173It is recommended to always add an fdtmap to every image, as well as any
174FIPs so that binman and other tools can access the entire image correctly.
175
176.. _FIP: https://trustedfirmware-a.readthedocs.io/en/latest/design/firmware-design.html#firmware-image-package-fip
177.. _`TF-A source tree`: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
178.. _`send a patch`: https://www.denx.de/wiki/U-Boot/Patches
179
180
181
Simon Glass8911fa12021-03-18 20:25:16 +1300182Entry: blob: Arbitrary binary blob
183----------------------------------
Simon Glass7a61c6b2018-07-17 13:25:37 -0600184
185Note: This should not be used by itself. It is normally used as a parent
186class by other entry types.
187
188Properties / Entry arguments:
189 - filename: Filename of file to read into entry
Simon Glass7ba33592018-09-14 04:57:26 -0600190 - compress: Compression algorithm to use:
191 none: No compression
192 lz4: Use lz4 compression (via 'lz4' command-line utility)
Simon Glass7a61c6b2018-07-17 13:25:37 -0600193
194This entry reads data from a file and places it in the entry. The
195default filename is often specified specified by the subclass. See for
Simon Glass537e0062021-03-18 20:24:54 +1300196example the 'u-boot' entry which provides the filename 'u-boot.bin'.
Simon Glass7a61c6b2018-07-17 13:25:37 -0600197
Simon Glass7ba33592018-09-14 04:57:26 -0600198If compression is enabled, an extra 'uncomp-size' property is written to
199the node (if enabled with -u) which provides the uncompressed size of the
200data.
Simon Glass7a61c6b2018-07-17 13:25:37 -0600201
202
Simon Glass7a61c6b2018-07-17 13:25:37 -0600203
Simon Glasse219aa42018-09-14 04:57:24 -0600204Entry: blob-dtb: A blob that holds a device tree
205------------------------------------------------
206
207This is a blob containing a device tree. The contents of the blob are
208obtained from the list of available device-tree files, managed by the
209'state' module.
210
211
212
Simon Glass8911fa12021-03-18 20:25:16 +1300213Entry: blob-ext: Externally built binary blob
214---------------------------------------------
Simon Glass5e560182020-07-09 18:39:36 -0600215
216Note: This should not be used by itself. It is normally used as a parent
217class by other entry types.
218
Simon Glass5d94cc62020-07-09 18:39:38 -0600219If the file providing this blob is missing, binman can optionally ignore it
220and produce a broken image with a warning.
221
Simon Glass5e560182020-07-09 18:39:36 -0600222See 'blob' for Properties / Entry arguments.
223
224
225
Simon Glass0b00ae62021-11-23 21:09:52 -0700226Entry: blob-ext-list: List of externally built binary blobs
227-----------------------------------------------------------
228
229This is like blob-ext except that a number of blobs can be provided,
230typically with some sort of relationship, e.g. all are DDC parameters.
231
232If any of the external files needed by this llist is missing, binman can
233optionally ignore it and produce a broken image with a warning.
234
235Args:
236 filenames: List of filenames to read and include
237
238
239
Simon Glassdb168d42018-07-17 13:25:39 -0600240Entry: blob-named-by-arg: A blob entry which gets its filename property from its subclass
241-----------------------------------------------------------------------------------------
242
243Properties / Entry arguments:
244 - <xxx>-path: Filename containing the contents of this entry (optional,
Simon Glass21db0ff2020-09-01 05:13:54 -0600245 defaults to None)
Simon Glassdb168d42018-07-17 13:25:39 -0600246
247where <xxx> is the blob_fname argument to the constructor.
248
249This entry cannot be used directly. Instead, it is used as a parent class
250for another entry, which defined blob_fname. This parameter is used to
251set the entry-arg or property containing the filename. The entry-arg or
252property is in turn used to set the actual filename.
253
254See cros_ec_rw for an example of this.
255
256
257
Simon Glass718b5292021-03-18 20:25:07 +1300258Entry: blob-phase: Section that holds a phase binary
259----------------------------------------------------
260
261This is a base class that should not normally be used directly. It is used
262when converting a 'u-boot' entry automatically into a 'u-boot-expanded'
263entry; similarly for SPL.
264
265
266
Simon Glass8911fa12021-03-18 20:25:16 +1300267Entry: cbfs: Coreboot Filesystem (CBFS)
268---------------------------------------
Simon Glass1de34482019-07-08 13:18:53 -0600269
270A CBFS provides a way to group files into a group. It has a simple directory
271structure and allows the position of individual files to be set, since it is
272designed to support execute-in-place in an x86 SPI-flash device. Where XIP
273is not used, it supports compression and storing ELF files.
274
275CBFS is used by coreboot as its way of orgnanising SPI-flash contents.
276
Simon Glass0ac96b62021-03-18 20:25:15 +1300277The contents of the CBFS are defined by subnodes of the cbfs entry, e.g.::
Simon Glass1de34482019-07-08 13:18:53 -0600278
279 cbfs {
280 size = <0x100000>;
281 u-boot {
282 cbfs-type = "raw";
283 };
284 u-boot-dtb {
285 cbfs-type = "raw";
286 };
287 };
288
289This creates a CBFS 1MB in size two files in it: u-boot.bin and u-boot.dtb.
290Note that the size is required since binman does not support calculating it.
291The contents of each entry is just what binman would normally provide if it
292were not a CBFS node. A blob type can be used to import arbitrary files as
Simon Glass0ac96b62021-03-18 20:25:15 +1300293with the second subnode below::
Simon Glass1de34482019-07-08 13:18:53 -0600294
295 cbfs {
296 size = <0x100000>;
297 u-boot {
298 cbfs-name = "BOOT";
299 cbfs-type = "raw";
300 };
301
302 dtb {
303 type = "blob";
304 filename = "u-boot.dtb";
305 cbfs-type = "raw";
306 cbfs-compress = "lz4";
Simon Glassc2f1aed2019-07-08 13:18:56 -0600307 cbfs-offset = <0x100000>;
Simon Glass1de34482019-07-08 13:18:53 -0600308 };
309 };
310
311This creates a CBFS 1MB in size with u-boot.bin (named "BOOT") and
312u-boot.dtb (named "dtb") and compressed with the lz4 algorithm.
313
314
315Properties supported in the top-level CBFS node:
316
317cbfs-arch:
318 Defaults to "x86", but you can specify the architecture if needed.
319
320
321Properties supported in the CBFS entry subnodes:
322
323cbfs-name:
324 This is the name of the file created in CBFS. It defaults to the entry
325 name (which is the node name), but you can override it with this
326 property.
327
328cbfs-type:
329 This is the CBFS file type. The following are supported:
330
331 raw:
332 This is a 'raw' file, although compression is supported. It can be
333 used to store any file in CBFS.
334
335 stage:
336 This is an ELF file that has been loaded (i.e. mapped to memory), so
337 appears in the CBFS as a flat binary. The input file must be an ELF
338 image, for example this puts "u-boot" (the ELF image) into a 'stage'
Simon Glass0ac96b62021-03-18 20:25:15 +1300339 entry::
Simon Glass1de34482019-07-08 13:18:53 -0600340
341 cbfs {
342 size = <0x100000>;
343 u-boot-elf {
344 cbfs-name = "BOOT";
345 cbfs-type = "stage";
346 };
347 };
348
Simon Glass0ac96b62021-03-18 20:25:15 +1300349 You can use your own ELF file with something like::
Simon Glass1de34482019-07-08 13:18:53 -0600350
351 cbfs {
352 size = <0x100000>;
353 something {
354 type = "blob";
355 filename = "cbfs-stage.elf";
356 cbfs-type = "stage";
357 };
358 };
359
360 As mentioned, the file is converted to a flat binary, so it is
361 equivalent to adding "u-boot.bin", for example, but with the load and
362 start addresses specified by the ELF. At present there is no option
363 to add a flat binary with a load/start address, similar to the
364 'add-flat-binary' option in cbfstool.
365
Simon Glassc2f1aed2019-07-08 13:18:56 -0600366cbfs-offset:
367 This is the offset of the file's data within the CBFS. It is used to
368 specify where the file should be placed in cases where a fixed position
369 is needed. Typical uses are for code which is not relocatable and must
370 execute in-place from a particular address. This works because SPI flash
371 is generally mapped into memory on x86 devices. The file header is
372 placed before this offset so that the data start lines up exactly with
373 the chosen offset. If this property is not provided, then the file is
374 placed in the next available spot.
Simon Glass1de34482019-07-08 13:18:53 -0600375
376The current implementation supports only a subset of CBFS features. It does
377not support other file types (e.g. payload), adding multiple files (like the
378'files' entry with a pattern supported by binman), putting files at a
379particular offset in the CBFS and a few other things.
380
381Of course binman can create images containing multiple CBFSs, simply by
Simon Glass0ac96b62021-03-18 20:25:15 +1300382defining these in the binman config::
Simon Glass1de34482019-07-08 13:18:53 -0600383
384
385 binman {
386 size = <0x800000>;
387 cbfs {
388 offset = <0x100000>;
389 size = <0x100000>;
390 u-boot {
391 cbfs-type = "raw";
392 };
393 u-boot-dtb {
394 cbfs-type = "raw";
395 };
396 };
397
398 cbfs2 {
399 offset = <0x700000>;
400 size = <0x100000>;
401 u-boot {
402 cbfs-type = "raw";
403 };
404 u-boot-dtb {
405 cbfs-type = "raw";
406 };
407 image {
408 type = "blob";
409 filename = "image.jpg";
410 };
411 };
412 };
413
414This creates an 8MB image with two CBFSs, one at offset 1MB, one at 7MB,
415both of size 1MB.
416
417
418
Simon Glasse1915782021-03-21 18:24:31 +1300419Entry: collection: An entry which contains a collection of other entries
420------------------------------------------------------------------------
421
422Properties / Entry arguments:
423 - content: List of phandles to entries to include
424
425This allows reusing the contents of other entries. The contents of the
426listed entries are combined to form this entry. This serves as a useful
427base class for entry types which need to process data from elsewhere in
428the image, not necessarily child entries.
429
430
431
Simon Glassdb168d42018-07-17 13:25:39 -0600432Entry: cros-ec-rw: A blob entry which contains a Chromium OS read-write EC image
433--------------------------------------------------------------------------------
434
435Properties / Entry arguments:
436 - cros-ec-rw-path: Filename containing the EC image
437
438This entry holds a Chromium OS EC (embedded controller) image, for use in
439updating the EC on startup via software sync.
440
441
442
Simon Glass0f621332019-07-08 14:25:27 -0600443Entry: fdtmap: An entry which contains an FDT map
444-------------------------------------------------
445
446Properties / Entry arguments:
447 None
448
449An FDT map is just a header followed by an FDT containing a list of all the
Simon Glassfb30e292019-07-20 12:23:51 -0600450entries in the image. The root node corresponds to the image node in the
451original FDT, and an image-name property indicates the image name in that
452original tree.
Simon Glass0f621332019-07-08 14:25:27 -0600453
454The header is the string _FDTMAP_ followed by 8 unused bytes.
455
456When used, this entry will be populated with an FDT map which reflects the
457entries in the current image. Hierarchy is preserved, and all offsets and
458sizes are included.
459
460Note that the -u option must be provided to ensure that binman updates the
461FDT with the position of each entry.
462
Simon Glass0ac96b62021-03-18 20:25:15 +1300463Example output for a simple image with U-Boot and an FDT map::
Simon Glass0f621332019-07-08 14:25:27 -0600464
Simon Glass0ac96b62021-03-18 20:25:15 +1300465 / {
466 image-name = "binman";
467 size = <0x00000112>;
Simon Glass0f621332019-07-08 14:25:27 -0600468 image-pos = <0x00000000>;
469 offset = <0x00000000>;
Simon Glass0ac96b62021-03-18 20:25:15 +1300470 u-boot {
471 size = <0x00000004>;
472 image-pos = <0x00000000>;
473 offset = <0x00000000>;
474 };
475 fdtmap {
476 size = <0x0000010e>;
477 image-pos = <0x00000004>;
478 offset = <0x00000004>;
479 };
Simon Glass0f621332019-07-08 14:25:27 -0600480 };
Simon Glass0f621332019-07-08 14:25:27 -0600481
Simon Glassfb30e292019-07-20 12:23:51 -0600482If allow-repack is used then 'orig-offset' and 'orig-size' properties are
483added as necessary. See the binman README.
484
Simon Glass637958f2021-11-23 21:09:50 -0700485When extracting files, an alternative 'fdt' format is available for fdtmaps.
486Use `binman extract -F fdt ...` to use this. It will export a devicetree,
487without the fdtmap header, so it can be viewed with `fdtdump`.
Simon Glass0f621332019-07-08 14:25:27 -0600488
489
Simon Glass637958f2021-11-23 21:09:50 -0700490
Simon Glass8911fa12021-03-18 20:25:16 +1300491Entry: files: A set of files arranged in a section
492--------------------------------------------------
Simon Glassac6328c2018-09-14 04:57:28 -0600493
494Properties / Entry arguments:
495 - pattern: Filename pattern to match the files to include
Simon Glass51d02ad2020-10-26 17:40:07 -0600496 - files-compress: Compression algorithm to use:
Simon Glassac6328c2018-09-14 04:57:28 -0600497 none: No compression
498 lz4: Use lz4 compression (via 'lz4' command-line utility)
Simon Glass3f093a32021-03-18 20:24:53 +1300499 - files-align: Align each file to the given alignment
Simon Glassac6328c2018-09-14 04:57:28 -0600500
501This entry reads a number of files and places each in a separate sub-entry
502within this entry. To access these you need to enable device-tree updates
503at run-time so you can obtain the file positions.
Simon Glass7a61c6b2018-07-17 13:25:37 -0600504
505
Simon Glassac6328c2018-09-14 04:57:28 -0600506
Simon Glass53f53992018-07-17 13:25:40 -0600507Entry: fill: An entry which is filled to a particular byte value
508----------------------------------------------------------------
509
510Properties / Entry arguments:
511 - fill-byte: Byte to use to fill the entry
512
513Note that the size property must be set since otherwise this entry does not
514know how large it should be.
515
516You can often achieve the same effect using the pad-byte property of the
517overall image, in that the space between entries will then be padded with
518that byte. But this entry is sometimes useful for explicitly setting the
519byte value of a region.
520
521
Simon Glassc7b010d2020-07-09 18:39:45 -0600522
Simon Glass8911fa12021-03-18 20:25:16 +1300523Entry: fit: Flat Image Tree (FIT)
524---------------------------------
Simon Glass45d556d2020-07-09 18:39:45 -0600525
526This calls mkimage to create a FIT (U-Boot Flat Image Tree) based on the
527input provided.
528
529Nodes for the FIT should be written out in the binman configuration just as
530they would be in a file passed to mkimage.
531
Simon Glass0ac96b62021-03-18 20:25:15 +1300532For example, this creates an image containing a FIT with U-Boot SPL::
Simon Glass45d556d2020-07-09 18:39:45 -0600533
534 binman {
535 fit {
536 description = "Test FIT";
Simon Glassa435cd12020-09-01 05:13:59 -0600537 fit,fdt-list = "of-list";
Simon Glass45d556d2020-07-09 18:39:45 -0600538
539 images {
540 kernel@1 {
541 description = "SPL";
542 os = "u-boot";
543 type = "rkspi";
544 arch = "arm";
545 compression = "none";
546 load = <0>;
547 entry = <0>;
548
549 u-boot-spl {
550 };
551 };
552 };
553 };
554 };
555
Simon Glass912339f2022-02-08 11:50:03 -0700556More complex setups can be created, with generated nodes, as described
557below.
558
559Properties (in the 'fit' node itself)
560~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
561
562Special properties have a `fit,` prefix, indicating that they should be
563processed but not included in the final FIT.
564
565The top-level 'fit' node supports the following special properties:
566
567 fit,external-offset
568 Indicates that the contents of the FIT are external and provides the
569 external offset. This is passed to mkimage via the -E and -p flags.
570
571 fit,fdt-list
572 Indicates the entry argument which provides the list of device tree
573 files for the gen-fdt-nodes operation (as below). This is often
574 `of-list` meaning that `-a of-list="dtb1 dtb2..."` should be passed
575 to binman.
576
577Substitutions
578~~~~~~~~~~~~~
579
580Node names and property values support a basic string-substitution feature.
581Available substitutions for '@' nodes (and property values) are:
582
583SEQ:
584 Sequence number of the generated fdt (1, 2, ...)
585NAME
586 Name of the dtb as provided (i.e. without adding '.dtb')
587
588The `default` property, if present, will be automatically set to the name
589if of configuration whose devicetree matches the `default-dt` entry
590argument, e.g. with `-a default-dt=sun50i-a64-pine64-lts`.
591
592Available substitutions for property values in these nodes are:
593
594DEFAULT-SEQ:
595 Sequence number of the default fdt, as provided by the 'default-dt'
596 entry argument
597
598Available operations
599~~~~~~~~~~~~~~~~~~~~
600
601You can add an operation to an '@' node to indicate which operation is
602required::
603
604 @fdt-SEQ {
605 fit,operation = "gen-fdt-nodes";
606 ...
607 };
608
609Available operations are:
610
611gen-fdt-nodes
612 Generate FDT nodes as above. This is the default if there is no
613 `fit,operation` property.
614
Simon Glass5f423422022-03-05 20:19:12 -0700615split-elf
616 Split an ELF file into a separate node for each segment.
617
Simon Glass912339f2022-02-08 11:50:03 -0700618Generating nodes from an FDT list (gen-fdt-nodes)
619~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
620
Simon Glassa435cd12020-09-01 05:13:59 -0600621U-Boot supports creating fdt and config nodes automatically. To do this,
Simon Glass9f1c6b92022-02-08 11:50:02 -0700622pass an `of-list` property (e.g. `-a of-list=file1 file2`). This tells
623binman that you want to generates nodes for two files: `file1.dtb` and
624`file2.dtb`. The `fit,fdt-list` property (see above) indicates that
625`of-list` should be used. If the property is missing you will get an error.
Simon Glassa435cd12020-09-01 05:13:59 -0600626
Simon Glass0ac96b62021-03-18 20:25:15 +1300627Then add a 'generator node', a node with a name starting with '@'::
Simon Glassa435cd12020-09-01 05:13:59 -0600628
629 images {
630 @fdt-SEQ {
631 description = "fdt-NAME";
632 type = "flat_dt";
633 compression = "none";
634 };
635 };
636
Simon Glass9f1c6b92022-02-08 11:50:02 -0700637This tells binman to create nodes `fdt-1` and `fdt-2` for each of your two
Simon Glassa435cd12020-09-01 05:13:59 -0600638files. All the properties you specify will be included in the node. This
639node acts like a template to generate the nodes. The generator node itself
640does not appear in the output - it is replaced with what binman generates.
Simon Glass9f1c6b92022-02-08 11:50:02 -0700641A 'data' property is created with the contents of the FDT file.
Simon Glassa435cd12020-09-01 05:13:59 -0600642
Simon Glass0ac96b62021-03-18 20:25:15 +1300643You can create config nodes in a similar way::
Simon Glassa435cd12020-09-01 05:13:59 -0600644
645 configurations {
646 default = "@config-DEFAULT-SEQ";
647 @config-SEQ {
648 description = "NAME";
Samuel Holland91079ac2020-10-21 21:12:14 -0500649 firmware = "atf";
650 loadables = "uboot";
Simon Glassa435cd12020-09-01 05:13:59 -0600651 fdt = "fdt-SEQ";
652 };
653 };
654
Simon Glass9f1c6b92022-02-08 11:50:02 -0700655This tells binman to create nodes `config-1` and `config-2`, i.e. a config
656for each of your two files.
Simon Glassa435cd12020-09-01 05:13:59 -0600657
Simon Glassa435cd12020-09-01 05:13:59 -0600658Note that if no devicetree files are provided (with '-a of-list' as above)
659then no nodes will be generated.
660
Simon Glass5f423422022-03-05 20:19:12 -0700661Generating nodes from an ELF file (split-elf)
662~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
663
664This uses the node as a template to generate multiple nodes. The following
665special properties are available:
666
667split-elf
668 Split an ELF file into a separate node for each segment. This uses the
669 node as a template to generate multiple nodes. The following special
670 properties are available:
671
672 fit,load
673 Generates a `load = <...>` property with the load address of the
674 segment
675
676 fit,entry
677 Generates a `entry = <...>` property with the entry address of the
678 ELF. This is only produced for the first entry
679
680 fit,data
681 Generates a `data = <...>` property with the contents of the segment
682
683 fit,loadables
684 Generates a `loadable = <...>` property with a list of the generated
685 nodes (including all nodes if this operation is used multiple times)
686
687
688Here is an example showing ATF, TEE and a device tree all combined::
689
690 fit {
691 description = "test-desc";
692 #address-cells = <1>;
693 fit,fdt-list = "of-list";
694
695 images {
696 u-boot {
697 description = "U-Boot (64-bit)";
698 type = "standalone";
699 os = "U-Boot";
700 arch = "arm64";
701 compression = "none";
702 load = <CONFIG_SYS_TEXT_BASE>;
703 u-boot-nodtb {
704 };
705 };
706 @fdt-SEQ {
707 description = "fdt-NAME.dtb";
708 type = "flat_dt";
709 compression = "none";
710 };
711 @atf-SEQ {
712 fit,operation = "split-elf";
713 description = "ARM Trusted Firmware";
714 type = "firmware";
715 arch = "arm64";
716 os = "arm-trusted-firmware";
717 compression = "none";
718 fit,load;
719 fit,entry;
720 fit,data;
721
722 atf-bl31 {
723 };
724 };
725
726 @tee-SEQ {
727 fit,operation = "split-elf";
728 description = "TEE";
729 type = "tee";
730 arch = "arm64";
731 os = "tee";
732 compression = "none";
733 fit,load;
734 fit,entry;
735 fit,data;
736
737 tee-os {
738 };
739 };
740 };
741
742 configurations {
743 default = "@config-DEFAULT-SEQ";
744 @config-SEQ {
745 description = "conf-NAME.dtb";
746 fdt = "fdt-SEQ";
747 firmware = "u-boot";
748 fit,loadables;
749 };
750 };
751 };
752
753If ATF-BL31 is available, this generates a node for each segment in the
754ELF file, for example::
755
756 images {
757 atf-1 {
758 data = <...contents of first segment...>;
759 data-offset = <0x00000000>;
760 entry = <0x00040000>;
761 load = <0x00040000>;
762 compression = "none";
763 os = "arm-trusted-firmware";
764 arch = "arm64";
765 type = "firmware";
766 description = "ARM Trusted Firmware";
767 };
768 atf-2 {
769 data = <...contents of second segment...>;
770 load = <0xff3b0000>;
771 compression = "none";
772 os = "arm-trusted-firmware";
773 arch = "arm64";
774 type = "firmware";
775 description = "ARM Trusted Firmware";
776 };
777 };
778
779The same applies for OP-TEE if that is available.
780
781If each binary is not available, the relevant template node (@atf-SEQ or
782@tee-SEQ) is removed from the output.
783
784This also generates a `config-xxx` node for each device tree in `of-list`.
785Note that the U-Boot build system uses `-a of-list=$(CONFIG_OF_LIST)`
786so you can use `CONFIG_OF_LIST` to define that list. In this example it is
787set up for `firefly-rk3399` with a single device tree and the default set
788with `-a default-dt=$(CONFIG_DEFAULT_DEVICE_TREE)`, so the resulting output
789is::
790
791 configurations {
792 default = "config-1";
793 config-1 {
794 loadables = "atf-1", "atf-2", "atf-3", "tee-1", "tee-2";
795 description = "rk3399-firefly.dtb";
796 fdt = "fdt-1";
797 firmware = "u-boot";
798 };
799 };
800
801U-Boot SPL can then load the firmware (U-Boot proper) and all the loadables
802(ATF and TEE), then proceed with the boot.
803
Simon Glass45d556d2020-07-09 18:39:45 -0600804
805
Simon Glass7a61c6b2018-07-17 13:25:37 -0600806Entry: fmap: An entry which contains an Fmap section
807----------------------------------------------------
808
809Properties / Entry arguments:
810 None
811
812FMAP is a simple format used by flashrom, an open-source utility for
813reading and writing the SPI flash, typically on x86 CPUs. The format
814provides flashrom with a list of areas, so it knows what it in the flash.
815It can then read or write just a single area, instead of the whole flash.
816
817The format is defined by the flashrom project, in the file lib/fmap.h -
818see www.flashrom.org/Flashrom for more information.
819
820When used, this entry will be populated with an FMAP which reflects the
821entries in the current image. Note that any hierarchy is squashed, since
Simon Glassb1d414c2021-04-03 11:05:10 +1300822FMAP does not support this. Sections are represented as an area appearing
823before its contents, so that it is possible to reconstruct the hierarchy
824from the FMAP by using the offset information. This convention does not
825seem to be documented, but is used in Chromium OS.
Simon Glass7a61c6b2018-07-17 13:25:37 -0600826
Simon Glassb1d414c2021-04-03 11:05:10 +1300827CBFS entries appear as a single entry, i.e. the sub-entries are ignored.
Simon Glass7a61c6b2018-07-17 13:25:37 -0600828
829
Simon Glassb1d414c2021-04-03 11:05:10 +1300830
Simon Glassc1ae83c2018-07-17 13:25:44 -0600831Entry: gbb: An entry which contains a Chromium OS Google Binary Block
832---------------------------------------------------------------------
833
834Properties / Entry arguments:
835 - hardware-id: Hardware ID to use for this build (a string)
836 - keydir: Directory containing the public keys to use
837 - bmpblk: Filename containing images used by recovery
838
839Chromium OS uses a GBB to store various pieces of information, in particular
840the root and recovery keys that are used to verify the boot process. Some
841more details are here:
842
843 https://www.chromium.org/chromium-os/firmware-porting-guide/2-concepts
844
845but note that the page dates from 2013 so is quite out of date. See
846README.chromium for how to obtain the required keys and tools.
847
848
849
Simon Glasscec34ba2019-07-08 14:25:28 -0600850Entry: image-header: An entry which contains a pointer to the FDT map
851---------------------------------------------------------------------
852
853Properties / Entry arguments:
854 location: Location of header ("start" or "end" of image). This is
855 optional. If omitted then the entry must have an offset property.
856
857This adds an 8-byte entry to the start or end of the image, pointing to the
858location of the FDT map. The format is a magic number followed by an offset
859from the start or end of the image, in twos-compliment format.
860
861This entry must be in the top-level part of the image.
862
863NOTE: If the location is at the start/end, you will probably need to specify
864sort-by-offset for the image, unless you actually put the image header
865first/last in the entry list.
866
867
868
Simon Glass8911fa12021-03-18 20:25:16 +1300869Entry: intel-cmc: Intel Chipset Micro Code (CMC) file
870-----------------------------------------------------
Simon Glass7a61c6b2018-07-17 13:25:37 -0600871
872Properties / Entry arguments:
873 - filename: Filename of file to read into entry
874
875This file contains microcode for some devices in a special format. An
876example filename is 'Microcode/C0_22211.BIN'.
877
878See README.x86 for information about x86 binary blobs.
879
880
881
882Entry: intel-descriptor: Intel flash descriptor block (4KB)
883-----------------------------------------------------------
884
885Properties / Entry arguments:
886 filename: Filename of file containing the descriptor. This is typically
887 a 4KB binary file, sometimes called 'descriptor.bin'
888
889This entry is placed at the start of flash and provides information about
890the SPI flash regions. In particular it provides the base address and
891size of the ME (Management Engine) region, allowing us to place the ME
892binary in the right place.
893
894With this entry in your image, the position of the 'intel-me' entry will be
895fixed in the image, which avoids you needed to specify an offset for that
896region. This is useful, because it is not possible to change the position
897of the ME region without updating the descriptor.
898
899See README.x86 for information about x86 binary blobs.
900
901
902
Simon Glass232f90c2019-08-24 07:22:50 -0600903Entry: intel-fit: Intel Firmware Image Table (FIT)
904--------------------------------------------------
905
906This entry contains a dummy FIT as required by recent Intel CPUs. The FIT
907contains information about the firmware and microcode available in the
908image.
909
910At present binman only supports a basic FIT with no microcode.
911
912
913
914Entry: intel-fit-ptr: Intel Firmware Image Table (FIT) pointer
915--------------------------------------------------------------
916
917This entry contains a pointer to the FIT. It is required to be at address
9180xffffffc0 in the image.
919
920
921
Simon Glass8911fa12021-03-18 20:25:16 +1300922Entry: intel-fsp: Intel Firmware Support Package (FSP) file
923-----------------------------------------------------------
Simon Glass7a61c6b2018-07-17 13:25:37 -0600924
925Properties / Entry arguments:
926 - filename: Filename of file to read into entry
927
928This file contains binary blobs which are used on some devices to make the
929platform work. U-Boot executes this code since it is not possible to set up
930the hardware using U-Boot open-source code. Documentation is typically not
931available in sufficient detail to allow this.
932
933An example filename is 'FSP/QUEENSBAY_FSP_GOLD_001_20-DECEMBER-2013.fd'
934
935See README.x86 for information about x86 binary blobs.
936
937
938
Simon Glass8911fa12021-03-18 20:25:16 +1300939Entry: intel-fsp-m: Intel Firmware Support Package (FSP) memory init
940--------------------------------------------------------------------
Simon Glassba7985d2019-08-24 07:23:07 -0600941
942Properties / Entry arguments:
943 - filename: Filename of file to read into entry
944
945This file contains a binary blob which is used on some devices to set up
946SDRAM. U-Boot executes this code in SPL so that it can make full use of
947memory. Documentation is typically not available in sufficient detail to
948allow U-Boot do this this itself..
949
950An example filename is 'fsp_m.bin'
951
952See README.x86 for information about x86 binary blobs.
953
954
955
Simon Glass8911fa12021-03-18 20:25:16 +1300956Entry: intel-fsp-s: Intel Firmware Support Package (FSP) silicon init
957---------------------------------------------------------------------
Simon Glass4d9086d2019-10-20 21:31:35 -0600958
959Properties / Entry arguments:
960 - filename: Filename of file to read into entry
961
962This file contains a binary blob which is used on some devices to set up
963the silicon. U-Boot executes this code in U-Boot proper after SDRAM is
964running, so that it can make full use of memory. Documentation is typically
965not available in sufficient detail to allow U-Boot do this this itself.
966
967An example filename is 'fsp_s.bin'
968
969See README.x86 for information about x86 binary blobs.
970
971
972
Simon Glass8911fa12021-03-18 20:25:16 +1300973Entry: intel-fsp-t: Intel Firmware Support Package (FSP) temp ram init
974----------------------------------------------------------------------
Simon Glass9ea87b22019-10-20 21:31:36 -0600975
976Properties / Entry arguments:
977 - filename: Filename of file to read into entry
978
979This file contains a binary blob which is used on some devices to set up
980temporary memory (Cache-as-RAM or CAR). U-Boot executes this code in TPL so
981that it has access to memory for its stack and initial storage.
982
983An example filename is 'fsp_t.bin'
984
985See README.x86 for information about x86 binary blobs.
986
987
988
Simon Glass8911fa12021-03-18 20:25:16 +1300989Entry: intel-ifwi: Intel Integrated Firmware Image (IFWI) file
990--------------------------------------------------------------
Simon Glassc2f1aed2019-07-08 13:18:56 -0600991
992Properties / Entry arguments:
993 - filename: Filename of file to read into entry. This is either the
994 IFWI file itself, or a file that can be converted into one using a
995 tool
996 - convert-fit: If present this indicates that the ifwitool should be
997 used to convert the provided file into a IFWI.
998
999This file contains code and data used by the SoC that is required to make
1000it work. It includes U-Boot TPL, microcode, things related to the CSE
1001(Converged Security Engine, the microcontroller that loads all the firmware)
1002and other items beyond the wit of man.
1003
1004A typical filename is 'ifwi.bin' for an IFWI file, or 'fitimage.bin' for a
1005file that will be converted to an IFWI.
1006
1007The position of this entry is generally set by the intel-descriptor entry.
1008
1009The contents of the IFWI are specified by the subnodes of the IFWI node.
1010Each subnode describes an entry which is placed into the IFWFI with a given
1011sub-partition (and optional entry name).
1012
Simon Glass8a5e2492019-08-24 07:22:47 -06001013Properties for subnodes:
Simon Glass0ac96b62021-03-18 20:25:15 +13001014 - ifwi-subpart: sub-parition to put this entry into, e.g. "IBBP"
1015 - ifwi-entry: entry name t use, e.g. "IBBL"
1016 - ifwi-replace: if present, indicates that the item should be replaced
1017 in the IFWI. Otherwise it is added.
Simon Glass8a5e2492019-08-24 07:22:47 -06001018
Simon Glassc2f1aed2019-07-08 13:18:56 -06001019See README.x86 for information about x86 binary blobs.
1020
1021
1022
Simon Glass8911fa12021-03-18 20:25:16 +13001023Entry: intel-me: Intel Management Engine (ME) file
1024--------------------------------------------------
Simon Glass7a61c6b2018-07-17 13:25:37 -06001025
1026Properties / Entry arguments:
1027 - filename: Filename of file to read into entry
1028
1029This file contains code used by the SoC that is required to make it work.
1030The Management Engine is like a background task that runs things that are
Thomas Hebbfd37f242019-11-13 18:18:03 -08001031not clearly documented, but may include keyboard, display and network
Simon Glass7a61c6b2018-07-17 13:25:37 -06001032access. For platform that use ME it is not possible to disable it. U-Boot
1033does not directly execute code in the ME binary.
1034
1035A typical filename is 'me.bin'.
1036
Simon Glassc4056b82019-07-08 13:18:38 -06001037The position of this entry is generally set by the intel-descriptor entry.
1038
Simon Glass7a61c6b2018-07-17 13:25:37 -06001039See README.x86 for information about x86 binary blobs.
1040
1041
1042
Simon Glass8911fa12021-03-18 20:25:16 +13001043Entry: intel-mrc: Intel Memory Reference Code (MRC) file
1044--------------------------------------------------------
Simon Glass7a61c6b2018-07-17 13:25:37 -06001045
1046Properties / Entry arguments:
1047 - filename: Filename of file to read into entry
1048
1049This file contains code for setting up the SDRAM on some Intel systems. This
1050is executed by U-Boot when needed early during startup. A typical filename
1051is 'mrc.bin'.
1052
1053See README.x86 for information about x86 binary blobs.
1054
1055
1056
Simon Glass8911fa12021-03-18 20:25:16 +13001057Entry: intel-refcode: Intel Reference Code file
1058-----------------------------------------------
Simon Glass17b84eb2019-05-17 22:00:53 -06001059
1060Properties / Entry arguments:
1061 - filename: Filename of file to read into entry
1062
1063This file contains code for setting up the platform on some Intel systems.
1064This is executed by U-Boot when needed early during startup. A typical
1065filename is 'refcode.bin'.
1066
1067See README.x86 for information about x86 binary blobs.
1068
1069
1070
Simon Glass8911fa12021-03-18 20:25:16 +13001071Entry: intel-vbt: Intel Video BIOS Table (VBT) file
1072---------------------------------------------------
Simon Glass7a61c6b2018-07-17 13:25:37 -06001073
1074Properties / Entry arguments:
1075 - filename: Filename of file to read into entry
1076
1077This file contains code that sets up the integrated graphics subsystem on
1078some Intel SoCs. U-Boot executes this when the display is started up.
1079
1080See README.x86 for information about Intel binary blobs.
1081
1082
1083
Simon Glass8911fa12021-03-18 20:25:16 +13001084Entry: intel-vga: Intel Video Graphics Adaptor (VGA) file
1085---------------------------------------------------------
Simon Glass7a61c6b2018-07-17 13:25:37 -06001086
1087Properties / Entry arguments:
1088 - filename: Filename of file to read into entry
1089
1090This file contains code that sets up the integrated graphics subsystem on
1091some Intel SoCs. U-Boot executes this when the display is started up.
1092
1093This is similar to the VBT file but in a different format.
1094
1095See README.x86 for information about Intel binary blobs.
1096
1097
1098
Simon Glass8911fa12021-03-18 20:25:16 +13001099Entry: mkimage: Binary produced by mkimage
1100------------------------------------------
Simon Glass48f3aad2020-07-09 18:39:31 -06001101
1102Properties / Entry arguments:
1103 - datafile: Filename for -d argument
1104 - args: Other arguments to pass
1105
1106The data passed to mkimage is collected from subnodes of the mkimage node,
Simon Glass0ac96b62021-03-18 20:25:15 +13001107e.g.::
Simon Glass48f3aad2020-07-09 18:39:31 -06001108
1109 mkimage {
1110 args = "-n test -T imximage";
1111
1112 u-boot-spl {
1113 };
1114 };
1115
1116This calls mkimage to create an imximage with u-boot-spl.bin as the input
1117file. The output from mkimage then becomes part of the image produced by
1118binman.
1119
Simon Glass948dd3a2022-02-08 11:49:58 -07001120To use CONFIG options in the arguments, use a string list instead, as in
1121this example which also produces four arguments::
1122
1123 mkimage {
1124 args = "-n", CONFIG_SYS_SOC, "-T imximage";
1125
1126 u-boot-spl {
1127 };
1128 };
1129
1130
Simon Glass48f3aad2020-07-09 18:39:31 -06001131
1132
Bin Mengc0b15742021-05-10 20:23:33 +08001133Entry: opensbi: RISC-V OpenSBI fw_dynamic blob
1134----------------------------------------------
1135
1136Properties / Entry arguments:
1137 - opensbi-path: Filename of file to read into entry. This is typically
1138 called fw_dynamic.bin
1139
1140This entry holds the run-time firmware, typically started by U-Boot SPL.
1141See the U-Boot README for your architecture or board for how to use it. See
1142https://github.com/riscv/opensbi for more information about OpenSBI.
1143
1144
1145
Jagdish Gediya311d4842018-09-03 21:35:08 +05301146Entry: powerpc-mpc85xx-bootpg-resetvec: PowerPC mpc85xx bootpg + resetvec code for U-Boot
1147-----------------------------------------------------------------------------------------
1148
1149Properties / Entry arguments:
1150 - filename: Filename of u-boot-br.bin (default 'u-boot-br.bin')
1151
Thomas Hebbfd37f242019-11-13 18:18:03 -08001152This entry is valid for PowerPC mpc85xx cpus. This entry holds
Jagdish Gediya311d4842018-09-03 21:35:08 +05301153'bootpg + resetvec' code for PowerPC mpc85xx CPUs which needs to be
1154placed at offset 'RESET_VECTOR_ADDRESS - 0xffc'.
1155
Simon Glass136dd352020-10-26 17:39:59 -06001156
1157
Philippe Reynesebe96cb2022-03-28 22:57:04 +02001158Entry: pre-load: Pre load image header
1159--------------------------------------
1160
1161Properties / Entry arguments:
1162 - key-path: Path of the directory that store key (provided by the environment variable KEY_PATH)
1163 - content: List of phandles to entries to sign
1164 - algo-name: Hash and signature algo to use for the signature
1165 - padding-name: Name of the padding (pkcs-1.5 or pss)
1166 - key-name: Filename of the private key to sign
1167 - header-size: Total size of the header
1168 - version: Version of the header
1169
1170This entry creates a pre-load header that contains a global
1171image signature.
1172
1173For example, this creates an image with a pre-load header and a binary::
1174
1175 binman {
1176 image2 {
1177 filename = "sandbox.bin";
1178
1179 pre-load {
1180 content = <&image>;
1181 algo-name = "sha256,rsa2048";
1182 padding-name = "pss";
1183 key-name = "private.pem";
1184 header-size = <4096>;
1185 version = <1>;
1186 };
1187
1188 image: blob-ext {
1189 filename = "sandbox.itb";
1190 };
1191 };
1192 };
1193
1194
1195
Simon Glass8911fa12021-03-18 20:25:16 +13001196Entry: scp: System Control Processor (SCP) firmware blob
1197--------------------------------------------------------
Simon Glass136dd352020-10-26 17:39:59 -06001198
1199Properties / Entry arguments:
1200 - scp-path: Filename of file to read into the entry, typically scp.bin
1201
1202This entry holds firmware for an external platform-specific coprocessor.
Jagdish Gediya311d4842018-09-03 21:35:08 +05301203
1204
Simon Glass136dd352020-10-26 17:39:59 -06001205
Simon Glass7a61c6b2018-07-17 13:25:37 -06001206Entry: section: Entry that contains other entries
1207-------------------------------------------------
1208
Simon Glasscc9a41c2021-11-23 11:03:49 -07001209A section is an entry which can contain other entries, thus allowing
1210hierarchical images to be created. See 'Sections and hierarchical images'
1211in the binman README for more information.
1212
1213The base implementation simply joins the various entries together, using
1214various rules about alignment, etc.
1215
1216Subclassing
1217~~~~~~~~~~~
1218
1219This class can be subclassed to support other file formats which hold
1220multiple entries, such as CBFS. To do this, override the following
1221functions. The documentation here describes what your function should do.
1222For example code, see etypes which subclass `Entry_section`, or `cbfs.py`
1223for a more involved example::
1224
1225 $ grep -l \(Entry_section tools/binman/etype/*.py
1226
1227ReadNode()
1228 Call `super().ReadNode()`, then read any special properties for the
1229 section. Then call `self.ReadEntries()` to read the entries.
1230
1231 Binman calls this at the start when reading the image description.
1232
1233ReadEntries()
1234 Read in the subnodes of the section. This may involve creating entries
1235 of a particular etype automatically, as well as reading any special
1236 properties in the entries. For each entry, entry.ReadNode() should be
1237 called, to read the basic entry properties. The properties should be
1238 added to `self._entries[]`, in the correct order, with a suitable name.
1239
1240 Binman calls this at the start when reading the image description.
1241
1242BuildSectionData(required)
1243 Create the custom file format that you want and return it as bytes.
1244 This likely sets up a file header, then loops through the entries,
1245 adding them to the file. For each entry, call `entry.GetData()` to
1246 obtain the data. If that returns None, and `required` is False, then
1247 this method must give up and return None. But if `required` is True then
1248 it should assume that all data is valid.
1249
1250 Binman calls this when packing the image, to find out the size of
1251 everything. It is called again at the end when building the final image.
1252
1253SetImagePos(image_pos):
1254 Call `super().SetImagePos(image_pos)`, then set the `image_pos` values
1255 for each of the entries. This should use the custom file format to find
1256 the `start offset` (and `image_pos`) of each entry. If the file format
1257 uses compression in such a way that there is no offset available (other
1258 than reading the whole file and decompressing it), then the offsets for
1259 affected entries can remain unset (`None`). The size should also be set
1260 if possible.
Simon Glass0ac96b62021-03-18 20:25:15 +13001261
Simon Glasscc9a41c2021-11-23 11:03:49 -07001262 Binman calls this after the image has been packed, to update the
1263 location that all the entries ended up at.
Simon Glass0ac96b62021-03-18 20:25:15 +13001264
Simon Glass637958f2021-11-23 21:09:50 -07001265ReadChildData(child, decomp, alt_format):
Simon Glasscc9a41c2021-11-23 11:03:49 -07001266 The default version of this may be good enough, if you are able to
1267 implement SetImagePos() correctly. But that is a bit of a bypass, so
1268 you can override this method to read from your custom file format. It
1269 should read the entire entry containing the custom file using
1270 `super().ReadData(True)`, then parse the file to get the data for the
1271 given child, then return that data.
Simon Glass7a61c6b2018-07-17 13:25:37 -06001272
Simon Glasscc9a41c2021-11-23 11:03:49 -07001273 If your file format supports compression, the `decomp` argument tells
1274 you whether to return the compressed data (`decomp` is False) or to
1275 uncompress it first, then return the uncompressed data (`decomp` is
1276 True). This is used by the `binman extract -U` option.
Simon Glass21db0ff2020-09-01 05:13:54 -06001277
Simon Glass637958f2021-11-23 21:09:50 -07001278 If your entry supports alternative formats, the alt_format provides the
1279 alternative format that the user has selected. Your function should
1280 return data in that format. This is used by the 'binman extract -l'
1281 option.
1282
Simon Glasscc9a41c2021-11-23 11:03:49 -07001283 Binman calls this when reading in an image, in order to populate all the
1284 entries with the data from that image (`binman ls`).
1285
1286WriteChildData(child):
1287 Binman calls this after `child.data` is updated, to inform the custom
1288 file format about this, in case it needs to do updates.
1289
1290 The default version of this does nothing and probably needs to be
1291 overridden for the 'binman replace' command to work. Your version should
1292 use `child.data` to update the data for that child in the custom file
1293 format.
1294
1295 Binman calls this when updating an image that has been read in and in
1296 particular to update the data for a particular entry (`binman replace`)
1297
1298Properties / Entry arguments
1299~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1300
1301See :ref:`develop/package/binman:Image description format` for more
1302information.
1303
1304align-default
1305 Default alignment for this section, if no alignment is given in the
1306 entry
1307
1308pad-byte
1309 Pad byte to use when padding
1310
1311sort-by-offset
1312 True if entries should be sorted by offset, False if they must be
1313 in-order in the device tree description
1314
1315end-at-4gb
1316 Used to build an x86 ROM which ends at 4GB (2^32)
1317
1318name-prefix
1319 Adds a prefix to the name of every entry in the section when writing out
1320 the map
1321
1322skip-at-start
1323 Number of bytes before the first entry starts. These effectively adjust
1324 the starting offset of entries. For example, if this is 16, then the
1325 first entry would start at 16. An entry with offset = 20 would in fact
1326 be written at offset 4 in the image file, since the first 16 bytes are
1327 skipped when writing.
Simon Glassb1d414c2021-04-03 11:05:10 +13001328
Simon Glass39dd2152019-07-08 14:25:47 -06001329Since a section is also an entry, it inherits all the properies of entries
1330too.
1331
Simon Glasscc9a41c2021-11-23 11:03:49 -07001332Note that the `allow_missing` member controls whether this section permits
1333external blobs to be missing their contents. The option will produce an
1334image but of course it will not work. It is useful to make sure that
1335Continuous Integration systems can build without the binaries being
1336available. This is set by the `SetAllowMissing()` method, if
1337`--allow-missing` is passed to binman.
Simon Glass7a61c6b2018-07-17 13:25:37 -06001338
1339
1340
Roger Quadros5cdcea02022-02-19 20:50:04 +02001341Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob
1342---------------------------------------------------------------
1343
1344Properties / Entry arguments:
1345 - tee-os-path: Filename of file to read into entry. This is typically
1346 called tee-pager.bin
1347
1348This entry holds the run-time firmware, typically started by U-Boot SPL.
1349See the U-Boot README for your architecture or board for how to use it. See
1350https://github.com/OP-TEE/optee_os for more information about OP-TEE.
1351
1352
1353
Simon Glass7a61c6b2018-07-17 13:25:37 -06001354Entry: text: An entry which contains text
1355-----------------------------------------
1356
1357The text can be provided either in the node itself or by a command-line
1358argument. There is a level of indirection to allow multiple text strings
1359and sharing of text.
1360
1361Properties / Entry arguments:
1362 text-label: The value of this string indicates the property / entry-arg
1363 that contains the string to place in the entry
1364 <xxx> (actual name is the value of text-label): contains the string to
1365 place in the entry.
Simon Glass47f6a622019-07-08 13:18:40 -06001366 <text>: The text to place in the entry (overrides the above mechanism).
1367 This is useful when the text is constant.
Simon Glass7a61c6b2018-07-17 13:25:37 -06001368
Simon Glass0ac96b62021-03-18 20:25:15 +13001369Example node::
Simon Glass7a61c6b2018-07-17 13:25:37 -06001370
1371 text {
1372 size = <50>;
1373 text-label = "message";
1374 };
1375
1376You can then use:
1377
1378 binman -amessage="this is my message"
1379
1380and binman will insert that string into the entry.
1381
Simon Glass0ac96b62021-03-18 20:25:15 +13001382It is also possible to put the string directly in the node::
Simon Glass7a61c6b2018-07-17 13:25:37 -06001383
1384 text {
1385 size = <8>;
1386 text-label = "message";
1387 message = "a message directly in the node"
1388 };
1389
Simon Glass0ac96b62021-03-18 20:25:15 +13001390or just::
Simon Glass47f6a622019-07-08 13:18:40 -06001391
1392 text {
1393 size = <8>;
1394 text = "some text directly in the node"
1395 };
1396
Simon Glass7a61c6b2018-07-17 13:25:37 -06001397The text is not itself nul-terminated. This can be achieved, if required,
1398by setting the size of the entry to something larger than the text.
1399
1400
1401
1402Entry: u-boot: U-Boot flat binary
1403---------------------------------
1404
1405Properties / Entry arguments:
1406 - filename: Filename of u-boot.bin (default 'u-boot.bin')
1407
1408This is the U-Boot binary, containing relocation information to allow it
1409to relocate itself at runtime. The binary typically includes a device tree
Simon Glass718b5292021-03-18 20:25:07 +13001410blob at the end of it.
Simon Glass7a61c6b2018-07-17 13:25:37 -06001411
1412U-Boot can access binman symbols at runtime. See:
1413
1414 'Access to binman entry offsets at run time (fdt)'
1415
1416in the binman README for more information.
1417
Simon Glass718b5292021-03-18 20:25:07 +13001418Note that this entry is automatically replaced with u-boot-expanded unless
Simon Glass7098b7f2021-03-21 18:24:30 +13001419--no-expanded is used or the node has a 'no-expanded' property.
Simon Glass7a61c6b2018-07-17 13:25:37 -06001420
1421
Simon Glass718b5292021-03-18 20:25:07 +13001422
Simon Glass7a61c6b2018-07-17 13:25:37 -06001423Entry: u-boot-dtb: U-Boot device tree
1424-------------------------------------
1425
1426Properties / Entry arguments:
1427 - filename: Filename of u-boot.dtb (default 'u-boot.dtb')
1428
1429This is the U-Boot device tree, containing configuration information for
1430U-Boot. U-Boot needs this to know what devices are present and which drivers
1431to activate.
1432
Simon Glasse219aa42018-09-14 04:57:24 -06001433Note: This is mostly an internal entry type, used by others. This allows
1434binman to know which entries contain a device tree.
Simon Glass7a61c6b2018-07-17 13:25:37 -06001435
1436
Simon Glass7a61c6b2018-07-17 13:25:37 -06001437
1438Entry: u-boot-dtb-with-ucode: A U-Boot device tree file, with the microcode removed
1439-----------------------------------------------------------------------------------
1440
1441Properties / Entry arguments:
1442 - filename: Filename of u-boot.dtb (default 'u-boot.dtb')
1443
1444See Entry_u_boot_ucode for full details of the three entries involved in
1445this process. This entry provides the U-Boot device-tree file, which
1446contains the microcode. If the microcode is not being collated into one
1447place then the offset and size of the microcode is recorded by this entry,
Simon Glass537e0062021-03-18 20:24:54 +13001448for use by u-boot-with-ucode_ptr. If it is being collated, then this
Simon Glass7a61c6b2018-07-17 13:25:37 -06001449entry deletes the microcode from the device tree (to save space) and makes
Simon Glass537e0062021-03-18 20:24:54 +13001450it available to u-boot-ucode.
Simon Glass7a61c6b2018-07-17 13:25:37 -06001451
1452
1453
Simon Glassb1714232018-09-14 04:57:35 -06001454Entry: u-boot-elf: U-Boot ELF image
1455-----------------------------------
1456
1457Properties / Entry arguments:
1458 - filename: Filename of u-boot (default 'u-boot')
1459
1460This is the U-Boot ELF image. It does not include a device tree but can be
1461relocated to any address for execution.
1462
1463
1464
Simon Glass136dd352020-10-26 17:39:59 -06001465Entry: u-boot-env: An entry which contains a U-Boot environment
1466---------------------------------------------------------------
1467
1468Properties / Entry arguments:
1469 - filename: File containing the environment text, with each line in the
1470 form var=value
1471
1472
Simon Glass718b5292021-03-18 20:25:07 +13001473
1474Entry: u-boot-expanded: U-Boot flat binary broken out into its component parts
1475------------------------------------------------------------------------------
1476
1477This is a section containing the U-Boot binary and a devicetree. Using this
1478entry type automatically creates this section, with the following entries
1479in it:
1480
1481 u-boot-nodtb
1482 u-boot-dtb
1483
1484Having the devicetree separate allows binman to update it in the final
1485image, so that the entries positions are provided to the running U-Boot.
1486
1487
Simon Glass136dd352020-10-26 17:39:59 -06001488
Simon Glass7a61c6b2018-07-17 13:25:37 -06001489Entry: u-boot-img: U-Boot legacy image
1490--------------------------------------
1491
1492Properties / Entry arguments:
1493 - filename: Filename of u-boot.img (default 'u-boot.img')
1494
1495This is the U-Boot binary as a packaged image, in legacy format. It has a
1496header which allows it to be loaded at the correct address for execution.
1497
1498You should use FIT (Flat Image Tree) instead of the legacy image for new
1499applications.
1500
1501
1502
1503Entry: u-boot-nodtb: U-Boot flat binary without device tree appended
1504--------------------------------------------------------------------
1505
1506Properties / Entry arguments:
Simon Glass537e0062021-03-18 20:24:54 +13001507 - filename: Filename to include (default 'u-boot-nodtb.bin')
Simon Glass7a61c6b2018-07-17 13:25:37 -06001508
1509This is the U-Boot binary, containing relocation information to allow it
1510to relocate itself at runtime. It does not include a device tree blob at
Simon Glass537e0062021-03-18 20:24:54 +13001511the end of it so normally cannot work without it. You can add a u-boot-dtb
Simon Glass718b5292021-03-18 20:25:07 +13001512entry after this one, or use a u-boot entry instead, normally expands to a
1513section containing u-boot and u-boot-dtb
Simon Glass7a61c6b2018-07-17 13:25:37 -06001514
1515
1516
1517Entry: u-boot-spl: U-Boot SPL binary
1518------------------------------------
1519
1520Properties / Entry arguments:
1521 - filename: Filename of u-boot-spl.bin (default 'spl/u-boot-spl.bin')
1522
1523This is the U-Boot SPL (Secondary Program Loader) binary. This is a small
1524binary which loads before U-Boot proper, typically into on-chip SRAM. It is
1525responsible for locating, loading and jumping to U-Boot. Note that SPL is
1526not relocatable so must be loaded to the correct address in SRAM, or written
Simon Glass8425a1f2018-07-17 13:25:48 -06001527to run from the correct address if direct flash execution is possible (e.g.
Simon Glass7a61c6b2018-07-17 13:25:37 -06001528on x86 devices).
1529
1530SPL can access binman symbols at runtime. See:
1531
1532 'Access to binman entry offsets at run time (symbols)'
1533
1534in the binman README for more information.
1535
1536The ELF file 'spl/u-boot-spl' must also be available for this to work, since
1537binman uses that to look up symbols to write into the SPL binary.
1538
Simon Glass718b5292021-03-18 20:25:07 +13001539Note that this entry is automatically replaced with u-boot-spl-expanded
Simon Glass7098b7f2021-03-21 18:24:30 +13001540unless --no-expanded is used or the node has a 'no-expanded' property.
Simon Glass718b5292021-03-18 20:25:07 +13001541
Simon Glass7a61c6b2018-07-17 13:25:37 -06001542
1543
1544Entry: u-boot-spl-bss-pad: U-Boot SPL binary padded with a BSS region
1545---------------------------------------------------------------------
1546
1547Properties / Entry arguments:
1548 None
1549
Simon Glass308939b2021-03-18 20:24:55 +13001550This holds the padding added after the SPL binary to cover the BSS (Block
1551Started by Symbol) region. This region holds the various variables used by
1552SPL. It is set to 0 by SPL when it starts up. If you want to append data to
1553the SPL image (such as a device tree file), you must pad out the BSS region
1554to avoid the data overlapping with U-Boot variables. This entry is useful in
1555that case. It automatically pads out the entry size to cover both the code,
1556data and BSS.
1557
1558The contents of this entry will a certain number of zero bytes, determined
1559by __bss_size
Simon Glass7a61c6b2018-07-17 13:25:37 -06001560
1561The ELF file 'spl/u-boot-spl' must also be available for this to work, since
1562binman uses that to look up the BSS address.
1563
1564
1565
1566Entry: u-boot-spl-dtb: U-Boot SPL device tree
1567---------------------------------------------
1568
1569Properties / Entry arguments:
1570 - filename: Filename of u-boot.dtb (default 'spl/u-boot-spl.dtb')
1571
1572This is the SPL device tree, containing configuration information for
1573SPL. SPL needs this to know what devices are present and which drivers
1574to activate.
1575
1576
1577
Simon Glassb1714232018-09-14 04:57:35 -06001578Entry: u-boot-spl-elf: U-Boot SPL ELF image
1579-------------------------------------------
1580
1581Properties / Entry arguments:
Simon Glass5dcc21d2019-07-08 13:18:45 -06001582 - filename: Filename of SPL u-boot (default 'spl/u-boot-spl')
Simon Glassb1714232018-09-14 04:57:35 -06001583
1584This is the U-Boot SPL ELF image. It does not include a device tree but can
1585be relocated to any address for execution.
1586
Simon Glass718b5292021-03-18 20:25:07 +13001587
1588
1589Entry: u-boot-spl-expanded: U-Boot SPL flat binary broken out into its component parts
1590--------------------------------------------------------------------------------------
1591
1592Properties / Entry arguments:
1593 - spl-dtb: Controls whether this entry is selected (set to 'y' or '1' to
1594 select)
1595
1596This is a section containing the U-Boot binary, BSS padding if needed and a
1597devicetree. Using this entry type automatically creates this section, with
1598the following entries in it:
1599
1600 u-boot-spl-nodtb
1601 u-boot-spl-bss-pad
1602 u-boot-dtb
1603
1604Having the devicetree separate allows binman to update it in the final
1605image, so that the entries positions are provided to the running U-Boot.
1606
1607This entry is selected based on the value of the 'spl-dtb' entryarg. If
1608this is non-empty (and not 'n' or '0') then this expanded entry is selected.
Simon Glassb1714232018-09-14 04:57:35 -06001609
1610
Simon Glass718b5292021-03-18 20:25:07 +13001611
Simon Glass7a61c6b2018-07-17 13:25:37 -06001612Entry: u-boot-spl-nodtb: SPL binary without device tree appended
1613----------------------------------------------------------------
1614
1615Properties / Entry arguments:
Simon Glass537e0062021-03-18 20:24:54 +13001616 - filename: Filename to include (default 'spl/u-boot-spl-nodtb.bin')
Simon Glass7a61c6b2018-07-17 13:25:37 -06001617
1618This is the U-Boot SPL binary, It does not include a device tree blob at
1619the end of it so may not be able to work without it, assuming SPL needs
Simon Glass537e0062021-03-18 20:24:54 +13001620a device tree to operate on your platform. You can add a u-boot-spl-dtb
Simon Glass718b5292021-03-18 20:25:07 +13001621entry after this one, or use a u-boot-spl entry instead' which normally
1622expands to a section containing u-boot-spl-dtb, u-boot-spl-bss-pad and
1623u-boot-spl-dtb
Simon Glass7a61c6b2018-07-17 13:25:37 -06001624
Simon Glass31e04cb2021-03-18 20:24:56 +13001625SPL can access binman symbols at runtime. See:
1626
1627 'Access to binman entry offsets at run time (symbols)'
1628
1629in the binman README for more information.
1630
1631The ELF file 'spl/u-boot-spl' must also be available for this to work, since
1632binman uses that to look up symbols to write into the SPL binary.
1633
Simon Glass7a61c6b2018-07-17 13:25:37 -06001634
1635
1636Entry: u-boot-spl-with-ucode-ptr: U-Boot SPL with embedded microcode pointer
1637----------------------------------------------------------------------------
1638
Simon Glass3fb4f422018-09-14 04:57:32 -06001639This is used when SPL must set up the microcode for U-Boot.
1640
Simon Glass7a61c6b2018-07-17 13:25:37 -06001641See Entry_u_boot_ucode for full details of the entries involved in this
1642process.
1643
1644
1645
Simon Glass8425a1f2018-07-17 13:25:48 -06001646Entry: u-boot-tpl: U-Boot TPL binary
1647------------------------------------
1648
1649Properties / Entry arguments:
1650 - filename: Filename of u-boot-tpl.bin (default 'tpl/u-boot-tpl.bin')
1651
1652This is the U-Boot TPL (Tertiary Program Loader) binary. This is a small
1653binary which loads before SPL, typically into on-chip SRAM. It is
1654responsible for locating, loading and jumping to SPL, the next-stage
1655loader. Note that SPL is not relocatable so must be loaded to the correct
1656address in SRAM, or written to run from the correct address if direct
1657flash execution is possible (e.g. on x86 devices).
1658
1659SPL can access binman symbols at runtime. See:
1660
1661 'Access to binman entry offsets at run time (symbols)'
1662
1663in the binman README for more information.
1664
1665The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since
1666binman uses that to look up symbols to write into the TPL binary.
1667
Simon Glass718b5292021-03-18 20:25:07 +13001668Note that this entry is automatically replaced with u-boot-tpl-expanded
Simon Glass7098b7f2021-03-21 18:24:30 +13001669unless --no-expanded is used or the node has a 'no-expanded' property.
Simon Glass718b5292021-03-18 20:25:07 +13001670
Simon Glass8425a1f2018-07-17 13:25:48 -06001671
1672
Simon Glass63f41d42021-03-18 20:24:58 +13001673Entry: u-boot-tpl-bss-pad: U-Boot TPL binary padded with a BSS region
1674---------------------------------------------------------------------
1675
1676Properties / Entry arguments:
1677 None
1678
1679This holds the padding added after the TPL binary to cover the BSS (Block
1680Started by Symbol) region. This region holds the various variables used by
1681TPL. It is set to 0 by TPL when it starts up. If you want to append data to
1682the TPL image (such as a device tree file), you must pad out the BSS region
1683to avoid the data overlapping with U-Boot variables. This entry is useful in
1684that case. It automatically pads out the entry size to cover both the code,
1685data and BSS.
1686
1687The contents of this entry will a certain number of zero bytes, determined
1688by __bss_size
1689
1690The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since
1691binman uses that to look up the BSS address.
1692
1693
1694
Simon Glass8425a1f2018-07-17 13:25:48 -06001695Entry: u-boot-tpl-dtb: U-Boot TPL device tree
1696---------------------------------------------
1697
1698Properties / Entry arguments:
1699 - filename: Filename of u-boot.dtb (default 'tpl/u-boot-tpl.dtb')
1700
1701This is the TPL device tree, containing configuration information for
1702TPL. TPL needs this to know what devices are present and which drivers
1703to activate.
1704
1705
1706
Simon Glass3fb4f422018-09-14 04:57:32 -06001707Entry: u-boot-tpl-dtb-with-ucode: U-Boot TPL with embedded microcode pointer
1708----------------------------------------------------------------------------
1709
1710This is used when TPL must set up the microcode for U-Boot.
1711
1712See Entry_u_boot_ucode for full details of the entries involved in this
1713process.
1714
1715
1716
Simon Glassa899f712019-07-08 13:18:46 -06001717Entry: u-boot-tpl-elf: U-Boot TPL ELF image
1718-------------------------------------------
1719
1720Properties / Entry arguments:
1721 - filename: Filename of TPL u-boot (default 'tpl/u-boot-tpl')
1722
1723This is the U-Boot TPL ELF image. It does not include a device tree but can
1724be relocated to any address for execution.
1725
1726
1727
Simon Glass718b5292021-03-18 20:25:07 +13001728Entry: u-boot-tpl-expanded: U-Boot TPL flat binary broken out into its component parts
1729--------------------------------------------------------------------------------------
1730
1731Properties / Entry arguments:
1732 - tpl-dtb: Controls whether this entry is selected (set to 'y' or '1' to
1733 select)
1734
1735This is a section containing the U-Boot binary, BSS padding if needed and a
1736devicetree. Using this entry type automatically creates this section, with
1737the following entries in it:
1738
1739 u-boot-tpl-nodtb
1740 u-boot-tpl-bss-pad
1741 u-boot-dtb
1742
1743Having the devicetree separate allows binman to update it in the final
1744image, so that the entries positions are provided to the running U-Boot.
1745
1746This entry is selected based on the value of the 'tpl-dtb' entryarg. If
1747this is non-empty (and not 'n' or '0') then this expanded entry is selected.
1748
1749
1750
Simon Glassc98de972021-03-18 20:24:57 +13001751Entry: u-boot-tpl-nodtb: TPL binary without device tree appended
1752----------------------------------------------------------------
1753
1754Properties / Entry arguments:
1755 - filename: Filename to include (default 'tpl/u-boot-tpl-nodtb.bin')
1756
1757This is the U-Boot TPL binary, It does not include a device tree blob at
1758the end of it so may not be able to work without it, assuming TPL needs
1759a device tree to operate on your platform. You can add a u-boot-tpl-dtb
Simon Glass718b5292021-03-18 20:25:07 +13001760entry after this one, or use a u-boot-tpl entry instead, which normally
1761expands to a section containing u-boot-tpl-dtb, u-boot-tpl-bss-pad and
1762u-boot-tpl-dtb
Simon Glassc98de972021-03-18 20:24:57 +13001763
1764TPL can access binman symbols at runtime. See:
1765
1766 'Access to binman entry offsets at run time (symbols)'
1767
1768in the binman README for more information.
1769
1770The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since
1771binman uses that to look up symbols to write into the TPL binary.
1772
1773
1774
Simon Glass3fb4f422018-09-14 04:57:32 -06001775Entry: u-boot-tpl-with-ucode-ptr: U-Boot TPL with embedded microcode pointer
1776----------------------------------------------------------------------------
1777
1778See Entry_u_boot_ucode for full details of the entries involved in this
1779process.
1780
1781
1782
Simon Glass7a61c6b2018-07-17 13:25:37 -06001783Entry: u-boot-ucode: U-Boot microcode block
1784-------------------------------------------
1785
1786Properties / Entry arguments:
1787 None
1788
1789The contents of this entry are filled in automatically by other entries
1790which must also be in the image.
1791
1792U-Boot on x86 needs a single block of microcode. This is collected from
1793the various microcode update nodes in the device tree. It is also unable
1794to read the microcode from the device tree on platforms that use FSP
1795(Firmware Support Package) binaries, because the API requires that the
1796microcode is supplied before there is any SRAM available to use (i.e.
1797the FSP sets up the SRAM / cache-as-RAM but does so in the call that
1798requires the microcode!). To keep things simple, all x86 platforms handle
1799microcode the same way in U-Boot (even non-FSP platforms). This is that
1800a table is placed at _dt_ucode_base_size containing the base address and
1801size of the microcode. This is either passed to the FSP (for FSP
1802platforms), or used to set up the microcode (for non-FSP platforms).
1803This all happens in the build system since it is the only way to get
1804the microcode into a single blob and accessible without SRAM.
1805
1806There are two cases to handle. If there is only one microcode blob in
1807the device tree, then the ucode pointer it set to point to that. This
1808entry (u-boot-ucode) is empty. If there is more than one update, then
1809this entry holds the concatenation of all updates, and the device tree
1810entry (u-boot-dtb-with-ucode) is updated to remove the microcode. This
1811last step ensures that that the microcode appears in one contiguous
1812block in the image and is not unnecessarily duplicated in the device
1813tree. It is referred to as 'collation' here.
1814
1815Entry types that have a part to play in handling microcode:
1816
1817 Entry_u_boot_with_ucode_ptr:
1818 Contains u-boot-nodtb.bin (i.e. U-Boot without the device tree).
1819 It updates it with the address and size of the microcode so that
1820 U-Boot can find it early on start-up.
1821 Entry_u_boot_dtb_with_ucode:
1822 Contains u-boot.dtb. It stores the microcode in a
1823 'self.ucode_data' property, which is then read by this class to
1824 obtain the microcode if needed. If collation is performed, it
1825 removes the microcode from the device tree.
1826 Entry_u_boot_ucode:
1827 This class. If collation is enabled it reads the microcode from
1828 the Entry_u_boot_dtb_with_ucode entry, and uses it as the
1829 contents of this entry.
1830
1831
1832
1833Entry: u-boot-with-ucode-ptr: U-Boot with embedded microcode pointer
1834--------------------------------------------------------------------
1835
1836Properties / Entry arguments:
Masahiro Yamadaa7a0ca42019-12-14 13:47:26 +09001837 - filename: Filename of u-boot-nodtb.bin (default 'u-boot-nodtb.bin')
Simon Glassee21d3a2018-09-14 04:57:07 -06001838 - optional-ucode: boolean property to make microcode optional. If the
1839 u-boot.bin image does not include microcode, no error will
1840 be generated.
Simon Glass7a61c6b2018-07-17 13:25:37 -06001841
1842See Entry_u_boot_ucode for full details of the three entries involved in
1843this process. This entry updates U-Boot with the offset and size of the
1844microcode, to allow early x86 boot code to find it without doing anything
Simon Glass537e0062021-03-18 20:24:54 +13001845complicated. Otherwise it is the same as the u-boot entry.
Simon Glass7a61c6b2018-07-17 13:25:37 -06001846
1847
1848
Simon Glass5c350162018-07-17 13:25:47 -06001849Entry: vblock: An entry which contains a Chromium OS verified boot block
1850------------------------------------------------------------------------
1851
1852Properties / Entry arguments:
Simon Glass17b84eb2019-05-17 22:00:53 -06001853 - content: List of phandles to entries to sign
Simon Glass5c350162018-07-17 13:25:47 -06001854 - keydir: Directory containing the public keys to use
1855 - keyblock: Name of the key file to use (inside keydir)
1856 - signprivate: Name of provide key file to use (inside keydir)
1857 - version: Version number of the vblock (typically 1)
1858 - kernelkey: Name of the kernel key to use (inside keydir)
1859 - preamble-flags: Value of the vboot preamble flags (typically 0)
1860
Simon Glass639505b2018-09-14 04:57:11 -06001861Output files:
1862 - input.<unique_name> - input file passed to futility
1863 - vblock.<unique_name> - output file generated by futility (which is
1864 used as the entry contents)
1865
Jagdish Gediya311d4842018-09-03 21:35:08 +05301866Chromium OS signs the read-write firmware and kernel, writing the signature
Simon Glass5c350162018-07-17 13:25:47 -06001867in this block. This allows U-Boot to verify that the next firmware stage
1868and kernel are genuine.
1869
1870
1871
Simon Glass0b074d62019-08-24 07:22:48 -06001872Entry: x86-reset16: x86 16-bit reset code for U-Boot
1873----------------------------------------------------
1874
1875Properties / Entry arguments:
1876 - filename: Filename of u-boot-x86-reset16.bin (default
1877 'u-boot-x86-reset16.bin')
1878
1879x86 CPUs start up in 16-bit mode, even if they are 32-bit CPUs. This code
1880must be placed at a particular address. This entry holds that code. It is
1881typically placed at offset CONFIG_RESET_VEC_LOC. The code is responsible
1882for jumping to the x86-start16 code, which continues execution.
1883
1884For 64-bit U-Boot, the 'x86_reset16_spl' entry type is used instead.
1885
1886
1887
1888Entry: x86-reset16-spl: x86 16-bit reset code for U-Boot
1889--------------------------------------------------------
1890
1891Properties / Entry arguments:
1892 - filename: Filename of u-boot-x86-reset16.bin (default
1893 'u-boot-x86-reset16.bin')
1894
1895x86 CPUs start up in 16-bit mode, even if they are 32-bit CPUs. This code
1896must be placed at a particular address. This entry holds that code. It is
1897typically placed at offset CONFIG_RESET_VEC_LOC. The code is responsible
1898for jumping to the x86-start16 code, which continues execution.
1899
1900For 32-bit U-Boot, the 'x86_reset_spl' entry type is used instead.
1901
1902
1903
1904Entry: x86-reset16-tpl: x86 16-bit reset code for U-Boot
1905--------------------------------------------------------
1906
1907Properties / Entry arguments:
1908 - filename: Filename of u-boot-x86-reset16.bin (default
1909 'u-boot-x86-reset16.bin')
1910
1911x86 CPUs start up in 16-bit mode, even if they are 32-bit CPUs. This code
1912must be placed at a particular address. This entry holds that code. It is
1913typically placed at offset CONFIG_RESET_VEC_LOC. The code is responsible
1914for jumping to the x86-start16 code, which continues execution.
1915
1916For 32-bit U-Boot, the 'x86_reset_tpl' entry type is used instead.
1917
1918
1919
Simon Glass7a61c6b2018-07-17 13:25:37 -06001920Entry: x86-start16: x86 16-bit start-up code for U-Boot
1921-------------------------------------------------------
1922
1923Properties / Entry arguments:
Simon Glassabab18c2019-08-24 07:22:49 -06001924 - filename: Filename of u-boot-x86-start16.bin (default
1925 'u-boot-x86-start16.bin')
Simon Glass7a61c6b2018-07-17 13:25:37 -06001926
1927x86 CPUs start up in 16-bit mode, even if they are 32-bit CPUs. This code
Simon Glassabab18c2019-08-24 07:22:49 -06001928must be placed in the top 64KB of the ROM. The reset code jumps to it. This
1929entry holds that code. It is typically placed at offset
1930CONFIG_SYS_X86_START16. The code is responsible for changing to 32-bit mode
1931and jumping to U-Boot's entry point, which requires 32-bit mode (for 32-bit
1932U-Boot).
Simon Glass7a61c6b2018-07-17 13:25:37 -06001933
1934For 64-bit U-Boot, the 'x86_start16_spl' entry type is used instead.
1935
1936
1937
1938Entry: x86-start16-spl: x86 16-bit start-up code for SPL
1939--------------------------------------------------------
1940
1941Properties / Entry arguments:
Simon Glassabab18c2019-08-24 07:22:49 -06001942 - filename: Filename of spl/u-boot-x86-start16-spl.bin (default
1943 'spl/u-boot-x86-start16-spl.bin')
Simon Glass7a61c6b2018-07-17 13:25:37 -06001944
Simon Glassabab18c2019-08-24 07:22:49 -06001945x86 CPUs start up in 16-bit mode, even if they are 32-bit CPUs. This code
1946must be placed in the top 64KB of the ROM. The reset code jumps to it. This
1947entry holds that code. It is typically placed at offset
1948CONFIG_SYS_X86_START16. The code is responsible for changing to 32-bit mode
1949and jumping to U-Boot's entry point, which requires 32-bit mode (for 32-bit
1950U-Boot).
Simon Glass7a61c6b2018-07-17 13:25:37 -06001951
Simon Glassabab18c2019-08-24 07:22:49 -06001952For 32-bit U-Boot, the 'x86-start16' entry type is used instead.
Simon Glass7a61c6b2018-07-17 13:25:37 -06001953
1954
1955
Simon Glassed40e962018-09-14 04:57:10 -06001956Entry: x86-start16-tpl: x86 16-bit start-up code for TPL
1957--------------------------------------------------------
1958
1959Properties / Entry arguments:
Simon Glassabab18c2019-08-24 07:22:49 -06001960 - filename: Filename of tpl/u-boot-x86-start16-tpl.bin (default
1961 'tpl/u-boot-x86-start16-tpl.bin')
Simon Glassed40e962018-09-14 04:57:10 -06001962
Simon Glassabab18c2019-08-24 07:22:49 -06001963x86 CPUs start up in 16-bit mode, even if they are 32-bit CPUs. This code
1964must be placed in the top 64KB of the ROM. The reset code jumps to it. This
1965entry holds that code. It is typically placed at offset
1966CONFIG_SYS_X86_START16. The code is responsible for changing to 32-bit mode
1967and jumping to U-Boot's entry point, which requires 32-bit mode (for 32-bit
1968U-Boot).
Simon Glassed40e962018-09-14 04:57:10 -06001969
Simon Glassabab18c2019-08-24 07:22:49 -06001970If TPL is not being used, the 'x86-start16-spl or 'x86-start16' entry types
Simon Glassed40e962018-09-14 04:57:10 -06001971may be used instead.
1972
1973
1974