All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Ralph Siemsen <ralph.siemsen@linaro.org>
Cc: u-boot@lists.denx.de, "Andre Przywara" <andre.przywara@arm.com>,
	"Heiko Thiery" <heiko.thiery@gmail.com>,
	"Jérôme Carretero" <cJ-uboot@zougloub.eu>,
	"Marc Kleine-Budde" <mkl@pengutronix.de>,
	"Massimo Pegorer" <massimo.pegorer@vimar.com>,
	"Max Krummenacher" <max.krummenacher@toradex.com>,
	"Pali Rohár" <pali@kernel.org>,
	"Philippe Reynes" <philippe.reynes@softathome.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Sean Anderson" <seanga2@gmail.com>, "Stefan Roese" <sr@denx.de>,
	"Steven Lawrance" <steven.lawrance@softathome.com>,
	"Weijie Gao" <weijie.gao@mediatek.com>
Subject: Re: [RFC PATCH v3 9/9] tools: spkgimage: add Renesas SPKG format
Date: Wed, 22 Feb 2023 12:16:57 -0700	[thread overview]
Message-ID: <CAPnjgZ0XOkfB+3NQm1iCjzyq7W_212XibnMSw3OVrffU_B-qfQ@mail.gmail.com> (raw)
In-Reply-To: <20230222154414.49219-10-ralph.siemsen@linaro.org>

Hi Ralph,

On Wed, 22 Feb 2023 at 08:44, Ralph Siemsen <ralph.siemsen@linaro.org> wrote:
>
> Renesas RZ/N1 devices contain BootROM code that loads a custom SPKG
> image from QSPI, NAND or USB DFU. Support this format in mkimage tool.
>
> SPKGs can optionally be signed, however creation of signed SPKG is not
> currently supported.
>
> Example of how to use it:
>
> tools/mkimage -n board/schneider/rzn1-snarc/spkgimage.cfg \
>         -T spkgimage -a 0x20040000 -e 0x20040000 \
>         -d u-boot.bin u-boot.bin.spkg
>
> The config file (spkgimage.cfg in this example) contains additional
> parameters such as NAND ECC settings.
>
> Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
> ---
>
> Changes in v3:
> - provide definition of __packed (as done in kwbimage.h)
> - explain why a local copy of roundup() is needed
> - document spkgimage in doc/mkimage.1
> - add range checks when parsing config file values
> - add line numbers for reporting errors in config file
> - rename SPKG_HEADER_SIGNATURE to SPKG_HEADER_MARKER
> - fix segfault when image is padded by less than 4 bytes
> - minor style and typo fixes
>
> Changes in v2:
> - rewrote the stand-alone spkg_utility to integrate into mkimage
>
>  board/schneider/rzn1-snarc/spkgimage.cfg |  26 ++
>  boot/image.c                             |   1 +
>  doc/mkimage.1                            |  45 ++++
>  include/image.h                          |   1 +
>  tools/Makefile                           |   1 +
>  tools/spkgimage.c                        | 330 +++++++++++++++++++++++
>  tools/spkgimage.h                        |  45 ++++
>  7 files changed, 449 insertions(+)
>  create mode 100644 board/schneider/rzn1-snarc/spkgimage.cfg
>  create mode 100644 tools/spkgimage.c
>  create mode 100644 tools/spkgimage.h

[..]

Reviewed-by: Simon Glass <sjg@chromium.org>

Can you please add some details to doc/ for this SoC and how it boots,
the use of mkimage, etc.?

Also as a follow-on, can you add a binman entry type for this so that
building a functioning image is automatic?

Finally, please add comments to struct spkg_hdr members below


