All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options
@ 2022-06-12 22:13 Sean Anderson
  2022-06-12 22:13 ` [PATCH v2 01/14] doc: mkimage: Use standard style for synopsis Sean Anderson
                   ` (13 more replies)
  0 siblings, 14 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:13 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

This gives a facelift for the mkimage man page, bringing it in line with the
style perscribed by man-pages(7) and groff_man_style(7). I have tried to remove
typographical and grammatical errors and inconsistencies wherever possible. The
man page now both looks and feels closer to other Linux man pages. As a bonus, I
also added a man page for dumpimage in the same style.

To address the impending exhaustion of short options, this also adds long
options for each short option.

Changes in v2:
- Add long options
- Better document multi images
- Document -h and -V
- Ensure comments are requests
- Escape minus signs in examples
- Fix -B not being bolded in the description for -R
- Fix extra quote in -E synopsis
- Fix spacing for -F
- Further document -o and -R
- Indent things more robustly
- Italicize parameter for -d
- Make lists of valid algos bold
- Rearrange more options
- Remove spaces around pipes
- Rename first subsection to "General options"
- Use escape-sequences for options width all three of B/I/R. This renders
  better with mandoc.
- Use paired quotation marks

Sean Anderson (14):
  doc: mkimage: Use standard style for synopsis
  doc: mkimage: Use empty request instead of blank lines
  doc: mkimage: Reformat examples
  doc: mkimage: Regularize option documentation
  doc: mkimage: Use subsection macro
  doc: mkimage: Rearrange/remove some options
  doc: mkimage: Use correct capitalization for NAME
  doc: mkimage: Edit options for style and consistency
  doc: mkimage: Add BUGS section
  doc: mkimage: Add SEE ALSO section
  doc: mkimage: Remove AUTHORS section
  mkimage: Add long options
  doc: mkimage: Further document -o and -R
  doc: Add man page for dumpimage

 doc/dumpimage.1 | 103 ++++++
 doc/mkimage.1   | 933 ++++++++++++++++++++++++++++++++++--------------
 tools/mkimage.c |  45 ++-
 3 files changed, 811 insertions(+), 270 deletions(-)
 create mode 100644 doc/dumpimage.1

-- 
2.35.1


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH v2 01/14] doc: mkimage: Use standard style for synopsis
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
@ 2022-06-12 22:13 ` Sean Anderson
  2022-06-16  9:45   ` Heinrich Schuchardt
  2022-06-12 22:13 ` [PATCH v2 02/14] doc: mkimage: Use empty request instead of blank lines Sean Anderson
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:13 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

The synopsis section is a bit messy. As an example, "uimage file name" is
printed in italics, bold, and roman (depending on the line). This cleans
things up and converts the synopsis section to use standard style. The
.SY/.YS macros set up appropriate fomatting for command synopsis sections
(such as disabling hyphenation and setting a hanging indent). All parts of
the synopsis now use the following style:

- Bold for parts of the command which should be typed in by the user (such
  as the program name and flags)
- Italic for parts which should be replaced (such as uimage-file-name)
- Roman for parts which should not be typed at all (such as brackets)

Multi-word variables now use hyphens to connect their words instead of
spaces. This makes it clearer that all the words are part of the same
variable. Additionally, "option ..." is used to denote where other options
may be specified, as this appears to be standard style.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- Fix spacing for -F

 doc/mkimage.1 | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 759dc2d12f..dc597272d4 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -3,17 +3,27 @@
 .SH NAME
 mkimage \- Generate image for U-Boot
 .SH SYNOPSIS
-.B mkimage
-.RB [ \-T " \fItype\fP] " \-l " [\fIuimage file name\fP]"
+.SY mkimage
+.OP \-T type
+.BI \-l\~ image-file-name
+.YS
 
-.B mkimage
-.RB [\fIoptions\fP] " \-f [" "image tree source file" "]" " [" "uimage file name" "]"
+.SY mkimage
+.RI [ option\~ .\|.\|.\&]
+.BI \-f\~ image-tree-source-file\c
+.RB | auto
+.I image-file-name
+.YS
 
-.B mkimage
-.RB [\fIoptions\fP] " \-F [" "uimage file name" "]"
+.SY mkimage
+.RI [ option\~ .\|.\|.\&]
+.BI \-F\~ image-file-name
+.YS
 
-.B mkimage
-.RB [\fIoptions\fP] " (legacy mode)"
+.SY mkimage
+.RI [ option\~ .\|.\|.\&]
+.R (legacy mode)
+.YS
 
 .SH "DESCRIPTION"
 The
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 02/14] doc: mkimage: Use empty request instead of blank lines
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
  2022-06-12 22:13 ` [PATCH v2 01/14] doc: mkimage: Use standard style for synopsis Sean Anderson
@ 2022-06-12 22:13 ` Sean Anderson
  2022-06-12 22:14 ` [PATCH v2 03/14] doc: mkimage: Reformat examples Sean Anderson
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:13 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

Blank lines do not have well-defined semantics in fill mode (the default).
Instead, use empty requests (.) where vertical space is necessary for
readability. There are a few places where we use a paragraph instead.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

(no changes since v1)

 doc/mkimage.1 | 110 +++++++++++++++++++++++++-------------------------
 1 file changed, 55 insertions(+), 55 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index dc597272d4..be12843928 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -1,5 +1,5 @@
 .TH MKIMAGE 1 "2022-02-07"
-
+.
 .SH NAME
 mkimage \- Generate image for U-Boot
 .SH SYNOPSIS
@@ -7,34 +7,34 @@ mkimage \- Generate image for U-Boot
 .OP \-T type
 .BI \-l\~ image-file-name
 .YS
-
+.
 .SY mkimage
 .RI [ option\~ .\|.\|.\&]
 .BI \-f\~ image-tree-source-file\c
 .RB | auto
 .I image-file-name
 .YS
-
+.
 .SY mkimage
 .RI [ option\~ .\|.\|.\&]
 .BI \-F\~ image-file-name
 .YS
-
+.
 .SY mkimage
 .RI [ option\~ .\|.\|.\&]
-.R (legacy mode)
+(legacy mode)
 .YS
-
+.
 .SH "DESCRIPTION"
 The
 .B mkimage
 command is used to create images for use with the U-Boot boot loader.
 These images can contain the linux kernel, device tree blob, root file
 system image, firmware images etc., either separate or combined.
-
+.P
 .B mkimage
 supports two different formats:
-
+.P
 The old
 .I legacy image
 format concatenates the individual parts (for example, kernel image,
@@ -42,69 +42,69 @@ device tree blob and ramdisk image) and adds a 64 bytes header
 containing information about target architecture, operating system,
 image type, compression method, entry points, time stamp, checksums,
 etc.
-
+.P
 The new
 .I FIT (Flattened Image Tree) format
 allows for more flexibility in handling images of various types and also
 enhances integrity protection of images with stronger checksums. It also
 supports verified boot.
-
+.
 .SH "OPTIONS"
-
+.
 .B List image information:
-
+.
 .TP
 .BI "\-l [" "uimage file name" "]"
 mkimage lists the information contained in the header of an existing U-Boot image.
-
+.
 .TP
 .BI "\-T [" "image type" "]"
 Parse image file as type.
 Pass \-h as the image to see the list of supported image type.
 Without this option image type is autodetected.
-
+.
 .TP
 .BI "\-q"
 Quiet. Don't print the image header on successful verification.
-
+.
 .P
 .B Create old legacy image:
-
+.
 .TP
 .BI "\-A [" "architecture" "]"
 Set architecture. Pass \-h as the architecture to see the list of supported architectures.
-
+.
 .TP
 .BI "\-O [" "os" "]"
 Set operating system. bootm command of u-boot changes boot method by os type.
 Pass \-h as the OS to see the list of supported OS.
-
+.
 .TP
 .BI "\-T [" "image type" "]"
 Set image type.
 Pass \-h as the image to see the list of supported image type.
-
+.
 .TP
 .BI "\-C [" "compression type" "]"
 Set compression type.
 Pass \-h as the compression to see the list of supported compression type.
-
+.
 .TP
 .BI "\-a [" "load address" "]"
 Set load address with a hex number.
-
+.
 .TP
 .BI "\-e [" "entry point" "]"
 Set entry point with a hex number.
-
+.
 .TP
 .BI "\-l"
 List the contents of an image.
-
+.
 .TP
 .BI "\-n [" "image name" "]"
 Set image name to 'image name'.
-
+.
 .TP
 .BI "\-R [" "secondary image name" "]"
 Some image types support a second image for additional data. For these types,
@@ -133,42 +133,42 @@ when loading the image. At most 256 parameters may be specified in this
 manner.
 T}
 .TE
-
+.
 .TP
 .BI "\-d [" "image data file" "]"
 Use image data from 'image data file'.
-
+.
 .TP
 .BI "\-x"
 Set XIP (execute in place) flag.
-
+.
 .TP
 .BI "\-s"
 Don't copy in the image data. Depending on the image type, this may create
 just the header, everything but the image data, or nothing at all.
-
+.
 .TP
 .BI "\-v"
 Verbose. Print file names as they are added to the image.
-
+.
 .P
 .B Create FIT image:
-
+.
 .TP
 .BI "\-b [" "device tree file" "]
 Appends the device tree binary file (.dtb) to the FIT.
-
+.
 .TP
 .BI "\-c [" "comment" "]"
 Specifies a comment to be added when signing. This is typically a useful
 message which describes how the image was signed or some other useful
 information.
-
+.
 .TP
 .BI "\-D [" "dtc options" "]"
 Provide special options to the device tree compiler that is used to
 create the image.
-
+.
 .TP
 .BI "\-E
 After processing, move the image data outside the FIT and store a data offset
@@ -177,44 +177,44 @@ FIT, with each one aligned to a 4-byte boundary. The existing 'data' property
 in each image will be replaced with 'data-offset' and 'data-size' properties.
 A 'data-offset' of 0 indicates that it starts in the first (4-byte aligned)
 byte after the FIT.
-
+.
 .TP
 .BI "\-B [" "alignment" "]"
 The alignment, in hexadecimal, that external data will be aligned to. This
 option only has an effect when \-E is specified.
-
+.
 .TP
 .BI "\-f [" "image tree source file" " | " "auto" "]"
 Image tree source file that describes the structure and contents of the
 FIT image.
-
+.IP
 This can be automatically generated for some simple cases.
 Use "-f auto" for this. In that case the arguments -d, -A, -O, -T, -C, -a
 and -e are used to specify the image to include in the FIT and its attributes.
 No .its file is required.
-
+.
 .TP
 .BI "\-F"
 Indicates that an existing FIT image should be modified. No dtc
 compilation is performed and the \-f flag should not be given.
 This can be used to sign images with additional keys after initial image
 creation.
-
+.
 .TP
 .BI "\-i [" "ramdisk_file" "]"
 Appends the ramdisk file to the FIT.
-
+.
 .TP
 .BI "\-k [" "key_directory" "]"
 Specifies the directory containing keys to use for signing. This directory
 should contain a private key file <name>.key for use with signing and a
 certificate <name>.crt (containing the public key) for use with verification.
-
+.
 .TP
 .BI "\-G [" "key_file" "]"
 Specifies the private key file to use when signing. This option may be used
 instead of \-k.
-
+.
 .TP
 .BI "\-K [" "key_destination" "]"
 Specifies a compiled device tree binary file (typically .dtb) to write
@@ -222,53 +222,53 @@ public key information into. When a private key is used to sign an image,
 the corresponding public key is written into this file for for run-time
 verification. Typically the file here is the device tree binary used by
 CONFIG_OF_CONTROL in U-Boot.
-
+.
 .TP
 .BI "\-G [" "key_file" "]"
 Specifies the private key file to use when signing. This option may be used
 instead of \-k.
-
+.
 .TP
 .BI "\-g [" "key_name_hint" "]"
 Sets the key-name-hint property when used with \-f auto. This is the <name>
 part of the key. The directory part is set by \-k. This option also indicates
 that the images included in the FIT should be signed. If this option is
 specified, \-o must be specified as well.
-
+.
 .TP
 .BI "\-o [" "signing algorithm" "]"
 Specifies the algorithm to be used for signing a FIT image. The default is
 taken from the signature node's 'algo' property.
-
+.
 .TP
 .BI "\-p [" "external position" "]"
 Place external data at a static external position. See \-E. Instead of writing
 a 'data-offset' property defining the offset from the end of the FIT, \-p will
 use 'data-position' as the absolute position from the base of the FIT.
-
+.
 .TP
 .BI "\-r"
 Specifies that keys used to sign the FIT are required. This means that they
 must be verified for the image to boot. Without this option, the verification
 will be optional (useful for testing but not for release).
-
+.
 .TP
 .BI "\-N [" "engine" "]"
 The openssl engine to use when signing and verifying the image. For a complete list of
 available engines, refer to
 .BR engine (1).
-
+.
 .TP
 .BI "\-t
 Update the timestamp in the FIT.
-
+.IP
 Normally the FIT timestamp is created the first time mkimage is run on a FIT,
 when converting the source .its to the binary .fit file. This corresponds to
 using the -f flag. But if the original input to mkimage is a binary file
 (already compiled) then the timestamp is assumed to have been set previously.
-
+.
 .SH EXAMPLES
-
+.
 List image information:
 .nf
 .B mkimage -l uImage
@@ -294,7 +294,7 @@ skipping those for which keys cannot be found. Also add a comment.
 .br
 .B -c """Kernel 3.8 image for production devices""" kernel.itb
 .fi
-
+.
 .P
 Add public keys to u-boot.dtb without needing a FIT to sign. This will also
 create a FIT containing an images node with no data named unused.itb.
@@ -303,7 +303,7 @@ create a FIT containing an images node with no data named unused.itb.
 .br
 .B -o sha256,rsa2048 -K u-boot.dtb unused.itb
 .fi
-
+.
 .P
 Update an existing FIT image, signing it with additional keys.
 Add corresponding public keys into u-boot.dtb. This will resign all images
@@ -314,7 +314,7 @@ with unavailable keys are skipped.
 .br
 .B -c """Kernel 3.8 image for production devices""" kernel.itb
 .fi
-
+.
 .P
 Create a FIT image containing a kernel, using automatic mode. No .its file
 is required.
@@ -340,7 +340,7 @@ file is required.
 .br
 .B -d vmlinuz -k /secret/signing-keys -g dev -o sha256,rsa2048 kernel.itb
 .fi
