mbox series

[u-boot-marvell,0/7] tools: kwbimage: Support for parsing extended v0 format

Message ID 20220215185925.16060-1-pali@kernel.org
Headers show
Series tools: kwbimage: Support for parsing extended v0 format | expand

Message

Pali Rohár Feb. 15, 2022, 6:59 p.m. UTC
This patch series extends kwbimage v0 format support by providing
ability to dump content of Dove boot images (extension of v0 format).
It also fixes recognition of these images in kwboot utility (as it uses
macros and inline functions from kwbimage.h header file).

Implementation is based on 88AP510 Functional Specifications,
Chapter 5.2 Boot Image Format, which is publicly available at:
https://web.archive.org/web/20120130172443/https://www.marvell.com/application-processors/armada-500/assets/Armada-510-Functional-Spec.pdf

Printing information about image.kwb is possible by:

  $ ./tools/dumpimage -l image.kwb

Dumping image.kwb is possible by commands:

  $ ./tools/dumpimage -T kwbimage -p -1 -o image.cfg image.kwb
  $ ./tools/dumpimage -T kwbimage -p 0 -o data.bin image.kwb
  $ ./tools/dumpimage -T kwbimage -p 1 -o binary1.bin image.kwb
  $ ./tools/dumpimage -T kwbimage -p 2 -o binary2.bin image.kwb
    ...
    (where -p N is Nth binary executable header, e.g. SPL)

Dove images contains more sections which in config file begins with line
"MATCH ADDRESS 0xaddr MASK 0xmask VALUE 0xval" and means that section is
executed only when check ((readl(addr) & mask) == (val & mask)) passes.

Support for generating these kind of images is not provided.
I hope that this patch series helps somebody else to implement it.

Pali Rohár (7):
  tools: kwbimage: Define structures for extended kwbimage v0 headers
  tools: kwbimage: Fix calculating size of kwbimage v0 header
  tools: kwbimage: Add support for dumping extended and binary v0
    headers
  tools: kwbimage: Do not show mkimage error message in dumpimage
  tools: kwbimage: Add support for NAND_BLKSZ and NAND_BADBLK_LOCATION
    for v0 images
  tools: kwbimage: Fix help how to extract DDR3 training code
  tools: kwbimage: Add me as an author of kwbimage

 tools/kwbimage.c | 139 ++++++++++++++++++++++++++++++++++++++++++-----
 tools/kwbimage.h | 116 +++++++++++++++++++++++++++++++++++----
 2 files changed, 231 insertions(+), 24 deletions(-)

Comments

Tony Dinh Feb. 16, 2022, 9:55 a.m. UTC | #1
Hi Pali,

Works great! I've tested this patch using dumpimage for the following boards:

HP Thin Client T5335z
Marvell Dove board: RD-88AP510-Avengers
SoC:   88AP510 (A1)
1Ghz CPU, 1GB RAM

Dell Kace M300
Marvell Kirkwood board: DB-88F6282A-BP LE
SoC: Armada 300 ( aka 88F6282)
2GHz CPU, 2GB RAM

Thanks!

Tested-by: Tony Dinh <mibodhi@gmail.com>



