Skip to contentSkip to conversation

doc: Move FIT into its own directory

PATCH New Simon Glass 1 participant 14 messages Jun 23, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/14 doc: Move FIT into its own directory

Create a new usage/fit directory which will house information about FIT.

---

Changes in v2:
- Drop newline at end of file

 doc/usage/{fit.rst => fit/index.rst} | 3 +++
 doc/usage/index.rst                  | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
 rename doc/usage/{fit.rst => fit/index.rst} (88%)
doc/usage/fit/index.rst renamed from doc/usage/fit.rst +3 -0
similarity index 88%
rename from doc/usage/fit.rst
rename to doc/usage/fit/index.rst
index 70374340577e..40f0d1193626 100644
@@ -6,3 +6,6 @@ Flat Image Tree (FIT)
 U-Boot uses Flat Image Tree (FIT) as a standard file format for packaging
 images that it it reads and boots. Documentation about FIT is available at
 doc/uImage.FIT
+
+.. toctree::
+    :maxdepth: 1
doc/usage/index.rst +1 -1
index 84ef8a9a427d..e1fe284b38c1 100644
@@ -8,7 +8,7 @@ Use U-Boot
    dfu
    environment
    fdt_overlays
-   fit
+   fit/index
    netconsole
    partitions
    cmdline
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#1 lore raw

PATCH v2 2/14 doc: Convert FIT source-file format to rST

Move this document and convert it to rST. Make minimal changes, enough for it to build successfully.

Future patches will tidy this up.

---

Changes in v2:
- Update commit message
- Tidy up the diagram alignment in two cases

 doc/usage/fit/index.rst                       |   2 +
 .../fit/source_file_format.rst}               | 126 +++++++++---------
 2 files changed, 65 insertions(+), 63 deletions(-)
 rename doc/{uImage.FIT/source_file_format.txt => usage/fit/source_file_format.rst} (84%)
doc/usage/fit/index.rst +2 -0
index 40f0d1193626..93a962319035 100644
@@ -9,3 +9,5 @@ doc/uImage.FIT
 
 .. toctree::
     :maxdepth: 1
+
+    source_file_format
doc/usage/fit/source_file_format.rst renamed from doc/uImage.FIT/source_file_format.txt +63 -63

168 lines not on this page · raw message

Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#2 lore raw

PATCH v2 3/14 doc: Reformat the FIT documentation to make it nicer

In reply to Simon Glass

Fix up headings and tables to read better.

---

(no changes since v1)

 doc/usage/fit/source_file_format.rst | 255 ++++++++++++++++++---------
 1 file changed, 172 insertions(+), 83 deletions(-)
doc/usage/fit/source_file_format.rst +172 -83
index bfe8f36c4a0c..7842256c226c 100644
@@ -1,11 +1,8 @@
 U-Boot new uImage source file format (bindings definition)
 ==========================================================
 
-Author: Marian Balakowicz <[email protected]>
-External data additions, 25/1/16 Simon Glass <[email protected]>
-
-1) Introduction
----------------
+Introduction
+------------
 
 Evolution of the 2.6 Linux kernel for embedded PowerPC systems introduced new
 booting method which requires that hardware description is available to the
@@ -30,16 +27,18 @@ All those factors combined clearly show that there is a need for new, more
 flexible, multi component uImage format.
 
 
-2) New uImage format assumptions
---------------------------------
+New uImage format assumptions
+-----------------------------
 
-a) Implementation
+Implementation
+~~~~~~~~~~~~~~
 
 Libfdt has been selected for the new uImage format implementation as (1) it
 provides needed functionality, (2) is actively maintained and developed and
 (3) increases code reuse as it is already part of the U-Boot source tree.
 
-b) Terminology
+Terminology
+~~~~~~~~~~~
 
 This document defines new uImage structure by providing FDT bindings for new
 uImage internals. Bindings are defined from U-Boot perspective, i.e. describe
@@ -50,15 +49,20 @@ hashes) will need to be filled in automatically by the U-Boot mkimage tool.
 To avoid confusion with the kernel FDT the following naming convention is
 proposed for the new uImage format related terms:
 
-FIT	- Flattened uImage Tree
+FIT
+    Flattened uImage Tree
 
 FIT is formally a flattened device tree (in the libfdt meaning), which
 conforms to bindings defined in this document.
 
-.its	- image tree source
-.itb	- flattened image tree blob
+.its
+    image tree source
+
+.itb
+    flattened image tree blob
 
-c) Image building procedure
+Image building procedure
+~~~~~~~~~~~~~~~~~~~~~~~~
 
 The following picture shows how the new uImage is prepared. Input consists of
 image source file (.its) and a set of data files. Image is created with the
@@ -74,14 +78,20 @@ actual binary of a new uImage::
                                           |
                                      'new uImage'
 
-	- create .its file, automatically filled-in properties are omitted
-	- call mkimage tool on a .its file
-	- mkimage calls dtc to create .itb image and assures that
-	  missing properties are added
-	- .itb (new uImage) is uploaded onto the target and used therein
+Steps:
+
+#. Create .its file, automatically filled-in properties are omitted
+
+#. Call mkimage tool on a .its file
+
+#. mkimage calls dtc to create .itb image and assures that
+   missing properties are added
+
+#. .itb (new uImage) is uploaded onto the target and used therein
 
 
-d) Unique identifiers
+Unique identifiers
+~~~~~~~~~~~~~~~~~~
 
 To identify FIT sub-nodes representing images, hashes, configurations (which
 are defined in the following sections), the "unit name" of the given sub-node
@@ -89,8 +99,8 @@ is used as it's identifier as it assures uniqueness without additional
 checking required.
 
 
-3) Root node properties
------------------------
+Root node properties
+--------------------
 
 Root node of the uImage Tree should have the following layout::
 
@@ -112,28 +122,42 @@ Root node of the uImage Tree should have the following layout::
           o conf-2 {...}
           ...
 
-  Optional property:
-  - description : Textual description of the uImage
+Optional property
+~~~~~~~~~~~~~~~~~
 
-  Mandatory property:
-  - timestamp : Last image modification time being counted in seconds since
+description
+    Textual description of the uImage
+
+Mandatory property
+~~~~~~~~~~~~~~~~~~
+
+timestamp
+    Last image modification time being counted in seconds since
     1970-01-01 00:00:00 - to be automatically calculated by mkimage tool.
 
-  Conditionally mandatory property:
-  - #address-cells : Number of 32bit cells required to represent entry and
+Conditionally mandatory property
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+#address-cells
+    Number of 32bit cells required to represent entry and
     load addresses supplied within sub-image nodes. May be omitted when no
     entry or load addresses are used.
 
-  Mandatory nodes:
-  - images : This node contains a set of sub-nodes, each of them representing
+Mandatory nodes
+~~~~~~~~~~~~~~~
+
+images
+    This node contains a set of sub-nodes, each of them representing
     single component sub-image (like kernel, ramdisk, etc.). At least one
     sub-image is required.
-  - configurations : Contains a set of available configuration nodes and
+
+configurations
+    Contains a set of available configuration nodes and
     defines a default configuration.
 
 
-4) '/images' node
------------------
+'/images' node
+--------------
 
 This node is a container node for component sub-image nodes. Each sub-node of
 the '/images' node should have the following layout::
@@ -152,53 +176,89 @@ the '/images' node should have the following layout::
         o hash-2 {...}
         ...
 
-  Mandatory properties:
-  - description : Textual description of the component sub-image
-  - type : Name of component sub-image type, supported types are:
+Mandatory properties
+~~~~~~~~~~~~~~~~~~~~
+
+description
+    Textual description of the component sub-image
+
+type
+    Name of component sub-image type, supported types are:
+
     "standalone", "kernel", "kernel_noload", "ramdisk", "firmware", "script",
     "filesystem", "flat_dt" and others (see uimage_type in common/image.c).
-  - data : Path to the external file which contains this node's binary data.
-  - compression : Compression used by included data. Supported compressions
+
+data
+    Path to the external file which contains this node's binary data.
+
+compression
+    Compression used by included data. Supported compressions
     are "gzip" and "bzip2". If no compression is used compression property
     should be set to "none". If the data is compressed but it should not be
     uncompressed by U-Boot (e.g. compressed ramdisk), this should also be set
     to "none".
 
-  Conditionally mandatory property:
-  - os : OS name, mandatory for types "kernel". Valid OS names are:
+Conditionally mandatory property
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+os
+    OS name, mandatory for types "kernel". Valid OS names are:
     "openbsd", "netbsd", "freebsd", "4_4bsd", "linux", "svr4", "esix",
     "solaris", "irix", "sco", "dell", "ncr", "lynxos", "vxworks", "psos", "qnx",
     "u-boot", "rtems", "unity", "integrity".
-  - arch : Architecture name, mandatory for types: "standalone", "kernel",
+
+arch
+    Architecture name, mandatory for types: "standalone", "kernel",
     "firmware", "ramdisk" and "fdt". Valid architecture names are: "alpha",
     "arm", "i386", "ia64", "mips", "mips64", "ppc", "s390", "sh", "sparc",
     "sparc64", "m68k", "microblaze", "nios2", "blackfin", "avr32", "st200",
     "sandbox".
-  - entry : entry point address, address size is determined by
+
+entry
+    entry point address, address size is determined by
     '#address-cells' property of the root node.
     Mandatory for types: "firmware", and "kernel".
-  - load : load address, address size is determined by '#address-cells'
+
+load
+    load address, address size is determined by '#address-cells'
     property of the root node.
     Mandatory for types: "firmware", and "kernel".
-  - compatible : compatible method for loading image.
+
+compatible
+    compatible method for loading image.
     Mandatory for types: "fpga", and images that do not specify a load address.
     Supported compatible methods:
-    "u-boot,fpga-legacy" - the generic fpga loading routine.
-    "u-boot,zynqmp-fpga-ddrauth" - signed non-encrypted FPGA bitstream for
-    Xilinx Zynq UltraScale+ (ZymqMP) device.
-    "u-boot,zynqmp-fpga-enc" - encrypted FPGA bitstream for Xilinx Zynq
+
+    "u-boot,fpga-legacy"
+        the generic fpga loading routine.
+
+    "u-boot,zynqmp-fpga-ddrauth"
+        signed non-encrypted FPGA bitstream for
+        Xilinx Zynq UltraScale+ (ZymqMP) device.
+
+    "u-boot,zynqmp-fpga-enc"
+        encrypted FPGA bitstream for Xilinx Zynq
+
     UltraScale+ (ZynqMP) device.
-  - phase : U-Boot phase for which the image is intended.
-    "spl" - image is an SPL image
-    "u-boot" - image is a U-Boot image
 
-  Optional nodes:
-  - hash-1 : Each hash sub-node represents separate hash or checksum
+phase
+    U-Boot phase for which the image is intended.
+
+    "spl"
+        image is an SPL image
+
+    "u-boot"
+        image is a U-Boot image
+
+Optional nodes:
+
+hash-1
+    Each hash sub-node represents separate hash or checksum
     calculated for node's data according to specified algorithm.
 
 
-5) Hash nodes
--------------
+Hash nodes
+----------
 
 ::
 
@@ -206,14 +266,18 @@ the '/images' node should have the following layout::
         |- algo = "hash or checksum algorithm name"
         |- value = [hash or checksum value]
 
-  Mandatory properties:
-  - algo : Algorithm name, supported are "crc32", "md5" and "sha1".
-  - value : Actual checksum or hash value, correspondingly 4, 16 or 20 bytes
-    long.
+Mandatory properties
+~~~~~~~~~~~~~~~~~~~~
+
+algo
+    Algorithm name, supported are "crc32", "md5" and "sha1".
+
+value
+    Actual checksum or hash value, correspondingly 4, 16 or 20 bytes long.
 
 
-6) '/configurations' node
--------------------------
+'/configurations' node
+----------------------
 
 The 'configurations' node creates convenient, labeled boot configurations,
 which combine together kernel images with their ramdisks and fdt blobs.
@@ -228,17 +292,21 @@ The 'configurations' node has the following structure::
         ...
 
 
-  Optional property:
-  - default : Selects one of the configuration sub-nodes as a default
-    configuration.
+Optional property
+~~~~~~~~~~~~~~~~~
 
-  Mandatory nodes:
-  - configuration-sub-node-unit-name : At least one of the configuration
-    sub-nodes is required.
+default
+    Selects one of the configuration sub-nodes as a default configuration.
 
+Mandatory nodes
+~~~~~~~~~~~~~~~
+
+configuration-sub-node-unit-name
+    At least one of the configuration sub-nodes is required.
 
-7) Configuration nodes
-----------------------
+
+Configuration nodes
+-------------------
 
 Each configuration has the following structure::
 
@@ -251,27 +319,43 @@ Each configuration has the following structure::
         |- compatible = "vendor,board-style device tree compatible string"
 
 
-  Mandatory properties:
-  - description : Textual configuration description.
-  - kernel or firmware: Unit name of the corresponding kernel or firmware
+Mandatory properties
+~~~~~~~~~~~~~~~~~~~~
+
+description
+    Textual configuration description.
+
+kernel or firmware
+    Unit name of the corresponding kernel or firmware
     (u-boot, op-tee, etc) image. If both "kernel" and "firmware" are specified,
     control is passed to the firmware image.
 
-  Optional properties:
-  - fdt : Unit name of the corresponding fdt blob (component image node of a
+Optional properties
+~~~~~~~~~~~~~~~~~~~
+
+fdt
+    Unit name of the corresponding fdt blob (component image node of a
     "fdt type"). Additional fdt overlay nodes can be supplied which signify
     that the resulting device tree blob is generated by the first base fdt
     blob with all subsequent overlays applied.
-  - fpga : Unit name of the corresponding fpga bitstream blob
+
+fpga
+    Unit name of the corresponding fpga bitstream blob
     (component image node of a "fpga type").
-  - loadables : Unit name containing a list of additional binaries to be
+
+loadables
+    Unit name containing a list of additional binaries to be
     loaded at their given locations.  "loadables" is a comma-separated list
     of strings. U-Boot will load each binary at its given start-address and
     may optionally invoke additional post-processing steps on this binary based
     on its component image node type.
-  - script : The image to use when loading a U-Boot script (for use with the
+
+script
+    The image to use when loading a U-Boot script (for use with the
     source command).
-  - compatible : The root compatible string of the U-Boot device tree that
+
+compatible
+    The root compatible string of the U-Boot device tree that
     this configuration shall automatically match when CONFIG_FIT_BEST_MATCH is
     enabled. If this property is not provided, the compatible string will be
     extracted from the fdt blob instead. This is only possible if the fdt is
@@ -286,8 +370,8 @@ Older, 2.4 kernel and 2.6 non-FDT kernel do not use FDT blob, in such cases
 not* be specified in a configuration node.
 
 
-8) External data
-----------------
+External data
+-------------
 
 The above format shows a 'data' property which holds the data for each image.
 It is also possible for this data to reside outside the FIT itself. This
@@ -297,10 +381,12 @@ be loaded from an external source.
 
 In this case the 'data' property is omitted. Instead you can use:
 
-  - data-offset : offset of the data in a separate image store. The image
+data-offset
+    offset of the data in a separate image store. The image
     store is placed immediately after the last byte of the device tree binary,
     aligned to a 4-byte boundary.
-  - data-size : size of the data in bytes
+
+data-size : size of the data in bytes
 
 The 'data-offset' property can be substituted with 'data-position', which
 defines an absolute position or address as the offset. This is helpful when
@@ -316,7 +402,10 @@ to block(512 byte) for block device, so that we don't need to do the copy when
 read the image data in SPL. Pass '-B 0x200' to mkimage to align the FIT
 structure and data to 512 byte, other values available for other align size.
 
-9) Examples
------------
+Examples
+--------
 
 Please see `doc/uImage.FIT/*.its` for actual image source files.
+
+.. sectionauthor:: Marian Balakowicz <[email protected]>
+.. sectionauthor:: External data additions, 25/1/16 Simon Glass <[email protected]>
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#3 lore raw

PATCH v2 4/14 doc: Bring in the FIT examples

In reply to Simon Glass

Convert these to rST format and add them to the index.

---