-
+.
 .SH HOMEPAGE
 http://www.denx.de/wiki/U-Boot/WebHome
 .PP
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 03/14] doc: mkimage: Reformat examples
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
  2022-06-12 22:13 ` [PATCH v2 01/14] doc: mkimage: Use standard style for synopsis Sean Anderson
  2022-06-12 22:13 ` [PATCH v2 02/14] doc: mkimage: Use empty request instead of blank lines Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-12 22:14 ` [PATCH v2 04/14] doc: mkimage: Regularize option documentation Sean Anderson
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

This puts each example in a new paragraph and uses a hanging indent for
continued lines to increase clarity. We use tabs instead of .in or .RS for
the indent because it renders properly in both man and mandoc (which is
what many common HTML man pages use). The only nit is that the tab stops in
man default to something like 2", so reduce that to 1". We also escape
every "minus" as recommended by man-pages(7).

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- Escape minus signs in examples
- Indent things more robustly

 doc/mkimage.1 | 116 +++++++++++++++++++++++++++++---------------------
 1 file changed, 67 insertions(+), 49 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index be12843928..1015e21576 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -268,78 +268,96 @@ using the -f flag. But if the original input to mkimage is a binary file
 (already compiled) then the timestamp is assumed to have been set previously.
 .
 .SH EXAMPLES
-.
+.\" Reduce the width of the tab stops to something reasonable
+.ta T 1i
 List image information:
-.nf
-.B mkimage -l uImage
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-l uImage
+.EE
+.RE
 .P
 Create legacy image with compressed PowerPC Linux kernel:
-.nf
-.B mkimage -A powerpc -O linux -T kernel -C gzip \\\\
-.br
-.B -a 0 -e 0 -n Linux -d vmlinux.gz uImage
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-A powerpc \-O linux \-T kernel \-C gzip \\
+	\-a 0 \-e 0 \-n Linux \-d vmlinux.gz uImage
+.EE
+.RE
 .P
 Create FIT image with compressed PowerPC Linux kernel:
-.nf
-.B mkimage -f kernel.its kernel.itb
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-f kernel.its kernel.itb
+.EE
+.RE
 .P
 Create FIT image with compressed kernel and sign it with keys in the
-/public/signing-keys directory. Add corresponding public keys into u-boot.dtb,
+/public/signing\-keys directory. Add corresponding public keys into u\-boot.dtb,
 skipping those for which keys cannot be found. Also add a comment.
-.nf
-.B mkimage -f kernel.its -k /public/signing-keys -K u-boot.dtb \\\\
-.br
-.B -c """Kernel 3.8 image for production devices""" kernel.itb
-.fi
-.
+.RS
 .P
-Add public keys to u-boot.dtb without needing a FIT to sign. This will also
+.EX
+\fBmkimage \-f kernel.its \-k /public/signing\-keys \-K u\-boot.dtb \\
+	\-c \(dqKernel 3.8 image for production devices\(dq kernel.itb
+.EE
+.RE
+.P
+Add public keys to u\-boot.dtb without needing a FIT to sign. This will also
 create a FIT containing an images node with no data named unused.itb.
-.nf
-.B mkimage -f auto -d /dev/null -k /public/signing-keys -g dev \\\\
-.br
-.B -o sha256,rsa2048 -K u-boot.dtb unused.itb
-.fi
-.
+.RS
+.P
+.EX
+\fBmkimage \-f auto \-d /dev/null \-k /public/signing\-keys \-g dev \\
+	\-o sha256,rsa2048 \-K u\-boot.dtb unused.itb
+.EE
+.RE
 .P
 Update an existing FIT image, signing it with additional keys.
-Add corresponding public keys into u-boot.dtb. This will resign all images
+Add corresponding public keys into u\-boot.dtb. This will resign all images
 with keys that are available in the new directory. Images that request signing
 with unavailable keys are skipped.
-.nf
-.B mkimage -F -k /secret/signing-keys -K u-boot.dtb \\\\
-.br
-.B -c """Kernel 3.8 image for production devices""" kernel.itb
-.fi
-.
+.RS
+.P
+.EX
+\fBmkimage \-F \-k /secret/signing\-keys \-K u\-boot.dtb \\
+	\-c \(dqKernel 3.8 image for production devices\(dq kernel.itb
+.EE
+.RE
 .P
 Create a FIT image containing a kernel, using automatic mode. No .its file
 is required.
-.nf
-.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \\\\
-.br
-.B -c """Kernel 4.4 image for production devices""" -d vmlinuz kernel.itb
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e00000 \-e 0 \\
+	\-c \(dqKernel 4.4 image for production devices\(dq \-d vmlinuz kernel.itb
+.EE
+.RE
 .P
 Create a FIT image containing a kernel and some device tree files, using
 automatic mode. No .its file is required.
-.nf
-.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \\\\
-.br
-.B -c """Kernel 4.4 image for production devices""" -d vmlinuz \\\\
-.B -b /path/to/rk3288-firefly.dtb -b /path/to/rk3288-jerry.dtb kernel.itb
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e00000 \-e 0 \\
+	\-c \(dqKernel 4.4 image for production devices\(dq \-d vmlinuz \\
+	\-b /path/to/rk3288\-firefly.dtb \-b /path/to/rk3288\-jerry.dtb kernel.itb
+.EE
+.RE
 .P
 Create a FIT image containing a signed kernel, using automatic mode. No .its
 file is required.
-.nf
-.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e00000 -e 0 \\\\
-.br
-.B -d vmlinuz -k /secret/signing-keys -g dev -o sha256,rsa2048 kernel.itb
-.fi
+.RS
+.P
+.EX
+\fBmkimage \-f auto \-A arm \-O linux \-T kernel \-C none \-a 43e00000 \-e 0 \\
+	\-d vmlinuz \-k /secret/signing\-keys \-g dev \-o sha256,rsa2048 kernel.itb
+.EE
+.RE
 .
 .SH HOMEPAGE
 http://www.denx.de/wiki/U-Boot/WebHome
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 04/14] doc: mkimage: Regularize option documentation
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
                   ` (2 preceding siblings ...)
  2022-06-12 22:14 ` [PATCH v2 03/14] doc: mkimage: Reformat examples Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-16 10:00   ` Heinrich Schuchardt
  2022-06-12 22:14 ` [PATCH v2 05/14] doc: mkimage: Use subsection macro Sean Anderson
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

Square brackets are commonly used to denote optional parts of a command.
However, all option arguments are mandatory. Remove these brackets. This
also removes some unnecessary quotation marks, and uses hyphens to connect
words in option arguments.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- Fix extra quote in -E synopsis

 doc/mkimage.1 | 72 +++++++++++++++++++++++++--------------------------
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 1015e21576..4074715fe5 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -25,7 +25,7 @@ mkimage \- Generate image for U-Boot
 (legacy mode)
 .YS
 .
-.SH "DESCRIPTION"
+.SH DESCRIPTION
 The
 .B mkimage
 command is used to create images for use with the U-Boot boot loader.
@@ -49,64 +49,64 @@ allows for more flexibility in handling images of various types and also
 enhances integrity protection of images with stronger checksums. It also
 supports verified boot.
 .
-.SH "OPTIONS"
+.SH OPTIONS
 .
 .B List image information:
 .
 .TP
-.BI "\-l [" "uimage file name" "]"
+.BI \-l " uimage-file-name"
 mkimage lists the information contained in the header of an existing U-Boot image.
 .
 .TP
-.BI "\-T [" "image type" "]"
+.BI \-T " image-type"
 Parse image file as type.
 Pass \-h as the image to see the list of supported image type.
 Without this option image type is autodetected.
 .
 .TP
-.BI "\-q"
+.B \-q
 Quiet. Don't print the image header on successful verification.
 .
 .P
 .B Create old legacy image:
 .
 .TP
-.BI "\-A [" "architecture" "]"
+.BI \-A " architecture"
 Set architecture. Pass \-h as the architecture to see the list of supported architectures.
 .
 .TP
-.BI "\-O [" "os" "]"
+.BI \-O " os"
 Set operating system. bootm command of u-boot changes boot method by os type.
 Pass \-h as the OS to see the list of supported OS.
 .
 .TP
-.BI "\-T [" "image type" "]"
+.BI \-T " image-type"
 Set image type.
 Pass \-h as the image to see the list of supported image type.
 .
 .TP
-.BI "\-C [" "compression type" "]"
+.BI \-C " compression-type"
 Set compression type.
 Pass \-h as the compression to see the list of supported compression type.
 .
 .TP
-.BI "\-a [" "load address" "]"
+.BI \-a " load-address"
 Set load address with a hex number.
 .
 .TP
-.BI "\-e [" "entry point" "]"
+.BI \-e " entry-point"
 Set entry point with a hex number.
 .
 .TP
-.BI "\-l"
+.B \-l
 List the contents of an image.
 .
 .TP
-.BI "\-n [" "image name" "]"
+.BI \-n " image-name"
 Set image name to 'image name'.
 .
 .TP
-.BI "\-R [" "secondary image name" "]"
+.BI \-R " secondary-image-name"
 Some image types support a second image for additional data. For these types,
 use \-R to specify this second image.
 .TS
@@ -135,42 +135,42 @@ T}
 .TE
 .
 .TP
-.BI "\-d [" "image data file" "]"
+.BI \-d " image-data-file"
 Use image data from 'image data file'.
 .
 .TP
-.BI "\-x"
+.B \-x
 Set XIP (execute in place) flag.
 .
 .TP
-.BI "\-s"
+.B \-s
 Don't copy in the image data. Depending on the image type, this may create
 just the header, everything but the image data, or nothing at all.
 .
 .TP
-.BI "\-v"
+.B \-v
 Verbose. Print file names as they are added to the image.
 .
 .P
 .B Create FIT image:
 .
 .TP
-.BI "\-b [" "device tree file" "]
+.BI \-b " device-tree-file"
 Appends the device tree binary file (.dtb) to the FIT.
 .
 .TP
-.BI "\-c [" "comment" "]"
+.BI \-c " comment"
 Specifies a comment to be added when signing. This is typically a useful
 message which describes how the image was signed or some other useful
 information.
 .
 .TP
-.BI "\-D [" "dtc options" "]"
+.BI \-D " dtc-options"
 Provide special options to the device tree compiler that is used to
 create the image.
 .
 .TP
-.BI "\-E
+.BI \-E
 After processing, move the image data outside the FIT and store a data offset
 in the FIT. Images will be placed one after the other immediately after the
 FIT, with each one aligned to a 4-byte boundary. The existing 'data' property
@@ -179,12 +179,12 @@ A 'data-offset' of 0 indicates that it starts in the first (4-byte aligned)
 byte after the FIT.
 .
 .TP
-.BI "\-B [" "alignment" "]"
+.BI \-B " alignment"
 The alignment, in hexadecimal, that external data will be aligned to. This
 option only has an effect when \-E is specified.
 .
 .TP
-.BI "\-f [" "image tree source file" " | " "auto" "]"
+.BI \-f " image-tree-source-file"
 Image tree source file that describes the structure and contents of the
 FIT image.
 .IP
@@ -194,29 +194,29 @@ and -e are used to specify the image to include in the FIT and its attributes.
 No .its file is required.
 .
 .TP
-.BI "\-F"
+.B \-F
 Indicates that an existing FIT image should be modified. No dtc
 compilation is performed and the \-f flag should not be given.
 This can be used to sign images with additional keys after initial image
 creation.
 .
 .TP
-.BI "\-i [" "ramdisk_file" "]"
+.BI \-i " ramdisk-file"
 Appends the ramdisk file to the FIT.
 .
 .TP
-.BI "\-k [" "key_directory" "]"
+.BI \-k " key-directory"
 Specifies the directory containing keys to use for signing. This directory
 should contain a private key file <name>.key for use with signing and a
 certificate <name>.crt (containing the public key) for use with verification.
 .
 .TP
-.BI "\-G [" "key_file" "]"
+.BI \-G " key-file"
 Specifies the private key file to use when signing. This option may be used
 instead of \-k.
 .
 .TP
-.BI "\-K [" "key_destination" "]"
+.BI \-K " key-destination"
 Specifies a compiled device tree binary file (typically .dtb) to write
 public key information into. When a private key is used to sign an image,
 the corresponding public key is written into this file for for run-time
@@ -224,42 +224,42 @@ verification. Typically the file here is the device tree binary used by
 CONFIG_OF_CONTROL in U-Boot.
 .
 .TP
-.BI "\-G [" "key_file" "]"
+.BI \-G " key-file"
 Specifies the private key file to use when signing. This option may be used
 instead of \-k.
 .
 .TP
-.BI "\-g [" "key_name_hint" "]"
+.BI \-g " key-name-hint"
 Sets the key-name-hint property when used with \-f auto. This is the <name>
 part of the key. The directory part is set by \-k. This option also indicates
 that the images included in the FIT should be signed. If this option is
 specified, \-o must be specified as well.
 .
 .TP
-.BI "\-o [" "signing algorithm" "]"
+.BI \-o " signing-algorithm"
 Specifies the algorithm to be used for signing a FIT image. The default is
 taken from the signature node's 'algo' property.
 .
 .TP
-.BI "\-p [" "external position" "]"
+.BI \-p " external-position"
 Place external data at a static external position. See \-E. Instead of writing
 a 'data-offset' property defining the offset from the end of the FIT, \-p will
 use 'data-position' as the absolute position from the base of the FIT.
 .
 .TP
-.BI "\-r"
+.B \-r
 Specifies that keys used to sign the FIT are required. This means that they
 must be verified for the image to boot. Without this option, the verification
 will be optional (useful for testing but not for release).
 .
 .TP
-.BI "\-N [" "engine" "]"
+.BI \-N " engine"
 The openssl engine to use when signing and verifying the image. For a complete list of
 available engines, refer to
 .BR engine (1).
 .
 .TP
-.BI "\-t
+.B \-t
 Update the timestamp in the FIT.
 .IP
 Normally the FIT timestamp is created the first time mkimage is run on a FIT,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 05/14] doc: mkimage: Use subsection macro
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
                   ` (3 preceding siblings ...)
  2022-06-12 22:14 ` [PATCH v2 04/14] doc: mkimage: Regularize option documentation Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-16 10:08   ` Heinrich Schuchardt
  2022-06-12 22:14 ` [PATCH v2 06/14] doc: mkimage: Rearrange/remove some options Sean Anderson
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

The options are divided up into several subsections. Use the appropriate
macro. While we're at it, rename the headings to better reflect the
contents of their sections.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- Rename first subsection to "General options"
- Use paired quotation marks

 doc/mkimage.1 | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 4074715fe5..8b96011f90 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -51,7 +51,7 @@ supports verified boot.
 .
 .SH OPTIONS
 .
-.B List image information:
+.SS General options
 .
 .TP
 .BI \-l " uimage-file-name"
@@ -67,8 +67,7 @@ Without this option image type is autodetected.
 .B \-q
 Quiet. Don't print the image header on successful verification.
 .
-.P
-.B Create old legacy image:
+.SS Options for creating legacy or \(lqauto\(rq images
 .
 .TP
 .BI \-A " architecture"
@@ -151,8 +150,7 @@ just the header, everything but the image data, or nothing at all.
 .B \-v
 Verbose. Print file names as they are added to the image.
 .
-.P
-.B Create FIT image:
+.SS Options for creating FIT images
 .
 .TP
 .BI \-b " device-tree-file"
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 06/14] doc: mkimage: Rearrange/remove some options
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
                   ` (4 preceding siblings ...)
  2022-06-12 22:14 ` [PATCH v2 05/14] doc: mkimage: Use subsection macro Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-12 22:14 ` [PATCH v2 07/14] doc: mkimage: Use correct capitalization for NAME Sean Anderson
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

This moves some options which work in any mode to the general options
section. -p is moved to after -E/-B since those options are related. This
also adds documentation for -h and -V.

The -F, -l, and -G options are documented twice. Remove the second
documentation in each case. The synopsis for -l also suggests an implied
second uimage-file-name parameter. E.g.

	mkimage [-l uimage-file-name] uimage-file-name

This is misleading, so remove it. Wrap a few lines to 80 characters as
well.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- Document -h and -V
- Rearrange more options

 doc/mkimage.1 | 62 ++++++++++++++++++++++++---------------------------
 1 file changed, 29 insertions(+), 33 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 8b96011f90..6c649f6cbf 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -54,8 +54,18 @@ supports verified boot.
 .SS General options
 .
 .TP
-.BI \-l " uimage-file-name"
-mkimage lists the information contained in the header of an existing U-Boot image.
+.B \-h
+Print a help message and exit.
+.
+.TP
+.B \-l
+mkimage lists the information contained in the header of an existing U-Boot
+image.
+.
+.TP
+.B \-s
+Don't copy in the image data. Depending on the image type, this may create
+just the header, everything but the image data, or nothing at all.
 .
 .TP
 .BI \-T " image-type"
@@ -65,13 +75,22 @@ Without this option image type is autodetected.
 .
 .TP
 .B \-q
-Quiet. Don't print the image header on successful verification.
+Quiet. Don't print the image header.
+.
+.TP
+.B \-v
+Verbose. Print file names as they are added to the image.
+.
+.TP
+.B \-V
+Print version information and exit.
 .
 .SS Options for creating legacy or \(lqauto\(rq images
 .
 .TP
 .BI \-A " architecture"
-Set architecture. Pass \-h as the architecture to see the list of supported architectures.
+Set architecture. Pass \-h as the architecture to see the list of supported
+architectures.
 .
 .TP
 .BI \-O " os"
@@ -79,11 +98,6 @@ Set operating system. bootm command of u-boot changes boot method by os type.
 Pass \-h as the OS to see the list of supported OS.
 .
 .TP
-.BI \-T " image-type"
-Set image type.
-Pass \-h as the image to see the list of supported image type.
-.
-.TP
 .BI \-C " compression-type"
 Set compression type.
 Pass \-h as the compression to see the list of supported compression type.
@@ -97,10 +111,6 @@ Set load address with a hex number.
 Set entry point with a hex number.
 .
 .TP
-.B \-l
-List the contents of an image.
-.
-.TP
 .BI \-n " image-name"
 Set image name to 'image name'.
 .
@@ -141,15 +151,6 @@ Use image data from 'image data file'.
 .B \-x
 Set XIP (execute in place) flag.
 .
-.TP
-.B \-s
-Don't copy in the image data. Depending on the image type, this may create
-just the header, everything but the image data, or nothing at all.
-.
-.TP
-.B \-v
-Verbose. Print file names as they are added to the image.
-.
 .SS Options for creating FIT images
 .
 .TP
@@ -182,6 +183,12 @@ The alignment, in hexadecimal, that external data will be aligned to. This
 option only has an effect when \-E is specified.
 .
 .TP
+.BI \-p " external-position"
+Place external data at a static external position. See \-E. Instead of writing
+a 'data-offset' property defining the offset from the end of the FIT, \-p will
+use 'data-position' as the absolute position from the base of the FIT.
+.
+.TP
 .BI \-f " image-tree-source-file"
 Image tree source file that describes the structure and contents of the
 FIT image.
@@ -222,11 +229,6 @@ verification. Typically the file here is the device tree binary used by
 CONFIG_OF_CONTROL in U-Boot.
 .
 .TP
-.BI \-G " key-file"
-Specifies the private key file to use when signing. This option may be used
-instead of \-k.
-.
-.TP
 .BI \-g " key-name-hint"
 Sets the key-name-hint property when used with \-f auto. This is the <name>
 part of the key. The directory part is set by \-k. This option also indicates
@@ -239,12 +241,6 @@ Specifies the algorithm to be used for signing a FIT image. The default is
 taken from the signature node's 'algo' property.
 .
 .TP
-.BI \-p " external-position"
-Place external data at a static external position. See \-E. Instead of writing
-a 'data-offset' property defining the offset from the end of the FIT, \-p will
-use 'data-position' as the absolute position from the base of the FIT.
-.
-.TP
 .B \-r
 Specifies that keys used to sign the FIT are required. This means that they
 must be verified for the image to boot. Without this option, the verification
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 07/14] doc: mkimage: Use correct capitalization for NAME
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
                   ` (5 preceding siblings ...)
  2022-06-12 22:14 ` [PATCH v2 06/14] doc: mkimage: Rearrange/remove some options Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-12 22:14 ` [PATCH v2 08/14] doc: mkimage: Edit options for style and consistency Sean Anderson
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

The description in NAME should not be capitalized. Fix a grammatical error
as well.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

(no changes since v1)

 doc/mkimage.1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 6c649f6cbf..5267e7d22e 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -1,7 +1,7 @@
 .TH MKIMAGE 1 "2022-02-07"
 .
 .SH NAME
-mkimage \- Generate image for U-Boot
+mkimage \- generate images for U-Boot
 .SH SYNOPSIS
 .SY mkimage
 .OP \-T type
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 08/14] doc: mkimage: Edit options for style and consistency
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
                   ` (6 preceding siblings ...)
  2022-06-12 22:14 ` [PATCH v2 07/14] doc: mkimage: Use correct capitalization for NAME Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-12 22:14 ` [PATCH v2 09/14] doc: mkimage: Add BUGS section Sean Anderson
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

This makes a variety of changes for the options to make them
typographically consistent, clarify their meaning, and fix grammatical (or
other) errors. Many of the changes here are stylistic, though there are a
few fixes. The main changes I made across the board were:

- All options are bolded and parameters italicised
- All single quotes are properly matched (instead of using apostrophes)
- Minor background info has been added to clarify many underdocument
  options

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- Better document multi images
- Fix -B not being bolded in the description for -R
- Italicize parameter for -d
- Make lists of valid algos bold
- Remove spaces around pipes
- Use escape-sequences for options width all three of B/I/R. This renders
  better with mandoc.

 doc/mkimage.1 | 230 +++++++++++++++++++++++++++++++++++---------------
 1 file changed, 163 insertions(+), 67 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 5267e7d22e..f74790c701 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -28,26 +28,23 @@ mkimage \- generate images for U-Boot
 .SH DESCRIPTION
 The
 .B mkimage
-command is used to create images for use with the U-Boot boot loader.
-These images can contain the linux kernel, device tree blob, root file
-system image, firmware images etc., either separate or combined.
+command is used to create images for use with the U-Boot boot loader.  These
+images can contain the Linux kernel, device tree blob, root file system image,
+firmware images etc., either separate or combined.
 .P
 .B mkimage
 supports two different formats:
 .P
-The old
-.I legacy image
-format concatenates the individual parts (for example, kernel image,
-device tree blob and ramdisk image) and adds a 64 bytes header
-containing information about target architecture, operating system,
-image type, compression method, entry points, time stamp, checksums,
-etc.
+The legacy image format concatenates the individual parts (for example, kernel
+image, device tree blob and ramdisk image) and adds a 64 byte header containing
+information about the target architecture, operating system, image type,
+compression method, entry points, time stamp, checksums, etc.
 .P
 The new
-.I FIT (Flattened Image Tree) format
-allows for more flexibility in handling images of various types and also
-enhances integrity protection of images with stronger checksums. It also
-supports verified boot.
+.I FIT
+(Flattened Image Tree) format allows for more flexibility in handling images of
+various types and also enhances integrity protection of images with stronger
+checksums. It also supports verified boot.
 .
 .SH OPTIONS
 .
@@ -59,8 +56,8 @@ Print a help message and exit.
 .
 .TP
 .B \-l
-mkimage lists the information contained in the header of an existing U-Boot
-image.
+.B mkimage
+lists the information contained in the header of an existing U-Boot image.
 .
 .TP
 .B \-s
@@ -69,9 +66,14 @@ just the header, everything but the image data, or nothing at all.
 .
 .TP
 .BI \-T " image-type"
-Parse image file as type.
-Pass \-h as the image to see the list of supported image type.
-Without this option image type is autodetected.
+Parse image file as
+.IR image-type .
+Pass
+.B \-h
+as
+.I image-type
+to see the list of supported image types. Without this option, the image type is
+autodetected.
 .
 .TP
 .B \-q
@@ -89,35 +91,58 @@ Print version information and exit.
 .
 .TP
 .BI \-A " architecture"
-Set architecture. Pass \-h as the architecture to see the list of supported
-architectures.
+Set the architecture. Pass
+.B \-h
+as the architecture to see the list of supported architectures.
 .
 .TP
 .BI \-O " os"
-Set operating system. bootm command of u-boot changes boot method by os type.
-Pass \-h as the OS to see the list of supported OS.
+Set the operating system. The U-Boot
+.I bootm
+command changes boot method based on the OS type.
+Pass
+.B \-h
+as the
+.I os
+to see the list of supported OSs.
 .
 .TP
 .BI \-C " compression-type"
-Set compression type.
-Pass \-h as the compression to see the list of supported compression type.
+Set the compression type. The image data should have already been compressed
+using this compression type.
+.B mkimage
+will not automatically compress image data.
+Pass
+.B \-h
+as the
+.I compression-type
+to see the list of supported compression types.
 .
 .TP
 .BI \-a " load-address"
-Set load address with a hex number.
+Set the absolute address to load the image data to.
+.I load-address
+will be interpreted as a hexadecimal number.
 .
 .TP
 .BI \-e " entry-point"
-Set entry point with a hex number.
+Set the absolute address of the image entry point. The U-Boot
+.I bootm
+command will jump to this address after loading the image.
+.I entry-point
+will be interpreted as a hexadecimal number.
 .
 .TP
 .BI \-n " image-name"
-Set image name to 'image name'.
+Set the image name to
+.IR image-name .
 .
 .TP
 .BI \-R " secondary-image-name"
 Some image types support a second image for additional data. For these types,
-use \-R to specify this second image.
+use
+.B \-R
+to specify this second image.
 .TS
 allbox;
 lb lbx
@@ -145,11 +170,26 @@ T}
 .
 .TP
 .BI \-d " image-data-file"
-Use image data from 'image data file'.
+Use image data from
+.IR image-data-file .
+If the
+.I image-type
+is
+.BR multi ,
+then multiple images may be specified, separated by colons:
+.RS
+.IP
+.IR image-data-file [\fB:\fP image-data-file .\|.\|.]
+.RE
 .
 .TP
 .B \-x
-Set XIP (execute in place) flag.
+Set the
+.I XIP
+(execute in place) flag. The U-Boot
+.I bootm
+command will not load the image data, and instead will assume it is already
+accessible at the load address (such as via memory-mapped flash).
 .
 .SS Options for creating FIT images
 .
@@ -159,23 +199,24 @@ Appends the device tree binary file (.dtb) to the FIT.
 .
 .TP
 .BI \-c " comment"
-Specifies a comment to be added when signing. This is typically a useful
-message which describes how the image was signed or some other useful
-information.
+Specifies a comment to be added when signing. This is typically a message which
+describes how the image was signed or some other useful information.
 .
 .TP
 .BI \-D " dtc-options"
-Provide special options to the device tree compiler that is used to
-create the image.
+Provide additional options to the device tree compiler when creating the image.
+See
+.BR dtc (1)
+for documentation of possible options.
 .
 .TP
 .BI \-E
 After processing, move the image data outside the FIT and store a data offset
-in the FIT. Images will be placed one after the other immediately after the
-FIT, with each one aligned to a 4-byte boundary. The existing 'data' property
-in each image will be replaced with 'data-offset' and 'data-size' properties.
-A 'data-offset' of 0 indicates that it starts in the first (4-byte aligned)
-byte after the FIT.
+in the FIT. Images will be placed one after the other immediately after the FIT,
+with each one aligned to a 4-byte boundary. The existing \(oqdata\(cq property
+in each image will be replaced with \(oqdata-offset\(cq and \(oqdata-size\(cq
+properties.  A \(oqdata-offset\(cq of 0 indicates that it starts in the first
+(4-byte-aligned) byte after the FIT.
 .
 .TP
 .BI \-B " alignment"
@@ -184,36 +225,55 @@ option only has an effect when \-E is specified.
 .
 .TP
 .BI \-p " external-position"
-Place external data at a static external position. See \-E. Instead of writing
-a 'data-offset' property defining the offset from the end of the FIT, \-p will
-use 'data-position' as the absolute position from the base of the FIT.
+Place external data at a static external position. Instead of writing a
+\(oqdata-offset\(cq property defining the offset from the end of the FIT,
+.B \-p
+will use \(oqdata-position\(cq as the absolute position from the base of the
+FIT. See
+.B \-E
+for details on using external data.
 .
 .TP
-.BI \-f " image-tree-source-file"
+\fB\-f \fIimage-tree-source-file\fR | \fBauto
 Image tree source file that describes the structure and contents of the
 FIT image.
 .IP
-This can be automatically generated for some simple cases.
-Use "-f auto" for this. In that case the arguments -d, -A, -O, -T, -C, -a
-and -e are used to specify the image to include in the FIT and its attributes.
-No .its file is required.
+In some simple cases, the image tree source can be generated automatically. To
+use this feature, pass
+.BR "\-f auto" .
+The
+.BR \-d ", " \-A ", " \-O ", " \-T ", " \-C ", " \-a ", and " \-e
+options may be used to specify the image to include in the FIT and its
+attributes. No
+.I image-tree-source-file
+is required.
 .
 .TP
 .B \-F
-Indicates that an existing FIT image should be modified. No dtc
-compilation is performed and the \-f flag should not be given.
-This can be used to sign images with additional keys after initial image
-creation.
+Indicates that an existing FIT image should be modified. No dtc compilation will
+be performed and
+.B \-f
+should not be passed. This can be used to sign images with additional keys
+after initial image creation.
 .
 .TP
 .BI \-i " ramdisk-file"
-Appends the ramdisk file to the FIT.
+Append a ramdisk or initramfs file to the image.
 .
 .TP
 .BI \-k " key-directory"
 Specifies the directory containing keys to use for signing. This directory
-should contain a private key file <name>.key for use with signing and a
-certificate <name>.crt (containing the public key) for use with verification.
+should contain a private key file
+.IR name .key
+for use with signing, and a certificate
+.IR name .crt
+(containing the public key) for use with verification. The public key is only
+necessary when embedding it into another device tree using
+.BR \-K .
+.I name
+defaults to the value of the signature node's \(oqkey-name-hint\(cq property,
+but may be overridden using
+.BR \-g .
 .
 .TP
 .BI \-G " key-file"
@@ -230,15 +290,49 @@ CONFIG_OF_CONTROL in U-Boot.
 .
 .TP
 .BI \-g " key-name-hint"
-Sets the key-name-hint property when used with \-f auto. This is the <name>
-part of the key. The directory part is set by \-k. This option also indicates
-that the images included in the FIT should be signed. If this option is
-specified, \-o must be specified as well.
+Overrides the signature node's \(oqkey-name-hint\(cq property. This is
+especially useful when signing an image with
+.BR "\-f auto" .
+This is the
+.I name
+part of the key. The directory part is set by
+.BR \-k .
+This option also indicates that the images included in the FIT should be signed.
+If this option is specified, then
+.B \-o
+must be specified as well.
 .
 .TP
-.BI \-o " signing-algorithm"
+.BI \-o " crypto" , checksum
 Specifies the algorithm to be used for signing a FIT image. The default is
-taken from the signature node's 'algo' property.
+taken from the signature node's \(oqalgo\(cq property.
+The valid values for
+.I crypto
+are:
+.RS
+.IP
+.TS
+lb.
+rsa2048
+rsa3072
+rsa4096
+ecdsa256
+.TE
+.RE
+.IP
+The valid values for
+.I checksum
+are
+.RS
+.IP
+.TS
+lb.
+sha1
+sha256
+sha384
+sha512
+.TE
+.RE
 .
 .TP
 .B \-r
@@ -248,18 +342,20 @@ will be optional (useful for testing but not for release).
 .
 .TP
 .BI \-N " engine"
-The openssl engine to use when signing and verifying the image. For a complete list of
-available engines, refer to
+The openssl engine to use when signing and verifying the image. For a complete
+list of available engines, refer to
 .BR engine (1).
 .
 .TP
 .B \-t
 Update the timestamp in the FIT.
 .IP
-Normally the FIT timestamp is created the first time mkimage is run on a FIT,
+Normally the FIT timestamp is created the first time mkimage runs,
 when converting the source .its to the binary .fit file. This corresponds to
-using the -f flag. But if the original input to mkimage is a binary file
-(already compiled) then the timestamp is assumed to have been set previously.
+using
+.BR -f .
+But if the original input to mkimage is a binary file (already compiled), then
+the timestamp is assumed to have been set previously.
 .
 .SH EXAMPLES
 .\" Reduce the width of the tab stops to something reasonable
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 09/14] doc: mkimage: Add BUGS section
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
                   ` (7 preceding siblings ...)
  2022-06-12 22:14 ` [PATCH v2 08/14] doc: mkimage: Edit options for style and consistency Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-12 22:14 ` [PATCH v2 10/14] doc: mkimage: Add SEE ALSO section Sean Anderson
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

In leiu of a non-standard HOMEPAGE section, add a BUGS section with a link
to the issue tracker.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

(no changes since v1)

 doc/mkimage.1 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index f74790c701..e2b0d83d94 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -357,6 +357,11 @@ using
 But if the original input to mkimage is a binary file (already compiled), then
 the timestamp is assumed to have been set previously.
 .
+.SH BUGS
+Please report bugs to the
+.UR https://\:source\:.denx\:.de/\:u-boot/\:u-boot/\:issues
+U-Boot bug tracker
+.UE .
 .SH EXAMPLES
 .\" Reduce the width of the tab stops to something reasonable
 .ta T 1i
@@ -449,8 +454,6 @@ file is required.
 .EE
 .RE
 .
-.SH HOMEPAGE
-http://www.denx.de/wiki/U-Boot/WebHome
 .PP
 .SH AUTHOR
 This manual page was written by Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 10/14] doc: mkimage: Add SEE ALSO section
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
                   ` (8 preceding siblings ...)
  2022-06-12 22:14 ` [PATCH v2 09/14] doc: mkimage: Add BUGS section Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-12 22:14 ` [PATCH v2 11/14] doc: mkimage: Remove AUTHORS section Sean Anderson
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

This adds a SEE ALSO section to link to similar man pages, as well as to
the U-Boot documentation.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

(no changes since v1)

 doc/mkimage.1 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index e2b0d83d94..1da2acbaec 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -459,3 +459,11 @@ file is required.
 This manual page was written by Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
 and Wolfgang Denk <wd@denx.de>. It was updated for image signing by
 Simon Glass <sjg@chromium.org>.
+.SH SEE ALSO
+.BR dtc (1),
+.BR dumpimage (1),
+.BR openssl (1),
+the\~
+.UR https://\:u-boot\:.readthedocs\:.io/\:en/\:latest/\:index.html
+U-Boot documentation
+.UE
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 11/14] doc: mkimage: Remove AUTHORS section
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
                   ` (9 preceding siblings ...)
  2022-06-12 22:14 ` [PATCH v2 10/14] doc: mkimage: Add SEE ALSO section Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-12 22:14 ` [PATCH v2 12/14] mkimage: Add long options Sean Anderson
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

Per man-pages(7), "use of an AUTHORS section is strongly discouraged."
Remove it, and instead add some copyright notices and an SPDX. The default
license for U-Boot is GPL2, so that's what I put. The copyright dates are
based on the commit dates.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- Ensure comments are requests

 doc/mkimage.1 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 1da2acbaec..f2ccb9d464 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -1,4 +1,9 @@
-.TH MKIMAGE 1 "2022-02-07"
+.\" SPDX-License-Identifier: GPL-2.0
+.\" Copyright (C) 2022 Sean Anderson <seanga2@gmail.com>
+.\" Copyright (C) 2013-20 Simon Glass <sjg@chromium.org>
+.\" Copyright (C) 2010 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+.\" Copyright (C) 2010 Wolfgang Denk <wd@denx.de>
+.TH MKIMAGE 1 2022-06-11 U-Boot
 .
 .SH NAME
 mkimage \- generate images for U-Boot
@@ -454,11 +459,6 @@ file is required.
 .EE
 .RE
 .
-.PP
-.SH AUTHOR
-This manual page was written by Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
-and Wolfgang Denk <wd@denx.de>. It was updated for image signing by
-Simon Glass <sjg@chromium.org>.
 .SH SEE ALSO
 .BR dtc (1),
 .BR dumpimage (1),
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 12/14] mkimage: Add long options
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
                   ` (10 preceding siblings ...)
  2022-06-12 22:14 ` [PATCH v2 11/14] doc: mkimage: Remove AUTHORS section Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-12 22:14 ` [PATCH v2 13/14] doc: mkimage: Further document -o and -R Sean Anderson
  2022-06-12 22:14 ` [PATCH v2 14/14] doc: Add man page for dumpimage Sean Anderson
  13 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

The mkimage command has had many options added over the years.
Unfortunately, we are starting to run out of short options. Recent options
don't have any obvious relation to their meaning (e.g. -o/-g). Fortunately,
long options exist. Add long options for each current short option.

For the curious, the remaining short options are HIkLmMPQSuUwWXyYzZ.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- New

 doc/mkimage.1   | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
 tools/mkimage.c | 45 +++++++++++++++++++++++++++++++--
 2 files changed, 109 insertions(+), 2 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index f2ccb9d464..d48de7e777 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -57,20 +57,28 @@ checksums. It also supports verified boot.
 .
 .TP
 .B \-h
+.TQ
+.B \-\-help
 Print a help message and exit.
 .
 .TP
 .B \-l
+.TQ
+.B \-\-list
 .B mkimage
 lists the information contained in the header of an existing U-Boot image.
 .
 .TP
 .B \-s
+.TQ
+.B \-\-no\-copy
 Don't copy in the image data. Depending on the image type, this may create
 just the header, everything but the image data, or nothing at all.
 .
 .TP
 .BI \-T " image-type"
+.TQ
+.BI \-\-type " image-type"
 Parse image file as
 .IR image-type .
 Pass
@@ -82,26 +90,36 @@ autodetected.
 .
 .TP
 .B \-q
+.TQ
+.B \-\-quiet
 Quiet. Don't print the image header.
 .
 .TP
 .B \-v
+.TQ
+.B \-\-verbose
 Verbose. Print file names as they are added to the image.
 .
 .TP
 .B \-V
+.TQ
+.B \-\-version
 Print version information and exit.
 .
 .SS Options for creating legacy or \(lqauto\(rq images
 .
 .TP
 .BI \-A " architecture"
+.TQ
+.BI \-\-architecture " architecture"
 Set the architecture. Pass
 .B \-h
 as the architecture to see the list of supported architectures.
 .
 .TP
 .BI \-O " os"
+.TQ
+.BI \-\-os " os"
 Set the operating system. The U-Boot
 .I bootm
 command changes boot method based on the OS type.
@@ -113,6 +131,8 @@ to see the list of supported OSs.
 .
 .TP
 .BI \-C " compression-type"
+.TQ
+.BI \-\-compression " compression-type"
 Set the compression type. The image data should have already been compressed
 using this compression type.
 .B mkimage
@@ -125,12 +145,16 @@ to see the list of supported compression types.
 .
 .TP
 .BI \-a " load-address"
+.TQ
+.BI \-\-load\-address " load-address"
 Set the absolute address to load the image data to.
 .I load-address
 will be interpreted as a hexadecimal number.
 .
 .TP
 .BI \-e " entry-point"
+.TQ
+.BI \-\-entry\-point " entry-point"
 Set the absolute address of the image entry point. The U-Boot
 .I bootm
 command will jump to this address after loading the image.
@@ -139,11 +163,15 @@ will be interpreted as a hexadecimal number.
 .
 .TP
 .BI \-n " image-name"
+.TQ
+.BI \-\-primary\-image " image-name"
 Set the image name to
 .IR image-name .
 .
 .TP
 .BI \-R " secondary-image-name"
+.TQ
+.BI \-\-secondary\-image " image-name"
 Some image types support a second image for additional data. For these types,
 use
 .B \-R
@@ -175,6 +203,8 @@ T}
 .
 .TP
 .BI \-d " image-data-file"
+.TQ
+.BI \-\-image " image-data-file"
 Use image data from
 .IR image-data-file .
 If the
@@ -189,6 +219,8 @@ then multiple images may be specified, separated by colons:
 .
 .TP
 .B \-x
+.TQ
+.B \-\-xip
 Set the
 .I XIP
 (execute in place) flag. The U-Boot
@@ -200,15 +232,21 @@ accessible at the load address (such as via memory-mapped flash).
 .
 .TP
 .BI \-b " device-tree-file"
+.TQ
+.BI \-\-device\-tree " device-tree-file"
 Appends the device tree binary file (.dtb) to the FIT.
 .
 .TP
 .BI \-c " comment"
+.TQ
+.BI \-\-comment " comment"
 Specifies a comment to be added when signing. This is typically a message which
 describes how the image was signed or some other useful information.
 .
 .TP
 .BI \-D " dtc-options"
+.TQ
+.BI \-\-dtcopts " dtc-options"
 Provide additional options to the device tree compiler when creating the image.
 See
 .BR dtc (1)
@@ -216,6 +254,8 @@ for documentation of possible options.
 .
 .TP
 .BI \-E
+.TQ
+.BI \-\-external
 After processing, move the image data outside the FIT and store a data offset
 in the FIT. Images will be placed one after the other immediately after the FIT,
 with each one aligned to a 4-byte boundary. The existing \(oqdata\(cq property
@@ -225,11 +265,15 @@ properties.  A \(oqdata-offset\(cq of 0 indicates that it starts in the first
 .
 .TP
 .BI \-B " alignment"
+.TQ
+.BI \-\-alignment " alignment"
 The alignment, in hexadecimal, that external data will be aligned to. This
 option only has an effect when \-E is specified.
 .
 .TP
 .BI \-p " external-position"
+.TQ
+.BI \-\-position " external-position"
 Place external data at a static external position. Instead of writing a
 \(oqdata-offset\(cq property defining the offset from the end of the FIT,
 .B \-p
@@ -240,6 +284,8 @@ for details on using external data.
 .
 .TP
 \fB\-f \fIimage-tree-source-file\fR | \fBauto
+.TQ
+\fB\-\-fit \fIimage-tree-source-file\fR | \fBauto
 Image tree source file that describes the structure and contents of the
 FIT image.
 .IP
@@ -255,6 +301,8 @@ is required.
 .
 .TP
 .B \-F
+.TQ
+.B \-\-update
 Indicates that an existing FIT image should be modified. No dtc compilation will
 be performed and
 .B \-f
@@ -263,10 +311,14 @@ after initial image creation.
 .
 .TP
 .BI \-i " ramdisk-file"
+.TQ
+.BI \-\-initramfs " ramdisk-file"
 Append a ramdisk or initramfs file to the image.
 .
 .TP
 .BI \-k " key-directory"
+.TQ
+.BI \-\-key\-dir " key-directory"
 Specifies the directory containing keys to use for signing. This directory
 should contain a private key file
 .IR name .key
@@ -282,11 +334,15 @@ but may be overridden using
 .
 .TP
 .BI \-G " key-file"
+.TQ
+.BI \-\-key\-file " key-file"
 Specifies the private key file to use when signing. This option may be used
 instead of \-k.
 .
 .TP
 .BI \-K " key-destination"
+.TQ
+.BI \-\-key\-dest " key-destination"
 Specifies a compiled device tree binary file (typically .dtb) to write
 public key information into. When a private key is used to sign an image,
 the corresponding public key is written into this file for for run-time
@@ -295,6 +351,8 @@ CONFIG_OF_CONTROL in U-Boot.
 .
 .TP
 .BI \-g " key-name-hint"
+.TQ
+.BI \-\-key\-name\-hint " key-name-hint"
 Overrides the signature node's \(oqkey-name-hint\(cq property. This is
 especially useful when signing an image with
 .BR "\-f auto" .
@@ -309,6 +367,8 @@ must be specified as well.
 .
 .TP
 .BI \-o " crypto" , checksum
+.TQ
+.BI \-\-algo " crypto" , checksum
 Specifies the algorithm to be used for signing a FIT image. The default is
 taken from the signature node's \(oqalgo\(cq property.
 The valid values for
@@ -341,18 +401,24 @@ sha512
 .
 .TP
 .B \-r
+.TQ
+.B \-\-key\-required
 Specifies that keys used to sign the FIT are required. This means that they
 must be verified for the image to boot. Without this option, the verification
 will be optional (useful for testing but not for release).
 .
 .TP
 .BI \-N " engine"
+.TQ
+.BI \-\-engine " engine"
 The openssl engine to use when signing and verifying the image. For a complete
 list of available engines, refer to
 .BR engine (1).
 .
 .TP
 .B \-t
+.TQ
+.B \-\-touch
 Update the timestamp in the FIT.
 .IP
 Normally the FIT timestamp is created the first time mkimage runs,
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 0e1198b411..597cb3a5ce 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -11,6 +11,7 @@
 #include "mkimage.h"
 #include "imximage.h"
 #include <fit_common.h>
+#include <getopt.h>
 #include <image.h>
 #include <version.h>
 #ifdef __linux__
@@ -134,6 +135,7 @@ static void usage(const char *msg)
 	fprintf(stderr, "       %s -V ==> print version information and exit\n",
 		params.cmdname);
 	fprintf(stderr, "Use '-T list' to see a list of available image types\n");
+	fprintf(stderr, "Long options are available; read the man page for details\n");
 
 	exit(EXIT_FAILURE);
 }
@@ -156,6 +158,45 @@ static int add_content(int type, const char *fname)
 	return 0;
 }
 
+static const char optstring[] =
+	"a:A:b:B:c:C:d:D:e:Ef:Fg:G:i:k:K:ln:N:o:O:p:qrR:stT:vVx";
+
+static const struct option longopts[] = {
+	{ "load-address", required_argument, NULL, 'a' },
+	{ "architecture", required_argument, NULL, 'A' },
+	{ "device-tree", required_argument, NULL, 'b' },
+	{ "alignment", required_argument, NULL, 'B' },
+	{ "comment", required_argument, NULL, 'c' },
+	{ "compression", required_argument, NULL, 'C' },
+	{ "image", required_argument, NULL, 'd' },
+	{ "dtcopts", required_argument, NULL, 'D' },
+	{ "entry-point", required_argument, NULL, 'e' },
+	{ "external", no_argument, NULL, 'E' },
+	{ "fit", required_argument, NULL, 'f' },
+	{ "update", no_argument, NULL, 'F' },
+	{ "key-name-hint", required_argument, NULL, 'g' },
+	{ "key-file", required_argument, NULL, 'G' },
+	{ "help", no_argument, NULL, 'h' },
+	{ "initramfs", required_argument, NULL, 'i' },
+	{ "key-dir", required_argument, NULL, 'k' },
+	{ "key-dest", required_argument, NULL, 'K' },
+	{ "list", no_argument, NULL, 'l' },
+	{ "config", required_argument, NULL, 'n' },
+	{ "engine", required_argument, NULL, 'N' },
+	{ "algo", required_argument, NULL, 'o' },
+	{ "os", required_argument, NULL, 'O' },
+	{ "position", required_argument, NULL, 'p' },
+	{ "quiet", no_argument, NULL, 'q' },
+	{ "key-required", no_argument, NULL, 'r' },
+	{ "secondary-config", required_argument, NULL, 'R' },
+	{ "no-copy", no_argument, NULL, 's' },
+	{ "touch", no_argument, NULL, 't' },
+	{ "type", required_argument, NULL, 'T' },
+	{ "verbose", no_argument, NULL, 'v' },
+	{ "version", no_argument, NULL, 'V' },
+	{ "xip", no_argument, NULL, 'x' },
+};
+
 static void process_args(int argc, char **argv)
 {
 	char *ptr;
@@ -163,8 +204,8 @@ static void process_args(int argc, char **argv)
 	char *datafile = NULL;
 	int opt;
 
-	while ((opt = getopt(argc, argv,
-		   "a:A:b:B:c:C:d:D:e:Ef:Fg:G:k:i:K:ln:N:p:o:O:rR:qstT:vVx")) != -1) {
+	while ((opt = getopt_long(argc, argv, optstring,
+				  longopts, NULL)) != -1) {
 		switch (opt) {
 		case 'a':
 			params.addr = strtoull(optarg, &ptr, 16);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 13/14] doc: mkimage: Further document -o and -R
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
                   ` (11 preceding siblings ...)
  2022-06-12 22:14 ` [PATCH v2 12/14] mkimage: Add long options Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-12 22:14 ` [PATCH v2 14/14] doc: Add man page for dumpimage Sean Anderson
  13 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

Despite the original description of these options, they are not always
image names, or even files. Some image types use these options to convey
configuration directly. Re-document these options as configuration options.

Additionally, add a new section documenting the format of the configuration
for each image type which uses it. In general, if configuration is used
directly (without a separate file) I have added documentation for it. If
the configuration points to a separate file, I have referenced that file's
documentation. Where there is no such documentation, I have added it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- New

 doc/mkimage.1 | 270 +++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 236 insertions(+), 34 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index d48de7e777..4c6b714ec2 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -162,44 +162,22 @@ command will jump to this address after loading the image.
 will be interpreted as a hexadecimal number.
 .
 .TP
-.BI \-n " image-name"
+.BI \-n " primary-configuration"
 .TQ
-.BI \-\-primary\-image " image-name"
-Set the image name to
-.IR image-name .
+.BI \-\-config " primary-configuration"
+Images may require additional configuration not specified with other options,
+often in a image-type-specific format. The image types which support this
+option and the format of their configuration are listed in
+.BR CONFIGURATION .
 .
 .TP
-.BI \-R " secondary-image-name"
+.BI \-R " secondary-configuration"
 .TQ
-.BI \-\-secondary\-image " image-name"
-Some image types support a second image for additional data. For these types,
-use
-.B \-R
-to specify this second image.
-.TS
-allbox;
-lb lbx
-l l.
-Image Type	Secondary Image Description
-pblimage	Additional RCW-style header, typically used for PBI commands.
-zynqimage, zynqmpimage	T{
-Initialization parameters, one per line. Each parameter has the form
-.sp
-.ti 4
-.I address data
-.sp
-where
-.I address
-and
-.I data
-are hexadecimal integers. The boot ROM will write each
-.I data
-to
-.I address
-when loading the image. At most 256 parameters may be specified in this
-manner.
-T}
-.TE
+.BI \-\-secondary\-config " secondary-configuration"
+Some image types support a second set of configuration data. The image types
+which support secondary configuration and the formap of their configuration are
+listed in
+.BR CONFIGURATION .
 .
 .TP
 .BI \-d " image-data-file"
@@ -428,6 +406,230 @@ using
 But if the original input to mkimage is a binary file (already compiled), then
 the timestamp is assumed to have been set previously.
 .
+.SH CONFIGURATION
+This section documents the formats of the primary and secondary configuration
+options for each image type which supports them.
+.
+.SS aisimage
+The primary configuration is a file containing a series of
+.I AIS
+(Application Image Script) commands, one per line. Each command has the form
+.RS
+.P
+.IR "command argument " .\|.\|.
+.RE
+.P
+See
+.UR https://\:www\:.ti\:.com/\:lit/\:pdf/\:spraag0
+TI application report SPRAAG0E
+.UE
+for details.
+.
+.SS atmelimage
+The primary configuration is a comma-separated list of NAND Flash parameters of
+the form
+.RS
+.P
+\fIparameter\fB=\fIvalue\fR[\fB,\fIparameter\fB=\fIvalue\fR.\|.\|.\&]
+.RE
+.P
+Valid
+.IR parameter s
+are
+.RS
+.P
+.TS
+lb.
+usePmecc
+nbSectorPerPage
+spareSize
+eccBitReq
+sectorSize
+eccOffset
+.TE
+.RE
+.P
+and valid
+.IR value s
+are decimal numbers. See section 11.4.4.1 of the SAMA5D3 Series Data Sheet for
+valid values for each parameter.
+.
+.SS imximage
+The primary configuration is a file containing configuration commands, as
+documented in doc/\:imx/\:mkimage/\:imximage.txt of the U-Boot source.
+.
+.SS imx8image and imx8mimage
+The primary configuration is a file containing configuration commands, as
+documented in doc/\:imx/\:mkimage/\:imx8image.txt of the U-Boot source.
+.
+.SS kwbimage
+The primary configuration is a file containing configuration commands, as
+documented in doc/\:imx/\:mkimage/\:kwbimage.txt of the U-Boot source.
+.
+.SS mtk_image
+The primary configuration is a semicolon-separated list of header options of the
+form
+.RS
+.P
+\fIkey\fB=\fIvalue\fR[\fB;\fIkey\fB=\fIvalue\fR.\|.\|.\&]
+.RE
+.P
+where the valid keys are:
+.RS
+.P
+.TS
+lb lbx
+lb l.
+Key	Description
+_
+lk	T{
+If \fB1\fP, then an \fILK\fP (legacy) image header is used. Otherwise, a
+\fIBootROM\fP image header is used.
+T}
+lkname	T{
+The name of the LK image header. The maximum length is 32 ASCII characters. If
+not specified, the default value is \fBU-Boot\fP.
+T}
+media	The boot device. See below for valid values.
+nandinfo	The desired NAND device type. See below for valid values.
+arm64	If \fB1\fP, then this denotes an AArch64 image.
+hdroffset	Increase the reported size of the BRLYT header by this amount.
+.TE
+.RE
+.P
+Valid values for
+.B media
+are:
+.RS
+.P
+.TS
+lb lb
+lb l.
+Value	Description
+_
+nand	Parallel NAND flash
+snand	Serial NAND flash
+nor	Serial NOR flash
+emmc	\fIeMMC\fP (Embedded Multi-Media Card)
+sdmmc	\fISD\fP (Secure Digital) card
+.TE
+.RE
+.P
+Valid values for
+.B nandinfo
+are:
+.RS
+.P
+.TS
+lb lb lb	lb	lb
+lb l	l	l	l.
+Value	NAND type	Page size	OOB size	Total size
+_
+2k+64	Serial	2KiB	64B
+2k+120	Serial	2KiB	120B
+2k+128	Serial	2KiB	128B
+4k+256	Serial	4KiB	256B
+1g:2k+64	Parallel	2KiB	64B	1Gbit
+2g:2k+64	Parallel	2KiB	64B	2Gbit
+4g:2k+64	Parallel	2KiB	64B	4Gbit
+2g:2k+128	Parallel	2KiB	128B	2Gbit
+4g:2k+128	Parallel	2KiB	128B	4Gbit
+.TE
+.RE
+.
+.SS mxsimage
+The primary configuration is a file containing configuration commands, as
+documented in doc/\:imx/\:mkimage/\:mxsimage.txt of the U-Boot source.
+.
+.SS omapimage
+The primary configuration is the optional value
+.BR byteswap .
+If present, each 32-bit word of the image will have its bytes swapped
+(converting from little-endian to big-endian, or vice versa).
+.
+.SS pblimage
+The primary configuration is a file containing the
+.I PBI
+(Pre-Boot Image) header. Each line of the configuration has the format
+.RS
+.P
+.IR value "[ " value .\|.\|.\&]
+.RE
+.P
+Where
+.I value
+is a 32-bit hexadecimal integer. Each
+.I value
+will, after being converted to raw bytes, be literally prepended to the PBI.
+.P
+The secondary configuration is a file with the same format as the primary
+configuration file. It will be inserted into the image after the primary
+configuration data and before the image data.
+.P
+It is traditional to use the primary configuration file for the
+.I RCW
+(Reset Configuration Word), and the secondary configuration file for any
+additional PBI commands. However, it is also possible to convert an existing PBI
+to the above format and \(lqchain\(rq additional data onto the end of the
+image. This may be especially useful for creating secure boot images.
+.
+.SS rkimage
+The primary configuration is the name of the processor to generate the image
+for. Valid values are:
+.RS
+.P
+.TS
+lb.
+px30
+rk3036
+rk3066
+rk3128
+rk3188
+rk322x
+rk3288
+rk3308
+rk3328
+rk3368
+rk3399
+rv1108
+rk3568
+.TE
+.RE
+.
+.SS sunxi_egon
+The primary configuration is the name to use for the device tree.
+.
+.SS ublimage
+The primary configuration is a file containing configuration commands, as
+documented in doc/\:README.ublimage of the U-Boot source.
+.
+.SS zynqimage and zynqmpimage
+For
+.BR zynqmpimage ,
+the primary configuration is a file containing the
+.I PMUFW
+(Power Management Unit Firmware).
+.B zynqimage
+does not use the primary configuration.
+.P
+For both image types, the secondary configuration is a file containinig
+initialization parameters, one per line. Each parameter has the form
+.RS
+.P
+.I address data
+.RE
+.P
+where
+.I address
+and
+.I data
+are hexadecimal integers. The boot ROM will write each
+.I data
+to
+.I address
+when loading the image. At most 256 parameters may be specified in this
+manner.
+.
 .SH BUGS
 Please report bugs to the
 .UR https://\:source\:.denx\:.de/\:u-boot/\:u-boot/\:issues
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 14/14] doc: Add man page for dumpimage
  2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
                   ` (12 preceding siblings ...)
  2022-06-12 22:14 ` [PATCH v2 13/14] doc: mkimage: Further document -o and -R Sean Anderson
@ 2022-06-12 22:14 ` Sean Anderson
  2022-06-16 11:50   ` Heinrich Schuchardt
  13 siblings, 1 reply; 23+ messages in thread
From: Sean Anderson @ 2022-06-12 22:14 UTC (permalink / raw)
  To: u-boot, Heinrich Schuchardt; +Cc: Simon Glass, Sean Anderson

This tool seems a bit underloved. Unfortunately, it seems to be missing
support for FIT images. Alas...

Add a man page documenting it. The example is taken from commit a804b5ce2d
("Add dumpimage, a tool to extract data from U-Boot images").

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- Ensure comments are requests

 doc/dumpimage.1 | 103 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)
 create mode 100644 doc/dumpimage.1

diff --git a/doc/dumpimage.1 b/doc/dumpimage.1
new file mode 100644
index 0000000000..52a45a3404
--- /dev/null
+++ b/doc/dumpimage.1
@@ -0,0 +1,103 @@
+.\" SPDX-License-Identifier: GPL-2.0
+.\" Copyright (C) 2022 Sean Anderson <seanga2@gmail.com>
+.TH DUMPIMAGE 1 2022-06-11 U-Boot
+.SH NAME
+dumpimage \- extract data from U-Boot images
+.
+.SH SYNOPSIS
+.SY dumpimage
+.OP \-T type
+.BI \-l\~ image
+.YS
+.SY dumpimage
+.OP \-T type
+.OP \-p position
+.BI \-o\~ outfile
+.I image
+.YS
+.SY dumpimage
+.B \-h
+.YS
+.SY dumpimage
+.B \-V
+.YS
+.
+.SH DESCRIPTION
+.B dumpimage
+lists and extracts data from U-Boot images. If
+.B \-l
+is specified,
+.B dumpimage
+lists the components in
+.IR image .
+Otherwise,
+.B dumpimage
+extracts the component at
+.IR position " to " outfile .
+.
+.SH OPTIONS
+.TP
+.B \-h
+Print usage information and exit.
+.
+.TP
+.B \-l
+Print the header information for
+.IR image ,
+including a list of components.
+.
+.TP
+.BI \-o " outfile"
+The file to write the dumped component to.
+.TP
+.BI \-p " position"
+Specify the
+.I position
+of the component to dump. This should be a numeric index, starting at 0. If not
+specified, the default
+.I position
+is 0.
+.
+.TP
+.BI \-T " type"
+Specify the
+.I type
+of the image. If not specified, the image type will be automatically detected. A
+list of supported image types may be printed by running
+.BR "mkimage\~\-T\~list" .
+.
+.TP
+.B \-V
+Print version information and exit.
+.
+.SH BUGS
+Please report bugs to the
+.UR https://\:source\:.denx\:.de/\:u-boot/\:u-boot/\:issues
+U-Boot bug tracker
+.UE .
+.SH EXAMPLES
+Create a multi-file image and then extract part of that image
+.PP
+.EX
+.in +4
+$ \c
+.B mkimage \-A x86 \-O linux \-T multi \-n x86 \\\\\&
+.in +4
+.B \-d vmlinuz:initrd.img:System.map multi.img
+.in
+Image Name:   x86
+Created:      Thu Jul 25 10:29:13 2013
+Image Type:   Intel x86 Linux Multi-File Image (gzip compressed)
+Data Size:    13722956 Bytes = 13401.32 kB = 13.09 MB
+Load Address: 00000000
+Entry Point:  00000000
+Contents:
+   Image 0: 4040128 Bytes = 3945.44 kB = 3.85 MB
+   Image 1: 7991719 Bytes = 7804.41 kB = 7.62 MB
+   Image 2: 1691092 Bytes = 1651.46 kB = 1.61 MB
+$ \c
+.B dumpimage -p 2 -o System.map multi.img
+.EE
+.in
+.SH SEE ALSO
+.BR mkimage (1)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 01/14] doc: mkimage: Use standard style for synopsis
  2022-06-12 22:13 ` [PATCH v2 01/14] doc: mkimage: Use standard style for synopsis Sean Anderson
@ 2022-06-16  9:45   ` Heinrich Schuchardt
  2022-06-16 13:40     ` Sean Anderson
  0 siblings, 1 reply; 23+ messages in thread
From: Heinrich Schuchardt @ 2022-06-16  9:45 UTC (permalink / raw)
  To: Sean Anderson; +Cc: Simon Glass, u-boot

On 6/13/22 00:13, Sean Anderson wrote:
> The synopsis section is a bit messy. As an example, "uimage file name" is
> printed in italics, bold, and roman (depending on the line). This cleans
> things up and converts the synopsis section to use standard style. The
> .SY/.YS macros set up appropriate fomatting for command synopsis sections

nits:
%s/fomatting/formatting/

> (such as disabling hyphenation and setting a hanging indent). All parts of
> the synopsis now use the following style:
>
> - Bold for parts of the command which should be typed in by the user (such
>    as the program name and flags)
> - Italic for parts which should be replaced (such as uimage-file-name)
> - Roman for parts which should not be typed at all (such as brackets)
>
> Multi-word variables now use hyphens to connect their words instead of
> spaces. This makes it clearer that all the words are part of the same
> variable. Additionally, "option ..." is used to denote where other options
> may be specified, as this appears to be standard style.
>
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
>
> Changes in v2:
> - Fix spacing for -F
>
>   doc/mkimage.1 | 26 ++++++++++++++++++--------
>   1 file changed, 18 insertions(+), 8 deletions(-)
>
> diff --git a/doc/mkimage.1 b/doc/mkimage.1
> index 759dc2d12f..dc597272d4 100644
> --- a/doc/mkimage.1
> +++ b/doc/mkimage.1
> @@ -3,17 +3,27 @@
>   .SH NAME
>   mkimage \- Generate image for U-Boot
>   .SH SYNOPSIS
> -.B mkimage
> -.RB [ \-T " \fItype\fP] " \-l " [\fIuimage file name\fP]"

mkimage -T script -l boot.scr

is illegal. Why did you add '-T type'?

> +.SY mkimage
> +.OP \-T type
> +.BI \-l\~ image-file-name

Replacing uimage by image seems to be correct. But you could mention it
in the commit message.

> +.YS
>
> -.B mkimage
> -.RB [\fIoptions\fP] " \-f [" "image tree source file" "]" " [" "uimage file name" "]"
> +.SY mkimage
> +.RI [ option\~ .\|.\|.\&]
> +.BI \-f\~ image-tree-source-file\c
> +.RB | auto

Adding 'auto' is also not mentioned in the commit message.

> +.I image-file-name
> +.YS
>
> -.B mkimage
> -.RB [\fIoptions\fP] " \-F [" "uimage file name" "]"
> +.SY mkimage
> +.RI [ option\~ .\|.\|.\&]
> +.BI \-F\~ image-file-name
> +.YS
>
> -.B mkimage
> -.RB [\fIoptions\fP] " (legacy mode)"
> +.SY mkimage
> +.RI [ option\~ .\|.\|.\&]
> +.R (legacy mode)

(legacy mode) is not an argument. So it should not appear in the synopsis

The last addition of an image type has commit date 2022-04-04
(IH_TYPE_SUNXI_TOC0). The term 'legacy mode' for everything that is not
FIT is misleading and should be avoided.

> +.YS
>
>   .SH "DESCRIPTION"
>   The
The following command is not covered by any entry in the synopsis:

mkimage -T script -n GRUB -d boot.txt boot.scr

The synopsis lacks an entry

mkimage -T type [options] image-file-name

Best regards

Heinrich

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 04/14] doc: mkimage: Regularize option documentation
  2022-06-12 22:14 ` [PATCH v2 04/14] doc: mkimage: Regularize option documentation Sean Anderson
@ 2022-06-16 10:00   ` Heinrich Schuchardt
  2022-06-16 13:42     ` Sean Anderson
  0 siblings, 1 reply; 23+ messages in thread
From: Heinrich Schuchardt @ 2022-06-16 10:00 UTC (permalink / raw)
  To: Sean Anderson, u-boot; +Cc: Simon Glass

On 6/13/22 00:14, Sean Anderson wrote:
> Square brackets are commonly used to denote optional parts of a command.
> However, all option arguments are mandatory. Remove these brackets. This
> also removes some unnecessary quotation marks, and uses hyphens to connect
> words in option arguments.
>
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
>
> Changes in v2:
> - Fix extra quote in -E synopsis
>
>   doc/mkimage.1 | 72 +++++++++++++++++++++++++--------------------------
>   1 file changed, 36 insertions(+), 36 deletions(-)
>
> diff --git a/doc/mkimage.1 b/doc/mkimage.1
> index 1015e21576..4074715fe5 100644
> --- a/doc/mkimage.1
> +++ b/doc/mkimage.1
> @@ -25,7 +25,7 @@ mkimage \- Generate image for U-Boot
>   (legacy mode)
>   .YS
>   .
> -.SH "DESCRIPTION"
> +.SH DESCRIPTION
>   The
>   .B mkimage
>   command is used to create images for use with the U-Boot boot loader.
> @@ -49,64 +49,64 @@ allows for more flexibility in handling images of various types and also
>   enhances integrity protection of images with stronger checksums. It also
>   supports verified boot.
>   .
> -.SH "OPTIONS"
> +.SH OPTIONS
>   .
>   .B List image information:
>   .
>   .TP
> -.BI "\-l [" "uimage file name" "]"
> +.BI \-l " uimage-file-name"

You have renamed this in the synopsis to image-file-name. Please, keep
the argument names consistent.

Best regards

Heinrich

>   mkimage lists the information contained in the header of an existing U-Boot image.
>   .
>   .TP
> -.BI "\-T [" "image type" "]"
> +.BI \-T " image-type"
>   Parse image file as type.
>   Pass \-h as the image to see the list of supported image type.
>   Without this option image type is autodetected.
>   .
>   .TP
> -.BI "\-q"
> +.B \-q
>   Quiet. Don't print the image header on successful verification.
>   .
>   .P
>   .B Create old legacy image:
>   .
>   .TP
> -.BI "\-A [" "architecture" "]"
> +.BI \-A " architecture"
>   Set architecture. Pass \-h as the architecture to see the list of supported architectures.
>   .
>   .TP
> -.BI "\-O [" "os" "]"
> +.BI \-O " os"
>   Set operating system. bootm command of u-boot changes boot method by os type.
>   Pass \-h as the OS to see the list of supported OS.
>   .
>   .TP
> -.BI "\-T [" "image type" "]"
> +.BI \-T " image-type"
>   Set image type.
>   Pass \-h as the image to see the list of supported image type.
>   .
>   .TP
> -.BI "\-C [" "compression type" "]"
> +.BI \-C " compression-type"
>   Set compression type.
>   Pass \-h as the compression to see the list of supported compression type.
>   .
>   .TP
> -.BI "\-a [" "load address" "]"
> +.BI \-a " load-address"
>   Set load address with a hex number.
>   .
>   .TP
> -.BI "\-e [" "entry point" "]"
> +.BI \-e " entry-point"
>   Set entry point with a hex number.
>   .
>   .TP
> -.BI "\-l"
> +.B \-l
>   List the contents of an image.
>   .
>   .TP
> -.BI "\-n [" "image name" "]"
> +.BI \-n " image-name"
>   Set image name to 'image name'.
>   .
>   .TP
> -.BI "\-R [" "secondary image name" "]"
> +.BI \-R " secondary-image-name"
>   Some image types support a second image for additional data. For these types,
>   use \-R to specify this second image.
>   .TS
> @@ -135,42 +135,42 @@ T}
>   .TE
>   .
>   .TP
> -.BI "\-d [" "image data file" "]"
> +.BI \-d " image-data-file"
>   Use image data from 'image data file'.
>   .
>   .TP
> -.BI "\-x"
> +.B \-x
>   Set XIP (execute in place) flag.
>   .
>   .TP
> -.BI "\-s"
> +.B \-s
>   Don't copy in the image data. Depending on the image type, this may create
>   just the header, everything but the image data, or nothing at all.
>   .
>   .TP
> -.BI "\-v"
> +.B \-v
>   Verbose. Print file names as they are added to the image.
>   .
>   .P
>   .B Create FIT image:
>   .
>   .TP
> -.BI "\-b [" "device tree file" "]
> +.BI \-b " device-tree-file"
>   Appends the device tree binary file (.dtb) to the FIT.
>   .
>   .TP
> -.BI "\-c [" "comment" "]"
> +.BI \-c " comment"
>   Specifies a comment to be added when signing. This is typically a useful
>   message which describes how the image was signed or some other useful
>   information.
>   .
>   .TP
> -.BI "\-D [" "dtc options" "]"
> +.BI \-D " dtc-options"
>   Provide special options to the device tree compiler that is used to
>   create the image.
>   .
>   .TP
> -.BI "\-E
> +.BI \-E
>   After processing, move the image data outside the FIT and store a data offset
>   in the FIT. Images will be placed one after the other immediately after the
>   FIT, with each one aligned to a 4-byte boundary. The existing 'data' property
> @@ -179,12 +179,12 @@ A 'data-offset' of 0 indicates that it starts in the first (4-byte aligned)
>   byte after the FIT.
>   .
>   .TP
> -.BI "\-B [" "alignment" "]"
> +.BI \-B " alignment"
>   The alignment, in hexadecimal, that external data will be aligned to. This
>   option only has an effect when \-E is specified.
>   .
>   .TP
> -.BI "\-f [" "image tree source file" " | " "auto" "]"
> +.BI \-f " image-tree-source-file"
>   Image tree source file that describes the structure and contents of the
>   FIT image.
>   .IP
> @@ -194,29 +194,29 @@ and -e are used to specify the image to include in the FIT and its attributes.
>   No .its file is required.
>   .
>   .TP
> -.BI "\-F"
> +.B \-F
>   Indicates that an existing FIT image should be modified. No dtc
>   compilation is performed and the \-f flag should not be given.
>   This can be used to sign images with additional keys after initial image
>   creation.
>   .
>   .TP
> -.BI "\-i [" "ramdisk_file" "]"
> +.BI \-i " ramdisk-file"
>   Appends the ramdisk file to the FIT.
>   .
>   .TP
> -.BI "\-k [" "key_directory" "]"
> +.BI \-k " key-directory"
>   Specifies the directory containing keys to use for signing. This directory
>   should contain a private key file <name>.key for use with signing and a
>   certificate <name>.crt (containing the public key) for use with verification.
>   .
>   .TP
> -.BI "\-G [" "key_file" "]"
> +.BI \-G " key-file"
>   Specifies the private key file to use when signing. This option may be used
>   instead of \-k.
>   .
>   .TP
> -.BI "\-K [" "key_destination" "]"
> +.BI \-K " key-destination"
>   Specifies a compiled device tree binary file (typically .dtb) to write
>   public key information into. When a private key is used to sign an image,
>   the corresponding public key is written into this file for for run-time
> @@ -224,42 +224,42 @@ verification. Typically the file here is the device tree binary used by
>   CONFIG_OF_CONTROL in U-Boot.
>   .
>   .TP
> -.BI "\-G [" "key_file" "]"
> +.BI \-G " key-file"
>   Specifies the private key file to use when signing. This option may be used
>   instead of \-k.
>   .
>   .TP
> -.BI "\-g [" "key_name_hint" "]"
> +.BI \-g " key-name-hint"
>   Sets the key-name-hint property when used with \-f auto. This is the <name>
>   part of the key. The directory part is set by \-k. This option also indicates
>   that the images included in the FIT should be signed. If this option is
>   specified, \-o must be specified as well.
>   .
>   .TP
> -.BI "\-o [" "signing algorithm" "]"
> +.BI \-o " signing-algorithm"
>   Specifies the algorithm to be used for signing a FIT image. The default is
>   taken from the signature node's 'algo' property.
>   .
>   .TP
> -.BI "\-p [" "external position" "]"
> +.BI \-p " external-position"
>   Place external data at a static external position. See \-E. Instead of writing
>   a 'data-offset' property defining the offset from the end of the FIT, \-p will
>   use 'data-position' as the absolute position from the base of the FIT.
>   .
>   .TP
> -.BI "\-r"
> +.B \-r
>   Specifies that keys used to sign the FIT are required. This means that they
>   must be verified for the image to boot. Without this option, the verification
>   will be optional (useful for testing but not for release).
>   .
>   .TP
> -.BI "\-N [" "engine" "]"
> +.BI \-N " engine"
>   The openssl engine to use when signing and verifying the image. For a complete list of
>   available engines, refer to
>   .BR engine (1).
>   .
>   .TP
> -.BI "\-t
> +.B \-t
>   Update the timestamp in the FIT.
>   .IP
>   Normally the FIT timestamp is created the first time mkimage is run on a FIT,


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 05/14] doc: mkimage: Use subsection macro
  2022-06-12 22:14 ` [PATCH v2 05/14] doc: mkimage: Use subsection macro Sean Anderson
@ 2022-06-16 10:08   ` Heinrich Schuchardt
  2022-06-16 13:45     ` Sean Anderson
  0 siblings, 1 reply; 23+ messages in thread
From: Heinrich Schuchardt @ 2022-06-16 10:08 UTC (permalink / raw)
  To: Sean Anderson; +Cc: Simon Glass, u-boot

On 6/13/22 00:14, Sean Anderson wrote:
> The options are divided up into several subsections. Use the appropriate
> macro. While we're at it, rename the headings to better reflect the
> contents of their sections.
>
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
>
> Changes in v2:
> - Rename first subsection to "General options"
> - Use paired quotation marks
>
>   doc/mkimage.1 | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/doc/mkimage.1 b/doc/mkimage.1
> index 4074715fe5..8b96011f90 100644
> --- a/doc/mkimage.1
> +++ b/doc/mkimage.1
> @@ -51,7 +51,7 @@ supports verified boot.
>   .
>   .SH OPTIONS
>   .
> -.B List image information:
> +.SS General options
>   .
>   .TP
>   .BI \-l " uimage-file-name"
> @@ -67,8 +67,7 @@ Without this option image type is autodetected.
>   .B \-q
>   Quiet. Don't print the image header on successful verification.
>   .
> -.P
> -.B Create old legacy image:
> +.SS Options for creating legacy or \(lqauto\(rq images
An image type (IH_TYPE_SUNXI_TOC0) introduced in 2022 cannot be legacy.
Please, remove this misleading and derogatory term. I guess you mean
anything but FIT. Should the whole paragraph be move down below the
descriptions of the creation of FIT images? Then you could say "Options
for creating other image types".

I have no clue what an "auto" image might refer to. The man-page is not
of any help here.

Best regards

Heinrich

>   .
>   .TP
>   .BI \-A " architecture"
> @@ -151,8 +150,7 @@ just the header, everything but the image data, or nothing at all.
>   .B \-v
>   Verbose. Print file names as they are added to the image.
>   .
> -.P
> -.B Create FIT image:
> +.SS Options for creating FIT images
>   .
>   .TP
>   .BI \-b " device-tree-file"


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 14/14] doc: Add man page for dumpimage
  2022-06-12 22:14 ` [PATCH v2 14/14] doc: Add man page for dumpimage Sean Anderson
@ 2022-06-16 11:50   ` Heinrich Schuchardt
  2022-06-16 13:47     ` Sean Anderson
  0 siblings, 1 reply; 23+ messages in thread
From: Heinrich Schuchardt @ 2022-06-16 11:50 UTC (permalink / raw)
  To: Sean Anderson, u-boot; +Cc: Simon Glass

On 6/13/22 00:14, Sean Anderson wrote:
> This tool seems a bit underloved. Unfortunately, it seems to be missing
> support for FIT images. Alas...
>
> Add a man page documenting it. The example is taken from commit a804b5ce2d
> ("Add dumpimage, a tool to extract data from U-Boot images").
>
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
>
> Changes in v2:
> - Ensure comments are requests
>
>   doc/dumpimage.1 | 103 ++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 103 insertions(+)
>   create mode 100644 doc/dumpimage.1
>
> diff --git a/doc/dumpimage.1 b/doc/dumpimage.1
> new file mode 100644
> index 0000000000..52a45a3404
> --- /dev/null
> +++ b/doc/dumpimage.1
> @@ -0,0 +1,103 @@
> +.\" SPDX-License-Identifier: GPL-2.0
> +.\" Copyright (C) 2022 Sean Anderson <seanga2@gmail.com>
> +.TH DUMPIMAGE 1 2022-06-11 U-Boot
> +.SH NAME
> +dumpimage \- extract data from U-Boot images
> +.
> +.SH SYNOPSIS
> +.SY dumpimage
> +.OP \-T type
> +.BI \-l\~ image
> +.YS
> +.SY dumpimage
> +.OP \-T type

The online help shows this parameter as optional.

> +.OP \-p position

-p is optional so it should be in brackets.

> +.BI \-o\~ outfile

-o is optional.

Best regards

Heinrich

> +.I image
> +.YS
> +.SY dumpimage
> +.B \-h
> +.YS
> +.SY dumpimage
> +.B \-V
> +.YS
> +.
> +.SH DESCRIPTION
> +.B dumpimage
> +lists and extracts data from U-Boot images. If
> +.B \-l
> +is specified,
> +.B dumpimage
> +lists the components in
> +.IR image .
> +Otherwise,
> +.B dumpimage
> +extracts the component at
> +.IR position " to " outfile .
> +.
> +.SH OPTIONS
> +.TP
> +.B \-h
> +Print usage information and exit.
> +.
> +.TP
> +.B \-l
> +Print the header information for
> +.IR image ,
> +including a list of components.
> +.
> +.TP
> +.BI \-o " outfile"
> +The file to write the dumped component to.
> +.TP
> +.BI \-p " position"
> +Specify the
> +.I position
> +of the component to dump. This should be a numeric index, starting at 0. If not
> +specified, the default
> +.I position
> +is 0.
> +.
> +.TP
> +.BI \-T " type"
> +Specify the
> +.I type
> +of the image. If not specified, the image type will be automatically detected. A
> +list of supported image types may be printed by running
> +.BR "mkimage\~\-T\~list" .
> +.
> +.TP
> +.B \-V
> +Print version information and exit.
> +.
> +.SH BUGS
> +Please report bugs to the
> +.UR https://\:source\:.denx\:.de/\:u-boot/\:u-boot/\:issues
> +U-Boot bug tracker
> +.UE .
> +.SH EXAMPLES
> +Create a multi-file image and then extract part of that image
> +.PP
> +.EX
> +.in +4
> +$ \c
> +.B mkimage \-A x86 \-O linux \-T multi \-n x86 \\\\\&
> +.in +4
> +.B \-d vmlinuz:initrd.img:System.map multi.img
> +.in
> +Image Name:   x86
> +Created:      Thu Jul 25 10:29:13 2013
> +Image Type:   Intel x86 Linux Multi-File Image (gzip compressed)
> +Data Size:    13722956 Bytes = 13401.32 kB = 13.09 MB
> +Load Address: 00000000
> +Entry Point:  00000000
> +Contents:
> +   Image 0: 4040128 Bytes = 3945.44 kB = 3.85 MB
> +   Image 1: 7991719 Bytes = 7804.41 kB = 7.62 MB
> +   Image 2: 1691092 Bytes = 1651.46 kB = 1.61 MB
> +$ \c
> +.B dumpimage -p 2 -o System.map multi.img
> +.EE
> +.in
> +.SH SEE ALSO
> +.BR mkimage (1)


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 01/14] doc: mkimage: Use standard style for synopsis
  2022-06-16  9:45   ` Heinrich Schuchardt
@ 2022-06-16 13:40     ` Sean Anderson
  0 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-16 13:40 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Simon Glass, u-boot

On 6/16/22 5:45 AM, Heinrich Schuchardt wrote:
> On 6/13/22 00:13, Sean Anderson wrote:
>> The synopsis section is a bit messy. As an example, "uimage file name" is
>> printed in italics, bold, and roman (depending on the line). This cleans
>> things up and converts the synopsis section to use standard style. The
>> .SY/.YS macros set up appropriate fomatting for command synopsis sections
> 
> nits:
> %s/fomatting/formatting/
> 
>> (such as disabling hyphenation and setting a hanging indent). All parts of
>> the synopsis now use the following style:
>>
>> - Bold for parts of the command which should be typed in by the user (such
>>    as the program name and flags)
>> - Italic for parts which should be replaced (such as uimage-file-name)
>> - Roman for parts which should not be typed at all (such as brackets)
>>
>> Multi-word variables now use hyphens to connect their words instead of
>> spaces. This makes it clearer that all the words are part of the same
>> variable. Additionally, "option ..." is used to denote where other options
>> may be specified, as this appears to be standard style.
>>
>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>> ---
>>
>> Changes in v2:
>> - Fix spacing for -F
>>
>>   doc/mkimage.1 | 26 ++++++++++++++++++--------
>>   1 file changed, 18 insertions(+), 8 deletions(-)
>>
>> diff --git a/doc/mkimage.1 b/doc/mkimage.1
>> index 759dc2d12f..dc597272d4 100644
>> --- a/doc/mkimage.1
>> +++ b/doc/mkimage.1
>> @@ -3,17 +3,27 @@
>>   .SH NAME
>>   mkimage \- Generate image for U-Boot
>>   .SH SYNOPSIS
>> -.B mkimage
>> -.RB [ \-T " \fItype\fP] " \-l " [\fIuimage file name\fP]"
> 
> mkimage -T script -l boot.scr
> 
> is illegal. Why did you add '-T type'?

This is the original synopsis. I have kept it as-is. -T type is
necessary for some types which are not autodetected, e.g. pblimage.

>> +.SY mkimage
>> +.OP \-T type
>> +.BI \-l\~ image-file-name
> 
> Replacing uimage by image seems to be correct. But you could mention it
> in the commit message.

Sure.

>> +.YS
>>
>> -.B mkimage
>> -.RB [\fIoptions\fP] " \-f [" "image tree source file" "]" " [" "uimage file name" "]"
>> +.SY mkimage
>> +.RI [ option\~ .\|.\|.\&]
>> +.BI \-f\~ image-tree-source-file\c
>> +.RB | auto
> 
> Adding 'auto' is also not mentioned in the commit message.

Will mention.

>> +.I image-file-name
>> +.YS
>>
>> -.B mkimage
>> -.RB [\fIoptions\fP] " \-F [" "uimage file name" "]"
>> +.SY mkimage
>> +.RI [ option\~ .\|.\|.\&]
>> +.BI \-F\~ image-file-name
>> +.YS
>>
>> -.B mkimage
>> -.RB [\fIoptions\fP] " (legacy mode)"
>> +.SY mkimage
>> +.RI [ option\~ .\|.\|.\&]
>> +.R (legacy mode)
> 
> (legacy mode) is not an argument. So it should not appear in the synopsis

That's why it's not in italics/bold.

> The last addition of an image type has commit date 2022-04-04
> (IH_TYPE_SUNXI_TOC0). The term 'legacy mode' for everything that is not
> FIT is misleading and should be avoided.

I agree. I will remove it.

>> +.YS
>>
>>   .SH "DESCRIPTION"
>>   The
> The following command is not covered by any entry in the synopsis:
> 
> mkimage -T script -n GRUB -d boot.txt boot.scr
> 
> The synopsis lacks an entry

I believe this is covered by the "legacy" mode.

> mkimage -T type [options] image-file-name

But perhaps it would be better to list "legacy" mode as

mkimage [options...] [-T type] image-file-name

--Sean


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 04/14] doc: mkimage: Regularize option documentation
  2022-06-16 10:00   ` Heinrich Schuchardt
@ 2022-06-16 13:42     ` Sean Anderson
  0 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-16 13:42 UTC (permalink / raw)
  To: Heinrich Schuchardt, u-boot; +Cc: Simon Glass

On 6/16/22 6:00 AM, Heinrich Schuchardt wrote:
> On 6/13/22 00:14, Sean Anderson wrote:
>> Square brackets are commonly used to denote optional parts of a command.
>> However, all option arguments are mandatory. Remove these brackets. This
>> also removes some unnecessary quotation marks, and uses hyphens to connect
>> words in option arguments.
>>
>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>> ---
>>
>> Changes in v2:
>> - Fix extra quote in -E synopsis
>>
>>   doc/mkimage.1 | 72 +++++++++++++++++++++++++--------------------------
>>   1 file changed, 36 insertions(+), 36 deletions(-)
>>
>> diff --git a/doc/mkimage.1 b/doc/mkimage.1
>> index 1015e21576..4074715fe5 100644
>> --- a/doc/mkimage.1
>> +++ b/doc/mkimage.1
>> @@ -25,7 +25,7 @@ mkimage \- Generate image for U-Boot
>>   (legacy mode)
>>   .YS
>>   .
>> -.SH "DESCRIPTION"
>> +.SH DESCRIPTION
>>   The
>>   .B mkimage
>>   command is used to create images for use with the U-Boot boot loader.
>> @@ -49,64 +49,64 @@ allows for more flexibility in handling images of various types and also
>>   enhances integrity protection of images with stronger checksums. It also
>>   supports verified boot.
>>   .
>> -.SH "OPTIONS"
>> +.SH OPTIONS
>>   .
>>   .B List image information:
>>   .
>>   .TP
>> -.BI "\-l [" "uimage file name" "]"
>> +.BI \-l " uimage-file-name"
> 
> You have renamed this in the synopsis to image-file-name. Please, keep
> the argument names consistent.

This is fixed in patch 6. I have tried to keep this patch to just a mechanical removal of quotes.

--Sean

>>   mkimage lists the information contained in the header of an existing U-Boot image.
>>   .
>>   .TP
>> -.BI "\-T [" "image type" "]"
>> +.BI \-T " image-type"
>>   Parse image file as type.
>>   Pass \-h as the image to see the list of supported image type.
>>   Without this option image type is autodetected.
>>   .
>>   .TP
>> -.BI "\-q"
>> +.B \-q
>>   Quiet. Don't print the image header on successful verification.
>>   .
>>   .P
>>   .B Create old legacy image:
>>   .
>>   .TP
>> -.BI "\-A [" "architecture" "]"
>> +.BI \-A " architecture"
>>   Set architecture. Pass \-h as the architecture to see the list of supported architectures.
>>   .
>>   .TP
>> -.BI "\-O [" "os" "]"
>> +.BI \-O " os"
>>   Set operating system. bootm command of u-boot changes boot method by os type.
>>   Pass \-h as the OS to see the list of supported OS.
>>   .
>>   .TP
>> -.BI "\-T [" "image type" "]"
>> +.BI \-T " image-type"
>>   Set image type.
>>   Pass \-h as the image to see the list of supported image type.
>>   .
>>   .TP
>> -.BI "\-C [" "compression type" "]"
>> +.BI \-C " compression-type"
>>   Set compression type.
>>   Pass \-h as the compression to see the list of supported compression type.
>>   .
>>   .TP
>> -.BI "\-a [" "load address" "]"
>> +.BI \-a " load-address"
>>   Set load address with a hex number.
>>   .
>>   .TP
>> -.BI "\-e [" "entry point" "]"
>> +.BI \-e " entry-point"
>>   Set entry point with a hex number.
>>   .
>>   .TP
>> -.BI "\-l"
>> +.B \-l
>>   List the contents of an image.
>>   .
>>   .TP
>> -.BI "\-n [" "image name" "]"
>> +.BI \-n " image-name"
>>   Set image name to 'image name'.
>>   .
>>   .TP
>> -.BI "\-R [" "secondary image name" "]"
>> +.BI \-R " secondary-image-name"
>>   Some image types support a second image for additional data. For these types,
>>   use \-R to specify this second image.
>>   .TS
>> @@ -135,42 +135,42 @@ T}
>>   .TE
>>   .
>>   .TP
>> -.BI "\-d [" "image data file" "]"
>> +.BI \-d " image-data-file"
>>   Use image data from 'image data file'.
>>   .
>>   .TP
>> -.BI "\-x"
>> +.B \-x
>>   Set XIP (execute in place) flag.
>>   .
>>   .TP
>> -.BI "\-s"
>> +.B \-s
>>   Don't copy in the image data. Depending on the image type, this may create
>>   just the header, everything but the image data, or nothing at all.
>>   .
>>   .TP
>> -.BI "\-v"
>> +.B \-v
>>   Verbose. Print file names as they are added to the image.
>>   .
>>   .P
>>   .B Create FIT image:
>>   .
>>   .TP
>> -.BI "\-b [" "device tree file" "]
>> +.BI \-b " device-tree-file"
>>   Appends the device tree binary file (.dtb) to the FIT.
>>   .
>>   .TP
>> -.BI "\-c [" "comment" "]"
>> +.BI \-c " comment"
>>   Specifies a comment to be added when signing. This is typically a useful
>>   message which describes how the image was signed or some other useful
>>   information.
>>   .
>>   .TP
>> -.BI "\-D [" "dtc options" "]"
>> +.BI \-D " dtc-options"
>>   Provide special options to the device tree compiler that is used to
>>   create the image.
>>   .
>>   .TP
>> -.BI "\-E
>> +.BI \-E
>>   After processing, move the image data outside the FIT and store a data offset
>>   in the FIT. Images will be placed one after the other immediately after the
>>   FIT, with each one aligned to a 4-byte boundary. The existing 'data' property
>> @@ -179,12 +179,12 @@ A 'data-offset' of 0 indicates that it starts in the first (4-byte aligned)
>>   byte after the FIT.
>>   .
>>   .TP
>> -.BI "\-B [" "alignment" "]"
>> +.BI \-B " alignment"
>>   The alignment, in hexadecimal, that external data will be aligned to. This
>>   option only has an effect when \-E is specified.
>>   .
>>   .TP
>> -.BI "\-f [" "image tree source file" " | " "auto" "]"
>> +.BI \-f " image-tree-source-file"
>>   Image tree source file that describes the structure and contents of the
>>   FIT image.
>>   .IP
>> @@ -194,29 +194,29 @@ and -e are used to specify the image to include in the FIT and its attributes.
>>   No .its file is required.
>>   .
>>   .TP
>> -.BI "\-F"
>> +.B \-F
>>   Indicates that an existing FIT image should be modified. No dtc
>>   compilation is performed and the \-f flag should not be given.
>>   This can be used to sign images with additional keys after initial image
>>   creation.
>>   .
>>   .TP
>> -.BI "\-i [" "ramdisk_file" "]"
>> +.BI \-i " ramdisk-file"
>>   Appends the ramdisk file to the FIT.
>>   .
>>   .TP
>> -.BI "\-k [" "key_directory" "]"
>> +.BI \-k " key-directory"
>>   Specifies the directory containing keys to use for signing. This directory
>>   should contain a private key file <name>.key for use with signing and a
>>   certificate <name>.crt (containing the public key) for use with verification.
>>   .
>>   .TP
>> -.BI "\-G [" "key_file" "]"
>> +.BI \-G " key-file"
>>   Specifies the private key file to use when signing. This option may be used
>>   instead of \-k.
>>   .
>>   .TP
>> -.BI "\-K [" "key_destination" "]"
>> +.BI \-K " key-destination"
>>   Specifies a compiled device tree binary file (typically .dtb) to write
>>   public key information into. When a private key is used to sign an image,
>>   the corresponding public key is written into this file for for run-time
>> @@ -224,42 +224,42 @@ verification. Typically the file here is the device tree binary used by
>>   CONFIG_OF_CONTROL in U-Boot.
>>   .
>>   .TP
>> -.BI "\-G [" "key_file" "]"
>> +.BI \-G " key-file"
>>   Specifies the private key file to use when signing. This option may be used
>>   instead of \-k.
>>   .
>>   .TP
>> -.BI "\-g [" "key_name_hint" "]"
>> +.BI \-g " key-name-hint"
>>   Sets the key-name-hint property when used with \-f auto. This is the <name>
>>   part of the key. The directory part is set by \-k. This option also indicates
>>   that the images included in the FIT should be signed. If this option is
>>   specified, \-o must be specified as well.
>>   .
>>   .TP
>> -.BI "\-o [" "signing algorithm" "]"
>> +.BI \-o " signing-algorithm"
>>   Specifies the algorithm to be used for signing a FIT image. The default is
>>   taken from the signature node's 'algo' property.
>>   .
>>   .TP
>> -.BI "\-p [" "external position" "]"
>> +.BI \-p " external-position"
>>   Place external data at a static external position. See \-E. Instead of writing
>>   a 'data-offset' property defining the offset from the end of the FIT, \-p will
>>   use 'data-position' as the absolute position from the base of the FIT.
>>   .
>>   .TP
>> -.BI "\-r"
>> +.B \-r
>>   Specifies that keys used to sign the FIT are required. This means that they
>>   must be verified for the image to boot. Without this option, the verification
>>   will be optional (useful for testing but not for release).
>>   .
>>   .TP
>> -.BI "\-N [" "engine" "]"
>> +.BI \-N " engine"
>>   The openssl engine to use when signing and verifying the image. For a complete list of
>>   available engines, refer to
>>   .BR engine (1).
>>   .
>>   .TP
>> -.BI "\-t
>> +.B \-t
>>   Update the timestamp in the FIT.
>>   .IP
>>   Normally the FIT timestamp is created the first time mkimage is run on a FIT,
> 



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 05/14] doc: mkimage: Use subsection macro
  2022-06-16 10:08   ` Heinrich Schuchardt
@ 2022-06-16 13:45     ` Sean Anderson
  0 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-16 13:45 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Simon Glass, u-boot

On 6/16/22 6:08 AM, Heinrich Schuchardt wrote:
> On 6/13/22 00:14, Sean Anderson wrote:
>> The options are divided up into several subsections. Use the appropriate
>> macro. While we're at it, rename the headings to better reflect the
>> contents of their sections.
>>
>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>> ---
>>
>> Changes in v2:
>> - Rename first subsection to "General options"
>> - Use paired quotation marks
>>
>>   doc/mkimage.1 | 8 +++-----
>>   1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/doc/mkimage.1 b/doc/mkimage.1
>> index 4074715fe5..8b96011f90 100644
>> --- a/doc/mkimage.1
>> +++ b/doc/mkimage.1
>> @@ -51,7 +51,7 @@ supports verified boot.
>>   .
>>   .SH OPTIONS
>>   .
>> -.B List image information:
>> +.SS General options
>>   .
>>   .TP
>>   .BI \-l " uimage-file-name"
>> @@ -67,8 +67,7 @@ Without this option image type is autodetected.
>>   .B \-q
>>   Quiet. Don't print the image header on successful verification.
>>   .
>> -.P
>> -.B Create old legacy image:
>> +.SS Options for creating legacy or \(lqauto\(rq images
> An image type (IH_TYPE_SUNXI_TOC0) introduced in 2022 cannot be legacy.
> Please, remove this misleading and derogatory term. I guess you mean
> anything but FIT. 

This is really Simon's usage. I agree that it doesn't really apply.

> Should the whole paragraph be move down below the
> descriptions of the creation of FIT images? Then you could say "Options
> for creating other image types".
> 
> I have no clue what an "auto" image might refer to. The man-page is not
> of any help here.

See the documentation for -f

The problem is that we really should have an image type of "fit" and -n
should be used instead of -f. But what's done is done.

--Sean

> Best regards
> 
> Heinrich
> 
>>   .
>>   .TP
>>   .BI \-A " architecture"
>> @@ -151,8 +150,7 @@ just the header, everything but the image data, or nothing at all.
>>   .B \-v
>>   Verbose. Print file names as they are added to the image.
>>   .
>> -.P
>> -.B Create FIT image:
>> +.SS Options for creating FIT images
>>   .
>>   .TP
>>   .BI \-b " device-tree-file"
> 



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 14/14] doc: Add man page for dumpimage
  2022-06-16 11:50   ` Heinrich Schuchardt
@ 2022-06-16 13:47     ` Sean Anderson
  0 siblings, 0 replies; 23+ messages in thread
From: Sean Anderson @ 2022-06-16 13:47 UTC (permalink / raw)
  To: Heinrich Schuchardt, u-boot; +Cc: Simon Glass

On 6/16/22 7:50 AM, Heinrich Schuchardt wrote:
> On 6/13/22 00:14, Sean Anderson wrote:
>> This tool seems a bit underloved. Unfortunately, it seems to be missing
>> support for FIT images. Alas...
>>
>> Add a man page documenting it. The example is taken from commit a804b5ce2d
>> ("Add dumpimage, a tool to extract data from U-Boot images").
>>
>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>> ---
>>
>> Changes in v2:
>> - Ensure comments are requests
>>
>>   doc/dumpimage.1 | 103 ++++++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 103 insertions(+)
>>   create mode 100644 doc/dumpimage.1
>>
>> diff --git a/doc/dumpimage.1 b/doc/dumpimage.1
>> new file mode 100644
>> index 0000000000..52a45a3404
>> --- /dev/null
>> +++ b/doc/dumpimage.1
>> @@ -0,0 +1,103 @@
>> +.\" SPDX-License-Identifier: GPL-2.0
>> +.\" Copyright (C) 2022 Sean Anderson <seanga2@gmail.com>
>> +.TH DUMPIMAGE 1 2022-06-11 U-Boot
>> +.SH NAME
>> +dumpimage \- extract data from U-Boot images
>> +.
>> +.SH SYNOPSIS
>> +.SY dumpimage
>> +.OP \-T type
>> +.BI \-l\~ image
>> +.YS
>> +.SY dumpimage
>> +.OP \-T type
> 
> The online help shows this parameter as optional.
> 
>> +.OP \-p position
> 
> -p is optional so it should be in brackets.

.OP automatically adds brackets

>> +.BI \-o\~ outfile
> 
> -o is optional.

It's only optional for -l, which is listed separately. See line 141
of tools/dumpimage.c.

--Sean

>> +.I image
>> +.YS
>> +.SY dumpimage
>> +.B \-h
>> +.YS
>> +.SY dumpimage
>> +.B \-V
>> +.YS
>> +.
>> +.SH DESCRIPTION
>> +.B dumpimage
>> +lists and extracts data from U-Boot images. If
>> +.B \-l
>> +is specified,
>> +.B dumpimage
>> +lists the components in
>> +.IR image .
>> +Otherwise,
>> +.B dumpimage
>> +extracts the component at
>> +.IR position " to " outfile .
>> +.
>> +.SH OPTIONS
>> +.TP
>> +.B \-h
>> +Print usage information and exit.
>> +.
>> +.TP
>> +.B \-l
>> +Print the header information for
>> +.IR image ,
>> +including a list of components.
>> +.
>> +.TP
>> +.BI \-o " outfile"
>> +The file to write the dumped component to.
>> +.TP
>> +.BI \-p " position"
>> +Specify the
>> +.I position
>> +of the component to dump. This should be a numeric index, starting at 0. If not
>> +specified, the default
>> +.I position
>> +is 0.
>> +.
>> +.TP
>> +.BI \-T " type"
>> +Specify the
>> +.I type
>> +of the image. If not specified, the image type will be automatically detected. A
>> +list of supported image types may be printed by running
>> +.BR "mkimage\~\-T\~list" .
>> +.
>> +.TP
>> +.B \-V
>> +Print version information and exit.
>> +.
>> +.SH BUGS
>> +Please report bugs to the
>> +.UR https://\:source\:.denx\:.de/\:u-boot/\:u-boot/\:issues
>> +U-Boot bug tracker
>> +.UE .
>> +.SH EXAMPLES
>> +Create a multi-file image and then extract part of that image
>> +.PP
>> +.EX
>> +.in +4
>> +$ \c
>> +.B mkimage \-A x86 \-O linux \-T multi \-n x86 \\\\\&
>> +.in +4
>> +.B \-d vmlinuz:initrd.img:System.map multi.img
>> +.in
>> +Image Name:   x86
>> +Created:      Thu Jul 25 10:29:13 2013
>> +Image Type:   Intel x86 Linux Multi-File Image (gzip compressed)
>> +Data Size:    13722956 Bytes = 13401.32 kB = 13.09 MB
>> +Load Address: 00000000
>> +Entry Point:  00000000
>> +Contents:
>> +   Image 0: 4040128 Bytes = 3945.44 kB = 3.85 MB
>> +   Image 1: 7991719 Bytes = 7804.41 kB = 7.62 MB
>> +   Image 2: 1691092 Bytes = 1651.46 kB = 1.61 MB
>> +$ \c
>> +.B dumpimage -p 2 -o System.map multi.img
>> +.EE
>> +.in
>> +.SH SEE ALSO
>> +.BR mkimage (1)
> 



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-06-16 13:47 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-12 22:13 [PATCH v2 00/14] doc: mkimage: Rework and refactor the man page; add long options Sean Anderson
2022-06-12 22:13 ` [PATCH v2 01/14] doc: mkimage: Use standard style for synopsis Sean Anderson
2022-06-16  9:45   ` Heinrich Schuchardt
2022-06-16 13:40     ` Sean Anderson
2022-06-12 22:13 ` [PATCH v2 02/14] doc: mkimage: Use empty request instead of blank lines Sean Anderson
2022-06-12 22:14 ` [PATCH v2 03/14] doc: mkimage: Reformat examples Sean Anderson
2022-06-12 22:14 ` [PATCH v2 04/14] doc: mkimage: Regularize option documentation Sean Anderson
2022-06-16 10:00   ` Heinrich Schuchardt
2022-06-16 13:42     ` Sean Anderson
2022-06-12 22:14 ` [PATCH v2 05/14] doc: mkimage: Use subsection macro Sean Anderson
2022-06-16 10:08   ` Heinrich Schuchardt
2022-06-16 13:45     ` Sean Anderson
2022-06-12 22:14 ` [PATCH v2 06/14] doc: mkimage: Rearrange/remove some options Sean Anderson
2022-06-12 22:14 ` [PATCH v2 07/14] doc: mkimage: Use correct capitalization for NAME Sean Anderson
2022-06-12 22:14 ` [PATCH v2 08/14] doc: mkimage: Edit options for style and consistency Sean Anderson
2022-06-12 22:14 ` [PATCH v2 09/14] doc: mkimage: Add BUGS section Sean Anderson
2022-06-12 22:14 ` [PATCH v2 10/14] doc: mkimage: Add SEE ALSO section Sean Anderson
2022-06-12 22:14 ` [PATCH v2 11/14] doc: mkimage: Remove AUTHORS section Sean Anderson
2022-06-12 22:14 ` [PATCH v2 12/14] mkimage: Add long options Sean Anderson
2022-06-12 22:14 ` [PATCH v2 13/14] doc: mkimage: Further document -o and -R Sean Anderson
2022-06-12 22:14 ` [PATCH v2 14/14] doc: Add man page for dumpimage Sean Anderson
2022-06-16 11:50   ` Heinrich Schuchardt
2022-06-16 13:47     ` Sean Anderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.