From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4228AC61DA4 for ; Wed, 22 Feb 2023 19:18:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9C4C885B96; Wed, 22 Feb 2023 20:17:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ZSCr/AdK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E05BD85B10; Wed, 22 Feb 2023 20:17:22 +0100 (CET) Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 17EC085B77 for ; Wed, 22 Feb 2023 20:17:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-ed1-x52b.google.com with SMTP id ck15so35957944edb.0 for ; Wed, 22 Feb 2023 11:17:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yIf83KRIsEDnUbGRpTAASlgp35mTpmgxnNzGmw16ZcM=; b=ZSCr/AdKeVTBSpFaecFFTAZLYavIbt/B/oyHihbKm3HOk8D7YjFUDVxMHqPfoU6yF1 Glf/yuQaQGyVZN4q6PHwyibcwWnbB/z/J/l1A2yu7lOYLBM+JCokWFb71EOX5gSrzEg1 TT9Khu3ao3LrB71akLAGQuSTpjwi62fXEq0K4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yIf83KRIsEDnUbGRpTAASlgp35mTpmgxnNzGmw16ZcM=; b=O7ZB642cMX+kKk7Yb8wGFZD38tHyqkLyGyrH7e9M/VQBpSD7pp2kkYElFJhknFvOzM Oq0Za8t8EQtoAgKqzEjpOl6VgaUA1IXNLG82HNgVh/fUBIfK8H7NNJ3guCJeI+ghUp6M EBxo/DcJQIpTIOal+JS2La+t+K9Q9ykLYthPWMpockacBMFEkJe9RfURCbahIhES20hT BAbqk6mbM6EtpU4HVGrBcBLsBNnXc+GJTpJ+FOQw3hHP7YVbG3HrM3tECns1lIQRDwRR 6s9ick6Hvbx0hdkctMub1G/fP34u5lWYXg6uD/mbairUX3fK2ZVSPFEByO+0NT6NW79B tvzA== X-Gm-Message-State: AO0yUKXmkEapR2gdXSUXtYX05VaN4pSh1CDudCA/twGd0QEO7pOQfFPz n7mXsXNXGSKucWOXyXlkmoH0JI25DqgcVxIJ/4ZNJQ== X-Google-Smtp-Source: AK7set9R+e3oUYCcB/CMrnGndu6wq5att907yGC1uZrpZQPiOSsmWbw3h6clKs4YEjkFr4H7p92/dJteKbV00dWHU5Y= X-Received: by 2002:a17:907:c8c7:b0:8d7:edbc:a7b6 with SMTP id ug7-20020a170907c8c700b008d7edbca7b6mr6857174ejc.2.1677093439336; Wed, 22 Feb 2023 11:17:19 -0800 (PST) MIME-Version: 1.0 References: <20230222154414.49219-1-ralph.siemsen@linaro.org> <20230222154414.49219-10-ralph.siemsen@linaro.org> In-Reply-To: <20230222154414.49219-10-ralph.siemsen@linaro.org> From: Simon Glass Date: Wed, 22 Feb 2023 12:16:57 -0700 Message-ID: Subject: Re: [RFC PATCH v3 9/9] tools: spkgimage: add Renesas SPKG format To: Ralph Siemsen Cc: u-boot@lists.denx.de, Andre Przywara , Heiko Thiery , =?UTF-8?B?SsOpcsO0bWUgQ2FycmV0ZXJv?= , Marc Kleine-Budde , Massimo Pegorer , Max Krummenacher , =?UTF-8?Q?Pali_Roh=C3=A1r?= , Philippe Reynes , Samuel Holland , Sean Anderson , Stefan Roese , Steven Lawrance , Weijie Gao Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi Ralph, On Wed, 22 Feb 2023 at 08:44, Ralph Siemsen 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 > --- > > 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 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