(no changes since v1)

 doc/uImage.FIT/kernel.its                 |  91 ---------------
 doc/uImage.FIT/kernel_fdt.its             |  51 --------
 doc/uImage.FIT/kernel_fdts_compressed.its |  73 ------------
 doc/uImage.FIT/multi-with-fpga.its        |  68 -----------
 doc/uImage.FIT/multi-with-loadables.its   |  89 --------------
 doc/uImage.FIT/multi.its                  | 133 ---------------------
 doc/uImage.FIT/multi_spl.its              |  96 ---------------
 doc/uImage.FIT/sec_firmware_ppa.its       |  49 --------
 doc/uImage.FIT/sign-configs.its           |  45 -------
 doc/uImage.FIT/sign-images.its            |  42 -------
 doc/uImage.FIT/uefi.its                   |  67 -----------
 doc/uImage.FIT/update3.its                |  44 -------
 doc/uImage.FIT/update_uboot.its           |  24 ----
 doc/usage/fit/kernel.rst                  |  93 +++++++++++++++
 doc/usage/fit/kernel_fdt.rst              |  54 +++++++++
 doc/usage/fit/kernel_fdts_compressed.rst  |  77 ++++++++++++
 doc/usage/fit/multi-with-fpga.rst         |  70 +++++++++++
 doc/usage/fit/multi-with-loadables.rst    |  91 +++++++++++++++
 doc/usage/fit/multi.rst                   | 136 ++++++++++++++++++++++
 doc/usage/fit/multi_spl.rst               | 101 ++++++++++++++++
 doc/usage/fit/sec_firmware_ppa.rst        |  54 +++++++++
 doc/usage/fit/sign-configs.rst            |  52 +++++++++
 doc/usage/fit/sign-images.rst             |  49 ++++++++
 doc/usage/fit/source_file_format.rst      |  25 +++-
 doc/usage/fit/uefi.rst                    |  72 ++++++++++++
 doc/usage/fit/update3.rst                 |  47 ++++++++
 doc/usage/fit/update_uboot.rst            |  28 +++++
 27 files changed, 947 insertions(+), 874 deletions(-)
 delete mode 100644 doc/uImage.FIT/kernel.its
 delete mode 100644 doc/uImage.FIT/kernel_fdt.its
 delete mode 100644 doc/uImage.FIT/kernel_fdts_compressed.its
 delete mode 100644 doc/uImage.FIT/multi-with-fpga.its
 delete mode 100644 doc/uImage.FIT/multi-with-loadables.its
 delete mode 100644 doc/uImage.FIT/multi.its
 delete mode 100644 doc/uImage.FIT/multi_spl.its
 delete mode 100644 doc/uImage.FIT/sec_firmware_ppa.its
 delete mode 100644 doc/uImage.FIT/sign-configs.its
 delete mode 100644 doc/uImage.FIT/sign-images.its
 delete mode 100644 doc/uImage.FIT/uefi.its
 delete mode 100644 doc/uImage.FIT/update3.its
 delete mode 100644 doc/uImage.FIT/update_uboot.its
 create mode 100644 doc/usage/fit/kernel.rst
 create mode 100644 doc/usage/fit/kernel_fdt.rst
 create mode 100644 doc/usage/fit/kernel_fdts_compressed.rst
 create mode 100644 doc/usage/fit/multi-with-fpga.rst
 create mode 100644 doc/usage/fit/multi-with-loadables.rst
 create mode 100644 doc/usage/fit/multi.rst
 create mode 100644 doc/usage/fit/multi_spl.rst
 create mode 100644 doc/usage/fit/sec_firmware_ppa.rst
 create mode 100644 doc/usage/fit/sign-configs.rst
 create mode 100644 doc/usage/fit/sign-images.rst
 create mode 100644 doc/usage/fit/uefi.rst
 create mode 100644 doc/usage/fit/update3.rst
 create mode 100644 doc/usage/fit/update_uboot.rst
doc/uImage.FIT/kernel.its deleted +0 -91
deleted file mode 100644
index 77ddf622deb8..000000000000
@@ -1,91 +0,0 @@
-/*
- * Simple U-Boot uImage source file containing a single kernel
- */
-
-/dts-v1/;
-
-/ {
-	description = "Simple image with single Linux kernel";
-	#address-cells = <1>;
-
-	images {
-		kernel {
-			description = "Vanilla Linux kernel";
-			data = /incbin/("./vmlinux.bin.gz");
-			type = "kernel";
-			arch = "ppc";
-			os = "linux";
-			compression = "gzip";
-			load = <00000000>;
-			entry = <00000000>;
-			hash-1 {
-				algo = "crc32";
-			};
-			hash-2 {
-				algo = "sha1";
-			};
-		};
-	};
-
-	configurations {
-		default = "config-1";
-		config-1 {
-			description = "Boot Linux kernel";
-			kernel = "kernel";
-		};
-	};
-};
-
-
-
-For x86 a setup node is also required: see x86-fit-boot.txt.
-
-/dts-v1/;
-
-/ {
-	description = "Simple image with single Linux kernel on x86";
-	#address-cells = <1>;
-
-	images {
-		kernel {
-			description = "Vanilla Linux kernel";
-			data = /incbin/("./image.bin.lzo");
-			type = "kernel";
-			arch = "x86";
-			os = "linux";
-			compression = "lzo";
-			load = <0x01000000>;
-			entry = <0x00000000>;
-			hash-2 {
-				algo = "sha1";
-			};
-		};
-
-		setup {
-			description = "Linux setup.bin";
-			data = /incbin/("./setup.bin");
-			type = "x86_setup";
-			arch = "x86";
-			os = "linux";
-			compression = "none";
-			load = <0x00090000>;
-			entry = <0x00090000>;
-			hash-2 {
-				algo = "sha1";
-			};
-		};
-	};
-
-	configurations {
-		default = "config-1";
-		config-1 {
-			description = "Boot Linux kernel";
-			kernel = "kernel";
-			setup = "setup";
-		};
-	};
-};
-
-Note: the above assumes a 32-bit kernel. To directly boot a 64-bit kernel,
-change both arch values to "x86_64". U-Boot will then change to 64-bit mode
-before booting the kernel (see boot_linux_kernel()).
doc/uImage.FIT/kernel_fdt.its deleted +0 -51

51 lines not on this page · raw message

doc/uImage.FIT/kernel_fdts_compressed.its deleted +0 -73

73 lines not on this page · raw message

doc/uImage.FIT/multi-with-fpga.its deleted +0 -68

68 lines not on this page · raw message

doc/uImage.FIT/multi-with-loadables.its deleted +0 -89

89 lines not on this page · raw message

doc/uImage.FIT/multi.its deleted +0 -133

133 lines not on this page · raw message

doc/uImage.FIT/multi_spl.its deleted +0 -96

96 lines not on this page · raw message

doc/uImage.FIT/sec_firmware_ppa.its deleted +0 -49

49 lines not on this page · raw message

doc/uImage.FIT/sign-configs.its deleted +0 -45

45 lines not on this page · raw message

doc/uImage.FIT/sign-images.its deleted +0 -42

42 lines not on this page · raw message

doc/uImage.FIT/uefi.its deleted +0 -67

67 lines not on this page · raw message

doc/uImage.FIT/update3.its deleted +0 -44

44 lines not on this page · raw message

doc/uImage.FIT/update_uboot.its deleted +0 -24
deleted file mode 100644
index aec482600815..000000000000
@@ -1,24 +0,0 @@
-/*
- * Automatic software update for U-Boot
- * Make sure the flashing addresses ('load' prop) is correct for your board!
- */
-
-/dts-v1/;
-
-/ {
-	description = "Automatic U-Boot update";
-	#address-cells = <1>;
-
-	images {
-		update-1 {
-			description = "U-Boot binary";
-			data = /incbin/("./u-boot.bin");
-			compression = "none";
-			type = "firmware";
-			load = <0xFFFC0000>;
-			hash-1 {
-				algo = "sha1";
-			};
-		};
-	};
-};
doc/usage/fit/kernel.rst new file +93 -0

93 lines not on this page · raw message

doc/usage/fit/kernel_fdt.rst new file +54 -0

54 lines not on this page · raw message

doc/usage/fit/kernel_fdts_compressed.rst new file +77 -0

77 lines not on this page · raw message

doc/usage/fit/multi-with-fpga.rst new file +70 -0

70 lines not on this page · raw message

doc/usage/fit/multi-with-loadables.rst new file +91 -0

91 lines not on this page · raw message

doc/usage/fit/multi.rst new file +136 -0

136 lines not on this page · raw message

doc/usage/fit/multi_spl.rst new file +101 -0

101 lines not on this page · raw message

doc/usage/fit/sec_firmware_ppa.rst new file +54 -0

54 lines not on this page · raw message

doc/usage/fit/sign-configs.rst new file +52 -0

52 lines not on this page · raw message

doc/usage/fit/sign-images.rst new file +49 -0

49 lines not on this page · raw message

doc/usage/fit/source_file_format.rst +23 -2
index 7842256c226c..e27377342a15 100644
@@ -1,3 +1,5 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
 U-Boot new uImage source file format (bindings definition)
 ==========================================================
 
@@ -386,7 +388,8 @@ data-offset
     store is placed immediately after the last byte of the device tree binary,
     aligned to a 4-byte boundary.
 
-data-size : size of the data in bytes
+data-size
+    size of the data in bytes
 
 The 'data-offset' property can be substituted with 'data-position', which
 defines an absolute position or address as the offset. This is helpful when
@@ -405,7 +408,25 @@ structure and data to 512 byte, other values available for other align size.
 Examples
 --------
 
-Please see `doc/uImage.FIT/*.its` for actual image source files.
+Some example files are available here, showing various scenarios
+
+.. toctree::
+    :maxdepth: 1
+
+    kernel
+    kernel_fdt
+    kernel_fdts_compressed
+    kernel
+    multi
+    multi_spl
+    multi-with-fpga
+    multi-with-loadables
+    sec_firmware_ppa
+    sign-configs
+    sign-images
+    uefi
+    update3
+    update_uboot
 
 .. sectionauthor:: Marian Balakowicz <[email protected]>
 .. sectionauthor:: External data additions, 25/1/16 Simon Glass <[email protected]>
doc/usage/fit/uefi.rst new file +72 -0

72 lines not on this page · raw message

doc/usage/fit/update3.rst new file +47 -0

47 lines not on this page · raw message

doc/usage/fit/update_uboot.rst new file +28 -0
new file mode 100644
index 000000000000..a9288ee63679
@@ -0,0 +1,28 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Automatic software update
+=========================
+
+Make sure the flashing addresses ('load' prop) is correct for your board!
+
+::
+
+    /dts-v1/;
+
+    / {
+        description = "Automatic U-Boot update";
+        #address-cells = <1>;
+
+        images {
+            update-1 {
+                description = "U-Boot binary";
+                data = /incbin/("./u-boot.bin");
+                compression = "none";
+                type = "firmware";
+                load = <0xFFFC0000>;
+                hash-1 {
+                    algo = "sha1";
+                };
+            };
+        };
+    };
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#4 lore raw

PATCH v2 5/14 doc: Bring in FIT x86 boot

In reply to Simon Glass

Bring this file into the documentation.

---

(no changes since v1)

 doc/uImage.FIT/x86-fit-boot.txt | 272 --------------------------------
 doc/usage/fit/index.rst         |   1 +
 doc/usage/fit/x86-fit-boot.rst  | 269 +++++++++++++++++++++++++++++++
 3 files changed, 270 insertions(+), 272 deletions(-)
 delete mode 100644 doc/uImage.FIT/x86-fit-boot.txt
 create mode 100644 doc/usage/fit/x86-fit-boot.rst
doc/uImage.FIT/x86-fit-boot.txt deleted +0 -272
deleted file mode 100644
index 88d3460a83eb..000000000000
@@ -1,272 +0,0 @@
-Booting Linux on x86 with FIT
-=============================
-
-Background
-----------
-
-(corrections to the text below are welcome)
-
-Generally Linux x86 uses its own very complex booting method. There is a setup
-binary which contains all sorts of parameters and a compressed self-extracting
-binary for the kernel itself, often with a small built-in serial driver to
-display decompression progress.
-
-The x86 CPU has various processor modes. I am no expert on these, but my
-understanding is that an x86 CPU (even a really new one) starts up in a 16-bit
-'real' mode where only 1MB of memory is visible, moves to 32-bit 'protected'
-mode where 4GB is visible (or more with special memory access techniques) and
-then to 64-bit 'long' mode if 64-bit execution is required.
-
-Partly the self-extracting nature of Linux was introduced to cope with boot
-loaders that were barely capable of loading anything. Even changing to 32-bit
-mode was something of a challenge, so putting this logic in the kernel seemed
-to make sense.
-
-Bit by bit more and more logic has been added to this post-boot pre-Linux
-wrapper:
-
-- Changing to 32-bit mode
-- Decompression
-- Serial output (with drivers for various chips)
-- Load address randomisation
-- Elf loader complete with relocation (for the above)
-- Random number generator via 3 methods (again for the above)
-- Some sort of EFI mini-loader (1000+ glorious lines of code)
-- Locating and tacking on a device tree and ramdisk
-
-To my mind, if you sit back and look at things from first principles, this
-doesn't make a huge amount of sense. Any boot loader worth its salts already
-has most of the above features and more besides. The boot loader already knows
-the layout of memory, has a serial driver, can decompress things, includes an
-ELF loader and supports device tree and ramdisks. The decision to duplicate
-all these features in a Linux wrapper caters for the lowest common
-denominator: a boot loader which consists of a BIOS call to load something off
-disk, followed by a jmp instruction.
-
-(Aside: On ARM systems, we worry that the boot loader won't know where to load
-the kernel. It might be easier to just provide that information in the image,
-or in the boot loader rather than adding a self-relocator to put it in the
-right place. Or just use ELF?
-
-As a result, the x86 kernel boot process is needlessly complex. The file
-format is also complex, and obfuscates the contents to a degree that it is
-quite a challenge to extract anything from it. This bzImage format has become
-so prevalent that is actually isn't possible to produce the 'raw' kernel build
-outputs with the standard Makefile (as it is on ARM for example, at least at
-the time of writing).
-
-This document describes an alternative boot process which uses simple raw
-images which are loaded into the right place by the boot loader and then
-executed.
-
-
-Build the kernel
-----------------
-
-Note: these instructions assume a 32-bit kernel. U-Boot also supports directly
-booting a 64-bit kernel by jumping into 64-bit mode first (see below).
-
-You can build the kernel as normal with 'make'. This will create a file called
-'vmlinux'. This is a standard ELF file and you can look at it if you like:
-
-$ objdump -h vmlinux
-
-vmlinux:     file format elf32-i386
-
-Sections:
-Idx Name          Size      VMA       LMA       File off  Algn
-  0 .text         00416850  81000000  01000000  00001000  2**5
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
-  1 .notes        00000024  81416850  01416850  00417850  2**2
-                  CONTENTS, ALLOC, LOAD, READONLY, CODE
-  2 __ex_table    00000c50  81416880  01416880  00417880  2**3
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
-  3 .rodata       00154b9e  81418000  01418000  00419000  2**5
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
-  4 __bug_table   0000597c  8156cba0  0156cba0  0056dba0  2**0
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
-  5 .pci_fixup    00001b80  8157251c  0157251c  0057351c  2**2
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
-  6 .tracedata    00000024  8157409c  0157409c  0057509c  2**0
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
-  7 __ksymtab     00007ec0  815740c0  015740c0  005750c0  2**2
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
-  8 __ksymtab_gpl 00004a28  8157bf80  0157bf80  0057cf80  2**2
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
-  9 __ksymtab_strings 0001d6fc  815809a8  015809a8  005819a8  2**0
-                  CONTENTS, ALLOC, LOAD, READONLY, DATA
- 10 __init_rodata 00001c3c  8159e0a4  0159e0a4  0059f0a4  2**2
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
- 11 __param       00000ff0  8159fce0  0159fce0  005a0ce0  2**2
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
- 12 __modver      00000330  815a0cd0  015a0cd0  005a1cd0  2**2
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
- 13 .data         00063000  815a1000  015a1000  005a2000  2**12
-                  CONTENTS, ALLOC, LOAD, RELOC, DATA
- 14 .init.text    0002f104  81604000  01604000  00605000  2**2
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
- 15 .init.data    00040cdc  81634000  01634000  00635000  2**12
-                  CONTENTS, ALLOC, LOAD, RELOC, DATA
- 16 .x86_cpu_dev.init 0000001c  81674cdc  01674cdc  00675cdc  2**2
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
- 17 .altinstructions 0000267c  81674cf8  01674cf8  00675cf8  2**0
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
- 18 .altinstr_replacement 00000942  81677374  01677374  00678374  2**0
-                  CONTENTS, ALLOC, LOAD, READONLY, CODE
- 19 .iommu_table  00000014  81677cb8  01677cb8  00678cb8  2**2
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
- 20 .apicdrivers  00000004  81677cd0  01677cd0  00678cd0  2**2
-                  CONTENTS, ALLOC, LOAD, RELOC, DATA
- 21 .exit.text    00001a80  81677cd8  01677cd8  00678cd8  2**0
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
- 22 .data..percpu 00007880  8167a000  0167a000  0067b000  2**12
-                  CONTENTS, ALLOC, LOAD, RELOC, DATA
- 23 .smp_locks    00003000  81682000  01682000  00683000  2**2
-                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
- 24 .bss          000a1000  81685000  01685000  00686000  2**12
-                  ALLOC
- 25 .brk          00424000  81726000  01726000  00686000  2**0
-                  ALLOC
- 26 .comment      00000049  00000000  00000000  00686000  2**0
-                  CONTENTS, READONLY
- 27 .GCC.command.line 0003e055  00000000  00000000  00686049  2**0
-                  CONTENTS, READONLY
- 28 .debug_aranges 0000f4c8  00000000  00000000  006c40a0  2**3
-                  CONTENTS, RELOC, READONLY, DEBUGGING
- 29 .debug_info   0440b0df  00000000  00000000  006d3568  2**0
-                  CONTENTS, RELOC, READONLY, DEBUGGING
- 30 .debug_abbrev 0022a83b  00000000  00000000  04ade647  2**0
-                  CONTENTS, READONLY, DEBUGGING
- 31 .debug_line   004ead0d  00000000  00000000  04d08e82  2**0
-                  CONTENTS, RELOC, READONLY, DEBUGGING
- 32 .debug_frame  0010a960  00000000  00000000  051f3b90  2**2
-                  CONTENTS, RELOC, READONLY, DEBUGGING
- 33 .debug_str    001b442d  00000000  00000000  052fe4f0  2**0
-                  CONTENTS, READONLY, DEBUGGING
- 34 .debug_loc    007c7fa9  00000000  00000000  054b291d  2**0
-                  CONTENTS, RELOC, READONLY, DEBUGGING
- 35 .debug_ranges 00098828  00000000  00000000  05c7a8c8  2**3
-                  CONTENTS, RELOC, READONLY, DEBUGGING
-
-There is also the setup binary mentioned earlier. This is at
-arch/x86/boot/setup.bin and is about 12KB in size. It includes the command
-line and various settings need by the kernel. Arguably the boot loader should
-provide all of this also, but setting it up is some complex that the kernel
-helps by providing a head start.
-
-As you can see the code loads to address 0x01000000 and everything else
-follows after that. We could load this image using the 'bootelf' command but
-we would still need to provide the setup binary. This is not supported by
-U-Boot although I suppose you could mostly script it. This would permit the
-use of a relocatable kernel.
-
-All we need to boot is the vmlinux file and the setup.bin file.
-
-
-Create a FIT
-------------
-
-To create a FIT you will need a source file describing what should go in the
-FIT. See kernel.its for an example for x86 and also instructions on setting
-the 'arch' value for booting 64-bit kernels if desired. Put this into a file
-called image.its.
-
-Note that setup is loaded to the special address of 0x90000 (a special address
-you just have to know) and the kernel is loaded to 0x01000000 (the address you
-saw above). This means that you will need to load your FIT to a different
-address so that U-Boot doesn't overwrite it when decompressing. Something like
-0x02000000 will do so you can set CONFIG_SYS_LOAD_ADDR to that.
-
-In that example the kernel is compressed with lzo. Also we need to provide a
-flat binary, not an ELF. So the steps needed to set things are are:
-
-   # Create a flat binary
-   objcopy -O binary vmlinux vmlinux.bin
-
-   # Compress it into LZO format
-   lzop vmlinux.bin
-
-   # Build a FIT image
-   mkimage -f image.its image.fit
-
-(be careful to run the mkimage from your U-Boot tools directory since it
-will have x86_setup support.)
-
-You can take a look at the resulting fit file if you like:
-
-$ dumpimage -l image.fit
-FIT description: Simple image with single Linux kernel on x86
-Created:         Tue Oct  7 10:57:24 2014
- Image 0 (kernel)
-  Description:  Vanilla Linux kernel
-  Created:      Tue Oct  7 10:57:24 2014
-  Type:         Kernel Image
-  Compression:  lzo compressed
-  Data Size:    4591767 Bytes = 4484.15 kB = 4.38 MB
-  Architecture: Intel x86
-  OS:           Linux
-  Load Address: 0x01000000
-  Entry Point:  0x00000000
-  Hash algo:    sha1
-  Hash value:   446b5163ebfe0fb6ee20cbb7a8501b263cd92392
- Image 1 (setup)
-  Description:  Linux setup.bin
-  Created:      Tue Oct  7 10:57:24 2014
-  Type:         x86 setup.bin
-  Compression:  uncompressed
-  Data Size:    12912 Bytes = 12.61 kB = 0.01 MB
-  Hash algo:    sha1
-  Hash value:   a1f2099cf47ff9816236cd534c77af86e713faad
- Default Configuration: 'config-1'
- Configuration 0 (config-1)
-  Description:  Boot Linux kernel
-  Kernel:       kernel
-
-
-Booting the FIT
----------------
-
-To make it boot you need to load it and then use 'bootm' to boot it. A
-suitable script to do this from a network server is:
-
-   bootp
-   tftp image.fit
-   bootm
-
-This will load the image from the network and boot it. The command line (from
-the 'bootargs' environment variable) will be passed to the kernel.
-
-If you want a ramdisk you can add it as normal with FIT. If you want a device
-tree then x86 doesn't normally use those - it has ACPI instead.
-
-
-Why Bother?
------------
-
-1. It demystifies the process of booting an x86 kernel
-2. It allows use of the standard U-Boot boot file format
-3. It allows U-Boot to perform decompression - problems will provide an error
-message and you are still in the boot loader. It is possible to investigate.
-4. It avoids all the pre-loader code in the kernel which is quite complex to
-follow
-5. You can use verified/secure boot and other features which haven't yet been
-added to the pre-Linux
-6. It makes x86 more like other architectures in the way it boots a kernel.
-You can potentially use the same file format for the kernel, and the same
-procedure for building and packaging it.
-
-
-References
-----------
-
-In the Linux kernel, Documentation/x86/boot.txt defines the boot protocol for
-the kernel including the setup.bin format. This is handled in U-Boot in
-arch/x86/lib/zimage.c and arch/x86/lib/bootm.c.
-
-Various files in the same directory as this file describe the FIT format.
-
-
---
-Simon Glass
[email protected]
-7-Oct-2014
doc/usage/fit/index.rst +1 -0
index 93a962319035..0635d06b811a 100644
@@ -11,3 +11,4 @@ doc/uImage.FIT
     :maxdepth: 1
 
     source_file_format
+    x86-fit-boot
doc/usage/fit/x86-fit-boot.rst new file +269 -0

269 lines not on this page · raw message

Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#5 lore raw

PATCH v2 6/14 doc: Bring in FIT signature files

In reply to Simon Glass

Bring these files into the documentation.

Fix 'wtih' and 'it' typos and repeated 'could' while we are here.

---

Changes in v2:
- Tidy up indentation nits

 doc/uImage.FIT/beaglebone_vboot.txt           | 607 --------------
 doc/uImage.FIT/signature.txt                  | 707 ----------------
 doc/usage/cmd/source.rst                      |   2 +-
 doc/usage/fit/beaglebone_vboot.rst            | 612 ++++++++++++++
 doc/usage/fit/index.rst                       |   3 +
 doc/usage/fit/signature.rst                   | 760 ++++++++++++++++++
 .../fit/verified-boot.rst}                    |  83 +-
 7 files changed, 1419 insertions(+), 1355 deletions(-)
 delete mode 100644 doc/uImage.FIT/beaglebone_vboot.txt
 delete mode 100644 doc/uImage.FIT/signature.txt
 create mode 100644 doc/usage/fit/beaglebone_vboot.rst
 create mode 100644 doc/usage/fit/signature.rst
 rename doc/{uImage.FIT/verified-boot.txt => usage/fit/verified-boot.rst} (54%)