On Tue, Feb 15, 2022 at 10:59 AM Pali Rohár <pali@kernel.org> wrote:
>
> This patch series extends kwbimage v0 format support by providing
> ability to dump content of Dove boot images (extension of v0 format).
> It also fixes recognition of these images in kwboot utility (as it uses
> macros and inline functions from kwbimage.h header file).
>
> Implementation is based on 88AP510 Functional Specifications,
> Chapter 5.2 Boot Image Format, which is publicly available at:
> https://web.archive.org/web/20120130172443/https://www.marvell.com/application-processors/armada-500/assets/Armada-510-Functional-Spec.pdf
>
> Printing information about image.kwb is possible by:
>
>   $ ./tools/dumpimage -l image.kwb
>
> Dumping image.kwb is possible by commands:
>
>   $ ./tools/dumpimage -T kwbimage -p -1 -o image.cfg image.kwb
>   $ ./tools/dumpimage -T kwbimage -p 0 -o data.bin image.kwb
>   $ ./tools/dumpimage -T kwbimage -p 1 -o binary1.bin image.kwb
>   $ ./tools/dumpimage -T kwbimage -p 2 -o binary2.bin image.kwb
>     ...
>     (where -p N is Nth binary executable header, e.g. SPL)
>
> Dove images contains more sections which in config file begins with line
> "MATCH ADDRESS 0xaddr MASK 0xmask VALUE 0xval" and means that section is
> executed only when check ((readl(addr) & mask) == (val & mask)) passes.
>
> Support for generating these kind of images is not provided.
> I hope that this patch series helps somebody else to implement it.
>
> Pali Rohár (7):
>   tools: kwbimage: Define structures for extended kwbimage v0 headers
>   tools: kwbimage: Fix calculating size of kwbimage v0 header
>   tools: kwbimage: Add support for dumping extended and binary v0
>     headers
>   tools: kwbimage: Do not show mkimage error message in dumpimage
>   tools: kwbimage: Add support for NAND_BLKSZ and NAND_BADBLK_LOCATION
>     for v0 images
>   tools: kwbimage: Fix help how to extract DDR3 training code
>   tools: kwbimage: Add me as an author of kwbimage
>
>  tools/kwbimage.c | 139 ++++++++++++++++++++++++++++++++++++++++++-----
>  tools/kwbimage.h | 116 +++++++++++++++++++++++++++++++++++----
>  2 files changed, 231 insertions(+), 24 deletions(-)
>
> --
> 2.20.1
>
Stefan Roese Feb. 17, 2022, 7:10 a.m. UTC | #2
Hi Pali,

On 2/15/22 19:59, Pali Rohár wrote:
> This patch series extends kwbimage v0 format support by providing
> ability to dump content of Dove boot images (extension of v0 format).
> It also fixes recognition of these images in kwboot utility (as it uses
> macros and inline functions from kwbimage.h header file).

This patchset seems to cause some problems with world / azure building.
Please see here for details:

https://dev.azure.com/sr0718/u-boot/_build/results?buildId=159&view=results

Could you please take a look and address this issue?

Thanks,
Stefan

> Implementation is based on 88AP510 Functional Specifications,
> Chapter 5.2 Boot Image Format, which is publicly available at:
> https://web.archive.org/web/20120130172443/https://www.marvell.com/application-processors/armada-500/assets/Armada-510-Functional-Spec.pdf
> 
> Printing information about image.kwb is possible by:
> 
>    $ ./tools/dumpimage -l image.kwb
> 
> Dumping image.kwb is possible by commands:
> 
>    $ ./tools/dumpimage -T kwbimage -p -1 -o image.cfg image.kwb
>    $ ./tools/dumpimage -T kwbimage -p 0 -o data.bin image.kwb
>    $ ./tools/dumpimage -T kwbimage -p 1 -o binary1.bin image.kwb
>    $ ./tools/dumpimage -T kwbimage -p 2 -o binary2.bin image.kwb
>      ...
>      (where -p N is Nth binary executable header, e.g. SPL)
> 
> Dove images contains more sections which in config file begins with line
> "MATCH ADDRESS 0xaddr MASK 0xmask VALUE 0xval" and means that section is
> executed only when check ((readl(addr) & mask) == (val & mask)) passes.
> 
> Support for generating these kind of images is not provided.
> I hope that this patch series helps somebody else to implement it.
> 
> Pali Rohár (7):
>    tools: kwbimage: Define structures for extended kwbimage v0 headers
>    tools: kwbimage: Fix calculating size of kwbimage v0 header
>    tools: kwbimage: Add support for dumping extended and binary v0
>      headers
>    tools: kwbimage: Do not show mkimage error message in dumpimage
>    tools: kwbimage: Add support for NAND_BLKSZ and NAND_BADBLK_LOCATION
>      for v0 images
>    tools: kwbimage: Fix help how to extract DDR3 training code
>    tools: kwbimage: Add me as an author of kwbimage
> 
>   tools/kwbimage.c | 139 ++++++++++++++++++++++++++++++++++++++++++-----
>   tools/kwbimage.h | 116 +++++++++++++++++++++++++++++++++++----
>   2 files changed, 231 insertions(+), 24 deletions(-)
> 

