mkimage: Add long options
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> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
785a051ee5
commit
dc3a923ed6
|
|
@ -60,20 +60,28 @@ checksums. It also supports verified boot.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-h
|
.B \-h
|
||||||
|
.TQ
|
||||||
|
.B \-\-help
|
||||||
Print a help message and exit.
|
Print a help message and exit.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-l
|
.B \-l
|
||||||
|
.TQ
|
||||||
|
.B \-\-list
|
||||||
.B mkimage
|
.B mkimage
|
||||||
lists the information contained in the header of an existing U-Boot image.
|
lists the information contained in the header of an existing U-Boot image.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-s
|
.B \-s
|
||||||
|
.TQ
|
||||||
|
.B \-\-no\-copy
|
||||||
Don't copy in the image data. Depending on the image type, this may create
|
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.
|
just the header, everything but the image data, or nothing at all.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-T " image-type"
|
.BI \-T " image-type"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-type " image-type"
|
||||||
Parse image file as
|
Parse image file as
|
||||||
.IR image-type .
|
.IR image-type .
|
||||||
Pass
|
Pass
|
||||||
|
|
@ -105,20 +113,28 @@ is absent, then the \(oqtype\(cq property will default to
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-q
|
.B \-q
|
||||||
|
.TQ
|
||||||
|
.B \-\-quiet
|
||||||
Quiet. Don't print the image header.
|
Quiet. Don't print the image header.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-v
|
.B \-v
|
||||||
|
.TQ
|
||||||
|
.B \-\-verbose
|
||||||
Verbose. Print file names as they are added to the image.
|
Verbose. Print file names as they are added to the image.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-V
|
.B \-V
|
||||||
|
.TQ
|
||||||
|
.B \-\-version
|
||||||
Print version information and exit.
|
Print version information and exit.
|
||||||
.
|
.
|
||||||
.SS General image-creation options
|
.SS General image-creation options
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-A " architecture"
|
.BI \-A " architecture"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-architecture " architecture"
|
||||||
Set the architecture. Pass
|
Set the architecture. Pass
|
||||||
.B \-h
|
.B \-h
|
||||||
as the architecture to see the list of supported architectures. If
|
as the architecture to see the list of supported architectures. If
|
||||||
|
|
@ -128,6 +144,8 @@ is absent, it defaults to
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-O " os"
|
.BI \-O " os"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-os " os"
|
||||||
Set the operating system. The U-Boot
|
Set the operating system. The U-Boot
|
||||||
.I bootm
|
.I bootm
|
||||||
command changes boot method based on the OS type.
|
command changes boot method based on the OS type.
|
||||||
|
|
@ -142,6 +160,8 @@ is absent, it defaults to
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-C " compression-type"
|
.BI \-C " compression-type"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-compression " compression-type"
|
||||||
Set the compression type. The image data should have already been compressed
|
Set the compression type. The image data should have already been compressed
|
||||||
using this compression type.
|
using this compression type.
|
||||||
.B mkimage
|
.B mkimage
|
||||||
|
|
@ -157,12 +177,16 @@ is absent, it defaults to
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-a " load-address"
|
.BI \-a " load-address"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-load\-address " load-address"
|
||||||
Set the absolute address to load the image data to.
|
Set the absolute address to load the image data to.
|
||||||
.I load-address
|
.I load-address
|
||||||
will be interpreted as a hexadecimal number.
|
will be interpreted as a hexadecimal number.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-e " entry-point"
|
.BI \-e " entry-point"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-entry\-point " entry-point"
|
||||||
Set the absolute address of the image entry point. The U-Boot
|
Set the absolute address of the image entry point. The U-Boot
|
||||||
.I bootm
|
.I bootm
|
||||||
command will jump to this address after loading the image.
|
command will jump to this address after loading the image.
|
||||||
|
|
@ -171,11 +195,15 @@ will be interpreted as a hexadecimal number.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-n " image-name"
|
.BI \-n " image-name"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-primary\-image " image-name"
|
||||||
Set the image name to
|
Set the image name to
|
||||||
.IR image-name .
|
.IR image-name .
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-R " secondary-image-name"
|
.BI \-R " secondary-image-name"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-secondary\-image " image-name"
|
||||||
Some image types support a second image for additional data. For these types,
|
Some image types support a second image for additional data. For these types,
|
||||||
use
|
use
|
||||||
.B \-R
|
.B \-R
|
||||||
|
|
@ -207,6 +235,8 @@ T}
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-d " image-data-file"
|
.BI \-d " image-data-file"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-image " image-data-file"
|
||||||
Use image data from
|
Use image data from
|
||||||
.IR image-data-file .
|
.IR image-data-file .
|
||||||
If the
|
If the
|
||||||
|
|
@ -221,6 +251,8 @@ then multiple images may be specified, separated by colons:
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-x
|
.B \-x
|
||||||
|
.TQ
|
||||||
|
.B \-\-xip
|
||||||
Set the
|
Set the
|
||||||
.I XIP
|
.I XIP
|
||||||
(execute in place) flag. The U-Boot
|
(execute in place) flag. The U-Boot
|
||||||
|
|
@ -232,15 +264,21 @@ accessible at the load address (such as via memory-mapped flash).
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-b " device-tree-file"
|
.BI \-b " device-tree-file"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-device\-tree " device-tree-file"
|
||||||
Appends the device tree binary file (.dtb) to the FIT.
|
Appends the device tree binary file (.dtb) to the FIT.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-c " comment"
|
.BI \-c " comment"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-comment " comment"
|
||||||
Specifies a comment to be added when signing. This is typically a message which
|
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.
|
describes how the image was signed or some other useful information.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-D " dtc-options"
|
.BI \-D " dtc-options"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-dtcopts " dtc-options"
|
||||||
Provide additional options to the device tree compiler when creating the image.
|
Provide additional options to the device tree compiler when creating the image.
|
||||||
See
|
See
|
||||||
.BR dtc (1)
|
.BR dtc (1)
|
||||||
|
|
@ -251,6 +289,8 @@ is absent, it defaults to
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-E
|
.BI \-E
|
||||||
|
.TQ
|
||||||
|
.BI \-\-external
|
||||||
After processing, move the image data outside the FIT and store a data offset
|
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,
|
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
|
with each one aligned to a 4-byte boundary. The existing \(oqdata\(cq property
|
||||||
|
|
@ -260,11 +300,15 @@ properties. A \(oqdata-offset\(cq of 0 indicates that it starts in the first
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-B " alignment"
|
.BI \-B " alignment"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-alignment " alignment"
|
||||||
The alignment, in hexadecimal, that external data will be aligned to. This
|
The alignment, in hexadecimal, that external data will be aligned to. This
|
||||||
option only has an effect when \-E is specified.
|
option only has an effect when \-E is specified.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-p " external-position"
|
.BI \-p " external-position"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-position " external-position"
|
||||||
Place external data at a static external position. Instead of writing a
|
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,
|
\(oqdata-offset\(cq property defining the offset from the end of the FIT,
|
||||||
.B \-p
|
.B \-p
|
||||||
|
|
@ -275,6 +319,8 @@ for details on using external data.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fB\-f \fIimage-tree-source-file\fR | \fBauto
|
\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
|
Image tree source file that describes the structure and contents of the
|
||||||
FIT image.
|
FIT image.
|
||||||
.IP
|
.IP
|
||||||
|
|
@ -297,6 +343,8 @@ is required.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-F
|
.B \-F
|
||||||
|
.TQ
|
||||||
|
.B \-\-update
|
||||||
Indicates that an existing FIT image should be modified. No dtc compilation will
|
Indicates that an existing FIT image should be modified. No dtc compilation will
|
||||||
be performed and
|
be performed and
|
||||||
.B \-f
|
.B \-f
|
||||||
|
|
@ -305,10 +353,14 @@ after initial image creation.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-i " ramdisk-file"
|
.BI \-i " ramdisk-file"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-initramfs " ramdisk-file"
|
||||||
Append a ramdisk or initramfs file to the image.
|
Append a ramdisk or initramfs file to the image.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-k " key-directory"
|
.BI \-k " key-directory"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-key\-dir " key-directory"
|
||||||
Specifies the directory containing keys to use for signing. This directory
|
Specifies the directory containing keys to use for signing. This directory
|
||||||
should contain a private key file
|
should contain a private key file
|
||||||
.IR name .key
|
.IR name .key
|
||||||
|
|
@ -324,11 +376,15 @@ but may be overridden using
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-G " key-file"
|
.BI \-G " key-file"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-key\-file " key-file"
|
||||||
Specifies the private key file to use when signing. This option may be used
|
Specifies the private key file to use when signing. This option may be used
|
||||||
instead of \-k.
|
instead of \-k.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-K " key-destination"
|
.BI \-K " key-destination"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-key\-dest " key-destination"
|
||||||
Specifies a compiled device tree binary file (typically .dtb) to write
|
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,
|
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
|
the corresponding public key is written into this file for for run-time
|
||||||
|
|
@ -337,6 +393,8 @@ CONFIG_OF_CONTROL in U-Boot.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-g " key-name-hint"
|
.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
|
Overrides the signature node's \(oqkey-name-hint\(cq property. This is
|
||||||
especially useful when signing an image with
|
especially useful when signing an image with
|
||||||
.BR "\-f auto" .
|
.BR "\-f auto" .
|
||||||
|
|
@ -351,6 +409,8 @@ must be specified as well.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-o " crypto" , checksum
|
.BI \-o " crypto" , checksum
|
||||||
|
.TQ
|
||||||
|
.BI \-\-algo " crypto" , checksum
|
||||||
Specifies the algorithm to be used for signing a FIT image. The default is
|
Specifies the algorithm to be used for signing a FIT image. The default is
|
||||||
taken from the signature node's \(oqalgo\(cq property.
|
taken from the signature node's \(oqalgo\(cq property.
|
||||||
The valid values for
|
The valid values for
|
||||||
|
|
@ -383,18 +443,24 @@ sha512
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-r
|
.B \-r
|
||||||
|
.TQ
|
||||||
|
.B \-\-key\-required
|
||||||
Specifies that keys used to sign the FIT are required. This means that they
|
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
|
must be verified for the image to boot. Without this option, the verification
|
||||||
will be optional (useful for testing but not for release).
|
will be optional (useful for testing but not for release).
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.BI \-N " engine"
|
.BI \-N " engine"
|
||||||
|
.TQ
|
||||||
|
.BI \-\-engine " engine"
|
||||||
The openssl engine to use when signing and verifying the image. For a complete
|
The openssl engine to use when signing and verifying the image. For a complete
|
||||||
list of available engines, refer to
|
list of available engines, refer to
|
||||||
.BR engine (1).
|
.BR engine (1).
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-t
|
.B \-t
|
||||||
|
.TQ
|
||||||
|
.B \-\-touch
|
||||||
Update the timestamp in the FIT.
|
Update the timestamp in the FIT.
|
||||||
.IP
|
.IP
|
||||||
Normally the FIT timestamp is created the first time mkimage runs,
|
Normally the FIT timestamp is created the first time mkimage runs,
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include "mkimage.h"
|
#include "mkimage.h"
|
||||||
#include "imximage.h"
|
#include "imximage.h"
|
||||||
#include <fit_common.h>
|
#include <fit_common.h>
|
||||||
|
#include <getopt.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <version.h>
|
#include <version.h>
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|
@ -134,6 +135,7 @@ static void usage(const char *msg)
|
||||||
fprintf(stderr, " %s -V ==> print version information and exit\n",
|
fprintf(stderr, " %s -V ==> print version information and exit\n",
|
||||||
params.cmdname);
|
params.cmdname);
|
||||||
fprintf(stderr, "Use '-T list' to see a list of available image types\n");
|
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);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
@ -156,6 +158,45 @@ static int add_content(int type, const char *fname)
|
||||||
return 0;
|
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)
|
static void process_args(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
@ -163,8 +204,8 @@ static void process_args(int argc, char **argv)
|
||||||
char *datafile = NULL;
|
char *datafile = NULL;
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv,
|
while ((opt = getopt_long(argc, argv, optstring,
|
||||||
"a:A:b:B:c:C:d:D:e:Ef:Fg:G:k:i:K:ln:N:p:o:O:rR:qstT:vVx")) != -1) {
|
longopts, NULL)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'a':
|
case 'a':
|
||||||
params.addr = strtoull(optarg, &ptr, 16);
|
params.addr = strtoull(optarg, &ptr, 16);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue