[U-Boot] [PATCH v2 16/27] mkimage: Allow a FIT to include an image of any type

Simon Glass sjg at chromium.org
Mon May 2 01:12:54 CEST 2016


Hi Andreas,

On 27 April 2016 at 01:28, Andreas Bießmann
<andreas.devel at googlemail.com> wrote:
> 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 at 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'?

Hmmm I didn't consider that. I see you have sent a patch (thank you)
so let's continue on that thread.

Regards,
Simon


More information about the U-Boot mailing list