> diff --git a/tools/spkgimage.h b/tools/spkgimage.h
> new file mode 100644
> index 0000000000..7be127b50f
> --- /dev/null
> +++ b/tools/spkgimage.h
> @@ -0,0 +1,45 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +/*
> + * Renesas RZ/N1 Package Table format
> + * (C) 2015-2016 Renesas Electronics Europe, LTD
> + * All rights reserved.
> + *
> + * Converted to mkimage plug-in
> + * (C) Copyright 2022 Schneider Electric
> + */
> +
> +#ifndef _SPKGIMAGE_H_
> +#define _SPKGIMAGE_H_
> +
> +#ifdef __GNUC__
> +#define __packed __attribute((packed))
> +#else
> +#define __packed
> +#endif
> +
> +#define SPKG_HEADER_MARKER     {'R', 'Z', 'N', '1'}
> +#define SPKG_HEADER_SIZE       24
> +#define SPKG_HEADER_COUNT      8
> +#define SPKG_BLP_SIZE          264
> +#define SPKG_CRC_SIZE          4
> +
> +/* SPKG header */
> +struct spkg_hdr {
> +       uint8_t         marker[4];      /* aka magic */
> +       uint8_t         version;
> +       uint8_t         ecc;
> +       uint8_t         ecc_scheme;
> +       uint8_t         ecc_bytes;
> +       uint32_t        payload_length; /* only HIGHER 24 bits */
> +       uint32_t        load_address;
> +       uint32_t        execution_offset;
> +       uint32_t        crc; /* of this header */
> +} __packed;
> +
> +struct spkg_file {
> +       struct spkg_hdr header[SPKG_HEADER_COUNT];
> +       uint8_t         payload[0];
> +       /* then the CRC */
> +} __packed;
> +
> +#endif
> --
> 2.25.1
>

Regards,
Simon

  reply	other threads:[~2023-02-22 19:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22 15:44 [RFC PATCH v3 0/9] Renesas RZ/N1 SoC initial support Ralph Siemsen
2023-02-22 15:44 ` [RFC PATCH v3 1/9] ARM: armv7: add non-SPL enable for Cortex SMPEN Ralph Siemsen
2023-02-22 15:44 ` [RFC PATCH v3 2/9] clk: renesas: prepare for non-RCAR clock drivers Ralph Siemsen
2023-02-22 15:44 ` [RFC PATCH v3 3/9] clk: renesas: add R906G032 driver Ralph Siemsen
2023-02-22 16:06   ` Marek Vasut
2023-02-22 16:57     ` Ralph Siemsen
2023-02-22 17:07       ` Marek Vasut
2023-02-22 17:21         ` Ralph Siemsen
2023-02-22 17:47           ` Marek Vasut
2023-02-22 18:32             ` Ralph Siemsen
2023-02-22 18:45               ` Marek Vasut
2023-02-22 19:32                 ` Ralph Siemsen
2023-02-23  0:12                   ` Marek Vasut
2023-02-23  7:17                     ` Miquel Raynal
2023-02-23 13:56                       ` Marek Vasut
2023-02-23 14:09                         ` Miquel Raynal
2023-02-24 15:14                           ` Ralph Siemsen
2023-02-24 17:05                             ` Marek Vasut
2023-02-24 18:00                               ` Ralph Siemsen
2023-02-25  6:16                                 ` Marek Vasut
2023-02-22 15:44 ` [RFC PATCH v3 4/9] pinctrl: " Ralph Siemsen
2023-02-22 15:44 ` [RFC PATCH v3 5/9] ram: cadence: add driver for Cadence EDAC Ralph Siemsen
2023-02-23 19:54   ` Bryan Brattlof
2023-02-24 15:19     ` Ralph Siemsen
2023-03-08  1:19       ` Ralph Siemsen
2023-02-22 15:44 ` [RFC PATCH v3 6/9] dts: basic devicetree for Renesas RZ/N1 SoC Ralph Siemsen
2023-02-22 15:44 ` [RFC PATCH v3 7/9] ARM: rzn1: basic support " Ralph Siemsen
2023-02-22 15:44 ` [RFC PATCH v3 8/9] board: schneider: add RZN1 board support Ralph Siemsen
2023-02-22 15:44 ` [RFC PATCH v3 9/9] tools: spkgimage: add Renesas SPKG format Ralph Siemsen
2023-02-22 19:16   ` Simon Glass [this message]
2023-02-22 21:17     ` Ralph Siemsen
2023-02-22 21:20       ` Simon Glass

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=CAPnjgZ0XOkfB+3NQm1iCjzyq7W_212XibnMSw3OVrffU_B-qfQ@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=andre.przywara@arm.com \
    --cc=cJ-uboot@zougloub.eu \
    --cc=heiko.thiery@gmail.com \
    --cc=massimo.pegorer@vimar.com \
    --cc=max.krummenacher@toradex.com \
    --cc=mkl@pengutronix.de \
    --cc=pali@kernel.org \
    --cc=philippe.reynes@softathome.com \
    --cc=ralph.siemsen@linaro.org \
    --cc=samuel@sholland.org \
    --cc=seanga2@gmail.com \
    --cc=sr@denx.de \
    --cc=steven.lawrance@softathome.com \
    --cc=u-boot@lists.denx.de \
    --cc=weijie.gao@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.