doc/uImage.FIT/beaglebone_vboot.txt deleted +0 -607
deleted file mode 100644
index ebd2068ed38d..000000000000
@@ -1,607 +0,0 @@
-Verified Boot on the Beaglebone Black
-=====================================
-
-Introduction
-------------
-
-Before reading this, please read verified-boot.txt and signature.txt. These
-instructions are for mainline U-Boot from v2014.07 onwards.
-
-There is quite a bit of documentation in this directory describing how
-verified boot works in U-Boot. There is also a test which runs through the
-entire process of signing an image and running U-Boot (sandbox) to check it.
-However, it might be useful to also have an example on a real board.
-
-Beaglebone Black is a fairly common board so seems to be a reasonable choice
-for an example of how to enable verified boot using U-Boot.
-
-First a note that may to help avoid confusion. U-Boot and Linux both use
-device tree. They may use the same device tree source, but it is seldom useful
-for them to use the exact same binary from the same place. More typically,
-U-Boot has its device tree packaged wtih it, and the kernel's device tree is
-packaged with the kernel. In particular this is important with verified boot,
-since U-Boot's device tree must be immutable. If it can be changed then the
-public keys can be changed and verified boot is useless. An attacker can
-simply generate a new key and put his public key into U-Boot so that
-everything verifies. On the other hand the kernel's device tree typically
-changes when the kernel changes, so it is useful to package an updated device
-tree with the kernel binary. U-Boot supports the latter with its flexible FIT
-format (Flat Image Tree).
-
-
-Overview
---------
-
-The steps are roughly as follows:
-
-1. Build U-Boot for the board, with the verified boot options enabled.
-
-2. Obtain a suitable Linux kernel
-
-3. Create a Image Tree Source file (ITS) file describing how you want the
-kernel to be packaged, compressed and signed.
-
-4. Create a key pair
-
-5. Sign the kernel
-
-6. Put the public key into U-Boot's image
-
-7. Put U-Boot and the kernel onto the board
-
-8. Try it
-
-
-Step 1: Build U-Boot
---------------------
-
-a. Set up the environment variable to point to your toolchain. You will need
-this for U-Boot and also for the kernel if you build it. For example if you
-installed a Linaro version manually it might be something like:
-
-   export CROSS_COMPILE=/opt/linaro/gcc-linaro-arm-linux-gnueabihf-4.8-2013.08_linux/bin/arm-linux-gnueabihf-
-
-or if you just installed gcc-arm-linux-gnueabi then it might be
-
-   export CROSS_COMPILE=arm-linux-gnueabi-
-
-b. Configure and build U-Boot with verified boot enabled:
-
-   export UBOOT=/path/to/u-boot
-   cd $UBOOT
-   # You can add -j10 if you have 10 CPUs to make it faster
-   make O=b/am335x_boneblack_vboot am335x_boneblack_vboot_config all
-   export UOUT=$UBOOT/b/am335x_boneblack_vboot
-
-c. You will now have a U-Boot image:
-
-   file b/am335x_boneblack_vboot/u-boot-dtb.img
-b/am335x_boneblack_vboot/u-boot-dtb.img: u-boot legacy uImage, U-Boot 2014.07-rc2-00065-g2f69f8, Firmware/ARM, Firmware Image (Not compressed), 395375 bytes, Sat May 31 16:19:04 2014, Load Address: 0x80800000, Entry Point: 0x00000000, Header CRC: 0x0ABD6ACA, Data CRC: 0x36DEF7E4
-
-
-Step 2: Build Linux
---------------------
-
-a. Find the kernel image ('Image') and device tree (.dtb) file you plan to
-use. In our case it is am335x-boneblack.dtb and it is built with the kernel.
-At the time of writing an SD Boot image can be obtained from here:
-
-   http://www.elinux.org/Beagleboard:Updating_The_Software#Image_For_Booting_From_microSD
-
-You can write this to an SD card and then mount it to extract the kernel and
-device tree files.
-
-You can also build a kernel. Instructions for this are are here:
-
-   http://elinux.org/Building_BBB_Kernel
-
-or you can use your favourite search engine. Following these instructions
-produces a kernel Image and device tree files. For the record the steps were:
-
-   export KERNEL=/path/to/kernel
-   cd $KERNEL
-   git clone git://github.com/beagleboard/kernel.git .
-   git checkout v3.14
-   ./patch.sh
-   cp configs/beaglebone kernel/arch/arm/configs/beaglebone_defconfig
-   cd kernel
-   make beaglebone_defconfig
-   make uImage dtbs   # -j10 if you have 10 CPUs
-   export OKERNEL=$KERNEL/kernel/arch/arm/boot
-
-c. You now have the 'Image' and 'am335x-boneblack.dtb' files needed to boot.
-
-
-Step 3: Create the ITS
-----------------------
-
-Set up a directory for your work.
-
-   export WORK=/path/to/dir
-   cd $WORK
-
-Put this into a file in that directory called sign.its:
-
-/dts-v1/;
-
-/ {
-	description = "Beaglebone black";
-	#address-cells = <1>;
-
-	images {
-		kernel {
-			data = /incbin/("Image.lzo");
-			type = "kernel";
-			arch = "arm";
-			os = "linux";
-			compression = "lzo";
-			load = <0x80008000>;
-			entry = <0x80008000>;
-			hash-1 {
-				algo = "sha1";
-			};
-		};
-		fdt-1 {
-			description = "beaglebone-black";
-			data = /incbin/("am335x-boneblack.dtb");
-			type = "flat_dt";
-			arch = "arm";
-			compression = "none";
-			hash-1 {
-				algo = "sha1";
-			};
-		};
-	};
-	configurations {
-		default = "conf-1";
-		conf-1 {
-			kernel = "kernel";
-			fdt = "fdt-1";
-			signature-1 {
-				algo = "sha1,rsa2048";
-				key-name-hint = "dev";
-				sign-images = "fdt", "kernel";
-			};
-		};
-	};
-};
-
-
-The explanation for this is all in the documentation you have already read.
-But briefly it packages a kernel and device tree, and provides a single
-configuration to be signed with a key named 'dev'. The kernel is compressed
-with LZO to make it smaller.
-
-
-Step 4: Create a key pair
--------------------------
-
-See signature.txt for details on this step.
-
-   cd $WORK
-   mkdir keys
-   openssl genrsa -F4 -out keys/dev.key 2048
-   openssl req -batch -new -x509 -key keys/dev.key -out keys/dev.crt
-
-Note: keys/dev.key contains your private key and is very secret. If anyone
-gets access to that file they can sign kernels with it. Keep it secure.
-
-
-Step 5: Sign the kernel
------------------------
-
-We need to use mkimage (which was built when you built U-Boot) to package the
-Linux kernel into a FIT (Flat Image Tree, a flexible file format that U-Boot
-can load) using the ITS file you just created.
-
-At the same time we must put the public key into U-Boot device tree, with the
-'required' property, which tells U-Boot that this key must be verified for the
-image to be valid. You will make this key available to U-Boot for booting in
-step 6.
-
-   ln -s $OKERNEL/dts/am335x-boneblack.dtb
-   ln -s $OKERNEL/Image
-   ln -s $UOUT/u-boot-dtb.img
-   cp $UOUT/arch/arm/dts/am335x-boneblack.dtb am335x-boneblack-pubkey.dtb
-   lzop Image
-   $UOUT/tools/mkimage -f sign.its -K am335x-boneblack-pubkey.dtb -k keys -r image.fit
-
-You should see something like this:
-
-FIT description: Beaglebone black
-Created:         Sun Jun  1 12:50:30 2014
- Image 0 (kernel)
-  Description:  unavailable
-  Created:      Sun Jun  1 12:50:30 2014
-  Type:         Kernel Image
-  Compression:  lzo compressed
-  Data Size:    7790938 Bytes = 7608.34 kB = 7.43 MB
-  Architecture: ARM
-  OS:           Linux
-  Load Address: 0x80008000
-  Entry Point:  0x80008000
-  Hash algo:    sha1
-  Hash value:   c94364646427e10f423837e559898ef02c97b988
- Image 1 (fdt-1)
-  Description:  beaglebone-black
-  Created:      Sun Jun  1 12:50:30 2014
-  Type:         Flat Device Tree
-  Compression:  uncompressed
-  Data Size:    31547 Bytes = 30.81 kB = 0.03 MB
-  Architecture: ARM
-  Hash algo:    sha1
-  Hash value:   cb09202f889d824f23b8e4404b781be5ad38a68d
- Default Configuration: 'conf-1'
- Configuration 0 (conf-1)
-  Description:  unavailable
-  Kernel:       kernel
-  FDT:          fdt-1
-
-
-Now am335x-boneblack-pubkey.dtb contains the public key and image.fit contains
-the signed kernel. Jump to step 6 if you like, or continue reading to increase
-your understanding.
-
-You can also run fit_check_sign to check it:
-
-   $UOUT/tools/fit_check_sign -f image.fit -k am335x-boneblack-pubkey.dtb
-
-which results in:
-
-Verifying Hash Integrity ... sha1,rsa2048:dev+
-## Loading kernel from FIT Image at 7fc6ee469000 ...
-   Using 'conf-1' configuration
-   Verifying Hash Integrity ...
-sha1,rsa2048:dev+
-OK
-
-   Trying 'kernel' kernel subimage
-     Description:  unavailable
-     Created:      Sun Jun  1 12:50:30 2014
-     Type:         Kernel Image
-     Compression:  lzo compressed
-     Data Size:    7790938 Bytes = 7608.34 kB = 7.43 MB
-     Architecture: ARM
-     OS:           Linux
-     Load Address: 0x80008000
-     Entry Point:  0x80008000
-     Hash algo:    sha1
-     Hash value:   c94364646427e10f423837e559898ef02c97b988
-   Verifying Hash Integrity ...
-sha1+
-OK
-
-Unimplemented compression type 4
-## Loading fdt from FIT Image at 7fc6ee469000 ...
-   Using 'conf-1' configuration
-   Trying 'fdt-1' fdt subimage
-     Description:  beaglebone-black
-     Created:      Sun Jun  1 12:50:30 2014
-     Type:         Flat Device Tree
-     Compression:  uncompressed
-     Data Size:    31547 Bytes = 30.81 kB = 0.03 MB
-     Architecture: ARM
-     Hash algo:    sha1
-     Hash value:   cb09202f889d824f23b8e4404b781be5ad38a68d
-   Verifying Hash Integrity ...
-sha1+
-OK
-
-   Loading Flat Device Tree ... OK
-
-## Loading ramdisk from FIT Image at 7fc6ee469000 ...
-   Using 'conf-1' configuration
-Could not find subimage node
-
-Signature check OK
-
-
-At the top, you see "sha1,rsa2048:dev+". This means that it checked an RSA key
-of size 2048 bits using SHA1 as the hash algorithm. The key name checked was
-'dev' and the '+' means that it verified. If it showed '-' that would be bad.
-
-Once the configuration is verified it is then possible to rely on the hashes
-in each image referenced by that configuration. So fit_check_sign goes on to
-load each of the images. We have a kernel and an FDT but no ramkdisk. In each
-case fit_check_sign checks the hash and prints sha1+ meaning that the SHA1
-hash verified. This means that none of the images has been tampered with.
-
-There is a test in test/vboot which uses U-Boot's sandbox build to verify that
-the above flow works.
-
-But it is fun to do this by hand, so you can load image.fit into a hex editor
-like ghex, and change a byte in the kernel:
-
-   $UOUT/tools/fit_info -f image.fit -n /images/kernel -p data
-NAME: kernel
-LEN: 7790938
-OFF: 168
-
-This tells us that the kernel starts at byte offset 168 (decimal) in image.fit
-and extends for about 7MB. Try changing a byte at 0x2000 (say) and run
-fit_check_sign again. You should see something like:
-
-Verifying Hash Integrity ... sha1,rsa2048:dev+
-## Loading kernel from FIT Image at 7f5a39571000 ...
-   Using 'conf-1' configuration
-   Verifying Hash Integrity ...
-sha1,rsa2048:dev+
-OK
-
-   Trying 'kernel' kernel subimage
-     Description:  unavailable
-     Created:      Sun Jun  1 13:09:21 2014
-     Type:         Kernel Image
-     Compression:  lzo compressed
-     Data Size:    7790938 Bytes = 7608.34 kB = 7.43 MB
-     Architecture: ARM
-     OS:           Linux
-     Load Address: 0x80008000
-     Entry Point:  0x80008000
-     Hash algo:    sha1
-     Hash value:   c94364646427e10f423837e559898ef02c97b988
-   Verifying Hash Integrity ...
-sha1 error
-Bad hash value for 'hash-1' hash node in 'kernel' image node
-Bad Data Hash
-
-## Loading fdt from FIT Image at 7f5a39571000 ...
-   Using 'conf-1' configuration
-   Trying 'fdt-1' fdt subimage
-     Description:  beaglebone-black
-     Created:      Sun Jun  1 13:09:21 2014
-     Type:         Flat Device Tree
-     Compression:  uncompressed
-     Data Size:    31547 Bytes = 30.81 kB = 0.03 MB
-     Architecture: ARM
-     Hash algo:    sha1
-     Hash value:   cb09202f889d824f23b8e4404b781be5ad38a68d
-   Verifying Hash Integrity ...
-sha1+
-OK
-
-   Loading Flat Device Tree ... OK
-
-## Loading ramdisk from FIT Image at 7f5a39571000 ...
-   Using 'conf-1' configuration
-Could not find subimage node
-
-Signature check Bad (error 1)
-
-
-It has detected the change in the kernel.
-
-You can also be sneaky and try to switch images, using the libfdt utilities
-that come with dtc (package name is device-tree-compiler but you will need a
-recent version like 1.4:
-
-   dtc -v
-Version: DTC 1.4.0
-
-First we can check which nodes are actually hashed by the configuration:
-
-   fdtget -l image.fit /
-images
-configurations
-
-   fdtget -l image.fit /configurations
-conf-1
-fdtget -l image.fit /configurations/conf-1
-signature-1
-
-   fdtget -p image.fit /configurations/conf-1/signature-1
-hashed-strings
-hashed-nodes
-timestamp
-signer-version
-signer-name
-value
-algo
-key-name-hint
-sign-images
-
-   fdtget image.fit /configurations/conf-1/signature-1 hashed-nodes
-/ /configurations/conf-1 /images/fdt-1 /images/fdt-1/hash /images/kernel /images/kernel/hash-1
-
-This gives us a bit of a look into the signature that mkimage added. Note you
-can also use fdtdump to list the entire device tree.
-
-Say we want to change the kernel that this configuration uses
-(/images/kernel). We could just put a new kernel in the image, but we will
-need to change the hash to match. Let's simulate that by changing a byte of
-the hash:
-
-    fdtget -tx image.fit /images/kernel/hash-1 value
-c9436464 6427e10f 423837e5 59898ef0 2c97b988
-    fdtput -tx image.fit /images/kernel/hash-1 value c9436464 6427e10f 423837e5 59898ef0 2c97b981
-
-Now check it again:
-
-   $UOUT/tools/fit_check_sign -f image.fit -k am335x-boneblack-pubkey.dtb
-Verifying Hash Integrity ... sha1,rsa2048:devrsa_verify_with_keynode: RSA failed to verify: -13
-rsa_verify_with_keynode: RSA failed to verify: -13
--
-Failed to verify required signature 'key-dev'
-Signature check Bad (error 1)
-
-This time we don't even get as far as checking the images, since the
-configuration signature doesn't match. We can't change any hashes without the
-signature check noticing. The configuration is essentially locked. U-Boot has
-a public key for which it requires a match, and will not permit the use of any
-configuration that does not match that public key. The only way the
-configuration will match is if it was signed by the matching private key.
-
-It would also be possible to add a new signature node that does match your new
-configuration. But that won't work since you are not allowed to change the
-configuration in any way. Try it with a fresh (valid) image if you like by
-running the mkimage link again. Then:
-
-   fdtput -p image.fit /configurations/conf-1/signature-1 value fred
-   $UOUT/tools/fit_check_sign -f image.fit -k am335x-boneblack-pubkey.dtb
-Verifying Hash Integrity ... -
-sha1,rsa2048:devrsa_verify_with_keynode: RSA failed to verify: -13
-rsa_verify_with_keynode: RSA failed to verify: -13
--
-Failed to verify required signature 'key-dev'
-Signature check Bad (error 1)
-
-
-Of course it would be possible to add an entirely new configuration and boot
-with that, but it still needs to be signed, so it won't help.
-
-
-6. Put the public key into U-Boot's image
------------------------------------------
-
-Having confirmed that the signature is doing its job, let's try it out in
-U-Boot on the board. U-Boot needs access to the public key corresponding to
-the private key that you signed with so that it can verify any kernels that
-you sign.
-
-   cd $UBOOT
-   make O=b/am335x_boneblack_vboot EXT_DTB=${WORK}/am335x-boneblack-pubkey.dtb
-
-Here we are overriding the normal device tree file with our one, which
-contains the public key.
-
-Now you have a special U-Boot image with the public key. It can verify can
-kernel that you sign with the private key as in step 5.
-
-If you like you can take a look at the public key information that mkimage
-added to U-Boot's device tree:
-
-   fdtget -p am335x-boneblack-pubkey.dtb /signature/key-dev
-required
-algo
-rsa,r-squared
-rsa,modulus
-rsa,n0-inverse
-rsa,num-bits
-key-name-hint
-
-This has information about the key and some pre-processed values which U-Boot
-can use to verify against it. These values are obtained from the public key
-certificate by mkimage, but require quite a bit of code to generate. To save
-code space in U-Boot, the information is extracted and written in raw form for
-U-Boot to easily use. The same mechanism is used in Google's Chrome OS.
-
-Notice the 'required' property. This marks the key as required - U-Boot will
-not boot any image that does not verify against this key.
-
-
-7. Put U-Boot and the kernel onto the board
--------------------------------------------
-
-The method here varies depending on how you are booting. For this example we
-are booting from an micro-SD card with two partitions, one for U-Boot and one
-for Linux. Put it into your machine and write U-Boot and the kernel to it.
-Here the card is /dev/sde:
-
-   cd $WORK
-   export UDEV=/dev/sde1   # Change thes two lines to the correct device
-   export KDEV=/dev/sde2
-   sudo mount $UDEV /mnt/tmp && sudo cp $UOUT/u-boot-dtb.img /mnt/tmp/u-boot.img  && sleep 1 && sudo umount $UDEV
-   sudo mount $KDEV /mnt/tmp && sudo cp $WORK/image.fit /mnt/tmp/boot/image.fit && sleep 1 && sudo umount $KDEV
-
-
-8. Try it
----------
-
-Boot the board using the commands below:
-
-   setenv bootargs console=ttyO0,115200n8 quiet root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait
-   ext2load mmc 0:2 82000000 /boot/image.fit
-   bootm 82000000
-
-You should then see something like this:
-
-U-Boot# setenv bootargs console=ttyO0,115200n8 quiet root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait
-U-Boot# ext2load mmc 0:2 82000000 /boot/image.fit
-7824930 bytes read in 589 ms (12.7 MiB/s)
-U-Boot# bootm 82000000
-## Loading kernel from FIT Image at 82000000 ...
-   Using 'conf-1' configuration
-   Verifying Hash Integrity ... sha1,rsa2048:dev+ OK
-   Trying 'kernel' kernel subimage
-     Description:  unavailable
-     Created:      2014-06-01  19:32:54 UTC
-     Type:         Kernel Image
-     Compression:  lzo compressed
-     Data Start:   0x820000a8
-     Data Size:    7790938 Bytes = 7.4 MiB
-     Architecture: ARM
-     OS:           Linux
-     Load Address: 0x80008000
-     Entry Point:  0x80008000
-     Hash algo:    sha1
-     Hash value:   c94364646427e10f423837e559898ef02c97b988
-   Verifying Hash Integrity ... sha1+ OK
-## Loading fdt from FIT Image at 82000000 ...
-   Using 'conf-1' configuration
-   Trying 'fdt-1' fdt subimage
-     Description:  beaglebone-black
-     Created:      2014-06-01  19:32:54 UTC
-     Type:         Flat Device Tree
-     Compression:  uncompressed
-     Data Start:   0x8276e2ec
-     Data Size:    31547 Bytes = 30.8 KiB
-     Architecture: ARM
-     Hash algo:    sha1
-     Hash value:   cb09202f889d824f23b8e4404b781be5ad38a68d
-   Verifying Hash Integrity ... sha1+ OK
-   Booting using the fdt blob at 0x8276e2ec
-   Uncompressing Kernel Image ... OK
-   Loading Device Tree to 8fff5000, end 8ffffb3a ... OK
-
-Starting kernel ...
-
-[    0.582377] omap_init_mbox: hwmod doesn't have valid attrs
-[    2.589651] musb-hdrc musb-hdrc.0.auto: Failed to request rx1.
-[    2.595830] musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517
-[    2.606470] musb-hdrc musb-hdrc.1.auto: Failed to request rx1.
-[    2.612723] musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -517
-[    2.940808] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
-[    7.248889] libphy: PHY 4a101000.mdio:01 not found
-[    7.253995] net eth0: phy 4a101000.mdio:01 not found on slave 1
-systemd-fsck[83]: Angstrom: clean, 50607/218160 files, 306348/872448 blocks
-
-.---O---.
-|       |                  .-.           o o
-|   |   |-----.-----.-----.| |   .----..-----.-----.
-|       |     | __  |  ---'| '--.|  .-'|     |     |
-|   |   |  |  |     |---  ||  --'|  |  |  '  | | | |
-'---'---'--'--'--.  |-----''----''--'  '-----'-'-'-'
-                -'  |
-                '---'
-
-The Angstrom Distribution beaglebone ttyO0
-
-Angstrom v2012.12 - Kernel 3.14.1+
-
-beaglebone login:
-
-At this point your kernel has been verified and you can be sure that it is one
-that you signed. As an exercise, try changing image.fit as in step 5 and see
-what happens.
-
-
-Further Improvements
---------------------
-
-Several of the steps here can be easily automated. In particular it would be
-capital if signing and packaging a kernel were easy, perhaps a simple make
-target in the kernel.
-
-Some mention of how to use multiple .dtb files in a FIT might be useful.
-
-U-Boot's verified boot mechanism has not had a robust and independent security
-review. Such a review should look at the implementation and its resistance to
-attacks.
-
-Perhaps the verified boot feature could could be integrated into the Amstrom
-distribution.
-
-
-Simon Glass
[email protected]
-2-June-14
doc/uImage.FIT/signature.txt deleted +0 -707

707 lines not on this page · raw message

doc/usage/cmd/source.rst +1 -1
index a5c5204a28b8..697f644745b2 100644
@@ -22,7 +22,7 @@ Two formats for script files exist:
 * Flat Image Tree (FIT)
 
 The benefit of the FIT images is that they can be signed and verifed as
-decribed in :download:`signature.txt <../../uImage.FIT/signature.txt>`.
+described in :doc:`../fit/signature`.
 
 Both formats can be created with the mkimage tool.
 
doc/usage/fit/beaglebone_vboot.rst new file +612 -0

612 lines not on this page · raw message

doc/usage/fit/index.rst +3 -0
index 0635d06b811a..0576675ec001 100644
@@ -12,3 +12,6 @@ doc/uImage.FIT
 
     source_file_format
     x86-fit-boot
+    signature
+    verified-boot
+    beaglebone_vboot
doc/usage/fit/signature.rst new file +760 -0

760 lines not on this page · raw message

doc/usage/fit/verified-boot.rst renamed from doc/uImage.FIT/verified-boot.txt +43 -40

120 lines not on this page · raw message

Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#6 lore raw

PATCH v2 7/14 doc: Bring in the FIT howto

In reply to Simon Glass

Bring this file into the documentation.

---

(no changes since v1)

 doc/uImage.FIT/howto.txt | 411 --------------------------------------
 doc/usage/fit/howto.rst  | 419 +++++++++++++++++++++++++++++++++++++++
 doc/usage/fit/index.rst  |   1 +
 3 files changed, 420 insertions(+), 411 deletions(-)
 delete mode 100644 doc/uImage.FIT/howto.txt
 create mode 100644 doc/usage/fit/howto.rst
doc/uImage.FIT/howto.txt deleted +0 -411
deleted file mode 100644
index 6dbd17dc8ca0..000000000000
@@ -1,411 +0,0 @@
-How to use images in the new image format
-=========================================
-
-Author: Bartlomiej Sieka <[email protected]>
-
-
-Overview
---------
-
-The new uImage format allows more flexibility in handling images of various
-types (kernel, ramdisk, etc.), it also enhances integrity protection of images
-with sha1 and md5 checksums.
-
-Two auxiliary tools are needed on the development host system in order to
-create an uImage in the new format: mkimage and dtc, although only one
-(mkimage) is invoked directly. dtc is called from within mkimage and operates
-behind the scenes, but needs to be present in the $PATH nevertheless. It is
-important that the dtc used has support for binary includes -- refer to
-
-	git://git.kernel.org/pub/scm/utils/dtc/dtc.git
-
-for its latest version. mkimage (together with dtc) takes as input
-an image source file, which describes the contents of the image and defines
-its various properties used during booting. By convention, image source file
-has the ".its" extension, also, the details of its format are given in
-doc/uImage.FIT/source_file_format.txt. The actual data that is to be included in
-the uImage (kernel, ramdisk, etc.) is specified in the image source file in the
-form of paths to appropriate data files. The outcome of the image creation
-process is a binary file (by convention with the ".itb" extension) that
-contains all the referenced data (kernel, ramdisk, etc.) and other information
-needed by U-Boot to handle the uImage properly. The uImage file is then
-transferred to the target (e.g., via tftp) and booted using the bootm command.
-
-To summarize the prerequisites needed for new uImage creation:
-- mkimage
-- dtc (with support for binary includes)
-- image source file (*.its)
-- image data file(s)
-
-
-Here's a graphical overview of the image creation and booting process:
-
-image source file     mkimage + dtc		  transfer to target
-	+	     ---------------> image file --------------------> bootm
-image data file(s)
-
-SPL usage
----------
-
-The SPL can make use of the new image format as well, this traditionally
-is used to ship multiple device tree files within one image. Code in the SPL
-will choose the one matching the current board and append this to the
-U-Boot proper binary to be automatically used up by it.
-Aside from U-Boot proper and one device tree blob the SPL can load multiple,
-arbitrary image files as well. These binaries should be specified in their
-own subnode under the /images node, which should then be referenced from one or
-multiple /configurations subnodes. The required images must be enumerated in
-the "loadables" property as a list of strings.
-
-If a platform specific image source file (.its) is shipped with the U-Boot
-source, it can be specified using the CONFIG_SPL_FIT_SOURCE Kconfig symbol.
-In this case it will be automatically used by U-Boot's Makefile to generate
-the image.
-If a static source file is not flexible enough, CONFIG_SPL_FIT_GENERATOR
-can point to a script which generates this image source file during
-the build process. It gets passed a list of device tree files (taken from the
-CONFIG_OF_LIST symbol).
-
-The SPL also records to a DT all additional images (called loadables) which are
-loaded. The information about loadables locations is passed via the DT node with
-fit-images name.
-
-Finally, if there are multiple xPL phases (e.g. SPL, VPL), images can be marked
-as intended for a particular phase using the 'phase' property. For example, if
-fit_image_load() is called with image_ph(IH_PHASE_SPL, IH_TYPE_FIRMWARE), then
-only the image listed into the "firmware" property where phase is set to "spl"
-will be loaded.
-
-Loadables Example
------------------
-Consider the following case for an ARM64 platform where U-Boot runs in EL2
-started by ATF where SPL is loading U-Boot (as loadables) and ATF (as firmware).
-
-/dts-v1/;
-
-/ {
-	description = "Configuration to load ATF before U-Boot";
-
-	images {
-		uboot {
-			description = "U-Boot (64-bit)";
-			data = /incbin/("u-boot-nodtb.bin");
-			type = "firmware";
-			os = "u-boot";
-			arch = "arm64";
-			compression = "none";
-			load = <0x8 0x8000000>;
-			entry = <0x8 0x8000000>;
-			hash {
-				algo = "md5";
-			};
-		};
-		atf {
-			description = "ARM Trusted Firmware";
-			data = /incbin/("bl31.bin");
-			type = "firmware";
-			os = "arm-trusted-firmware";
-			arch = "arm64";
-			compression = "none";
-			load = <0xfffea000>;
-			entry = <0xfffea000>;
-			hash {
-				algo = "md5";
-			};
-		};
-		fdt_1 {
-			description = "zynqmp-zcu102-revA";
-			data = /incbin/("arch/arm/dts/zynqmp-zcu102-revA.dtb");
-			type = "flat_dt";
-			arch = "arm64";
-			compression = "none";
-			load = <0x100000>;
-			hash {
-				algo = "md5";
-			};
-		};
-	};
-	configurations {
-		default = "config_1";
-
-		config_1 {
-			description = "zynqmp-zcu102-revA";
-			firmware = "atf";
-			loadables = "uboot";
-			fdt = "fdt_1";
-		};
-	};
-};
-
-In this case the SPL records via fit-images DT node the information about
-loadables U-Boot image.
-
-ZynqMP> fdt addr $fdtcontroladdr
-ZynqMP> fdt print /fit-images
-fit-images {
-	uboot {
-		os = "u-boot";
-		type = "firmware";
-		size = <0x001017c8>;
-		entry = <0x00000008 0x08000000>;
-		load = <0x00000008 0x08000000>;
-	};
-};
-
-As you can see entry and load properties are 64bit wide to support loading
-images above 4GB (in past entry and load properties where just 32bit).
-
-
-Example 1 -- old-style (non-FDT) kernel booting
------------------------------------------------
-
-Consider a simple scenario, where a PPC Linux kernel built from sources on the
-development host is to be booted old-style (non-FDT) by U-Boot on an embedded
-target. Assume that the outcome of the build is vmlinux.bin.gz, a file which
-contains a gzip-compressed PPC Linux kernel (the only data file in this case).
-The uImage can be produced using the image source file
-doc/uImage.FIT/kernel.its (note that kernel.its assumes that vmlinux.bin.gz is
-in the current working directory; if desired, an alternative path can be
-specified in the kernel.its file). Here's how to create the image and inspect
-its contents:
-
-[on the host system]
-$ mkimage -f kernel.its kernel.itb
-DTC: dts->dtb  on file "kernel.its"
-$
-$ mkimage -l kernel.itb
-FIT description: Simple image with single Linux kernel
-Created:	 Tue Mar 11 17:26:15 2008
- Image 0 (kernel)
-  Description:	Vanilla Linux kernel
-  Type:		Kernel Image
-  Compression:	gzip compressed
-  Data Size:	943347 Bytes = 921.24 kB = 0.90 MB
-  Architecture: PowerPC
-  OS:		Linux
-  Load Address: 0x00000000
-  Entry Point:	0x00000000
-  Hash algo:	crc32
-  Hash value:	2ae2bb40
-  Hash algo:	sha1
-  Hash value:	3c200f34e2c226ddc789240cca0c59fc54a67cf4
- Default Configuration: 'config-1'
- Configuration 0 (config-1)
-  Description:	Boot Linux kernel
-  Kernel:	kernel
-
-
-The resulting image file kernel.itb can be now transferred to the target,
-inspected and booted (note that first three U-Boot commands below are shown
-for completeness -- they are part of the standard booting procedure and not
-specific to the new image format).
-
-[on the target system]
-=> print nfsargs
-nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath}
-=> print addip
-addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off panic=1
-=> run nfsargs addip
-=> tftp 900000 /path/to/tftp/location/kernel.itb
-Using FEC device
-TFTP from server 192.168.1.1; our IP address is 192.168.160.5
-Filename '/path/to/tftp/location/kernel.itb'.
-Load address: 0x900000
-Loading: #################################################################
-done
-Bytes transferred = 944464 (e6950 hex)
-=> iminfo
-
-## Checking Image at 00900000 ...
-   FIT image found
-   FIT description: Simple image with single Linux kernel
-   Created:	    2008-03-11	16:26:15 UTC
-    Image 0 (kernel)
-     Description:  Vanilla Linux kernel
-     Type:	   Kernel Image
-     Compression:  gzip compressed
-     Data Start:   0x009000e0
-     Data Size:    943347 Bytes = 921.2 kB
-     Architecture: PowerPC
-     OS:	   Linux
-     Load Address: 0x00000000
-     Entry Point:  0x00000000
-     Hash algo:    crc32
-     Hash value:   2ae2bb40
-     Hash algo:    sha1
-     Hash value:   3c200f34e2c226ddc789240cca0c59fc54a67cf4
-    Default Configuration: 'config-1'
-    Configuration 0 (config-1)
-     Description:  Boot Linux kernel
-     Kernel:	   kernel
-
-=> bootm
-## Booting kernel from FIT Image at 00900000 ...
-   Using 'config-1' configuration
-   Trying 'kernel' kernel subimage
-     Description:  Vanilla Linux kernel
-     Type:	   Kernel Image
-     Compression:  gzip compressed
-     Data Start:   0x009000e0
-     Data Size:    943347 Bytes = 921.2 kB
-     Architecture: PowerPC
-     OS:	   Linux
-     Load Address: 0x00000000
-     Entry Point:  0x00000000
-     Hash algo:    crc32
-     Hash value:   2ae2bb40
-     Hash algo:    sha1
-     Hash value:   3c200f34e2c226ddc789240cca0c59fc54a67cf4
-   Verifying Hash Integrity ... crc32+ sha1+ OK
-   Uncompressing Kernel Image ... OK
-Memory BAT mapping: BAT2=256Mb, BAT3=0Mb, residual: 0Mb
-Linux version 2.4.25 (m8@hekate) (gcc version 4.0.0 (DENX ELDK 4.0 4.0.0)) #2 czw lip 5 17:56:18 CEST 2007
-On node 0 totalpages: 65536
-zone(0): 65536 pages.
-zone(1): 0 pages.
-zone(2): 0 pages.
-Kernel command line: root=/dev/nfs rw nfsroot=192.168.1.1:/opt/eldk-4.1/ppc_6xx ip=192.168.160.5:192.168.1.1::255.255.0.0:lite5200b:eth0:off panic=1
-Calibrating delay loop... 307.20 BogoMIPS
-
-
-Example 2 -- new-style (FDT) kernel booting
--------------------------------------------
-
-Consider another simple scenario, where a PPC Linux kernel is to be booted
-new-style, i.e., with a FDT blob. In this case there are two prerequisite data
-files: vmlinux.bin.gz (Linux kernel) and target.dtb (FDT blob). The uImage can
-be produced using image source file doc/uImage.FIT/kernel_fdt.its like this
-(note again, that both prerequisite data files are assumed to be present in
-the current working directory -- image source file kernel_fdt.its can be
-modified to take the files from some other location if needed):
-
-[on the host system]
-$ mkimage -f kernel_fdt.its kernel_fdt.itb
-DTC: dts->dtb  on file "kernel_fdt.its"
-$
-$ mkimage -l kernel_fdt.itb
-FIT description: Simple image with single Linux kernel and FDT blob
-Created:	 Tue Mar 11 16:29:22 2008
- Image 0 (kernel)
-  Description:	Vanilla Linux kernel
-  Type:		Kernel Image
-  Compression:	gzip compressed
-  Data Size:	1092037 Bytes = 1066.44 kB = 1.04 MB
-  Architecture: PowerPC
-  OS:		Linux
-  Load Address: 0x00000000
-  Entry Point:	0x00000000
-  Hash algo:	crc32
-  Hash value:	2c0cc807
-  Hash algo:	sha1
-  Hash value:	264b59935470e42c418744f83935d44cdf59a3bb
- Image 1 (fdt-1)
-  Description:	Flattened Device Tree blob
-  Type:		Flat Device Tree
-  Compression:	uncompressed
-  Data Size:	16384 Bytes = 16.00 kB = 0.02 MB
-  Architecture: PowerPC
-  Hash algo:	crc32
-  Hash value:	0d655d71
-  Hash algo:	sha1
-  Hash value:	25ab4e15cd4b8a5144610394560d9c318ce52def
- Default Configuration: 'conf-1'
- Configuration 0 (conf-1)
-  Description:	Boot Linux kernel with FDT blob
-  Kernel:	kernel
-  FDT:		fdt-1
-
-
-The resulting image file kernel_fdt.itb can be now transferred to the target,
-inspected and booted:
-
-[on the target system]
-=> tftp 900000 /path/to/tftp/location/kernel_fdt.itb
-Using FEC device
-TFTP from server 192.168.1.1; our IP address is 192.168.160.5
-Filename '/path/to/tftp/location/kernel_fdt.itb'.
-Load address: 0x900000
-Loading: #################################################################
-	 ###########
-done
-Bytes transferred = 1109776 (10ef10 hex)
-=> iminfo
-
-## Checking Image at 00900000 ...
-   FIT image found
-   FIT description: Simple image with single Linux kernel and FDT blob
-   Created:	    2008-03-11	15:29:22 UTC
-    Image 0 (kernel)
-     Description:  Vanilla Linux kernel
-     Type:	   Kernel Image
-     Compression:  gzip compressed
-     Data Start:   0x009000ec
-     Data Size:    1092037 Bytes =  1 MB
-     Architecture: PowerPC
-     OS:	   Linux
-     Load Address: 0x00000000
-     Entry Point:  0x00000000
-     Hash algo:    crc32
-     Hash value:   2c0cc807
-     Hash algo:    sha1
-     Hash value:   264b59935470e42c418744f83935d44cdf59a3bb
-    Image 1 (fdt-1)
-     Description:  Flattened Device Tree blob
-     Type:	   Flat Device Tree
-     Compression:  uncompressed
-     Data Start:   0x00a0abdc
-     Data Size:    16384 Bytes = 16 kB
-     Architecture: PowerPC
-     Hash algo:    crc32
-     Hash value:   0d655d71
-     Hash algo:    sha1
-     Hash value:   25ab4e15cd4b8a5144610394560d9c318ce52def
-    Default Configuration: 'conf-1'
-    Configuration 0 (conf-1)
-     Description:  Boot Linux kernel with FDT blob
-     Kernel:	   kernel
-     FDT:	   fdt-1
-=> bootm
-## Booting kernel from FIT Image at 00900000 ...
-   Using 'conf-1' configuration
-   Trying 'kernel' kernel subimage
-     Description:  Vanilla Linux kernel
-     Type:	   Kernel Image
-     Compression:  gzip compressed
-     Data Start:   0x009000ec
-     Data Size:    1092037 Bytes =  1 MB
-     Architecture: PowerPC
-     OS:	   Linux
-     Load Address: 0x00000000
-     Entry Point:  0x00000000
-     Hash algo:    crc32
-     Hash value:   2c0cc807
-     Hash algo:    sha1
-     Hash value:   264b59935470e42c418744f83935d44cdf59a3bb
-   Verifying Hash Integrity ... crc32+ sha1+ OK
-   Uncompressing Kernel Image ... OK
-## Flattened Device Tree from FIT Image at 00900000
-   Using 'conf-1' configuration
-   Trying 'fdt-1' FDT blob subimage
-     Description:  Flattened Device Tree blob
-     Type:	   Flat Device Tree
-     Compression:  uncompressed
-     Data Start:   0x00a0abdc
-     Data Size:    16384 Bytes = 16 kB
-     Architecture: PowerPC
-     Hash algo:    crc32
-     Hash value:   0d655d71
-     Hash algo:    sha1
-     Hash value:   25ab4e15cd4b8a5144610394560d9c318ce52def
-   Verifying Hash Integrity ... crc32+ sha1+ OK
-   Booting using the fdt blob at 0xa0abdc
-   Loading Device Tree to 007fc000, end 007fffff ... OK
-[    0.000000] Using lite5200 machine description
-[    0.000000] Linux version 2.6.24-rc6-gaebecdfc (m8@hekate) (gcc version 4.0.0 (DENX ELDK 4.1 4.0.0)) #1 Sat Jan 12 15:38:48 CET 2008
-
-
-Example 3 -- advanced booting
------------------------------
-
-Refer to doc/uImage.FIT/multi.its for an image source file that allows more
-sophisticated booting scenarios (multiple kernels, ramdisks and fdt blobs).
doc/usage/fit/howto.rst new file +419 -0

419 lines not on this page · raw message

doc/usage/fit/index.rst +1 -0
index 0576675ec001..83bc4d01ca42 100644
@@ -11,6 +11,7 @@ doc/uImage.FIT
     :maxdepth: 1
 
     source_file_format
+    howto
     x86-fit-boot
     signature
     verified-boot
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#7 lore raw

PATCH v2 8/14 doc: Bring in the FIT overlay information

In reply to Simon Glass

Bring this file into the documentation.

---

(no changes since v1)

 doc/uImage.FIT/overlay-fdt-boot.txt | 225 ---------------------------
 doc/usage/fit/index.rst             |   1 +
 doc/usage/fit/overlay-fdt-boot.rst  | 227 ++++++++++++++++++++++++++++
 3 files changed, 228 insertions(+), 225 deletions(-)
 delete mode 100644 doc/uImage.FIT/overlay-fdt-boot.txt
 create mode 100644 doc/usage/fit/overlay-fdt-boot.rst
doc/uImage.FIT/overlay-fdt-boot.txt deleted +0 -225
deleted file mode 100644
index dddc4db1a67d..000000000000
@@ -1,225 +0,0 @@
-U-Boot FDT Overlay FIT usage
-============================
-
-Introduction
-------------
-In many cases it is desirable to have a single FIT image support a multitude
-of similar boards and their expansion options. The same kernel on DT enabled
-platforms can support this easily enough by providing a DT blob upon boot
-that matches the desired configuration.
-
-This document focuses on specifically using overlays as part of a FIT image.
-General information regarding overlays including its syntax and building it
-can be found in doc/README.fdt-overlays
-
-Configuration without overlays
-------------------------------
-
-Take a hypothetical board named 'foo' where there are different supported
-revisions, reva and revb. Assume that both board revisions can use add a bar
-add-on board, while only the revb board can use a baz add-on board.
-
-Without using overlays the configuration would be as follows for every case.
-
-	/dts-v1/;
-	/ {
-		images {
-			kernel {
-				data = /incbin/("./zImage");
-				type = "kernel";
-				arch = "arm";
-				os = "linux";
-				load = <0x82000000>;
-				entry = <0x82000000>;
-			};
-			fdt-1 {
-				data = /incbin/("./foo-reva.dtb");
-				type = "flat_dt";
-				arch = "arm";
-			};
-			fdt-2 {
-				data = /incbin/("./foo-revb.dtb");
-				type = "flat_dt";
-				arch = "arm";
-			};
-			fdt-3 {
-				data = /incbin/("./foo-reva-bar.dtb");
-				type = "flat_dt";
-				arch = "arm";
-			};
-			fdt-4 {
-				data = /incbin/("./foo-revb-bar.dtb");
-				type = "flat_dt";
-				arch = "arm";
-			};
-			fdt-5 {
-				data = /incbin/("./foo-revb-baz.dtb");
-				type = "flat_dt";
-				arch = "arm";
-			};
-			fdt-6 {
-				data = /incbin/("./foo-revb-bar-baz.dtb");
-				type = "flat_dt";
-				arch = "arm";
-			};
-		};
-
-		configurations {
-			default = "foo-reva.dtb;
-			foo-reva.dtb {
-				kernel = "kernel";
-				fdt = "fdt-1";
-			};
-			foo-revb.dtb {
-				kernel = "kernel";
-				fdt = "fdt-2";
-			};
-			foo-reva-bar.dtb {
-				kernel = "kernel";
-				fdt = "fdt-3";
-			};
-			foo-revb-bar.dtb {
-				kernel = "kernel";
-				fdt = "fdt-4";
-			};
-			foo-revb-baz.dtb {
-				kernel = "kernel";
-				fdt = "fdt-5";
-			};
-			foo-revb-bar-baz.dtb {
-				kernel = "kernel";
-				fdt = "fdt-6";
-			};
-		};
-	};
-
-Note the blob needs to be compiled for each case and the combinatorial explosion of
-configurations. A typical device tree blob is in the low hunderds of kbytes so a
-multitude of configuration grows the image quite a bit.
-
-Booting this image is done by using
-
-	# bootm <addr>#<config>
-
-Where config is one of:
-	foo-reva.dtb, foo-revb.dtb, foo-reva-bar.dtb, foo-revb-bar.dtb,
-	foo-revb-baz.dtb, foo-revb-bar-baz.dtb
-
-This selects the DTB to use when booting.
-
-Configuration using overlays
-----------------------------
-
-Device tree overlays can be applied to a base DT and result in the same blob
-being passed to the booting kernel. This saves on space and avoid the combinatorial
-explosion problem.
-
-	/dts-v1/;
-	/ {
-		images {
-			kernel {
-				data = /incbin/("./zImage");
-				type = "kernel";
-				arch = "arm";
-				os = "linux";
-				load = <0x82000000>;
-				entry = <0x82000000>;
-			};
-			fdt-1 {
-				data = /incbin/("./foo.dtb");
-				type = "flat_dt";
-				arch = "arm";
-				load = <0x87f00000>;
-			};
-			fdt-2 {
-				data = /incbin/("./reva.dtbo");
-				type = "flat_dt";
-				arch = "arm";
-				load = <0x87fc0000>;
-			};
-			fdt-3 {
-				data = /incbin/("./revb.dtbo");
-				type = "flat_dt";
-				arch = "arm";
-				load = <0x87fc0000>;
-			};
-			fdt-4 {
-				data = /incbin/("./bar.dtbo");
-				type = "flat_dt";
-				arch = "arm";
-				load = <0x87fc0000>;
-			};
-			fdt-5 {
-				data = /incbin/("./baz.dtbo");
-				type = "flat_dt";
-				arch = "arm";
-				load = <0x87fc0000>;
-			};
-		};
-
-		configurations {
-			default = "foo-reva.dtb;
-			foo-reva.dtb {
-				kernel = "kernel";
-				fdt = "fdt-1", "fdt-2";
-			};
-			foo-revb.dtb {
-				kernel = "kernel";
-				fdt = "fdt-1", "fdt-3";
-			};
-			foo-reva-bar.dtb {
-				kernel = "kernel";
-				fdt = "fdt-1", "fdt-2", "fdt-4";
-			};
-			foo-revb-bar.dtb {
-				kernel = "kernel";
-				fdt = "fdt-1", "fdt-3", "fdt-4";
-			};
-			foo-revb-baz.dtb {
-				kernel = "kernel";
-				fdt = "fdt-1", "fdt-3", "fdt-5";
-			};
-			foo-revb-bar-baz.dtb {
-				kernel = "kernel";
-				fdt = "fdt-1", "fdt-3", "fdt-4", "fdt-5";
-			};
-			bar {
-				fdt = "fdt-4";
-			};
-			baz {
-				fdt = "fdt-5";
-			};
-		};
-	};
-
-Booting this image is exactly the same as the non-overlay example.
-u-boot will retrieve the base blob and apply the overlays in sequence as
-they are declared in the configuration.
-
-Note the minimum amount of different DT blobs, as well as the requirement for
-the DT blobs to have a load address; the overlay application requires the blobs
-to be writeable.
-
-Configuration using overlays and feature selection
---------------------------------------------------
-
-Although the configuration in the previous section works is a bit inflexible
-since it requires all possible configuration options to be laid out before
-hand in the FIT image. For the add-on boards the extra config selection method
-might make sense.
-
-Note the two bar & baz configuration nodes. To boot a reva board with
-the bar add-on board enabled simply use:
-
-	# bootm <addr>#foo-reva.dtb#bar
-
-While booting a revb with bar and baz is as follows:
-
-	# bootm <addr>#foo-revb.dtb#bar#baz
-
-The limitation for a feature selection configuration node is that a single
-fdt option is currently supported.
-
-Pantelis Antoniou
[email protected]
-12/6/2017
doc/usage/fit/index.rst +1 -0
index 83bc4d01ca42..bd25bd30b284 100644
@@ -16,3 +16,4 @@ doc/uImage.FIT
     signature
     verified-boot
     beaglebone_vboot