Viele Grüße,
Stefan Roese
Pali Rohár Feb. 17, 2022, 9:18 a.m. UTC | #3
On Thursday 17 February 2022 08:10:57 Stefan Roese wrote:
> Hi Pali,
> 
> On 2/15/22 19:59, Pali Rohár wrote:
> > This patch series extends kwbimage v0 format support by providing
> > ability to dump content of Dove boot images (extension of v0 format).
> > It also fixes recognition of these images in kwboot utility (as it uses
> > macros and inline functions from kwbimage.h header file).
> 
> This patchset seems to cause some problems with world / azure building.
> Please see here for details:
> 
> https://dev.azure.com/sr0718/u-boot/_build/results?buildId=159&view=results
> 
> Could you please take a look and address this issue?

  In file included from tools/kwbimage.c:22:
  include/asm-generic/bitops/fls.h:12:8: error: unknown type name '__always_inline'
  static __always_inline int fls(int x)
         ^
    HOSTCC  tools/omapimage.o
  1 error generated.

It looks like that it is not possible to use fls() function from
U-Boot bitops/fls.h header file. I will rewrite code to not use that
header file.

> Thanks,
> Stefan
> 
> > Implementation is based on 88AP510 Functional Specifications,
> > Chapter 5.2 Boot Image Format, which is publicly available at:
> > https://web.archive.org/web/20120130172443/https://www.marvell.com/application-processors/armada-500/assets/Armada-510-Functional-Spec.pdf
> > 
> > Printing information about image.kwb is possible by:
> > 
> >    $ ./tools/dumpimage -l image.kwb
> > 
> > Dumping image.kwb is possible by commands:
> > 
> >    $ ./tools/dumpimage -T kwbimage -p -1 -o image.cfg image.kwb
> >    $ ./tools/dumpimage -T kwbimage -p 0 -o data.bin image.kwb
> >    $ ./tools/dumpimage -T kwbimage -p 1 -o binary1.bin image.kwb
> >    $ ./tools/dumpimage -T kwbimage -p 2 -o binary2.bin image.kwb
> >      ...
> >      (where -p N is Nth binary executable header, e.g. SPL)
> > 
> > Dove images contains more sections which in config file begins with line
> > "MATCH ADDRESS 0xaddr MASK 0xmask VALUE 0xval" and means that section is
> > executed only when check ((readl(addr) & mask) == (val & mask)) passes.
> > 
> > Support for generating these kind of images is not provided.
> > I hope that this patch series helps somebody else to implement it.
> > 
> > Pali Rohár (7):
> >    tools: kwbimage: Define structures for extended kwbimage v0 headers
> >    tools: kwbimage: Fix calculating size of kwbimage v0 header
> >    tools: kwbimage: Add support for dumping extended and binary v0
> >      headers
> >    tools: kwbimage: Do not show mkimage error message in dumpimage
> >    tools: kwbimage: Add support for NAND_BLKSZ and NAND_BADBLK_LOCATION
> >      for v0 images
> >    tools: kwbimage: Fix help how to extract DDR3 training code
> >    tools: kwbimage: Add me as an author of kwbimage
> > 
> >   tools/kwbimage.c | 139 ++++++++++++++++++++++++++++++++++++++++++-----
> >   tools/kwbimage.h | 116 +++++++++++++++++++++++++++++++++++----
> >   2 files changed, 231 insertions(+), 24 deletions(-)
> > 
> 
> Viele Grüße,
> Stefan Roese
> 
> -- 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de