public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 16/27] mkimage: Allow a FIT to include an image of any type
Date: Wed, 27 Apr 2016 09:28:47 +0200	[thread overview]
Message-ID: <29526f90-ba50-25dc-efc3-17c9bd85ea81@gmail.com> (raw)
In-Reply-To: <1456206959-29115-17-git-send-email-sjg@chromium.org>

Hi Simon,

On 23.02.2016 06:55, Simon Glass wrote:
> At present FIT images are set up by providing a device tree source file
> which is a file with a .its extension. We want to support automatically
> creating this file based on the image supplied to mkimage. This means that
> even though the final file type is always IH_TYPE_FLATDT, the image inside
> may be something else.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v2:
> - Always expect the final argument to be the image file

> diff --git a/tools/mkimage.c b/tools/mkimage.c
> index b8293f6..2fd1f0b 100644
> --- a/tools/mkimage.c
> +++ b/tools/mkimage.c
> @@ -112,10 +112,14 @@ static void usage(const char *msg)
>  static void process_args(int argc, char **argv)
>  {
>  	char *ptr;
> +	int type = IH_TYPE_INVALID;
> +	char *datafile = NULL;
> +	int expecting;
>  	int opt;
>  
> +	expecting = IH_TYPE_COUNT;	/* Unknown */
>  	while ((opt = getopt(argc, argv,
> -			     "a:A:cC:d:D:e:f:Fk:K:ln:O:rR:sT:vVx")) != -1) {
> +			     "-a:A:cC:d:D:e:f:Fk:K:ln:O:rR:sT:vVx")) != -1) {

I just encountered an error building the latest ToT on my OS X box with
this change. Unfortunately the '-' in optstring seems to be an GNU
option and is not portable.

>  		switch (opt) {

> @@ -211,14 +217,31 @@ static void process_args(int argc, char **argv)
>  		case 'x':
>  			params.xflag++;
>  			break;
> +		case 1:
> +			if (expecting == type || optind == argc) {
> +				params.imagefile = optarg;
> +				expecting = IH_TYPE_INVALID;
> +			}
> +			break;
>  		default:
>  			usage("Invalid option");
>  		}
>  	}
>  
> -	if (optind >= argc)
> +	/*
> +	 * For auto-generated FIT images we need to know the image type to put
> +	 * in the FIT, which is separate from the file's image type (which
> +	 * will always be IH_TYPE_FLATDT in this case).
> +	 */
> +	if (params.type == IH_TYPE_FLATDT) {
> +		params.fit_image_type = type;
> +		params.datafile = datafile;
> +	} else if (type != IH_TYPE_INVALID) {
> +		params.type = type;
> +	}
> +
> +	if (!params.imagefile)
>  		usage("Missing output filename");
> -	params.imagefile = argv[optind];
>  }

Therefore the imagefile is never set. Do you mind to switch back to the
portable version with 'POSIX_CORRECT'?

Andreas

  parent reply	other threads:[~2016-04-27  7:28 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-23  5:55 [U-Boot] [PATCH v2 00/27] spl: Support loading a FIT image containing U-Boot Simon Glass
2016-02-23  5:55 ` [U-Boot] [PATCH v2 01/27] mkimage: Move argument processing into its own function Simon Glass
2016-03-15 11:53   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 02/27] mkimage: Convert to use getopt() Simon Glass
2016-03-15 11:53   ` [U-Boot] [U-Boot,v2,02/27] " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 03/27] mkimage: Sort the option processing code by option Simon Glass
2016-03-15 11:53   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 04/27] mkimage: Move usage() up to the top Simon Glass
2016-03-15 11:53   ` [U-Boot] [U-Boot,v2,04/27] " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 05/27] mkimage: Show an error message when usage() is called Simon Glass
2016-03-15 11:53   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 06/27] mkimage: Make 'params' static Simon Glass
2016-03-15 11:53   ` [U-Boot] [U-Boot,v2,06/27] " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 07/27] libfdt: Add a function to write a property placeholder Simon Glass
2016-03-15 11:53   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 08/27] Correct defconfig ordering Simon Glass
2016-03-15 11:53   ` [U-Boot] [U-Boot,v2,08/27] " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 09/27] freescale: Remove CONFIG_DM from header files Simon Glass
2016-03-15 11:53   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 10/27] Move CONFIG_OF_LIBFDT to Kconfig Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot,v2,10/27] " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 11/27] Kconfig: Move CONFIG_FIT and related options " Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 12/27] fdt: Adjust DEFAULT_DEVICE_TREE to device on OF_CONTROL Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 13/27] fdt: Allow libfdt to be used in SPL Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot,v2,13/27] " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 14/27] sunxi: Display the board model on start-up Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 15/27] tools: Include fdt_sw.o in libfdt for mkimage Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 16/27] mkimage: Allow a FIT to include an image of any type Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-04-27  7:28   ` Andreas Bießmann [this message]
2016-05-01 23:12     ` [U-Boot] [PATCH v2 " Simon Glass
2016-02-23  5:55 ` [U-Boot] [PATCH v2 17/27] tools: Add a function to obtain the size of a file Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 18/27] image: Add functions to obtain short names Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 19/27] mkimage: Support automatic creating of a FIT without a .its Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 20/27] mkimage: Support adding device tree files to a FIT Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 21/27] mkimage: Support placing data outside the FIT Simon Glass
2016-03-15 11:54   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 22/27] mkimage: Bring data into the FIT before processing Simon Glass
2016-03-15 11:55   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 23/27] spl: Add a way for boards to select which device tree to load Simon Glass
2016-03-15 11:55   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 24/27] spl: Add an option to load a FIT containing U-Boot Simon Glass
2016-03-15 11:55   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 25/27] spl: Add a way to specify a list of device trees to include Simon Glass
2016-03-15 11:55   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 26/27] spl: Support loading a FIT from MMC Simon Glass
2016-03-15 11:55   ` [U-Boot] [U-Boot,v2,26/27] " Tom Rini
2016-02-23  5:55 ` [U-Boot] [PATCH v2 27/27] RFC: sunxi: Enable SPL FIT support Simon Glass
2016-04-28  9:44   ` Michal Simek
2016-04-28 13:07     ` Tom Rini
2016-04-28 13:12       ` Michal Simek
2016-04-28 19:05         ` Tom Rini
2016-04-29  6:17           ` Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29526f90-ba50-25dc-efc3-17c9bd85ea81@gmail.com \
    --to=andreas.devel@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox