On Wed, Sep 09, 2026 at 11:51:08PM +0800, Junhui Liu wrote:
> The SpacemiT BootROM loads the FSBL from a boot image consisting of a
> fixed 4 KiB header with two metadata headers and authentication
> information, followed by a 32-byte-aligned SPL payload and a trailing
> authentication area. K1 and K3 share the same layout, but use different
> integrity and authentication schemes. K1 requires RSA-signed images,
> while K3 uses CRC32 to verify images in non-secure boot mode.
> 
> Add mkimage type "smtimage" for the K3 CRC32 path. Populate both
> metadata headers, fill their CRC32 values and the payload CRC32, and
> reserve the authentication areas required by the layout.
> 
> The image header has no reliable K1/K3 identifier, so select the SoC
> with -n. Omit dumpimage support since it cannot take -n to distinguish
> between the variants.
> 
> Only "-n k3" in non-secure boot mode is supported. Route SoC differences
> through a variant table so K1 and RSA authentication support can be
> added later.
> 
> Tested-by: E Shattow <[email protected]>
> Signed-off-by: Junhui Liu <[email protected]>
> ---
>  boot/image.c     |   1 +
>  include/image.h  |   1 +
>  tools/Makefile   |   1 +
>  tools/smtimage.c | 202 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 205 insertions(+)

...

> diff --git a/tools/smtimage.c b/tools/smtimage.c
> new file mode 100644
> index 000000000000..96e8b5d8d171
> --- /dev/null
> +++ b/tools/smtimage.c

...

> +#include <image.h>
> +#include <u-boot/crc.h>
> +#include "imagetool.h"

I think you should explicitly include all headers you used explicitly,
e.g., string.h for strcmp(), stdint.h for uintXX_t...

...

> +static const struct smtimage_variant *smtimage_get_variant(const char *name)
> +{
> +     int i;
> +
> +     if (!name || !*name)
> +             return NULL;

Isn't this !*name check unnecessary?

> +
> +     for (i = 0; i < ARRAY_SIZE(smtimage_variants); i++)
> +             if (!strcmp(name, smtimage_variants[i].name))
> +                     return &smtimage_variants[i];
> +
> +     return NULL;
> +}

Regards,
Yao Zi

Reply via email to