+    overlay-fdt-boot
doc/usage/fit/overlay-fdt-boot.rst new file +227 -0

227 lines not on this page · raw message

Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#8 lore raw

PATCH v2 9/14 doc: Tidy up the format docs to be more generic

In reply to Simon Glass

Avoid reference to uImage which is the old format. Drop the historical language at the top and rewrite a few other sections. Correct the U-Boot filename which is now in the boot/ directory.

---

(no changes since v1)

 doc/usage/fit/source_file_format.rst | 82 +++++++++++-----------------
 1 file changed, 31 insertions(+), 51 deletions(-)
doc/usage/fit/source_file_format.rst +31 -51
index e27377342a15..986ccdfe3256 100644
@@ -1,61 +1,41 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot new uImage source file format (bindings definition)
-==========================================================
+Flattened Image Tree (FIT) Format
+=================================
 
 Introduction
 ------------
 
-Evolution of the 2.6 Linux kernel for embedded PowerPC systems introduced new
-booting method which requires that hardware description is available to the
-kernel in the form of Flattened Device Tree.
+The number of elements playing a role in the kernel booting process has
+increased over time and now typically includes the devicetree, kernel image and
+possibly a ramdisk image. Generally, all must be placed in the system memory and
+booted together.
 
-Booting with a Flattened Device Tree is much more flexible and is intended to
-replace direct passing of 'struct bd_info' which was used to boot pre-FDT
-kernels.
+For firmware images a similar process has taken place, with various binaries
+loaded at different addresses, such as ARM's ATF, OpenSBI, FPGA and U-Boot
+itself.
 
