[PATCH v7 11/13] mkeficapsule: Add support for generating empty capsules

Ilias Apalodimas ilias.apalodimas at linaro.org
Fri Jul 15 15:52:41 CEST 2022


Hi Sughosh,

On Thu, 14 Jul 2022 at 21:40, Sughosh Ganu <sughosh.ganu at linaro.org> wrote:
>
> The Dependable Boot specification[1] describes the structure of the
> firmware accept and revert capsules. These are empty capsules which
> are used for signalling the acceptance or rejection of the updated
> firmware by the OS. Add support for generating these empty capsules.
>
> [1] - https://git.codelinaro.org/linaro/dependable-boot/mbfw/uploads/6f7ddfe3be24e18d4319e108a758d02e/mbfw.pdf
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>

[...]

> +       capsule_type = CAPSULE_NORMAL_BLOB;
>         for (;;) {
>                 c = getopt_long(argc, argv, opts_short, options, &idx);
>                 if (c == -1)
> @@ -639,22 +693,46 @@ int main(int argc, char **argv)
>                 case 'd':
>                         dump_sig = 1;
>                         break;
> -               case 'h':
> +               case 'A':
> +                       capsule_type |= CAPSULE_ACCEPT;
> +                       break;
> +               case 'R':
> +                       capsule_type |= CAPSULE_REVERT;
> +                       break;

capsule_type will be set to CAPSULE_NORMAL_BLOB.  I think it's better to have
case 'A':
   if (capsule_type)
       //error out mentioned A and R are mutually exclusive
    capsule_type = CAPSULE_ACCEPT;
    break;
    case 'R':
        if (capsule_type)
       //error out mentioned A and R are mutually exclusive
        capsule_type |= CAPSULE_REVERT;
            break;

> +               default:
>                         print_usage();
>                         exit(EXIT_SUCCESS);
>                 }
>         }
>
> +       if (capsule_type == (CAPSULE_ACCEPT | CAPSULE_REVERT)) {
> +               fprintf(stderr,
> +                       "Select either of Accept or Revert capsule generation\n");
> +               exit(EXIT_FAILURE);
> +       }
> +

And get rid of this if

[...]

Regards
/Ilias


More information about the U-Boot mailing list