-However, U-Boot needs to support both techniques to provide backward
-compatibility for platforms which are not FDT ready. Number of elements
-playing role in the booting process has increased and now includes the FDT
-blob. Kernel image, FDT blob and possibly ramdisk image - all must be placed
-in the system memory and passed to bootm as a arguments. Some of them may be
-missing: FDT is not present for legacy platforms, ramdisk is always optional.
-Additionally, old uImage format has been extended to support multi sub-images
-but the support is limited by simple format of the legacy uImage structure.
-Single binary header 'struct legacy_img_hdr' is not flexible enough to cover all
-possible scenarios.
-
-All those factors combined clearly show that there is a need for new, more
-flexible, multi component uImage format.
-
-
-New uImage format assumptions
------------------------------
-
-Implementation
-~~~~~~~~~~~~~~
-
-Libfdt has been selected for the new uImage format implementation as (1) it
-provides needed functionality, (2) is actively maintained and developed and
-(3) increases code reuse as it is already part of the U-Boot source tree.
+FIT provides a flexible and extensible format to deal with this complexity. It
+provides support for multiple components. It also supports multiple
+configurations, so that the same FIT can be used to boot multiple boards, with
+some components in common (e.g. kernel) and some specific to that board (e.g.
+devicetree).
 
 Terminology
 ~~~~~~~~~~~
 
-This document defines new uImage structure by providing FDT bindings for new
-uImage internals. Bindings are defined from U-Boot perspective, i.e. describe
-final form of the uImage at the moment when it reaches U-Boot. User
+This document defines FIT by providing FDT (Flat Device Tree) bindings. These
+describe the final form of the FIT at the moment when it is used. The user
 perspective may be simpler, as some of the properties (like timestamps and
-hashes) will need to be filled in automatically by the U-Boot mkimage tool.
+hashes) are filled in automatically by the U-Boot mkimage tool.
 
-To avoid confusion with the kernel FDT the following naming convention is
-proposed for the new uImage format related terms:
+To avoid confusion with the kernel FDT the following naming convention is used:
 
 FIT
-    Flattened uImage Tree
+    Flattened Image Tree
 
-FIT is formally a flattened device tree (in the libfdt meaning), which
-conforms to bindings defined in this document.
+FIT is formally a flattened devicetree (in the libfdt meaning), which conforms
+to bindings defined in this document.
 
 .its
     image tree source
@@ -63,22 +43,22 @@ conforms to bindings defined in this document.
 .itb
     flattened image tree blob
 
-Image building procedure
+Image-building procedure
 ~~~~~~~~~~~~~~~~~~~~~~~~
 
-The following picture shows how the new uImage is prepared. Input consists of
+The following picture shows how the FIT is prepared. Input consists of
 image source file (.its) and a set of data files. Image is created with the
 help of standard U-Boot mkimage tool which in turn uses dtc (device tree
-compiler) to produce image tree blob (.itb).  Resulting .itb file is the
-actual binary of a new uImage::
+compiler) to produce image tree blob (.itb). The resulting .itb file is the
+actual binary of a new FIT::
 
     tqm5200.its
     +
     vmlinux.bin.gz     mkimage + dtc               xfer to target
-    eldk-4.2-ramdisk  --------------> tqm5200.itb --------------> bootm
+    eldk-4.2-ramdisk  --------------> tqm5200.itb --------------> boot
     tqm5200.dtb                          /|\
                                           |
-                                     'new uImage'
+                                     'new FIT'
 
 Steps:
 
@@ -89,7 +69,7 @@ Steps:
 #. mkimage calls dtc to create .itb image and assures that
    missing properties are added
 
-#. .itb (new uImage) is uploaded onto the target and used therein
+#. .itb (new FIT) is uploaded onto the target and used therein
 
 
 Unique identifiers
@@ -101,10 +81,10 @@ is used as it's identifier as it assures uniqueness without additional
 checking required.
 
 
-Root node properties
+Root-node properties
 --------------------
 
-Root node of the uImage Tree should have the following layout::
+The root node of the FIT should have the following layout::
 
     / o image-tree
         |- description = "image description"
@@ -128,7 +108,7 @@ Optional property
 ~~~~~~~~~~~~~~~~~
 
 description
-    Textual description of the uImage
+    Textual description of the FIT
 
 Mandatory property
 ~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#9 lore raw

PATCH v2 10/14 doc: Expand FIT tables to include all values

In reply to Simon Glass

Add tables which include all values for type, algo, arch, algo and compression.

---

(no changes since v1)

 doc/usage/fit/source_file_format.rst | 184 ++++++++++++++++++++++-----
 1 file changed, 155 insertions(+), 29 deletions(-)
doc/usage/fit/source_file_format.rst +155 -29
index 986ccdfe3256..1c72230c0604 100644
@@ -165,36 +165,150 @@ description
     Textual description of the component sub-image
 
 type
-    Name of component sub-image type, supported types are:
-
-    "standalone", "kernel", "kernel_noload", "ramdisk", "firmware", "script",
-    "filesystem", "flat_dt" and others (see uimage_type in common/image.c).
+    Name of component sub-image type. Supported types are:
+
+    ====================  ==================
+    Sub-image type        Meaning
+    ====================  ==================
+    invalid               Invalid Image
+    aisimage              Davinci AIS image
+    atmelimage            ATMEL ROM-Boot Image
+    copro                 Coprocessor Image}
+    fdt_legacy            legacy Image with Flat Device Tree
+    filesystem            Filesystem Image
+    firmware              Firmware
+    firmware_ivt          Firmware with HABv4 IVT }
+    flat_dt               Flat Device Tree
+    fpga                  FPGA Image }
+    gpimage               TI Keystone SPL Image
+    imx8image             NXP i.MX8 Boot Image
+    imx8mimage            NXP i.MX8M Boot Image
+    imximage              Freescale i.MX Boot Image
+    kernel                Kernel Image
+    kernel_noload         Kernel Image (no loading done)
+    kwbimage              Kirkwood Boot Image
+    lpc32xximage          LPC32XX Boot Image
+    mtk_image             MediaTek BootROM loadable Image }
+    multi                 Multi-File Image
+    mxsimage              Freescale MXS Boot Image
+    omapimage             TI OMAP SPL With GP CH
+    pblimage              Freescale PBL Boot Image
+    pmmc                  TI Power Management Micro-Controller Firmware
+    ramdisk               RAMDisk Image
+    rkimage               Rockchip Boot Image }
+    rksd                  Rockchip SD Boot Image }
+    rkspi                 Rockchip SPI Boot Image }
+    script                Script
+    socfpgaimage          Altera SoCFPGA CV/AV preloader
+    socfpgaimage_v1       Altera SoCFPGA A10 preloader
+    spkgimage             Renesas SPKG Image }
+    standalone            Standalone Program
+    stm32image            STMicroelectronics STM32 Image }
+    sunxi_egon            Allwinner eGON Boot Image }
+    sunxi_toc0            Allwinner TOC0 Boot Image }
+    tee                   Trusted Execution Environment Image
+    ublimage              Davinci UBL image
+    vybridimage           Vybrid Boot Image
+    x86_setup             x86 setup.bin
+    zynqimage             Xilinx Zynq Boot Image }
+    zynqmpbif             Xilinx ZynqMP Boot Image (bif) }
+    zynqmpimage           Xilinx ZynqMP Boot Image }
+    ====================  ==================
 
 data
     Path to the external file which contains this node's binary data.
 
 compression
-    Compression used by included data. Supported compressions
-    are "gzip" and "bzip2". If no compression is used compression property
-    should be set to "none". If the data is compressed but it should not be
-    uncompressed by U-Boot (e.g. compressed ramdisk), this should also be set
-    to "none".
+    Compression used by included data. If no compression is used, the
+    compression property should be set to "none". If the data is compressed but
+    it should not be uncompressed by the loader (e.g. compressed ramdisk), this
+    should also be set to "none".
+
+    Supported compression types are:
+
+    ====================  ==================
+    Compression type      Meaning
+    ====================  ==================
+    none                  uncompressed
+    bzip2                 bzip2 compressed
+    gzip                  gzip compressed
+    lz4                   lz4 compressed
+    lzma                  lzma compressed
+    lzo                   lzo compressed
+    zstd                  zstd compressed
+    ====================  ==================
 
 Conditionally mandatory property
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 os
     OS name, mandatory for types "kernel". Valid OS names are:
-    "openbsd", "netbsd", "freebsd", "4_4bsd", "linux", "svr4", "esix",
-    "solaris", "irix", "sco", "dell", "ncr", "lynxos", "vxworks", "psos", "qnx",
-    "u-boot", "rtems", "unity", "integrity".
+
+    ====================  ==================
+    OS name               Meaning
+    ====================  ==================
+    invalid               Invalid OS
+    4_4bsd                4_4BSD
+    arm-trusted-firmware  ARM Trusted Firmware
+    dell                  Dell
+    efi                   EFI Firmware
+    esix                  Esix
+    freebsd               FreeBSD
+    integrity             INTEGRITY
+    irix                  Irix
+    linux                 Linux
+    ncr                   NCR
+    netbsd                NetBSD
+    openbsd               OpenBSD
+    openrtos              OpenRTOS
+    opensbi               RISC-V OpenSBI
+    ose                   Enea OSE
+    plan9                 Plan 9
+    psos                  pSOS
+    qnx                   QNX
+    rtems                 RTEMS
+    sco                   SCO
+    solaris               Solaris
+    svr4                  SVR4
+    tee                   Trusted Execution Environment
+    u-boot                U-Boot
+    vxworks               VxWorks
+    ====================  ==================
 
 arch
     Architecture name, mandatory for types: "standalone", "kernel",
-    "firmware", "ramdisk" and "fdt". Valid architecture names are: "alpha",
-    "arm", "i386", "ia64", "mips", "mips64", "ppc", "s390", "sh", "sparc",
-    "sparc64", "m68k", "microblaze", "nios2", "blackfin", "avr32", "st200",
-    "sandbox".
+    "firmware", "ramdisk" and "fdt". Valid architecture names are:
+
+    ====================  ==================
+    Architecture type     Meaning
+    ====================  ==================
+    invalid               Invalid ARCH
+    alpha                 Alpha
+    arc                   ARC
+    arm64                 AArch64
+    arm                   ARM
+    avr32                 AVR32
+    blackfin              Blackfin
+    ia64                  IA64
+    m68k                  M68K
+    microblaze            MicroBlaze
+    mips64                MIPS 64 Bit
+    mips                  MIPS
+    nds32                 NDS32
+    nios2                 NIOS II
+    or1k                  OpenRISC 1000
+    powerpc               PowerPC
+    ppc                   PowerPC
+    riscv                 RISC-V
+    s390                  IBM S390
+    sandbox               Sandbox
+    sh                    SuperH
+    sparc64               SPARC 64 Bit
+    sparc                 SPARC
+    x86_64                AMD x86_64
+    x86                   Intel x86
+    xtensa                Xtensa
+    ====================  ==================
 
 entry
     entry point address, address size is determined by
@@ -211,17 +325,15 @@ compatible
     Mandatory for types: "fpga", and images that do not specify a load address.
     Supported compatible methods:
 
-    "u-boot,fpga-legacy"
-        the generic fpga loading routine.
-
-    "u-boot,zynqmp-fpga-ddrauth"
-        signed non-encrypted FPGA bitstream for
-        Xilinx Zynq UltraScale+ (ZymqMP) device.
-
-    "u-boot,zynqmp-fpga-enc"
-        encrypted FPGA bitstream for Xilinx Zynq
-
-    UltraScale+ (ZynqMP) device.
+    ==========================  =========================================
+    Compatible string           Meaning
+    ==========================  =========================================
+    u-boot,fpga-legacy          Generic fpga loading routine.
+    u-boot,zynqmp-fpga-ddrauth  Signed non-encrypted FPGA bitstream for
+                                Xilinx Zynq UltraScale+ (ZymqMP) device.
+    u-boot,zynqmp-fpga-enc      Encrypted FPGA bitstream for Xilinx Zynq
+                                UltraScale+ (ZynqMP) device.
+    ==========================  =========================================
 
 phase
     U-Boot phase for which the image is intended.
@@ -252,10 +364,24 @@ Mandatory properties
 ~~~~~~~~~~~~~~~~~~~~
 
 algo
-    Algorithm name, supported are "crc32", "md5" and "sha1".
+    Algorithm name. Supported algoriths and their value sizes are:
+
+    ==================== ============ =========================================
+    Sub-image type       Size (bytes) Meaning
+    ==================== ============ =========================================
+    crc16-ccitt          2            Cyclic Redundancy Check 16-bit
+                                      (Consultative Committee for International
+                                      Telegraphy and Telephony)
+    crc32                4            Cyclic Redundancy Check 32-bit
+    md5                  16           Message Digest 5 (MD5)
+    sha1                 20           Secure Hash Algorithm 1 (SHA1)
+    sha256               32           Secure Hash Algorithm 2 (SHA256)
+    sha384               48           Secure Hash Algorithm 2 (SHA384)
+    sha512               64           Secure Hash Algorithm 2 (SHA512)
+    ==================== ============ =========================================
 
 value
-    Actual checksum or hash value, correspondingly 4, 16 or 20 bytes long.
+    Actual checksum or hash value.
 
 
 '/configurations' node
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#10 lore raw

PATCH v2 11/14 doc: Move external FIT docs into the main body

In reply to Simon Glass

Rather than having this as an addition to the end, move this into the main body of the spec, rewriting as needed.

---

(no changes since v1)

 doc/usage/fit/source_file_format.rst | 74 ++++++++++++++--------------
 1 file changed, 38 insertions(+), 36 deletions(-)
doc/usage/fit/source_file_format.rst +38 -36
index 1c72230c0604..f1cc1bc4931c 100644
@@ -81,6 +81,25 @@ is used as it's identifier as it assures uniqueness without additional
 checking required.
 
 
+External data
+~~~~~~~~~~~~~
+
+FIT is normally built initially with image data in the 'data' property of each
+image node. It is also possible for this data to reside outside the FIT itself.
+This allows the 'FDT' part of the FIT to be quite small, so that it can be
+loaded and scanned without loading a large amount of data. Then when an image is
+needed it can be loaded from an external source.
+
+External FITs use 'data-offset' or 'data-position' instead of 'data'.
+
+The mkimage tool can convert a FIT to use external data using the `-E` argument,
+optionally using `-p` to specific a fixed position.
+
+It is often desirable to align each image to a block size or cache-line size
+(e.g. 512 bytes), so that there is no need to copy it to an aligned address when
+reading the image data. The mkimage tool provides a `-B` argument to support
+this.
+
 Root-node properties
 --------------------
 
@@ -215,9 +234,6 @@ type
     zynqmpimage           Xilinx ZynqMP Boot Image }
     ====================  ==================
 
-data
-    Path to the external file which contains this node's binary data.
-
 compression
     Compression used by included data. If no compression is used, the
     compression property should be set to "none". If the data is compressed but
@@ -238,9 +254,28 @@ compression
     zstd                  zstd compressed
     ====================  ==================
 
+data-size
+    size of the data in bytes
+
+
 Conditionally mandatory property
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+data
+    Path to the external file which contains this node's binary data. Within
+    the FIT this is the contents of the file. This is mandatory unless
+    external data is used.
+
+data-offset
+    Offset of the data in a separate image store. The image store is placed
+    immediately after the last byte of the device tree binary, aligned to a
+    4-byte boundary. This is mandatory if external data is used, with an offset.
+
+data-position
+    Machine address at which the data is to be found. This is a fixed address
+    not relative to the loading of the FIT. This is mandatory if external data
+    used with a fixed address.
+
 os
     OS name, mandatory for types "kernel". Valid OS names are:
 
@@ -478,39 +513,6 @@ Older, 2.4 kernel and 2.6 non-FDT kernel do not use FDT blob, in such cases
 not* be specified in a configuration node.
 
 
-External data
--------------
-
-The above format shows a 'data' property which holds the data for each image.
-It is also possible for this data to reside outside the FIT itself. This
-allows the FIT to be quite small, so that it can be loaded and scanned
-without loading a large amount of data. Then when an image is needed it can
-be loaded from an external source.
-
-In this case the 'data' property is omitted. Instead you can use:
-
-data-offset
-    offset of the data in a separate image store. The image
-    store is placed immediately after the last byte of the device tree binary,
-    aligned to a 4-byte boundary.
-
-data-size
-    size of the data in bytes
-
-The 'data-offset' property can be substituted with 'data-position', which
-defines an absolute position or address as the offset. This is helpful when
-booting U-Boot proper before performing relocation. Pass '-p [offset]' to
-mkimage to enable 'data-position'.
-
-Normal kernel FIT image has data embedded within FIT structure. U-Boot image
-for SPL boot has external data. Existence of 'data-offset' can be used to
-identify which format is used.
-
-For FIT image with external data, it would be better to align each blob of data
-to block(512 byte) for block device, so that we don't need to do the copy when
-read the image data in SPL. Pass '-B 0x200' to mkimage to align the FIT
-structure and data to 512 byte, other values available for other align size.
-
 Examples
 --------
 
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#11 lore raw

PATCH v2 12/14 doc: Add signing to the FIT spec

In reply to Simon Glass

Move this properties into the main spec.

---

(no changes since v1)

 doc/usage/fit/signature.rst          |  64 ------------
 doc/usage/fit/source_file_format.rst | 147 ++++++++++++++++++++++++++-
 2 files changed, 146 insertions(+), 65 deletions(-)
doc/usage/fit/signature.rst +0 -64
index 7d8292ece867..0804bffd1edc 100644
@@ -82,70 +82,6 @@ If you like you can look at the public key also::
     $ openssl rsa -in keys/dev.key -pubout
 
 
-Device Tree Bindings
---------------------
-The following properties are required in the FIT's signature node(s) to
-allow the signer to operate. These should be added to the .its file.
-Signature nodes sit at the same level as hash nodes and are called
-signature-1, signature-2, etc.
-
-algo
-    Algorithm name (e.g. "sha1,rsa2048")
-
-key-name-hint
-    Name of key to use for signing. The keys will normally be in
-    a single directory (parameter -k to mkimage). For a given key <name>, its
-    private key is stored in <name>.key and the certificate is stored in
-    <name>.crt.
-
-When the image is signed, the following properties are added (mandatory):
-
-value
-    The signature data (e.g. 256 bytes for 2048-bit RSA)
-
-When the image is signed, the following properties are optional:
-
-timestamp
-    Time when image was signed (standard Unix time_t format)
-
-signer-name
-    Name of the signer (e.g. "mkimage")
-
-signer-version
-    Version string of the signer (e.g. "2013.01")
-
-comment
-    Additional information about the signer or image
-
-padding
-    The padding algorithm, it may be pkcs-1.5 or pss,
-    if no value is provided we assume pkcs-1.5
-
-For config bindings (see Signed Configurations below), the following
-additional properties are optional:
-
-sign-images
-    A list of images to sign, each being a property of the conf
-    node that contains then. The default is "kernel,fdt" which means that these
-    two images will be looked up in the config and signed if present.
-
-For config bindings, these properties are added by the signer:
-
-hashed-nodes
-    A list of nodes which were hashed by the signer. Each is
-    a string - the full path to node. A typical value might be::
-
-	hashed-nodes = "/", "/configurations/conf-1", "/images/kernel",
-	    "/images/kernel/hash-1", "/images/fdt-1",
-	    "/images/fdt-1/hash-1";
-
-hashed-strings
-    The start and size of the string region of the FIT that was hashed
-
-Example: See :doc:`sign-images` for an example image tree source file and
-sign-configs.its for config signing.
-
-
 Public Key Storage
 ------------------
 In order to verify an image that has been signed with a public key we need to
doc/usage/fit/source_file_format.rst +146 -1

177 lines not on this page · raw message

Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#12 lore raw

PATCH v2 13/14 doc: Bring in the command-syntax extensions

In reply to Simon Glass

Bring this file into the documentation. For now it is not in the correct format for a command, but it is valid rST. Futher work will improve this.

---

Changes in v2:
- Move to 'bootm' documentation instead of generic FIT

 .../cmd/bootm.rst}                            | 166 ++++++++++--------
 doc/usage/fit/index.rst                       |   1 +
 2 files changed, 97 insertions(+), 70 deletions(-)
 rename doc/{uImage.FIT/command_syntax_extensions.txt => usage/cmd/bootm.rst} (57%)
doc/usage/cmd/bootm.rst renamed from doc/uImage.FIT/command_syntax_extensions.txt +96 -70
similarity index 57%
rename from doc/uImage.FIT/command_syntax_extensions.txt
rename to doc/usage/cmd/bootm.rst
index 6a99089ab557..65b7891c8a69 100644
@@ -1,3 +1,5 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
 Command syntax extensions for the new uImage format
 ===================================================
 
@@ -20,100 +22,117 @@ of supported bootm usages.
 Note: U-Boot supports two methods of booting a PowerPC Linux kernel: old way,
 i.e., without passing the Flattened Device Tree (FDT), and new way, where the
 kernel is passed a pointer to the FDT. The boot method is indicated for each
-scenario.
+scenario::
 
+    1.  bootm        boot image at the current address, equivalent to 2,3,8
 
-1.  bootm		boot image at the current address, equivalent to 2,3,8
+Old uImage::
 
-Old uImage:
-2.  bootm <addr1>		    /* single image at <addr1> */
-3.  bootm <addr1>		    /* multi-image at <addr1>  */
-4.  bootm <addr1> -		    /* multi-image at <addr1>  */
-5.  bootm <addr1> <addr2>	    /* single image at <addr1> */
-6.  bootm <addr1> <addr2> <addr3>   /* single image at <addr1> */
-7.  bootm <addr1> -	  <addr3>   /* single image at <addr1> */
+    2.  bootm <addr1>            /* single image at <addr1> */
+    3.  bootm <addr1>            /* multi-image at <addr1>  */
+    4.  bootm <addr1> -            /* multi-image at <addr1>  */
+    5.  bootm <addr1> <addr2>        /* single image at <addr1> */
+    6.  bootm <addr1> <addr2> <addr3>   /* single image at <addr1> */
+    7.  bootm <addr1> -      <addr3>   /* single image at <addr1> */
 
-New uImage:
-8.  bootm <addr1>
-9.  bootm [<addr1>]:<subimg1>
-10. bootm [<addr1>]#<conf>[#<extra-conf[#...]]
-11. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2>
-12. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> [<addr3>]:<subimg3>
-13. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> <addr3>
-14. bootm [<addr1>]:<subimg1> -			  [<addr3>]:<subimg3>
-15. bootm [<addr1>]:<subimg1> -			  <addr3>
+New uImage::
 
+    8.  bootm <addr1>
+    9.  bootm [<addr1>]:<subimg1>
+    10. bootm [<addr1>]#<conf>[#<extra-conf[#...]]
+    11. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2>
+    12. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> [<addr3>]:<subimg3>
+    13. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> <addr3>
+    14. bootm [<addr1>]:<subimg1> -              [<addr3>]:<subimg3>
+    15. bootm [<addr1>]:<subimg1> -              <addr3>
 
 Ad. 1. This is equivalent to cases 2,3,8, depending on the type of image at
 the current image address.
+
 - boot method: see cases 2,3,8
 
 Ad. 2. Boot kernel image located at <addr1>.
+
 - boot method: non-FDT
 
 Ad. 3. First and second components of the image at <addr1> are assumed to be a
 kernel and a ramdisk, respectively. The kernel is booted with initrd loaded
 with the ramdisk from the image.
+
 - boot method: depends on the number of components at <addr1>, and on whether
-  U-Boot is compiled with OF support:
+  U-Boot is compiled with OF support::
 
-		    |	       2 components |	       3 components |
-		    |	   (kernel, initrd) | (kernel, initrd, fdt) |
----------------------------------------------------------------------
-#ifdef CONFIG_OF_*  |		    non-FDT |			FDT |
-#ifndef CONFIG_OF_* |		    non-FDT |		    non-FDT |
+    ======================================================================
+                        |           2 components |           3 components|
+                        |       (kernel, initrd) | (kernel, initrd, fdt) |
+    ======================================================================
+    #ifdef CONFIG_OF_*  |                non-FDT |                   FDT |
+    #ifndef CONFIG_OF_* |                non-FDT |               non-FDT |
+    ======================================================================
 
 Ad. 4. Similar to case 3, but the kernel is booted without initrd.  Second
 component of the multi-image is irrelevant (it can be a dummy, 1-byte file).
+
 - boot method: see case 3
 
 Ad. 5. Boot kernel image located at <addr1> with initrd loaded with ramdisk
 from the image at <addr2>.
+
 - boot method: non-FDT
 
 Ad. 6. <addr1> is the address of a kernel image, <addr2> is the address of a
 ramdisk image, and <addr3> is the address of a FDT binary blob.  Kernel is
 booted with initrd loaded with ramdisk from the image at <addr2>.
+
 - boot method: FDT
 
 Ad. 7. <addr1> is the address of a kernel image and <addr3> is the address of
 a FDT binary blob. Kernel is booted without initrd.
+
 - boot method: FDT
 
 Ad. 8. Image at <addr1> is assumed to contain a default configuration, which
 is booted.
+
 - boot method: FDT or non-FDT, depending on whether the default configuration
   defines FDT
 
 Ad. 9. Similar to case 2: boot kernel stored in <subimg1> from the image at
 address <addr1>.
+
 - boot method: non-FDT
 
 Ad. 10. Boot configuration <conf> from the image at <addr1>.
+
 - boot method: FDT or non-FDT, depending on whether the configuration given
   defines FDT
 
 Ad. 11. Equivalent to case 5: boot kernel stored in <subimg1> from the image
 at <addr1> with initrd loaded with ramdisk <subimg2> from the image at
 <addr2>.
+
 - boot method: non-FDT
 
 Ad. 12. Equivalent to case 6: boot kernel stored in <subimg1> from the image
 at <addr1> with initrd loaded with ramdisk <subimg2> from the image at
 <addr2>, and pass FDT blob <subimg3> from the image at <addr3>.
+
 - boot method: FDT
 
 Ad. 13. Similar to case 12, the difference being that <addr3> is the address
 of FDT binary blob that is to be passed to the kernel.
+
 - boot method: FDT
 
 Ad. 14. Equivalent to case 7: boot kernel stored in <subimg1> from the image
 at <addr1>, without initrd, and pass FDT blob <subimg3> from the image at
 <addr3>.
+
 - boot method: FDT
 
 Ad. 15. Similar to case 14, the difference being that <addr3> is the address
 of the FDT binary blob that is to be passed to the kernel.
+
 - boot method: FDT
 
 
@@ -123,14 +142,14 @@ New uImage argument syntax
 New uImage support introduces two new forms for bootm arguments, with the
 following syntax:
 
-- new uImage sub-image specification
-<addr>:<sub-image unit_name>
+new uImage sub-image specification
+    <addr>:<sub-image unit_name>
 
-- new uImage configuration specification
-<addr>#<configuration unit_name>
+new uImage configuration specification
+    <addr>#<configuration unit_name>
 
-- new uImage configuration specification with extra configuration components
-<addr>#<configuration unit_name>[#<extra configuration unit_name>[#..]]
+new uImage configuration specification with extra configuration components
+    <addr>#<configuration unit_name>[#<extra configuration unit_name>[#..]]
 
 The extra configuration currently is supported only for additional device tree
 overlays to apply on the base device tree supplied by the first configuration
@@ -138,31 +157,38 @@ unit.
 
 Examples:
 
-- boot kernel "kernel-1" stored in a new uImage located at 200000:
-bootm 200000:kernel-1
+boot kernel "kernel-1" stored in a new uImage located at 200000::
+
+    bootm 200000:kernel-1
+
+boot configuration "cfg-1" from a new uImage located at 200000::
+
+    bootm 200000#cfg-1
+
+boot configuration "cfg-1" with extra "cfg-2" from a new uImage located
+at 200000::
+
+    bootm 200000#cfg-1#cfg-2
+
+boot "kernel-1" from a new uImage at 200000 with initrd "ramdisk-2" found in
+some other new uImage stored at address 800000::
+
+    bootm 200000:kernel-1 800000:ramdisk-2
 
-- boot configuration "cfg-1" from a new uImage located at 200000:
-bootm 200000#cfg-1
+boot "kernel-2" from a new uImage at 200000, with initrd "ramdisk-1" and FDT
+"fdt-1", both stored in some other new uImage located at 800000::
 
-- boot configuration "cfg-1" with extra "cfg-2" from a new uImage located
-  at 200000:
-bootm 200000#cfg-1#cfg-2
+    bootm 200000:kernel-1 800000:ramdisk-1 800000:fdt-1
 
-- boot "kernel-1" from a new uImage at 200000 with initrd "ramdisk-2" found in
-  some other new uImage stored at address 800000:
-bootm 200000:kernel-1 800000:ramdisk-2
+boot kernel "kernel-2" with initrd "ramdisk-2", both stored in a new uImage
+at address 200000, with a raw FDT blob stored at address 600000::
 
-- boot "kernel-2" from a new uImage at 200000, with initrd "ramdisk-1" and FDT
-  "fdt-1", both stored in some other new uImage located at 800000:
-bootm 200000:kernel-1 800000:ramdisk-1 800000:fdt-1
+    bootm 200000:kernel-2 200000:ramdisk-2 600000
 
-- boot kernel "kernel-2" with initrd "ramdisk-2", both stored in a new uImage
-  at address 200000, with a raw FDT blob stored at address 600000:
-bootm 200000:kernel-2 200000:ramdisk-2 600000
+boot kernel "kernel-2" from new uImage at 200000 with FDT "fdt-1" from the
+same new uImage::
 
-- boot kernel "kernel-2" from new uImage at 200000 with FDT "fdt-1" from the
-  same new uImage:
-bootm 200000:kernel-2 - 200000:fdt-1
+    bootm 200000:kernel-2 - 200000:fdt-1
 
 
 Note on current image address
@@ -171,31 +197,31 @@ Note on current image address
 When bootm is called without arguments, the image at current image address is
 booted. The current image address is the address set most recently by a load
 command, etc, and is by default equal to CONFIG_SYS_LOAD_ADDR. For example, consider
-the following commands:
+the following commands::
 
-tftp 200000 /tftpboot/kernel
-bootm
-Last command is equivalent to:
-bootm 200000
+    tftp 200000 /tftpboot/kernel
+    bootm
+    Last command is equivalent to:
+    bootm 200000
 
 In case of the new uImage argument syntax, the address portion of any argument
 can be omitted. If <addr3> is omitted, then it is assumed that image at
 <addr2> should be used. Similarly, when <addr2> is omitted, it is assumed that
 image at <addr1> should be used. If <addr1> is omitted, it is assumed that the
 current image address is to be used. For example, consider the following
-commands:
-
-tftp 200000 /tftpboot/uImage
-bootm :kernel-1
-Last command is equivalent to:
-bootm 200000:kernel-1
-
-tftp 200000 /tftpboot/uImage
-bootm 400000:kernel-1 :ramdisk-1
-Last command is equivalent to:
-bootm 400000:kernel-1 400000:ramdisk-1
-
-tftp 200000 /tftpboot/uImage
-bootm :kernel-1 400000:ramdisk-1 :fdt-1
-Last command is equivalent to:
-bootm 200000:kernel-1 400000:ramdisk-1 400000:fdt-1
+commands::
+
+    tftp 200000 /tftpboot/uImage
+    bootm :kernel-1
+    Last command is equivalent to:
+    bootm 200000:kernel-1
+
+    tftp 200000 /tftpboot/uImage
+    bootm 400000:kernel-1 :ramdisk-1
+    Last command is equivalent to:
+    bootm 400000:kernel-1 400000:ramdisk-1
+
+    tftp 200000 /tftpboot/uImage
+    bootm :kernel-1 400000:ramdisk-1 :fdt-1
+    Last command is equivalent to:
+    bootm 200000:kernel-1 400000:ramdisk-1 400000:fdt-1
doc/usage/fit/index.rst +1 -0
index bd25bd30b284..92998e724c28 100644
@@ -17,3 +17,4 @@ doc/uImage.FIT
     verified-boot
     beaglebone_vboot
     overlay-fdt-boot
+    command_syntax_extensions
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
#13 lore raw

PATCH v2 14/14 doc: Improve documentation for the bootm command

In reply to Simon Glass

Reformat and rewrite the documentation for this command.

This is a complicated command, so further improvements are welcome.

---

(no changes since v1)

 doc/usage/cmd/bootm.rst | 327 ++++++++++++++++++++++++----------------
 doc/usage/fit/index.rst |   1 -
 doc/usage/index.rst     |   1 +
 3 files changed, 201 insertions(+), 128 deletions(-)
doc/usage/cmd/bootm.rst +200 -127
index 65b7891c8a69..a7e5f6ce69ab 100644
@@ -1,161 +1,267 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-Command syntax extensions for the new uImage format
-===================================================
+bootm command
+=============
 
-Author: Bartlomiej Sieka <[email protected]>
+Synopsis
+--------
 
-With the introduction of the new uImage format, bootm command (and other
-commands as well) have to understand new syntax of the arguments. This is
-necessary in order to specify objects contained in the new uImage, on which
-bootm has to operate. This note attempts to first summarize bootm usage
-scenarios, and then introduces new argument syntax.
+::
 
+    bootm [fit_addr]#<conf>[#extra-conf]
+    bootm [[fit_addr]:<os_subimg>] [[<fit_addr2>]:<rd_subimg2>] [[<fit_addr3>]:<fdt_subimg>]
 
-bootm usage scenarios
----------------------
+    bootm <addr1> [[<addr2> [<addr3>]]    # Legacy boot
 
-Below is a summary of bootm usage scenarios, focused on booting a PowerPC
-Linux kernel. The purpose of the following list is to document a complete list
-of supported bootm usages.
+Description
+-----------
 
-Note: U-Boot supports two methods of booting a PowerPC Linux kernel: old way,
-i.e., without passing the Flattened Device Tree (FDT), and new way, where the
-kernel is passed a pointer to the FDT. The boot method is indicated for each
-scenario::
+The *bootm* command is used to boot an Operating System. It has a large number
+of options depending on what needs to be booted.
 
-    1.  bootm        boot image at the current address, equivalent to 2,3,8
+Note that the second form supports the first and/or second arguments to be
+omitted by using a hyphen '-' instead.
 
-Old uImage::
+fit_addr / fit_addr2 / fit_addr3
+    address of FIT to boot, defaults to CONFIG_SYS_LOAD_ADDR. See notes below.
 
-    2.  bootm <addr1>            /* single image at <addr1> */
-    3.  bootm <addr1>            /* multi-image at <addr1>  */
-    4.  bootm <addr1> -            /* multi-image at <addr1>  */
-    5.  bootm <addr1> <addr2>        /* single image at <addr1> */
-    6.  bootm <addr1> <addr2> <addr3>   /* single image at <addr1> */
-    7.  bootm <addr1> -      <addr3>   /* single image at <addr1> */
+conf
+    configuration unit to boot (must be preceded by hash '#')
 
-New uImage::
+extra-conf
+    extra configuration to boot. This is supported only for additional
+    devicetree overlays to apply on the base device tree supplied by the first
+    configuration unit.
 
-    8.  bootm <addr1>
-    9.  bootm [<addr1>]:<subimg1>
-    10. bootm [<addr1>]#<conf>[#<extra-conf[#...]]
-    11. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2>
-    12. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> [<addr3>]:<subimg3>
-    13. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> <addr3>
-    14. bootm [<addr1>]:<subimg1> -              [<addr3>]:<subimg3>
-    15. bootm [<addr1>]:<subimg1> -              <addr3>
+os_subimg
+    OS sub-image to boot (must be preceded by colon ':')
+
+rd_subimg
+    ramdisk sub-image to boot. Use a hyphen '-' if there is no ramdisk but an
+    FDT is needed.
+
+fdt_subimg
+    FDT sub-image to boot
+
+See below for legacy boot. Booting using :doc:`../fit/index` is recommended.
+
+Note on current image address
+-----------------------------
+
+When bootm is called without arguments, the image at current image address is
+booted. The current image address is the address set most recently by a load
+command, etc, and is by default equal to CONFIG_SYS_LOAD_ADDR. For example,
+consider the following commands::
+
+    tftp 200000 /tftpboot/kernel
+    bootm
+    # Last command is equivalent to:
+    # bootm 200000
+
+As shown above, with FIT the address portion of any argument
+can be omitted. If <addr3> is omitted, then it is assumed that image at
+<addr2> should be used. Similarly, when <addr2> is omitted, it is assumed that
+image at <addr1> should be used. If <addr1> is omitted, it is assumed that the
+current image address is to be used. For example, consider the following
+commands::
+
+    tftp 200000 /tftpboot/uImage
+    bootm :kernel-1
+    # Last command is equivalent to:
+    # bootm 200000:kernel-1
+
+    tftp 200000 /tftpboot/uImage
+    bootm 400000:kernel-1 :ramdisk-1
+    # Last command is equivalent to:
+    # bootm 400000:kernel-1 400000:ramdisk-1
+
+    tftp 200000 /tftpboot/uImage
+    bootm :kernel-1 400000:ramdisk-1 :fdt-1
+    # Last command is equivalent to:
+    # bootm 200000:kernel-1 400000:ramdisk-1 400000:fdt-1
+
+
+Legacy boot
+-----------
+
+U-Boot supports a legacy image format, enabled by `CONFIG_LEGACY_IMAGE_FORMAT`.
+This is not recommended as it is quite limited and insecure. Use
+:doc:`../fit/index` instead. It is documented here for old boards which still
+use it.
+
+Arguments are:
+
+addr1
+    address of legacy image to boot. If the image includes a second component
+    (ramdisk) it is used as well, unless the second parameter is hyphen '-'.
+
+addr2
+    address of legacy image to use as ramdisk
 
-Ad. 1. This is equivalent to cases 2,3,8, depending on the type of image at
+addr3
+    address of legacy image to use as FDT
+
+
+Example syntax
+--------------
+
+This section provides various examples of possible usage::
+
+    1.  bootm       /* boot image at the current address, equivalent to 2,3,8 */
+
+This is equivalent to cases 2, 3 or 8, depending on the type of image at
 the current image address.
 
-- boot method: see cases 2,3,8
+Boot method: see cases 2,3,8
+
+Legacy uImage syntax
+~~~~~~~~~~~~~~~~~~~~
 
-Ad. 2. Boot kernel image located at <addr1>.
+::
+
+    2.  bootm <addr1>            /* single image at <addr1> */
 
-- boot method: non-FDT
+Boot kernel image located at <addr1>.
 
-Ad. 3. First and second components of the image at <addr1> are assumed to be a
+Boot method: non-FDT
+
+::
+
+    3.  bootm <addr1>            /* multi-image at <addr1>  */
+
+First and second components of the image at <addr1> are assumed to be a
 kernel and a ramdisk, respectively. The kernel is booted with initrd loaded
 with the ramdisk from the image.
 
-- boot method: depends on the number of components at <addr1>, and on whether
-  U-Boot is compiled with OF support::
+Boot method: depends on the number of components at <addr1>, and on whether
+U-Boot is compiled with OF support, which it should be.
 
-    ======================================================================
-                        |           2 components |           3 components|
-                        |       (kernel, initrd) | (kernel, initrd, fdt) |
-    ======================================================================
-    #ifdef CONFIG_OF_*  |                non-FDT |                   FDT |
-    #ifndef CONFIG_OF_* |                non-FDT |               non-FDT |
-    ======================================================================
+    ==================== ======================== ========================
+    Configuration        2 components             3 components
+                         (kernel, initrd)         (kernel, initrd, fdt)
+    ==================== ======================== ========================
+    #ifdef CONFIG_OF_*                   non-FDT                     FDT
+    #ifndef CONFIG_OF_*                  non-FDT                 non-FDT
+    ==================== ======================== ========================
+
+::
+
+    4.  bootm <addr1> -            /* multi-image at <addr1>  */
 
-Ad. 4. Similar to case 3, but the kernel is booted without initrd.  Second
+Similar to case 3, but the kernel is booted without initrd.  Second
 component of the multi-image is irrelevant (it can be a dummy, 1-byte file).
 
-- boot method: see case 3
+Boot method: see case 3
 
-Ad. 5. Boot kernel image located at <addr1> with initrd loaded with ramdisk
+::
+
+    5.  bootm <addr1> <addr2>        /* single image at <addr1> */
+
+Boot kernel image located at <addr1> with initrd loaded with ramdisk
 from the image at <addr2>.
 
-- boot method: non-FDT
+Boot method: non-FDT
+
+::
 
-Ad. 6. <addr1> is the address of a kernel image, <addr2> is the address of a
+    6.  bootm <addr1> <addr2> <addr3>   /* single image at <addr1> */
+
+<addr1> is the address of a kernel image, <addr2> is the address of a
 ramdisk image, and <addr3> is the address of a FDT binary blob.  Kernel is
 booted with initrd loaded with ramdisk from the image at <addr2>.
 
-- boot method: FDT
+Boot method: FDT
+
+::
+
+    7.  bootm <addr1> -      <addr3>   /* single image at <addr1> */
 
-Ad. 7. <addr1> is the address of a kernel image and <addr3> is the address of
+<addr1> is the address of a kernel image and <addr3> is the address of
 a FDT binary blob. Kernel is booted without initrd.
 
-- boot method: FDT
+Boot method: FDT
+
+FIT syntax
+~~~~~~~~~~
+
+::
+
+    8.  bootm <addr1>
 
-Ad. 8. Image at <addr1> is assumed to contain a default configuration, which
+Image at <addr1> is assumed to contain a default configuration, which
 is booted.
 
-- boot method: FDT or non-FDT, depending on whether the default configuration
-  defines FDT
+Boot method: FDT or non-FDT, depending on whether the default configuration
+defines FDT
+
+::
+
+    9.  bootm [<addr1>]:<subimg1>
 
-Ad. 9. Similar to case 2: boot kernel stored in <subimg1> from the image at
+Similar to case 2: boot kernel stored in <subimg1> from the image at
 address <addr1>.
 
-- boot method: non-FDT
+Boot method: non-FDT
 
-Ad. 10. Boot configuration <conf> from the image at <addr1>.
+::
 
-- boot method: FDT or non-FDT, depending on whether the configuration given
-  defines FDT
+    10. bootm [<addr1>]#<conf>[#<extra-conf[#...]]
+
+Boot configuration <conf> from the image at <addr1>.
+
+Boot method: FDT or non-FDT, depending on whether the configuration given
+defines FDT
+
+::
 
-Ad. 11. Equivalent to case 5: boot kernel stored in <subimg1> from the image
+    11. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2>
+
+Equivalent to case 5: boot kernel stored in <subimg1> from the image
 at <addr1> with initrd loaded with ramdisk <subimg2> from the image at
 <addr2>.
 
-- boot method: non-FDT
+Boot method: non-FDT
 
-Ad. 12. Equivalent to case 6: boot kernel stored in <subimg1> from the image
+::
+
+    12. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> [<addr3>]:<subimg3>
+
+Equivalent to case 6: boot kernel stored in <subimg1> from the image
 at <addr1> with initrd loaded with ramdisk <subimg2> from the image at
 <addr2>, and pass FDT blob <subimg3> from the image at <addr3>.
 
-- boot method: FDT
+Boot method: FDT
 
-Ad. 13. Similar to case 12, the difference being that <addr3> is the address
-of FDT binary blob that is to be passed to the kernel.
+::
 
-- boot method: FDT
+    13. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> <addr3>
 
-Ad. 14. Equivalent to case 7: boot kernel stored in <subimg1> from the image
-at <addr1>, without initrd, and pass FDT blob <subimg3> from the image at
-<addr3>.
+Similar to case 12, the difference being that <addr3> is the address
+of FDT binary blob that is to be passed to the kernel.
 
-- boot method: FDT
+Boot method: FDT
 
-Ad. 15. Similar to case 14, the difference being that <addr3> is the address
-of the FDT binary blob that is to be passed to the kernel.
+::
 
-- boot method: FDT
+    14. bootm [<addr1>]:<subimg1> -              [<addr3>]:<subimg3>
 
+Equivalent to case 7: boot kernel stored in <subimg1> from the image
+at <addr1>, without initrd, and pass FDT blob <subimg3> from the image at
+<addr3>.
 
-New uImage argument syntax
---------------------------
+Boot method: FDT
 
-New uImage support introduces two new forms for bootm arguments, with the
-following syntax:
+    15. bootm [<addr1>]:<subimg1> -              <addr3>
 
-new uImage sub-image specification
-    <addr>:<sub-image unit_name>
+Similar to case 14, the difference being that <addr3> is the address
+of the FDT binary blob that is to be passed to the kernel.
 
-new uImage configuration specification
-    <addr>#<configuration unit_name>
+Boot method: FDT
 
-new uImage configuration specification with extra configuration components
-    <addr>#<configuration unit_name>[#<extra configuration unit_name>[#..]]
 
-The extra configuration currently is supported only for additional device tree
-overlays to apply on the base device tree supplied by the first configuration
-unit.
 
-Examples:
+Example
+-------
 
 boot kernel "kernel-1" stored in a new uImage located at 200000::
 
@@ -190,38 +296,5 @@ same new uImage::
 
     bootm 200000:kernel-2 - 200000:fdt-1
 
-
-Note on current image address
------------------------------
-
-When bootm is called without arguments, the image at current image address is
-booted. The current image address is the address set most recently by a load
-command, etc, and is by default equal to CONFIG_SYS_LOAD_ADDR. For example, consider
-the following commands::
-
-    tftp 200000 /tftpboot/kernel
-    bootm
-    Last command is equivalent to:
-    bootm 200000
-
-In case of the new uImage argument syntax, the address portion of any argument
-can be omitted. If <addr3> is omitted, then it is assumed that image at
-<addr2> should be used. Similarly, when <addr2> is omitted, it is assumed that
-image at <addr1> should be used. If <addr1> is omitted, it is assumed that the
-current image address is to be used. For example, consider the following
-commands::
-
-    tftp 200000 /tftpboot/uImage
-    bootm :kernel-1
-    Last command is equivalent to:
-    bootm 200000:kernel-1
-
-    tftp 200000 /tftpboot/uImage
-    bootm 400000:kernel-1 :ramdisk-1
-    Last command is equivalent to:
-    bootm 400000:kernel-1 400000:ramdisk-1
-
-    tftp 200000 /tftpboot/uImage
-    bootm :kernel-1 400000:ramdisk-1 :fdt-1
-    Last command is equivalent to:
-    bootm 200000:kernel-1 400000:ramdisk-1 400000:fdt-1
+.. sectionauthor:: Bartlomiej Sieka <[email protected]>
+.. sectionauthor:: Simon Glass <[email protected]>
doc/usage/fit/index.rst +0 -1
index 92998e724c28..bd25bd30b284 100644
@@ -17,4 +17,3 @@ doc/uImage.FIT
     verified-boot
     beaglebone_vboot
     overlay-fdt-boot
-    command_syntax_extensions
doc/usage/index.rst +1 -0
index e1fe284b38c1..98dd8614fe53 100644
@@ -31,6 +31,7 @@ Shell commands
    cmd/bootefi
    cmd/bootflow
    cmd/booti
+   cmd/bootm
    cmd/bootmenu
    cmd/bootmeth
    cmd/button
Signature · 1 line
2.41.0.162.gfafddb0af9-goog